2019-12-24 13:56:53 +08:00
|
|
|
|
/*
|
2023-12-09 16:23:51 +08:00
|
|
|
|
* Copyright (c) 2016-present The ZLMediaKit project authors. All Rights Reserved.
|
2019-12-23 18:50:46 +08:00
|
|
|
|
*
|
2023-12-09 16:23:51 +08:00
|
|
|
|
* This file is part of ZLMediaKit(https://github.com/ZLMediaKit/ZLMediaKit).
|
2019-12-23 18:50:46 +08:00
|
|
|
|
*
|
2023-12-09 16:23:51 +08:00
|
|
|
|
* Use of this source code is governed by MIT-like license that can be found in the
|
2020-04-04 20:30:09 +08:00
|
|
|
|
* LICENSE file in the root of the source tree. All contributing project authors
|
|
|
|
|
* may be found in the AUTHORS file in the root of the source tree.
|
2019-12-23 18:50:46 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef MK_EVENT_OBJECTS_H
|
|
|
|
|
#define MK_EVENT_OBJECTS_H
|
2019-12-27 10:10:31 +08:00
|
|
|
|
#include "mk_common.h"
|
|
|
|
|
#include "mk_tcp.h"
|
2023-06-10 09:34:00 +08:00
|
|
|
|
#include "mk_track.h"
|
2023-11-12 21:14:46 +08:00
|
|
|
|
#include "mk_util.h"
|
2019-12-23 18:50:46 +08:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2024-05-10 14:27:23 +08:00
|
|
|
|
///////////////////////////////////////////RecordInfo/////////////////////////////////////////////
|
|
|
|
|
//RecordInfo对象的C映射
|
|
|
|
|
typedef struct mk_record_info_t *mk_record_info;
|
2020-09-20 11:40:42 +08:00
|
|
|
|
// GMT 标准时间,单位秒
|
2024-05-10 14:27:23 +08:00
|
|
|
|
API_EXPORT uint64_t API_CALL mk_record_info_get_start_time(const mk_record_info ctx);
|
2020-09-20 11:40:42 +08:00
|
|
|
|
// 录像长度,单位秒
|
2024-05-10 14:27:23 +08:00
|
|
|
|
API_EXPORT float API_CALL mk_record_info_get_time_len(const mk_record_info ctx);
|
2020-09-20 11:40:42 +08:00
|
|
|
|
// 文件大小,单位 BYTE
|
2024-05-10 14:27:23 +08:00
|
|
|
|
API_EXPORT size_t API_CALL mk_record_info_get_file_size(const mk_record_info ctx);
|
2020-09-20 11:40:42 +08:00
|
|
|
|
// 文件路径
|
2024-05-10 14:27:23 +08:00
|
|
|
|
API_EXPORT const char *API_CALL mk_record_info_get_file_path(const mk_record_info ctx);
|
2020-09-20 11:40:42 +08:00
|
|
|
|
// 文件名称
|
2024-05-10 14:27:23 +08:00
|
|
|
|
API_EXPORT const char *API_CALL mk_record_info_get_file_name(const mk_record_info ctx);
|
2020-09-20 11:40:42 +08:00
|
|
|
|
// 文件夹路径
|
2024-05-10 14:27:23 +08:00
|
|
|
|
API_EXPORT const char *API_CALL mk_record_info_get_folder(const mk_record_info ctx);
|
2020-09-20 11:40:42 +08:00
|
|
|
|
// 播放路径
|
2024-05-10 14:27:23 +08:00
|
|
|
|
API_EXPORT const char *API_CALL mk_record_info_get_url(const mk_record_info ctx);
|
2020-09-20 11:40:42 +08:00
|
|
|
|
// 应用名称
|
2024-05-10 14:27:23 +08:00
|
|
|
|
API_EXPORT const char *API_CALL mk_record_info_get_vhost(const mk_record_info ctx);
|
2020-09-20 11:40:42 +08:00
|
|
|
|
// 流 ID
|
2024-05-10 14:27:23 +08:00
|
|
|
|
API_EXPORT const char *API_CALL mk_record_info_get_app(const mk_record_info ctx);
|
2020-09-20 11:40:42 +08:00
|
|
|
|
// 虚拟主机
|
2024-05-10 14:27:23 +08:00
|
|
|
|
API_EXPORT const char *API_CALL mk_record_info_get_stream(const mk_record_info ctx);
|
|
|
|
|
|
|
|
|
|
//// 下面宏保障用户代码兼容性, 二进制abi不兼容,用户需要重新编译链接 /////
|
|
|
|
|
#define mk_mp4_info mk_record_info
|
|
|
|
|
#define mk_mp4_info_get_start_time mk_record_info_get_start_time
|
|
|
|
|
#define mk_mp4_info_get_time_len mk_record_info_get_time_len
|
|
|
|
|
#define mk_mp4_info_get_file_size mk_record_info_get_file_size
|
|
|
|
|
#define mk_mp4_info_get_file_path mk_record_info_get_file_path
|
|
|
|
|
#define mk_mp4_info_get_file_name mk_record_info_get_file_name
|
|
|
|
|
#define mk_mp4_info_get_folder mk_record_info_get_folder
|
|
|
|
|
#define mk_mp4_info_get_url mk_record_info_get_url
|
|
|
|
|
#define mk_mp4_info_get_vhost mk_record_info_get_vhost
|
|
|
|
|
#define mk_mp4_info_get_app mk_record_info_get_app
|
|
|
|
|
#define mk_mp4_info_get_stream mk_record_info_get_stream
|
2019-12-23 18:50:46 +08:00
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////Parser/////////////////////////////////////////////
|
|
|
|
|
//Parser对象的C映射
|
2023-02-26 21:45:14 +08:00
|
|
|
|
typedef struct mk_parser_t *mk_parser;
|
2024-07-05 20:56:23 +08:00
|
|
|
|
//Parser对象中Headers foreach回调
|
|
|
|
|
typedef void(API_CALL *on_mk_parser_header_cb)(void *user_data, const char *key, const char *val);
|
2019-12-23 18:50:46 +08:00
|
|
|
|
//Parser::Method(),获取命令字,譬如GET/POST
|
|
|
|
|
API_EXPORT const char* API_CALL mk_parser_get_method(const mk_parser ctx);
|
|
|
|
|
//Parser::Url(),获取HTTP的访问url(不包括?后面的参数)
|
|
|
|
|
API_EXPORT const char* API_CALL mk_parser_get_url(const mk_parser ctx);
|
|
|
|
|
//Parser::Params(),?后面的参数字符串
|
|
|
|
|
API_EXPORT const char* API_CALL mk_parser_get_url_params(const mk_parser ctx);
|
|
|
|
|
//Parser::getUrlArgs()["key"],获取?后面的参数中的特定参数
|
|
|
|
|
API_EXPORT const char* API_CALL mk_parser_get_url_param(const mk_parser ctx,const char *key);
|
|
|
|
|
//Parser::Tail(),获取协议相关信息,譬如 HTTP/1.1
|
|
|
|
|
API_EXPORT const char* API_CALL mk_parser_get_tail(const mk_parser ctx);
|
|
|
|
|
//Parser::getValues()["key"],获取HTTP头中特定字段
|
|
|
|
|
API_EXPORT const char* API_CALL mk_parser_get_header(const mk_parser ctx,const char *key);
|
|
|
|
|
//Parser::Content(),获取HTTP body
|
2021-01-17 18:31:50 +08:00
|
|
|
|
API_EXPORT const char* API_CALL mk_parser_get_content(const mk_parser ctx, size_t *length);
|
2024-07-05 20:56:23 +08:00
|
|
|
|
//循环获取所有header
|
|
|
|
|
API_EXPORT void API_CALL mk_parser_headers_for_each(const mk_parser ctx, on_mk_parser_header_cb cb, void *user_data);
|
2019-12-23 18:50:46 +08:00
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////MediaInfo/////////////////////////////////////////////
|
|
|
|
|
//MediaInfo对象的C映射
|
2023-02-26 21:45:14 +08:00
|
|
|
|
typedef struct mk_media_info_t *mk_media_info;
|
2023-05-25 16:23:24 +08:00
|
|
|
|
//MediaInfo::param_strs
|
2019-12-23 18:50:46 +08:00
|
|
|
|
API_EXPORT const char* API_CALL mk_media_info_get_params(const mk_media_info ctx);
|
2023-05-25 16:23:24 +08:00
|
|
|
|
//MediaInfo::schema
|
2019-12-23 18:50:46 +08:00
|
|
|
|
API_EXPORT const char* API_CALL mk_media_info_get_schema(const mk_media_info ctx);
|
2023-05-25 16:23:24 +08:00
|
|
|
|
//MediaInfo::vhost
|
2019-12-23 18:50:46 +08:00
|
|
|
|
API_EXPORT const char* API_CALL mk_media_info_get_vhost(const mk_media_info ctx);
|
2023-05-25 16:23:24 +08:00
|
|
|
|
//MediaInfo::app
|
2019-12-23 18:50:46 +08:00
|
|
|
|
API_EXPORT const char* API_CALL mk_media_info_get_app(const mk_media_info ctx);
|
2023-05-25 16:23:24 +08:00
|
|
|
|
//MediaInfo::stream
|
2019-12-23 18:50:46 +08:00
|
|
|
|
API_EXPORT const char* API_CALL mk_media_info_get_stream(const mk_media_info ctx);
|
2023-05-25 16:23:24 +08:00
|
|
|
|
//MediaInfo::host
|
2020-04-22 09:51:04 +08:00
|
|
|
|
API_EXPORT const char* API_CALL mk_media_info_get_host(const mk_media_info ctx);
|
2023-05-25 16:23:24 +08:00
|
|
|
|
//MediaInfo::port
|
2020-04-22 09:51:04 +08:00
|
|
|
|
API_EXPORT uint16_t API_CALL mk_media_info_get_port(const mk_media_info ctx);
|
2019-12-23 18:50:46 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////MediaSource/////////////////////////////////////////////
|
|
|
|
|
//MediaSource对象的C映射
|
2023-02-26 21:45:14 +08:00
|
|
|
|
typedef struct mk_media_source_t *mk_media_source;
|
2019-12-23 18:50:46 +08:00
|
|
|
|
//查找MediaSource的回调函数
|
|
|
|
|
typedef void(API_CALL *on_mk_media_source_find_cb)(void *user_data, const mk_media_source ctx);
|
|
|
|
|
|
|
|
|
|
//MediaSource::getSchema()
|
|
|
|
|
API_EXPORT const char* API_CALL mk_media_source_get_schema(const mk_media_source ctx);
|
|
|
|
|
//MediaSource::getVhost()
|
|
|
|
|
API_EXPORT const char* API_CALL mk_media_source_get_vhost(const mk_media_source ctx);
|
|
|
|
|
//MediaSource::getApp()
|
|
|
|
|
API_EXPORT const char* API_CALL mk_media_source_get_app(const mk_media_source ctx);
|
|
|
|
|
//MediaSource::getId()
|
|
|
|
|
API_EXPORT const char* API_CALL mk_media_source_get_stream(const mk_media_source ctx);
|
|
|
|
|
//MediaSource::readerCount()
|
|
|
|
|
API_EXPORT int API_CALL mk_media_source_get_reader_count(const mk_media_source ctx);
|
2019-12-28 16:57:35 +08:00
|
|
|
|
//MediaSource::totalReaderCount()
|
|
|
|
|
API_EXPORT int API_CALL mk_media_source_get_total_reader_count(const mk_media_source ctx);
|
2023-06-10 09:34:00 +08:00
|
|
|
|
// get track count from MediaSource
|
|
|
|
|
API_EXPORT int API_CALL mk_media_source_get_track_count(const mk_media_source ctx);
|
2023-06-17 09:14:51 +08:00
|
|
|
|
// copy track reference by index from MediaSource, please use mk_track_unref to release it
|
2023-06-10 09:34:00 +08:00
|
|
|
|
API_EXPORT mk_track API_CALL mk_media_source_get_track(const mk_media_source ctx, int index);
|
2024-06-15 15:55:39 +08:00
|
|
|
|
// MediaSource::Track:loss
|
|
|
|
|
API_EXPORT float API_CALL mk_media_source_get_track_loss(const mk_media_source ctx, const mk_track track);
|
2023-09-02 12:58:20 +08:00
|
|
|
|
// MediaSource::broadcastMessage
|
|
|
|
|
API_EXPORT int API_CALL mk_media_source_broadcast_msg(const mk_media_source ctx, const char *msg, size_t len);
|
2024-04-05 22:09:40 +08:00
|
|
|
|
// MediaSource::getOriginUrl()
|
|
|
|
|
API_EXPORT const char* API_CALL mk_media_source_get_origin_url(const mk_media_source ctx);
|
|
|
|
|
// MediaSource::getOriginType()
|
|
|
|
|
API_EXPORT int API_CALL mk_media_source_get_origin_type(const mk_media_source ctx);
|
2024-06-15 15:55:39 +08:00
|
|
|
|
// MediaSource::getOriginTypeStr(), 使用后请用mk_free释放返回值
|
|
|
|
|
API_EXPORT const char *API_CALL mk_media_source_get_origin_type_str(const mk_media_source ctx);
|
2024-04-05 22:09:40 +08:00
|
|
|
|
// MediaSource::getCreateStamp()
|
|
|
|
|
API_EXPORT uint64_t API_CALL mk_media_source_get_create_stamp(const mk_media_source ctx);
|
|
|
|
|
// MediaSource::isRecording() 0:hls,1:MP4
|
|
|
|
|
API_EXPORT int API_CALL mk_media_source_is_recording(const mk_media_source ctx, int type);
|
2024-06-15 15:55:39 +08:00
|
|
|
|
// MediaSource::getBytesSpeed()
|
|
|
|
|
API_EXPORT int API_CALL mk_media_source_get_bytes_speed(const mk_media_source ctx);
|
|
|
|
|
// MediaSource::getAliveSecond()
|
|
|
|
|
API_EXPORT uint64_t API_CALL mk_media_source_get_alive_second(const mk_media_source ctx);
|
2020-03-10 23:22:48 +08:00
|
|
|
|
/**
|
|
|
|
|
* 直播源在ZLMediaKit中被称作为MediaSource,
|
|
|
|
|
* 目前支持3种,分别是RtmpMediaSource、RtspMediaSource、HlsMediaSource
|
|
|
|
|
* 源的产生有被动和主动方式:
|
|
|
|
|
* 被动方式分别是rtsp/rtmp/rtp推流、mp4点播
|
|
|
|
|
* 主动方式包括mk_media_create创建的对象(DevChannel)、mk_proxy_player_create创建的对象(PlayerProxy)
|
|
|
|
|
* 被动方式你不用做任何处理,ZLMediaKit已经默认适配了MediaSource::close()事件,都会关闭直播流
|
|
|
|
|
* 主动方式你要设置这个事件的回调,你要自己选择删除对象
|
|
|
|
|
* 通过mk_proxy_player_set_on_close、mk_media_set_on_close函数可以设置回调,
|
|
|
|
|
* 请在回调中删除对象来完成媒体的关闭,否则又为什么要调用mk_media_source_close函数?
|
|
|
|
|
* @param ctx 对象
|
|
|
|
|
* @param force 是否强制关闭,如果强制关闭,在有人观看的情况下也会关闭
|
|
|
|
|
* @return 0代表失败,1代表成功
|
|
|
|
|
*/
|
2019-12-23 18:50:46 +08:00
|
|
|
|
API_EXPORT int API_CALL mk_media_source_close(const mk_media_source ctx,int force);
|
|
|
|
|
//MediaSource::seekTo()
|
|
|
|
|
API_EXPORT int API_CALL mk_media_source_seek_to(const mk_media_source ctx,uint32_t stamp);
|
|
|
|
|
|
2020-11-21 22:13:08 +08:00
|
|
|
|
/**
|
|
|
|
|
* rtp推流成功与否的回调(第一次成功后,后面将一直重试)
|
|
|
|
|
*/
|
2021-01-02 20:43:02 +08:00
|
|
|
|
typedef void(API_CALL *on_mk_media_source_send_rtp_result)(void *user_data, uint16_t local_port, int err, const char *msg);
|
2020-11-21 22:13:08 +08:00
|
|
|
|
|
|
|
|
|
//MediaSource::startSendRtp,请参考mk_media_start_send_rtp,注意ctx参数类型不一样
|
|
|
|
|
API_EXPORT void API_CALL mk_media_source_start_send_rtp(const mk_media_source ctx, const char *dst_url, uint16_t dst_port, const char *ssrc, int is_udp, on_mk_media_source_send_rtp_result cb, void *user_data);
|
2023-02-11 15:14:18 +08:00
|
|
|
|
API_EXPORT void API_CALL mk_media_source_start_send_rtp2(const mk_media_source ctx, const char *dst_url, uint16_t dst_port, const char *ssrc, int is_udp, on_mk_media_source_send_rtp_result cb, void *user_data, on_user_data_free user_data_free);
|
2020-11-21 22:13:08 +08:00
|
|
|
|
//MediaSource::stopSendRtp,请参考mk_media_stop_send_rtp,注意ctx参数类型不一样
|
|
|
|
|
API_EXPORT int API_CALL mk_media_source_stop_send_rtp(const mk_media_source ctx);
|
|
|
|
|
|
2019-12-23 18:50:46 +08:00
|
|
|
|
//MediaSource::find()
|
|
|
|
|
API_EXPORT void API_CALL mk_media_source_find(const char *schema,
|
|
|
|
|
const char *vhost,
|
|
|
|
|
const char *app,
|
|
|
|
|
const char *stream,
|
2022-07-24 08:51:11 +08:00
|
|
|
|
int from_mp4,
|
2019-12-23 18:50:46 +08:00
|
|
|
|
void *user_data,
|
|
|
|
|
on_mk_media_source_find_cb cb);
|
2023-05-25 16:57:03 +08:00
|
|
|
|
|
2024-03-30 14:59:28 +08:00
|
|
|
|
API_EXPORT mk_media_source API_CALL mk_media_source_find2(const char *schema,
|
|
|
|
|
const char *vhost,
|
|
|
|
|
const char *app,
|
|
|
|
|
const char *stream,
|
|
|
|
|
int from_mp4);
|
2019-12-23 18:50:46 +08:00
|
|
|
|
//MediaSource::for_each_media()
|
2021-06-30 21:06:29 +08:00
|
|
|
|
API_EXPORT void API_CALL mk_media_source_for_each(void *user_data, on_mk_media_source_find_cb cb, const char *schema,
|
|
|
|
|
const char *vhost, const char *app, const char *stream);
|
2019-12-23 18:50:46 +08:00
|
|
|
|
|
2019-12-25 14:25:26 +08:00
|
|
|
|
///////////////////////////////////////////HttpBody/////////////////////////////////////////////
|
|
|
|
|
//HttpBody对象的C映射
|
2023-02-26 21:45:14 +08:00
|
|
|
|
typedef struct mk_http_body_t *mk_http_body;
|
2019-12-25 14:25:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 生成HttpStringBody
|
|
|
|
|
* @param str 字符串指针
|
|
|
|
|
* @param len 字符串长度,为0则用strlen获取
|
|
|
|
|
*/
|
2021-01-17 18:31:50 +08:00
|
|
|
|
API_EXPORT mk_http_body API_CALL mk_http_body_from_string(const char *str,size_t len);
|
2019-12-25 14:25:26 +08:00
|
|
|
|
|
2023-02-11 11:55:06 +08:00
|
|
|
|
/**
|
|
|
|
|
* 生成HttpBufferBody
|
|
|
|
|
* @param buffer mk_buffer对象
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT mk_http_body API_CALL mk_http_body_from_buffer(mk_buffer buffer);
|
|
|
|
|
|
|
|
|
|
|
2019-12-25 14:25:26 +08:00
|
|
|
|
/**
|
|
|
|
|
* 生成HttpFileBody
|
|
|
|
|
* @param file_path 文件完整路径
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT mk_http_body API_CALL mk_http_body_from_file(const char *file_path);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 生成HttpMultiFormBody
|
|
|
|
|
* @param key_val 参数key-value
|
|
|
|
|
* @param file_path 文件完整路径
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT mk_http_body API_CALL mk_http_body_from_multi_form(const char *key_val[],const char *file_path);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 销毁HttpBody
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_http_body_release(mk_http_body ctx);
|
|
|
|
|
|
2019-12-23 18:50:46 +08:00
|
|
|
|
///////////////////////////////////////////HttpResponseInvoker/////////////////////////////////////////////
|
|
|
|
|
//HttpSession::HttpResponseInvoker对象的C映射
|
2023-02-26 21:45:14 +08:00
|
|
|
|
typedef struct mk_http_response_invoker_t *mk_http_response_invoker;
|
2019-12-23 18:50:46 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2019-12-25 14:25:26 +08:00
|
|
|
|
* HttpSession::HttpResponseInvoker(const string &codeOut, const StrCaseMap &headerOut, const HttpBody::Ptr &body);
|
2021-01-02 21:24:06 +08:00
|
|
|
|
* @param response_code 譬如200
|
2019-12-23 18:50:46 +08:00
|
|
|
|
* @param response_header 返回的http头,譬如 {"Content-Type","text/html",NULL} 必须以NULL结尾
|
2019-12-25 14:25:26 +08:00
|
|
|
|
* @param response_body body对象
|
2019-12-23 18:50:46 +08:00
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_http_response_invoker_do(const mk_http_response_invoker ctx,
|
2021-01-02 21:24:06 +08:00
|
|
|
|
int response_code,
|
2019-12-25 14:25:26 +08:00
|
|
|
|
const char **response_header,
|
|
|
|
|
const mk_http_body response_body);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* HttpSession::HttpResponseInvoker(const string &codeOut, const StrCaseMap &headerOut, const string &body);
|
2021-01-02 21:24:06 +08:00
|
|
|
|
* @param response_code 譬如200
|
2019-12-25 14:25:26 +08:00
|
|
|
|
* @param response_header 返回的http头,譬如 {"Content-Type","text/html",NULL} 必须以NULL结尾
|
|
|
|
|
* @param response_content 返回的content部分,譬如一个网页内容
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_http_response_invoker_do_string(const mk_http_response_invoker ctx,
|
2021-01-02 21:24:06 +08:00
|
|
|
|
int response_code,
|
2019-12-25 14:25:26 +08:00
|
|
|
|
const char **response_header,
|
|
|
|
|
const char *response_content);
|
2019-12-23 18:50:46 +08:00
|
|
|
|
/**
|
|
|
|
|
* HttpSession::HttpResponseInvoker(const StrCaseMap &requestHeader,const StrCaseMap &responseHeader,const string &filePath);
|
2019-12-25 14:25:26 +08:00
|
|
|
|
* @param request_parser 请求事件中的mk_parser对象,用于提取其中http头中的Range字段,通过该字段先fseek然后再发送文件部分片段
|
2019-12-23 18:50:46 +08:00
|
|
|
|
* @param response_header 返回的http头,譬如 {"Content-Type","text/html",NULL} 必须以NULL结尾
|
|
|
|
|
* @param response_file_path 返回的content部分,譬如/path/to/html/file
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_http_response_invoker_do_file(const mk_http_response_invoker ctx,
|
|
|
|
|
const mk_parser request_parser,
|
|
|
|
|
const char *response_header[],
|
|
|
|
|
const char *response_file_path);
|
2019-12-24 14:24:32 +08:00
|
|
|
|
/**
|
|
|
|
|
* 克隆mk_http_response_invoker对象,通过克隆对象为堆对象,可以实现跨线程异步执行mk_http_response_invoker_do
|
|
|
|
|
* 如果是同步执行mk_http_response_invoker_do,那么没必要克隆对象
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT mk_http_response_invoker API_CALL mk_http_response_invoker_clone(const mk_http_response_invoker ctx);
|
2019-12-23 18:50:46 +08:00
|
|
|
|
|
2019-12-24 14:24:32 +08:00
|
|
|
|
/**
|
|
|
|
|
* 销毁堆上的克隆对象
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_http_response_invoker_clone_release(const mk_http_response_invoker ctx);
|
2019-12-23 18:50:46 +08:00
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////HttpAccessPathInvoker/////////////////////////////////////////////
|
|
|
|
|
//HttpSession::HttpAccessPathInvoker对象的C映射
|
2023-02-26 21:45:14 +08:00
|
|
|
|
typedef struct mk_http_access_path_invoker_t *mk_http_access_path_invoker;
|
|
|
|
|
|
2019-12-23 18:50:46 +08:00
|
|
|
|
/**
|
|
|
|
|
* HttpSession::HttpAccessPathInvoker(const string &errMsg,const string &accessPath, int cookieLifeSecond);
|
|
|
|
|
* @param err_msg 如果为空,则代表鉴权通过,否则为错误提示,可以为null
|
|
|
|
|
* @param access_path 运行或禁止访问的根目录,可以为null
|
|
|
|
|
* @param cookie_life_second 鉴权cookie有效期
|
|
|
|
|
**/
|
|
|
|
|
API_EXPORT void API_CALL mk_http_access_path_invoker_do(const mk_http_access_path_invoker ctx,
|
|
|
|
|
const char *err_msg,
|
|
|
|
|
const char *access_path,
|
|
|
|
|
int cookie_life_second);
|
|
|
|
|
|
2019-12-24 14:24:32 +08:00
|
|
|
|
/**
|
|
|
|
|
* 克隆mk_http_access_path_invoker对象,通过克隆对象为堆对象,可以实现跨线程异步执行mk_http_access_path_invoker_do
|
|
|
|
|
* 如果是同步执行mk_http_access_path_invoker_do,那么没必要克隆对象
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT mk_http_access_path_invoker API_CALL mk_http_access_path_invoker_clone(const mk_http_access_path_invoker ctx);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 销毁堆上的克隆对象
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_http_access_path_invoker_clone_release(const mk_http_access_path_invoker ctx);
|
|
|
|
|
|
2019-12-23 18:50:46 +08:00
|
|
|
|
///////////////////////////////////////////RtspSession::onGetRealm/////////////////////////////////////////////
|
|
|
|
|
//RtspSession::onGetRealm对象的C映射
|
2023-02-26 21:45:14 +08:00
|
|
|
|
typedef struct mk_rtsp_get_realm_invoker_t *mk_rtsp_get_realm_invoker;
|
2019-12-23 18:50:46 +08:00
|
|
|
|
/**
|
|
|
|
|
* 执行RtspSession::onGetRealm
|
|
|
|
|
* @param realm 该rtsp流是否需要开启rtsp专属鉴权,至null或空字符串则不鉴权
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_rtsp_get_realm_invoker_do(const mk_rtsp_get_realm_invoker ctx,
|
|
|
|
|
const char *realm);
|
|
|
|
|
|
2019-12-24 14:24:32 +08:00
|
|
|
|
/**
|
|
|
|
|
* 克隆mk_rtsp_get_realm_invoker对象,通过克隆对象为堆对象,可以实现跨线程异步执行mk_rtsp_get_realm_invoker_do
|
|
|
|
|
* 如果是同步执行mk_rtsp_get_realm_invoker_do,那么没必要克隆对象
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT mk_rtsp_get_realm_invoker API_CALL mk_rtsp_get_realm_invoker_clone(const mk_rtsp_get_realm_invoker ctx);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 销毁堆上的克隆对象
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_rtsp_get_realm_invoker_clone_release(const mk_rtsp_get_realm_invoker ctx);
|
|
|
|
|
|
2019-12-23 18:50:46 +08:00
|
|
|
|
///////////////////////////////////////////RtspSession::onAuth/////////////////////////////////////////////
|
|
|
|
|
//RtspSession::onAuth对象的C映射
|
2023-02-26 21:45:14 +08:00
|
|
|
|
typedef struct mk_rtsp_auth_invoker_t *mk_rtsp_auth_invoker;
|
2019-12-23 18:50:46 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 执行RtspSession::onAuth
|
|
|
|
|
* @param encrypted 为true是则表明是md5加密的密码,否则是明文密码, 在请求明文密码时如果提供md5密码者则会导致认证失败
|
|
|
|
|
* @param pwd_or_md5 明文密码或者md5加密的密码
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_rtsp_auth_invoker_do(const mk_rtsp_auth_invoker ctx,
|
|
|
|
|
int encrypted,
|
|
|
|
|
const char *pwd_or_md5);
|
|
|
|
|
|
2019-12-24 14:24:32 +08:00
|
|
|
|
/**
|
|
|
|
|
* 克隆mk_rtsp_auth_invoker对象,通过克隆对象为堆对象,可以实现跨线程异步执行mk_rtsp_auth_invoker_do
|
|
|
|
|
* 如果是同步执行mk_rtsp_auth_invoker_do,那么没必要克隆对象
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT mk_rtsp_auth_invoker API_CALL mk_rtsp_auth_invoker_clone(const mk_rtsp_auth_invoker ctx);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 销毁堆上的克隆对象
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_rtsp_auth_invoker_clone_release(const mk_rtsp_auth_invoker ctx);
|
2019-12-23 18:50:46 +08:00
|
|
|
|
|
|
|
|
|
///////////////////////////////////////////Broadcast::PublishAuthInvoker/////////////////////////////////////////////
|
|
|
|
|
//Broadcast::PublishAuthInvoker对象的C映射
|
2023-02-26 21:45:14 +08:00
|
|
|
|
typedef struct mk_publish_auth_invoker_t *mk_publish_auth_invoker;
|
2019-12-23 18:50:46 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 执行Broadcast::PublishAuthInvoker
|
|
|
|
|
* @param err_msg 为空或null则代表鉴权成功
|
|
|
|
|
* @param enable_hls 是否允许转换hls
|
|
|
|
|
* @param enable_mp4 是否运行MP4录制
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_publish_auth_invoker_do(const mk_publish_auth_invoker ctx,
|
|
|
|
|
const char *err_msg,
|
|
|
|
|
int enable_hls,
|
|
|
|
|
int enable_mp4);
|
|
|
|
|
|
2023-11-12 21:14:46 +08:00
|
|
|
|
API_EXPORT void API_CALL mk_publish_auth_invoker_do2(const mk_publish_auth_invoker ctx, const char *err_msg, mk_ini option);
|
|
|
|
|
|
2019-12-24 14:24:32 +08:00
|
|
|
|
/**
|
|
|
|
|
* 克隆mk_publish_auth_invoker对象,通过克隆对象为堆对象,可以实现跨线程异步执行mk_publish_auth_invoker_do
|
|
|
|
|
* 如果是同步执行mk_publish_auth_invoker_do,那么没必要克隆对象
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT mk_publish_auth_invoker API_CALL mk_publish_auth_invoker_clone(const mk_publish_auth_invoker ctx);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 销毁堆上的克隆对象
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_publish_auth_invoker_clone_release(const mk_publish_auth_invoker ctx);
|
|
|
|
|
|
2019-12-23 18:50:46 +08:00
|
|
|
|
///////////////////////////////////////////Broadcast::AuthInvoker/////////////////////////////////////////////
|
|
|
|
|
//Broadcast::AuthInvoker对象的C映射
|
2023-02-26 21:45:14 +08:00
|
|
|
|
typedef struct mk_auth_invoker_t *mk_auth_invoker;
|
2019-12-23 18:50:46 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 执行Broadcast::AuthInvoker
|
|
|
|
|
* @param err_msg 为空或null则代表鉴权成功
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_auth_invoker_do(const mk_auth_invoker ctx, const char *err_msg);
|
|
|
|
|
|
2019-12-24 14:24:32 +08:00
|
|
|
|
/**
|
|
|
|
|
* 克隆mk_auth_invoker对象,通过克隆对象为堆对象,可以实现跨线程异步执行mk_auth_invoker_do
|
|
|
|
|
* 如果是同步执行mk_auth_invoker_do,那么没必要克隆对象
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT mk_auth_invoker API_CALL mk_auth_invoker_clone(const mk_auth_invoker ctx);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 销毁堆上的克隆对象
|
|
|
|
|
*/
|
2020-02-29 10:27:30 +08:00
|
|
|
|
API_EXPORT void API_CALL mk_auth_invoker_clone_release(const mk_auth_invoker ctx);
|
2019-12-23 18:50:46 +08:00
|
|
|
|
|
2024-03-02 16:52:51 +08:00
|
|
|
|
///////////////////////////////////////////WebRtcTransport/////////////////////////////////////////////
|
|
|
|
|
//WebRtcTransport对象的C映射
|
|
|
|
|
typedef struct mk_rtc_transport_t *mk_rtc_transport;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 发送rtc数据通道
|
|
|
|
|
* @param ctx 数据通道对象
|
|
|
|
|
* @param streamId 流id
|
|
|
|
|
* @param ppid 协议id
|
|
|
|
|
* @param msg 数据
|
|
|
|
|
* @param len 数据长度
|
|
|
|
|
*/
|
|
|
|
|
API_EXPORT void API_CALL mk_rtc_send_datachannel(const mk_rtc_transport ctx, uint16_t streamId, uint32_t ppid, const char* msg, size_t len);
|
|
|
|
|
|
2019-12-23 18:50:46 +08:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif //MK_EVENT_OBJECTS_H
|