From 791c773ae04f2a3f2cc181dc597bb1bc62efa36c Mon Sep 17 00:00:00 2001 From: lyg1949 Date: Wed, 24 Jun 2020 08:52:45 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BE=93=E5=85=A5PCM?= =?UTF-8?q?=E5=B8=A7=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在使用faac库的前提下,增加输入PCM帧的接口 --- api/include/mk_media.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/api/include/mk_media.h b/api/include/mk_media.h index c221053b..ff85cf47 100755 --- a/api/include/mk_media.h +++ b/api/include/mk_media.h @@ -98,6 +98,16 @@ API_EXPORT void API_CALL mk_media_input_h265(mk_media ctx, void *data, int len, */ API_EXPORT void API_CALL mk_media_input_aac(mk_media ctx, void *data, int len, uint32_t dts, void *adts); +#ifdef ENABLE_FAAC +/** + * 输入单帧PCM音频 + * @param ctx 对象指针 + * @param data 单帧PCM数据 + * @param len 单帧PCM数据字节数 + * @param dts 时间戳,毫秒 + */ +API_EXPORT void API_CALL mk_media_input_PCM(mk_media ctx, void *Data, int len, uint32_t pts); +#endif //ENABLE_FAAC /** * 输入单帧G711音频 * @param ctx 对象指针 From f0a538d37de356b823634d42813e07cb41da377a Mon Sep 17 00:00:00 2001 From: lyg1949 Date: Wed, 24 Jun 2020 08:54:15 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E8=BE=93=E5=85=A5PCM?= =?UTF-8?q?=E5=B8=A7=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 实现输入PCM帧的接口 --- api/source/mk_media.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/source/mk_media.cpp b/api/source/mk_media.cpp index c3309c5d..c6bdaf19 100755 --- a/api/source/mk_media.cpp +++ b/api/source/mk_media.cpp @@ -157,6 +157,15 @@ API_EXPORT void API_CALL mk_media_input_aac(mk_media ctx, void *data, int len, u (*obj)->getChannel()->inputAAC((char *) data, len, dts, (char *) adts); } +#ifdef ENABLE_FAAC +API_EXPORT void API_CALL mk_media_input_PCM(mk_media ctx, void *data , int len, uint32_t pts) +{ + assert(ctx && data && len > 0); + MediaHelper::Ptr* obj = (MediaHelper::Ptr*) ctx; + (*obj)->getChannel()->inputPCM((char*)data, len, pts); +} +#endif //ENABLE_FAAC + API_EXPORT void API_CALL mk_media_input_g711(mk_media ctx, void* data, int len, uint32_t dts){ assert(ctx && data && len > 0); MediaHelper::Ptr* obj = (MediaHelper::Ptr*) ctx; From 3d25ede46fe4d17a467d3630ef1780aecae9d955 Mon Sep 17 00:00:00 2001 From: zhlong Date: Wed, 24 Jun 2020 09:50:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=B8=BAAPI=E6=B7=BB=E5=8A=A0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E9=85=8D=E7=BD=AE=E5=9E=8B=E5=86=85=E5=AE=B9=E7=9A=84?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/include/mk_common.h | 7 +++++++ api/source/mk_common.cpp | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/api/include/mk_common.h b/api/include/mk_common.h index 6363d22e..d93f1124 100755 --- a/api/include/mk_common.h +++ b/api/include/mk_common.h @@ -101,6 +101,13 @@ API_EXPORT void API_CALL mk_env_init1(int thread_num, */ API_EXPORT void API_CALL mk_set_option(const char *key, const char *val); +/** + * 获取配置项的值 + * @param key 配置项名 + */ +API_EXPORT const char * API_CALL mk_get_option(const char *key); + + /** * 创建http[s]服务器 * @param port htt监听端口,推荐80,传入0则随机分配 diff --git a/api/source/mk_common.cpp b/api/source/mk_common.cpp index 0baa311c..ce36924e 100644 --- a/api/source/mk_common.cpp +++ b/api/source/mk_common.cpp @@ -119,6 +119,17 @@ API_EXPORT void API_CALL mk_set_option(const char *key, const char *val) { mINI::Instance()[key] = val; } +API_EXPORT const char * API_CALL mk_get_option(const char *key) +{ + assert(key); + if (mINI::Instance().find(key) == mINI::Instance().end()) { + WarnL << "key:" << key << " not existed!"; + return nullptr; + } + return mINI::Instance()[key].data(); +} + + API_EXPORT uint16_t API_CALL mk_http_server_start(uint16_t port, int ssl) { ssl = MAX(0,MIN(ssl,1)); try {