mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
commit
2b3d32f6c6
@ -75,7 +75,7 @@ API_EXPORT void API_CALL mk_media_init_complete(mk_media ctx);
|
|||||||
* @param dts 解码时间戳,单位毫秒
|
* @param dts 解码时间戳,单位毫秒
|
||||||
* @param pts 播放时间戳,单位毫秒
|
* @param pts 播放时间戳,单位毫秒
|
||||||
*/
|
*/
|
||||||
API_EXPORT void API_CALL mk_media_input_h264(mk_media ctx, void *data, int len, uint32_t dts, uint32_t pts);
|
API_EXPORT void API_CALL mk_media_input_h264(mk_media ctx, const void *data, int len, uint32_t dts, uint32_t pts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 输入单帧H265视频,帧起始字节00 00 01,00 00 00 01均可
|
* 输入单帧H265视频,帧起始字节00 00 01,00 00 00 01均可
|
||||||
@ -85,7 +85,7 @@ API_EXPORT void API_CALL mk_media_input_h264(mk_media ctx, void *data, int len,
|
|||||||
* @param dts 解码时间戳,单位毫秒
|
* @param dts 解码时间戳,单位毫秒
|
||||||
* @param pts 播放时间戳,单位毫秒
|
* @param pts 播放时间戳,单位毫秒
|
||||||
*/
|
*/
|
||||||
API_EXPORT void API_CALL mk_media_input_h265(mk_media ctx, void *data, int len, uint32_t dts, uint32_t pts);
|
API_EXPORT void API_CALL mk_media_input_h265(mk_media ctx, const void *data, int len, uint32_t dts, uint32_t pts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 输入单帧AAC音频(单独指定adts头)
|
* 输入单帧AAC音频(单独指定adts头)
|
||||||
@ -95,7 +95,7 @@ API_EXPORT void API_CALL mk_media_input_h265(mk_media ctx, void *data, int len,
|
|||||||
* @param dts 时间戳,毫秒
|
* @param dts 时间戳,毫秒
|
||||||
* @param adts adts头,可以为null
|
* @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);
|
API_EXPORT void API_CALL mk_media_input_aac(mk_media ctx, const void *data, int len, uint32_t dts, void *adts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 输入单帧PCM音频,启用ENABLE_FAAC编译时,该函数才有效
|
* 输入单帧PCM音频,启用ENABLE_FAAC编译时,该函数才有效
|
||||||
@ -113,7 +113,7 @@ API_EXPORT void API_CALL mk_media_input_pcm(mk_media ctx, void *data, int len, u
|
|||||||
* @param len 单帧音频数据字节数
|
* @param len 单帧音频数据字节数
|
||||||
* @param dts 时间戳,毫秒
|
* @param dts 时间戳,毫秒
|
||||||
*/
|
*/
|
||||||
API_EXPORT void API_CALL mk_media_input_audio(mk_media ctx, void* data, int len, uint32_t dts);
|
API_EXPORT void API_CALL mk_media_input_audio(mk_media ctx, const void* data, int len, uint32_t dts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MediaSource.close()回调事件
|
* MediaSource.close()回调事件
|
||||||
|
@ -202,22 +202,22 @@ API_EXPORT void API_CALL mk_media_init_complete(mk_media ctx){
|
|||||||
(*obj)->getChannel()->addTrackCompleted();
|
(*obj)->getChannel()->addTrackCompleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT void API_CALL mk_media_input_h264(mk_media ctx, void *data, int len, uint32_t dts, uint32_t pts) {
|
API_EXPORT void API_CALL mk_media_input_h264(mk_media ctx, const void *data, int len, uint32_t dts, uint32_t pts) {
|
||||||
assert(ctx && data && len > 0);
|
assert(ctx && data && len > 0);
|
||||||
MediaHelper::Ptr *obj = (MediaHelper::Ptr *) ctx;
|
MediaHelper::Ptr *obj = (MediaHelper::Ptr *) ctx;
|
||||||
(*obj)->getChannel()->inputH264((char *) data, len, dts, pts);
|
(*obj)->getChannel()->inputH264((const char *) data, len, dts, pts);
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT void API_CALL mk_media_input_h265(mk_media ctx, void *data, int len, uint32_t dts, uint32_t pts) {
|
API_EXPORT void API_CALL mk_media_input_h265(mk_media ctx, const void *data, int len, uint32_t dts, uint32_t pts) {
|
||||||
assert(ctx && data && len > 0);
|
assert(ctx && data && len > 0);
|
||||||
MediaHelper::Ptr *obj = (MediaHelper::Ptr *) ctx;
|
MediaHelper::Ptr *obj = (MediaHelper::Ptr *) ctx;
|
||||||
(*obj)->getChannel()->inputH265((char *) data, len, dts, pts);
|
(*obj)->getChannel()->inputH265((const char *) data, len, dts, pts);
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT void API_CALL mk_media_input_aac(mk_media ctx, void *data, int len, uint32_t dts, void *adts) {
|
API_EXPORT void API_CALL mk_media_input_aac(mk_media ctx, const void *data, int len, uint32_t dts, void *adts) {
|
||||||
assert(ctx && data && len > 0 && adts);
|
assert(ctx && data && len > 0 && adts);
|
||||||
MediaHelper::Ptr *obj = (MediaHelper::Ptr *) ctx;
|
MediaHelper::Ptr *obj = (MediaHelper::Ptr *) ctx;
|
||||||
(*obj)->getChannel()->inputAAC((char *) data, len, dts, (char *) adts);
|
(*obj)->getChannel()->inputAAC((const char *) data, len, dts, (char *) adts);
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT void API_CALL mk_media_input_pcm(mk_media ctx, void *data , int len, uint32_t pts){
|
API_EXPORT void API_CALL mk_media_input_pcm(mk_media ctx, void *data , int len, uint32_t pts){
|
||||||
@ -226,10 +226,10 @@ API_EXPORT void API_CALL mk_media_input_pcm(mk_media ctx, void *data , int len,
|
|||||||
(*obj)->getChannel()->inputPCM((char*)data, len, pts);
|
(*obj)->getChannel()->inputPCM((char*)data, len, pts);
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT void API_CALL mk_media_input_audio(mk_media ctx, void* data, int len, uint32_t dts){
|
API_EXPORT void API_CALL mk_media_input_audio(mk_media ctx, const void* data, int len, uint32_t dts){
|
||||||
assert(ctx && data && len > 0);
|
assert(ctx && data && len > 0);
|
||||||
MediaHelper::Ptr* obj = (MediaHelper::Ptr*) ctx;
|
MediaHelper::Ptr* obj = (MediaHelper::Ptr*) ctx;
|
||||||
(*obj)->getChannel()->inputAudio((char*)data, len, dts);
|
(*obj)->getChannel()->inputAudio((const char*)data, len, dts);
|
||||||
}
|
}
|
||||||
|
|
||||||
API_EXPORT void API_CALL mk_media_start_send_rtp(mk_media ctx, const char *dst_url, uint16_t dst_port, const char *ssrc, int is_udp, on_mk_media_send_rtp_result cb, void *user_data){
|
API_EXPORT void API_CALL mk_media_start_send_rtp(mk_media ctx, const char *dst_url, uint16_t dst_port, const char *ssrc, int is_udp, on_mk_media_send_rtp_result cb, void *user_data){
|
||||||
|
@ -83,7 +83,7 @@ int AudioSRC::getPCMData(char *buf, int size) {
|
|||||||
if (_audio_cvt.len_cvt) {
|
if (_audio_cvt.len_cvt) {
|
||||||
_target_buf.append(_buf.get(), _audio_cvt.len_cvt);
|
_target_buf.append(_buf.get(), _audio_cvt.len_cvt);
|
||||||
}
|
}
|
||||||
if (_target_buf.size() < size) {
|
if (_target_buf.size() < (size_t)size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
memcpy(buf, _target_buf.data(), size);
|
memcpy(buf, _target_buf.data(), size);
|
||||||
@ -122,7 +122,7 @@ int AudioPlayer::getPCMChannel() {
|
|||||||
|
|
||||||
int AudioPlayer::getPCMData(char *buf, int size) {
|
int AudioPlayer::getPCMData(char *buf, int size) {
|
||||||
lock_guard<mutex> lck(_mtx);
|
lock_guard<mutex> lck(_mtx);
|
||||||
if (_buffer.size() < size) {
|
if (_buffer.size() < (size_t)size) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
memcpy(buf, _buffer.data(), size);
|
memcpy(buf, _buffer.data(), size);
|
||||||
|
@ -102,7 +102,7 @@ FFmpegSwr::~FFmpegSwr() {
|
|||||||
FFmpegFrame::Ptr FFmpegSwr::inputFrame(const FFmpegFrame::Ptr &frame) {
|
FFmpegFrame::Ptr FFmpegSwr::inputFrame(const FFmpegFrame::Ptr &frame) {
|
||||||
if (frame->get()->format == _target_format &&
|
if (frame->get()->format == _target_format &&
|
||||||
frame->get()->channels == _target_channels &&
|
frame->get()->channels == _target_channels &&
|
||||||
frame->get()->channel_layout == _target_channel_layout &&
|
frame->get()->channel_layout == (uint64_t)_target_channel_layout &&
|
||||||
frame->get()->sample_rate == _target_samplerate) {
|
frame->get()->sample_rate == _target_samplerate) {
|
||||||
//不转格式
|
//不转格式
|
||||||
return frame;
|
return frame;
|
||||||
|
@ -712,7 +712,6 @@ static inline int decodeVuiParameters(void *pvBuf, T_SPS *ptSps)
|
|||||||
{
|
{
|
||||||
int iAspectRatioInfoPresentFlag;
|
int iAspectRatioInfoPresentFlag;
|
||||||
unsigned int uiAspectRatioIdc;
|
unsigned int uiAspectRatioIdc;
|
||||||
int iChromaSampleLocation;
|
|
||||||
|
|
||||||
iAspectRatioInfoPresentFlag = getOneBit(pvBuf);
|
iAspectRatioInfoPresentFlag = getOneBit(pvBuf);
|
||||||
|
|
||||||
@ -759,8 +758,7 @@ static inline int decodeVuiParameters(void *pvBuf, T_SPS *ptSps)
|
|||||||
/* chroma_location_info_present_flag */
|
/* chroma_location_info_present_flag */
|
||||||
if (getOneBit(pvBuf))
|
if (getOneBit(pvBuf))
|
||||||
{
|
{
|
||||||
/* chroma_sample_location_type_top_field */
|
parseUe(pvBuf); /* chroma_sample_location_type_top_field */
|
||||||
iChromaSampleLocation = parseUe(pvBuf);
|
|
||||||
parseUe(pvBuf); /* chroma_sample_location_type_bottom_field */
|
parseUe(pvBuf); /* chroma_sample_location_type_bottom_field */
|
||||||
}
|
}
|
||||||
if(getBitsLeft(pvBuf) < 10)
|
if(getBitsLeft(pvBuf) < 10)
|
||||||
|
Loading…
Reference in New Issue
Block a user