From 0859ff690936c65ddba34e1918dbb62421ee6b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=81=93=E7=94=AB?= Date: Wed, 29 May 2024 09:48:57 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A1=A5=E5=85=85C=20API=E6=8B=89?= =?UTF-8?q?=E6=B5=81=E4=BB=A3=E7=90=86=E7=BC=BA=E5=B0=91retry=5Fcount?= =?UTF-8?q?=E9=87=8D=E8=AF=95=E6=AC=A1=E6=95=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/include/mk_proxyplayer.h | 28 ++++++++++++++++++++++++++++ api/source/mk_proxyplayer.cpp | 16 ++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/api/include/mk_proxyplayer.h b/api/include/mk_proxyplayer.h index e8d45b4a..c3cbed01 100644 --- a/api/include/mk_proxyplayer.h +++ b/api/include/mk_proxyplayer.h @@ -32,6 +32,21 @@ typedef struct mk_proxy_player_t *mk_proxy_player; */ 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); + +/** + * 创建一个代理播放器 + * @param vhost 虚拟主机名,一般为__defaultVhost__ + * @param app 应用名 + * @param stream 流名 + * @param rtp_type rtsp播放方式:RTP_TCP = 0, RTP_UDP = 1, RTP_MULTICAST = 2 + * @param hls_enabled 是否生成hls + * @param mp4_enabled 是否生成mp4 + * @param retry_count 重试次数,当<0无限次重试 + * @return 对象指针 + */ +API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create1( + const char *vhost, const char *app, const char *stream, int hls_enabled, int mp4_enabled, int retry_count); + /** * 创建一个代理播放器 * @param vhost 虚拟主机名,一般为__defaultVhost__ @@ -43,6 +58,19 @@ API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create(const char *vhost, co API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create2(const char *vhost, const char *app, const char *stream, mk_ini option); +/** + * 创建一个代理播放器 + * @param vhost 虚拟主机名,一般为__defaultVhost__ + * @param app 应用名 + * @param stream 流名 + * @param option ProtocolOption相关配置 + * @param retry_count 重试次数,当<0无限次重试 + * @return 对象指针 + */ +API_EXPORT mk_proxy_player API_CALL +mk_proxy_player_create3(const char *vhost, const char *app, const char *stream, mk_ini option, int retry_count); + + /** * 销毁代理播放器 * @param ctx 对象指针 diff --git a/api/source/mk_proxyplayer.cpp b/api/source/mk_proxyplayer.cpp index 0b98e8fe..29a39167 100644 --- a/api/source/mk_proxyplayer.cpp +++ b/api/source/mk_proxyplayer.cpp @@ -24,6 +24,15 @@ API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create(const char *vhost, co return (mk_proxy_player) obj; } +API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create1(const char *vhost, const char *app, const char *stream, int hls_enabled, int mp4_enabled, int retry_count) { + assert(vhost && app && stream); + ProtocolOption option; + option.enable_hls = hls_enabled; + option.enable_mp4 = mp4_enabled; + PlayerProxy::Ptr *obj(new PlayerProxy::Ptr(new PlayerProxy(vhost, app, stream, option, retry_count))); + return (mk_proxy_player)obj; +} + API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create2(const char *vhost, const char *app, const char *stream, mk_ini ini) { assert(vhost && app && stream); ProtocolOption option(*((mINI *)ini)); @@ -32,6 +41,13 @@ API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create2(const char *vhost, c } +API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create3(const char *vhost, const char *app, const char *stream, mk_ini ini, int retry_count) { + assert(vhost && app && stream); + ProtocolOption option(*((mINI *)ini)); + PlayerProxy::Ptr *obj(new PlayerProxy::Ptr(new PlayerProxy(vhost, app, stream, option, retry_count))); + return (mk_proxy_player)obj; +} + API_EXPORT void API_CALL mk_proxy_player_release(mk_proxy_player ctx) { assert(ctx); PlayerProxy::Ptr *obj = (PlayerProxy::Ptr *) ctx;