在C++中如何调用zlmediakit的api进行推流
int video_rtsp(app_context_t *ctx, const char *url)
{
char *ini_path = mk_util_get_exe_dir(ctx->mk_file_path.c_str());
mk_config config = {
.thread_num = 10,
.log_level = 0,
.log_mask = LOG_CONSOLE,
.log_file_path = NULL,
.log_file_days = 0,
.ini_is_path = 1,
.ini = ini_path,
.ssl_is_path = 1,
.ssl = NULL,
.ssl_pwd = NULL
};
mk_env_init(&config);
mk_free(ini_path);
if (ctx->enable_http == 1)
mk_http_server_start(ctx->push_http_port, 0);
if (ctx->enable_rtsp == 1)
mk_rtsp_server_start(ctx->push_rtsp_port, 0);
if (ctx->enable_rtmp == 1)
mk_rtmp_server_start(ctx->push_rtmp_port, 0);
if (ctx->enable_rtc == 1)
mk_rtc_server_start(ctx->push_rtc_port);
ctx->player = mk_player_create();
ctx->stream_url = url;
mk_player_set_on_result(ctx->player, on_mk_play_event_func, ctx);
mk_player_set_on_shutdown(ctx->player, on_mk_shutdown_func, ctx);
mk_player_play(ctx->player, ctx->stream_url);
printf("enter any key to exit\n");
getchar();
if (ctx->player)
{
mk_player_release(ctx->player);
}
return 0;
}