mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-13 03:31:45 +08:00
合并 #278
This commit is contained in:
@@ -68,7 +68,7 @@ API_EXPORT void API_CALL mk_media_init_aac(mk_media ctx, int channel, int sample
|
||||
/**
|
||||
* 添加g711音频轨道
|
||||
* @param ctx 对象指针
|
||||
* @param au 1.G711A 2.G711U
|
||||
* @param au 3 : G711A 4: G711U
|
||||
* @param channel 通道数
|
||||
* @param sample_bit 采样位数,只支持16
|
||||
* @param sample_rate 采样率
|
||||
|
||||
@@ -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
|
||||
* @param codec_id 0:H264,1:H265,2:AAC 3.G711A 4.G711U
|
||||
* @param data 数据指针
|
||||
* @param len 数据长度
|
||||
* @param dts 解码时间戳,单位毫秒
|
||||
@@ -98,13 +98,15 @@ API_EXPORT void API_CALL mk_player_set_on_shutdown(mk_player ctx, on_mk_play_eve
|
||||
|
||||
/**
|
||||
* 设置音视频数据回调函数
|
||||
* 该接口只能在播放成功事件触发后才能调用
|
||||
* 该接口在播放成功事件触发后才有效
|
||||
* @param ctx 播放器指针
|
||||
* @param cb 回调函数指针,不得为null
|
||||
* @param user_data 用户数据指针
|
||||
*/
|
||||
API_EXPORT void API_CALL mk_player_set_on_data(mk_player ctx, on_mk_play_data cb, void *user_data);
|
||||
|
||||
///////////////////////////获取音视频相关信息接口在播放成功回调触发后才有效///////////////////////////////
|
||||
|
||||
/**
|
||||
* 获取视频codec_id -1:不存在 0:H264,1:H265,2:AAC 3.G711A 4.G711U
|
||||
* @param ctx 播放器指针
|
||||
|
||||
@@ -113,6 +113,7 @@ API_EXPORT void API_CALL mk_media_init_h264(mk_media ctx, int width, int height,
|
||||
assert(ctx);
|
||||
MediaHelper::Ptr *obj = (MediaHelper::Ptr *) ctx;
|
||||
VideoInfo info;
|
||||
info.codecId = CodecH264;
|
||||
info.iFrameRate = frameRate;
|
||||
info.iWidth = width;
|
||||
info.iHeight = height;
|
||||
@@ -123,16 +124,18 @@ API_EXPORT void API_CALL mk_media_init_h265(mk_media ctx, int width, int height,
|
||||
assert(ctx);
|
||||
MediaHelper::Ptr *obj = (MediaHelper::Ptr *) ctx;
|
||||
VideoInfo info;
|
||||
info.codecId = CodecH265;
|
||||
info.iFrameRate = frameRate;
|
||||
info.iWidth = width;
|
||||
info.iHeight = height;
|
||||
(*obj)->getChannel()->initH265Video(info);
|
||||
(*obj)->getChannel()->initVideo(info);
|
||||
}
|
||||
|
||||
API_EXPORT void API_CALL mk_media_init_aac(mk_media ctx, int channel, int sample_bit, int sample_rate, int profile) {
|
||||
assert(ctx);
|
||||
MediaHelper::Ptr *obj = (MediaHelper::Ptr *) ctx;
|
||||
AudioInfo info;
|
||||
info.codecId = CodecAAC;
|
||||
info.iSampleRate = sample_rate;
|
||||
info.iChannel = channel;
|
||||
info.iSampleBit = sample_bit;
|
||||
@@ -140,17 +143,16 @@ API_EXPORT void API_CALL mk_media_init_aac(mk_media ctx, int channel, int sample
|
||||
(*obj)->getChannel()->initAudio(info);
|
||||
}
|
||||
|
||||
|
||||
API_EXPORT void API_CALL mk_media_init_g711(mk_media ctx, int au, int sample_bit, int sample_rate)
|
||||
{
|
||||
API_EXPORT void API_CALL mk_media_init_g711(mk_media ctx, int au, int sample_bit, int sample_rate){
|
||||
assert(ctx);
|
||||
assert(au == CodecG711A || au == CodecG711U);
|
||||
MediaHelper::Ptr* obj = (MediaHelper::Ptr*) ctx;
|
||||
AudioInfo info;
|
||||
info.codecId = (CodecId)au;
|
||||
info.iSampleRate = sample_rate;
|
||||
info.iChannel = 1;
|
||||
info.iSampleBit = sample_bit;
|
||||
info.iProfile = 0;
|
||||
info.codecId = (CodecId)au;
|
||||
(*obj)->getChannel()->initAudio(info);
|
||||
}
|
||||
|
||||
@@ -184,12 +186,8 @@ API_EXPORT void API_CALL mk_media_input_aac1(mk_media ctx, void *data, int len,
|
||||
(*obj)->getChannel()->inputAAC((char *) data, len, dts, (char *) adts);
|
||||
}
|
||||
|
||||
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_g711(mk_media ctx, void* data, int len, uint32_t dts){
|
||||
assert(ctx && data && len > 0);
|
||||
MediaHelper::Ptr* obj = (MediaHelper::Ptr*) ctx;
|
||||
(*obj)->getChannel()->inputG711((char*)data, len, dts);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -101,9 +101,7 @@ API_EXPORT void API_CALL mk_player_set_on_data(mk_player ctx, on_mk_play_data cb
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
API_EXPORT int API_CALL mk_player_video_codecId(mk_player ctx)
|
||||
{
|
||||
API_EXPORT int API_CALL mk_player_video_codecId(mk_player ctx){
|
||||
assert(ctx);
|
||||
MediaPlayer::Ptr& player = *((MediaPlayer::Ptr*)ctx);
|
||||
auto track = dynamic_pointer_cast<VideoTrack>(player->getTrack(TrackVideo));
|
||||
@@ -131,9 +129,7 @@ API_EXPORT int API_CALL mk_player_video_fps(mk_player ctx) {
|
||||
return track ? track->getVideoFps() : 0;
|
||||
}
|
||||
|
||||
|
||||
API_EXPORT int API_CALL mk_player_audio_codecId(mk_player ctx)
|
||||
{
|
||||
API_EXPORT int API_CALL mk_player_audio_codecId(mk_player ctx){
|
||||
assert(ctx);
|
||||
MediaPlayer::Ptr& player = *((MediaPlayer::Ptr*)ctx);
|
||||
auto track = dynamic_pointer_cast<AudioTrack>(player->getTrack(TrackAudio));
|
||||
|
||||
Reference in New Issue
Block a user