From 38584a7478c16a9d59aeb3cf694ab95ab4387184 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Thu, 27 Feb 2020 11:40:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0mk=5Fmedia=5Finit=5Fcomplete?= =?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_media.h | 8 ++++++++ api/source/mk_media.cpp | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/api/include/mk_media.h b/api/include/mk_media.h index 16516de4..e2eeba8c 100755 --- a/api/include/mk_media.h +++ b/api/include/mk_media.h @@ -81,6 +81,14 @@ API_EXPORT void API_CALL mk_media_init_h265(mk_media ctx, int width, int height, */ API_EXPORT void API_CALL mk_media_init_aac(mk_media ctx, int channel, int sample_bit, int sample_rate, int profile); +/** + * 初始化h264/h265/aac完毕后调用此函数, + * 在单track(只有音频或视频)时,因为ZLMediaKit不知道后续是否还要添加track,所以会多等待3秒钟 + * 如果产生的流是单Track类型,请调用此函数以便加快流生成速度,当然不调用该函数,影响也不大(会多等待3秒) + * @param ctx 对象指针 + */ +API_EXPORT void API_CALL mk_media_init_complete(mk_media ctx); + /** * 输入单帧H264视频,帧起始字节00 00 01,00 00 00 01均可 * @param ctx 对象指针 diff --git a/api/source/mk_media.cpp b/api/source/mk_media.cpp index 1751005b..a09525fd 100755 --- a/api/source/mk_media.cpp +++ b/api/source/mk_media.cpp @@ -75,6 +75,12 @@ API_EXPORT void API_CALL mk_media_init_aac(mk_media ctx, int channel, int sample (*obj)->initAudio(info); } +API_EXPORT void API_CALL mk_media_init_complete(mk_media ctx){ + assert(ctx); + DevChannel::Ptr *obj = (DevChannel::Ptr *) ctx; + (*obj)->addTrackCompleted(); +} + API_EXPORT void API_CALL mk_media_input_h264(mk_media ctx, void *data, int len, uint32_t dts, uint32_t pts) { assert(ctx && data && len > 0); DevChannel::Ptr *obj = (DevChannel::Ptr *) ctx;