mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-29 22:32:23 +08:00
@@ -19,25 +19,25 @@ extern "C" {
|
||||
///////////////////////////////////////////MP4Info/////////////////////////////////////////////
|
||||
//MP4Info对象的C映射
|
||||
typedef void* mk_mp4_info;
|
||||
//MP4Info::ui64StartedTime
|
||||
// GMT 标准时间,单位秒
|
||||
API_EXPORT uint64_t API_CALL mk_mp4_info_get_start_time(const mk_mp4_info ctx);
|
||||
//MP4Info::ui64TimeLen
|
||||
API_EXPORT uint64_t API_CALL mk_mp4_info_get_time_len(const mk_mp4_info ctx);
|
||||
//MP4Info::ui64FileSize
|
||||
// 录像长度,单位秒
|
||||
API_EXPORT float API_CALL mk_mp4_info_get_time_len(const mk_mp4_info ctx);
|
||||
// 文件大小,单位 BYTE
|
||||
API_EXPORT uint64_t API_CALL mk_mp4_info_get_file_size(const mk_mp4_info ctx);
|
||||
//MP4Info::strFilePath
|
||||
// 文件路径
|
||||
API_EXPORT const char* API_CALL mk_mp4_info_get_file_path(const mk_mp4_info ctx);
|
||||
//MP4Info::strFileName
|
||||
// 文件名称
|
||||
API_EXPORT const char* API_CALL mk_mp4_info_get_file_name(const mk_mp4_info ctx);
|
||||
//MP4Info::strFolder
|
||||
// 文件夹路径
|
||||
API_EXPORT const char* API_CALL mk_mp4_info_get_folder(const mk_mp4_info ctx);
|
||||
//MP4Info::strUrl
|
||||
// 播放路径
|
||||
API_EXPORT const char* API_CALL mk_mp4_info_get_url(const mk_mp4_info ctx);
|
||||
//MP4Info::strVhost
|
||||
// 应用名称
|
||||
API_EXPORT const char* API_CALL mk_mp4_info_get_vhost(const mk_mp4_info ctx);
|
||||
//MP4Info::strAppName
|
||||
// 流 ID
|
||||
API_EXPORT const char* API_CALL mk_mp4_info_get_app(const mk_mp4_info ctx);
|
||||
//MP4Info::strStreamId
|
||||
// 虚拟主机
|
||||
API_EXPORT const char* API_CALL mk_mp4_info_get_stream(const mk_mp4_info ctx);
|
||||
|
||||
///////////////////////////////////////////Parser/////////////////////////////////////////////
|
||||
@@ -276,13 +276,11 @@ typedef void* mk_publish_auth_invoker;
|
||||
/**
|
||||
* 执行Broadcast::PublishAuthInvoker
|
||||
* @param err_msg 为空或null则代表鉴权成功
|
||||
* @param enable_rtxp rtmp推流时是否运行转rtsp;rtsp推流时,是否允许转rtmp
|
||||
* @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_rtxp,
|
||||
int enable_hls,
|
||||
int enable_mp4);
|
||||
|
||||
|
||||
@@ -26,14 +26,12 @@ typedef void *mk_media;
|
||||
* @param app 应用名,推荐为live
|
||||
* @param stream 流id,例如camera
|
||||
* @param duration 时长(单位秒),直播则为0
|
||||
* @param rtsp_enabled 是否启用rtsp协议
|
||||
* @param rtmp_enabled 是否启用rtmp协议
|
||||
* @param hls_enabled 是否生成hls
|
||||
* @param mp4_enabled 是否生成mp4
|
||||
* @return 对象指针
|
||||
*/
|
||||
API_EXPORT mk_media API_CALL mk_media_create(const char *vhost, const char *app, const char *stream, float duration,
|
||||
int rtsp_enabled, int rtmp_enabled, int hls_enabled, int mp4_enabled);
|
||||
API_EXPORT mk_media API_CALL mk_media_create(const char *vhost, const char *app, const char *stream,
|
||||
float duration, int hls_enabled, int mp4_enabled);
|
||||
|
||||
/**
|
||||
* 销毁媒体源
|
||||
@@ -54,7 +52,7 @@ API_EXPORT void API_CALL mk_media_init_video(mk_media ctx, int track_id, int wid
|
||||
/**
|
||||
* 添加音频轨道
|
||||
* @param ctx 对象指针
|
||||
* @param track_id 2:CodecAAC/3:CodecG711A/4:CodecG711U
|
||||
* @param track_id 2:CodecAAC/3:CodecG711A/4:CodecG711U/5:OPUS
|
||||
* @param channel 通道数
|
||||
* @param sample_bit 采样位数,只支持16
|
||||
* @param sample_rate 采样率
|
||||
@@ -95,7 +93,7 @@ API_EXPORT void API_CALL mk_media_input_h265(mk_media ctx, void *data, int len,
|
||||
* @param data 不包含adts头的单帧AAC数据
|
||||
* @param len 单帧AAC数据字节数
|
||||
* @param dts 时间戳,毫秒
|
||||
* @param adts adts头
|
||||
* @param adts adts头,可以为null
|
||||
*/
|
||||
API_EXPORT void API_CALL mk_media_input_aac(mk_media ctx, void *data, int len, uint32_t dts, void *adts);
|
||||
|
||||
@@ -109,13 +107,13 @@ API_EXPORT void API_CALL mk_media_input_aac(mk_media ctx, void *data, int len, u
|
||||
API_EXPORT void API_CALL mk_media_input_pcm(mk_media ctx, void *data, int len, uint32_t pts);
|
||||
|
||||
/**
|
||||
* 输入单帧G711音频
|
||||
* 输入单帧OPUS/G711音频帧
|
||||
* @param ctx 对象指针
|
||||
* @param data 单帧G711数据
|
||||
* @param len 单帧G711数据字节数
|
||||
* @param data 单帧音频数据
|
||||
* @param len 单帧音频数据字节数
|
||||
* @param dts 时间戳,毫秒
|
||||
*/
|
||||
API_EXPORT void API_CALL mk_media_input_g711(mk_media ctx, void* data, int len, uint32_t dts);
|
||||
API_EXPORT void API_CALL mk_media_input_audio(mk_media ctx, void* data, int len, uint32_t dts);
|
||||
|
||||
/**
|
||||
* MediaSource.close()回调事件
|
||||
|
||||
@@ -22,5 +22,6 @@
|
||||
#include "mk_tcp.h"
|
||||
#include "mk_util.h"
|
||||
#include "mk_thread.h"
|
||||
#include "mk_rtp_server.h"
|
||||
|
||||
#endif /* MK_API_H_ */
|
||||
|
||||
@@ -31,7 +31,7 @@ typedef void(API_CALL *on_mk_play_event)(void *user_data,int err_code,const char
|
||||
* 收到音视频数据回调
|
||||
* @param user_data 用户数据指针
|
||||
* @param track_type 0:视频,1:音频
|
||||
* @param codec_id 0:H264,1:H265,2:AAC 3.G711A 4.G711U
|
||||
* @param codec_id 0:H264,1:H265,2:AAC 3.G711A 4.G711U 5.OPUS
|
||||
* @param data 数据指针
|
||||
* @param len 数据长度
|
||||
* @param dts 解码时间戳,单位毫秒
|
||||
|
||||
58
api/include/mk_rtp_server.h
Normal file
58
api/include/mk_rtp_server.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of ZLMediaKit(https://github.com/xiongziliang/ZLMediaKit).
|
||||
*
|
||||
* Use of this source code is governed by MIT license that can be found in the
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "mk_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void* mk_rtp_server;
|
||||
|
||||
/**
|
||||
* 创建GB28181 RTP 服务器
|
||||
* @param port 监听端口,0则为随机
|
||||
* @param enable_tcp 创建udp端口时是否同时监听tcp端口
|
||||
* @param stream_id 该端口绑定的流id
|
||||
* @return
|
||||
*/
|
||||
API_EXPORT mk_rtp_server API_CALL mk_rtp_server_create(uint16_t port, int enable_tcp, const char *stream_id);
|
||||
|
||||
/**
|
||||
* 销毁GB28181 RTP 服务器
|
||||
* @param ctx 服务器对象
|
||||
*/
|
||||
API_EXPORT void API_CALL mk_rtp_server_release(mk_rtp_server ctx);
|
||||
|
||||
/**
|
||||
* 获取本地监听的端口号
|
||||
* @param ctx 服务器对象
|
||||
* @return 端口号
|
||||
*/
|
||||
API_EXPORT uint16_t API_CALL mk_rtp_server_port(mk_rtp_server ctx);
|
||||
|
||||
/**
|
||||
* GB28181 RTP 服务器接收流超时时触发
|
||||
* @param user_data 用户数据指针
|
||||
*/
|
||||
typedef void(API_CALL *on_mk_rtp_server_detach)(void *user_data);
|
||||
|
||||
/**
|
||||
* 监听B28181 RTP 服务器接收流超时事件
|
||||
* @param ctx 服务器对象
|
||||
* @param cb 回调函数
|
||||
* @param user_data 回调函数用户数据指针
|
||||
*/
|
||||
API_EXPORT void API_CALL mk_rtp_server_set_on_detach(mk_rtp_server ctx, on_mk_rtp_server_detach cb, void *user_data);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user