Add mk_proxy_player_create2 for support more proxy options (#3262)

This commit is contained in:
lidaofu-hub 2024-02-04 23:15:11 +08:00 committed by GitHub
parent bfcaf15075
commit 4d28b99780
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 0 deletions

View File

@ -12,6 +12,7 @@
#define MK_PROXY_PLAYER_H_ #define MK_PROXY_PLAYER_H_
#include "mk_common.h" #include "mk_common.h"
#include "mk_util.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -31,6 +32,17 @@ 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); 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 option ProtocolOption相关配置
* @return
*/
API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create2(const char *vhost, const char *app, const char *stream, mk_ini option);
/** /**
* *
* @param ctx * @param ctx

View File

@ -10,6 +10,7 @@
#include "mk_proxyplayer.h" #include "mk_proxyplayer.h"
#include "Player/PlayerProxy.h" #include "Player/PlayerProxy.h"
#include "mk_util.h"
using namespace toolkit; using namespace toolkit;
using namespace mediakit; using namespace mediakit;
@ -23,6 +24,14 @@ API_EXPORT mk_proxy_player API_CALL mk_proxy_player_create(const char *vhost, co
return (mk_proxy_player) obj; 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));
PlayerProxy::Ptr *obj(new PlayerProxy::Ptr(new PlayerProxy(vhost, app, stream, option)));
return (mk_proxy_player)obj;
}
API_EXPORT void API_CALL mk_proxy_player_release(mk_proxy_player ctx) { API_EXPORT void API_CALL mk_proxy_player_release(mk_proxy_player ctx) {
assert(ctx); assert(ctx);
PlayerProxy::Ptr *obj = (PlayerProxy::Ptr *) ctx; PlayerProxy::Ptr *obj = (PlayerProxy::Ptr *) ctx;