新增自定义转协议创建mk_media接口

This commit is contained in:
ziyue 2023-02-11 11:40:32 +08:00
parent 9629dbd969
commit 0773e79fd1
2 changed files with 20 additions and 0 deletions

View File

@ -16,6 +16,7 @@
#include "mk_frame.h" #include "mk_frame.h"
#include "mk_events_objects.h" #include "mk_events_objects.h"
#include "mk_thread.h" #include "mk_thread.h"
#include "mk_util.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -36,6 +37,17 @@ typedef void *mk_media;
API_EXPORT mk_media API_CALL mk_media_create(const char *vhost, const char *app, const char *stream, API_EXPORT mk_media API_CALL mk_media_create(const char *vhost, const char *app, const char *stream,
float duration, int hls_enabled, int mp4_enabled); float duration, int hls_enabled, int mp4_enabled);
/**
*
* @param vhost __defaultVhost__
* @param app live
* @param stream idcamera
* @param duration ()0
* @param option ProtocolOption相关配置
* @return
*/
API_EXPORT mk_media API_CALL mk_media_create2(const char *vhost, const char *app, const char *stream, float duration, mk_ini option);
/** /**
* *
* @param ctx * @param ctx

View File

@ -163,6 +163,14 @@ API_EXPORT mk_media API_CALL mk_media_create(const char *vhost, const char *app,
return (mk_media) obj; return (mk_media) obj;
} }
API_EXPORT mk_media API_CALL mk_media_create2(const char *vhost, const char *app, const char *stream, float duration, mk_ini ini) {
assert(vhost && app && stream && ini);
ProtocolOption option(*((mINI *)ini));
MediaHelper::Ptr *obj(new MediaHelper::Ptr(new MediaHelper(vhost, app, stream, duration, option)));
(*obj)->attachEvent();
return (mk_media) obj;
}
API_EXPORT void API_CALL mk_media_release(mk_media ctx) { API_EXPORT void API_CALL mk_media_release(mk_media ctx) {
assert(ctx); assert(ctx);
MediaHelper::Ptr *obj = (MediaHelper::Ptr *) ctx; MediaHelper::Ptr *obj = (MediaHelper::Ptr *) ctx;