mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
新增自定义转协议创建mk_media接口
This commit is contained in:
parent
9629dbd969
commit
0773e79fd1
@ -16,6 +16,7 @@
|
||||
#include "mk_frame.h"
|
||||
#include "mk_events_objects.h"
|
||||
#include "mk_thread.h"
|
||||
#include "mk_util.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
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,
|
||||
float duration, int hls_enabled, int mp4_enabled);
|
||||
|
||||
/**
|
||||
* 创建一个媒体源
|
||||
* @param vhost 虚拟主机名,一般为__defaultVhost__
|
||||
* @param app 应用名,推荐为live
|
||||
* @param stream 流id,例如camera
|
||||
* @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 对象指针
|
||||
|
@ -163,6 +163,14 @@ API_EXPORT mk_media API_CALL mk_media_create(const char *vhost, const char *app,
|
||||
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) {
|
||||
assert(ctx);
|
||||
MediaHelper::Ptr *obj = (MediaHelper::Ptr *) ctx;
|
||||
|
Loading…
Reference in New Issue
Block a user