添加pusher接口

整理代码
This commit is contained in:
xiongziliang
2019-12-18 14:43:32 +08:00
parent ee4659a185
commit ef7e937808
10 changed files with 62 additions and 25 deletions

View File

@@ -37,6 +37,7 @@ typedef void *mk_media;
/**
* 创建一个媒体源
* @param vhost 虚拟主机名一般为__defaultVhost__
* @param app 应用名推荐为live
* @param stream 流id例如camera
* @param duration 时长(单位秒)直播则为0
@@ -44,7 +45,7 @@ typedef void *mk_media;
* @param mp4_enabled 是否生成mp4
* @return 对象指针
*/
API_EXPORT mk_media API_CALL mk_media_create(const char *app, const char *stream, float duration, int hls_enabled, int mp4_enabled);
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);
/**
* 销毁媒体源

View File

@@ -33,5 +33,6 @@
#include "proxyplayer.h"
#include "flvrecorder.h"
#include "player.h"
#include "pusher.h"
#endif /* MK_API_H_ */

View File

@@ -56,7 +56,7 @@ typedef void(API_CALL *on_mk_play_event)(void *user_data,int err_code,const char
typedef void(API_CALL *on_mk_play_data)(void *user_data,int track_type,int codec_id,void *data,int len,uint32_t dts,uint32_t pts);
/**
* 创建一个播放器,支持rtmp/rtsp
* 创建一个播放器,支持rtmp[s]/rtsp[s]
* @return 播放器指针
*/
API_EXPORT mk_player API_CALL mk_player_create();
@@ -78,7 +78,7 @@ API_EXPORT void API_CALL mk_player_set_option(mk_player ctx, const char *key, co
/**
* 开始播放url
* @param ctx 播放器指针
* @param url rtsp/rtmp url
* @param url rtsp[s]/rtmp[s] url
*/
API_EXPORT void API_CALL mk_player_play(mk_player ctx, const char *url);
@@ -99,7 +99,7 @@ API_EXPORT void API_CALL mk_player_seekto(mk_player ctx, float progress);
/**
* 设置播放器开启播放结果回调函数
* @param ctx 播放器指针
* @param cb 回调函数指针
* @param cb 回调函数指针,不得为null
* @param user_data 用户数据指针
*/
API_EXPORT void API_CALL mk_player_set_on_result(mk_player ctx, on_mk_play_event cb, void *user_data);

View File

@@ -37,6 +37,7 @@ typedef void *mk_proxy_player;
/**
* 创建一个代理播放器
* @param vhost 虚拟主机名一般为__defaultVhost__
* @param app 应用名
* @param stream 流名
* @param rtp_type rtsp播放方式:RTP_TCP = 0, RTP_UDP = 1, RTP_MULTICAST = 2
@@ -44,7 +45,7 @@ typedef void *mk_proxy_player;
* @param mp4_enabled 是否生成mp4
* @return 对象指针
*/
API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create(const char *app, const char *stream, int rtp_type, int hls_enabled, int mp4_enabled);
API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create(const char *vhost, const char *app, const char *stream, int hls_enabled, int mp4_enabled);
/**
* 销毁代理播放器
@@ -52,6 +53,15 @@ API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create(const char *app, cons
*/
API_EXPORT void API_CALL mk_proxy_player_release(mk_proxy_player ctx);
/**
* 设置代理播放器配置选项
* @param ctx 代理播放器指针
* @param key 配置项键,支持 net_adapter/rtp_type/rtsp_user/rtsp_pwd/protocol_timeout_ms/media_timeout_ms/beat_interval_ms/max_analysis_ms
* @param val 配置项值,如果是整形需要转换成统一转换成string
*/
API_EXPORT void API_CALL mk_proxy_player_set_option(mk_proxy_player ctx, const char *key, const char *val);
/**
* 开始播放
* @param ctx 对象指针