add: C API on_record_ts callback
This commit is contained in:
parent
4f72eef6ae
commit
0308f101ca
|
|
@ -134,6 +134,11 @@ typedef struct {
|
|||
*/
|
||||
void (API_CALL *on_mk_record_mp4)(const mk_mp4_info mp4);
|
||||
|
||||
/**
|
||||
* 录制ts分片文件成功后广播
|
||||
*/
|
||||
void(API_CALL *on_mk_record_ts)(const mk_ts_info ts);
|
||||
|
||||
/**
|
||||
* shell登录鉴权
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -42,6 +42,31 @@ API_EXPORT const char* API_CALL mk_mp4_info_get_app(const mk_mp4_info ctx);
|
|||
// 虚拟主机
|
||||
API_EXPORT const char* API_CALL mk_mp4_info_get_stream(const mk_mp4_info ctx);
|
||||
|
||||
///////////////////////////////////////////TSInfo/////////////////////////////////////////////
|
||||
// TSInfo对象的C映射
|
||||
typedef struct mk_ts_info_t *mk_ts_info;
|
||||
// GMT 标准时间,单位秒
|
||||
API_EXPORT uint64_t API_CALL mk_ts_info_get_start_time(const mk_ts_info ctx);
|
||||
// 录像长度,单位秒
|
||||
API_EXPORT float API_CALL mk_ts_info_get_time_len(const mk_ts_info ctx);
|
||||
// 文件大小,单位 BYTE
|
||||
API_EXPORT size_t API_CALL mk_ts_info_get_file_size(const mk_ts_info ctx);
|
||||
// 文件路径
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_file_path(const mk_ts_info ctx);
|
||||
// 文件名称
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_file_name(const mk_ts_info ctx);
|
||||
// 文件夹路径
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_folder(const mk_ts_info ctx);
|
||||
// 播放路径
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_url(const mk_ts_info ctx);
|
||||
// 应用名称
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_vhost(const mk_ts_info ctx);
|
||||
// 流 ID
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_app(const mk_ts_info ctx);
|
||||
// 虚拟主机
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_stream(const mk_ts_info ctx);
|
||||
|
||||
|
||||
///////////////////////////////////////////Parser/////////////////////////////////////////////
|
||||
//Parser对象的C映射
|
||||
typedef struct mk_parser_t *mk_parser;
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@ API_EXPORT void API_CALL mk_events_listen(const mk_events *events){
|
|||
}
|
||||
});
|
||||
|
||||
NoticeCenter::Instance().addListener(&s_tag, Broadcast::kBroadcastRecordTs, [](BroadcastRecordTsArgs) {
|
||||
if (s_events.on_mk_record_ts) {
|
||||
s_events.on_mk_record_ts((mk_ts_info)&info);
|
||||
}
|
||||
});
|
||||
|
||||
NoticeCenter::Instance().addListener(&s_tag,Broadcast::kBroadcastHttpRequest,[](BroadcastHttpRequestArgs){
|
||||
if(s_events.on_mk_http_request){
|
||||
int consumed_int = consumed;
|
||||
|
|
|
|||
|
|
@ -86,6 +86,67 @@ API_EXPORT const char* API_CALL mk_mp4_info_get_stream(const mk_mp4_info ctx){
|
|||
return info->stream.c_str();
|
||||
}
|
||||
|
||||
API_EXPORT uint64_t API_CALL mk_ts_info_get_start_time(const mk_ts_info ctx) {
|
||||
assert(ctx);
|
||||
RecordInfo *info = (RecordInfo *)ctx;
|
||||
return info->start_time;
|
||||
}
|
||||
|
||||
API_EXPORT float API_CALL mk_ts_info_get_time_len(const mk_ts_info ctx) {
|
||||
assert(ctx);
|
||||
RecordInfo *info = (RecordInfo *)ctx;
|
||||
return info->time_len;
|
||||
}
|
||||
|
||||
API_EXPORT size_t API_CALL mk_ts_info_get_file_size(const mk_ts_info ctx) {
|
||||
assert(ctx);
|
||||
RecordInfo *info = (RecordInfo *)ctx;
|
||||
return info->file_size;
|
||||
}
|
||||
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_file_path(const mk_ts_info ctx) {
|
||||
assert(ctx);
|
||||
RecordInfo *info = (RecordInfo *)ctx;
|
||||
return info->file_path.c_str();
|
||||
}
|
||||
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_file_name(const mk_ts_info ctx) {
|
||||
assert(ctx);
|
||||
RecordInfo *info = (RecordInfo *)ctx;
|
||||
return info->file_name.c_str();
|
||||
}
|
||||
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_folder(const mk_ts_info ctx) {
|
||||
assert(ctx);
|
||||
RecordInfo *info = (RecordInfo *)ctx;
|
||||
return info->folder.c_str();
|
||||
}
|
||||
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_url(const mk_ts_info ctx) {
|
||||
assert(ctx);
|
||||
RecordInfo *info = (RecordInfo *)ctx;
|
||||
return info->url.c_str();
|
||||
}
|
||||
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_vhost(const mk_ts_info ctx) {
|
||||
assert(ctx);
|
||||
RecordInfo *info = (RecordInfo *)ctx;
|
||||
return info->vhost.c_str();
|
||||
}
|
||||
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_app(const mk_ts_info ctx) {
|
||||
assert(ctx);
|
||||
RecordInfo *info = (RecordInfo *)ctx;
|
||||
return info->app.c_str();
|
||||
}
|
||||
|
||||
API_EXPORT const char *API_CALL mk_ts_info_get_stream(const mk_ts_info ctx) {
|
||||
assert(ctx);
|
||||
RecordInfo *info = (RecordInfo *)ctx;
|
||||
return info->stream.c_str();
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////Parser/////////////////////////////////////////////
|
||||
API_EXPORT const char* API_CALL mk_parser_get_method(const mk_parser ctx){
|
||||
assert(ctx);
|
||||
|
|
|
|||
Loading…
Reference in New Issue