Commit 2c914151 by xiongziliang

ts/ps支持G711

parent b2b27602
media-server @ abc08f61
Subproject commit 24519a594c2c634b21fbe09fad28d54c4eba0885
Subproject commit abc08f61bb1250b94d252cfeaea249527912dd3b
......@@ -28,24 +28,29 @@ void TsMuxer::addTrack(const Track::Ptr &track) {
case CodecH264: {
_have_video = true;
_codec_to_trackid[track->getCodecId()].track_id = mpeg_ts_add_stream(_context, PSI_STREAM_H264, nullptr, 0);
}
break;
}
case CodecH265: {
_have_video = true;
_codec_to_trackid[track->getCodecId()].track_id = mpeg_ts_add_stream(_context, PSI_STREAM_H265, nullptr, 0);
}
break;
}
case CodecAAC: {
_codec_to_trackid[track->getCodecId()].track_id = mpeg_ts_add_stream(_context, PSI_STREAM_AAC, nullptr, 0);
break;
}
case CodecG711A: {
_codec_to_trackid[track->getCodecId()].track_id = mpeg_ts_add_stream(_context, PSI_STREAM_AUDIO_G711A, nullptr, 0);
break;
}
case CodecG711A:
case CodecG711U: {
//todo 此处未区分G711a和G711u
_codec_to_trackid[track->getCodecId()].track_id = mpeg_ts_add_stream(_context, PSI_STREAM_AUDIO_G711, nullptr, 0);
}
_codec_to_trackid[track->getCodecId()].track_id = mpeg_ts_add_stream(_context, PSI_STREAM_AUDIO_G711U, nullptr, 0);
break;
}
default:
break;
......
......@@ -9,7 +9,7 @@
*/
#if defined(ENABLE_RTPPROXY)
#include "mpeg-ps.h"
#include "mpeg-ts-proto.h"
#include "RtpProcess.h"
#include "Util/File.h"
#include "Extension/H265.h"
......@@ -204,19 +204,29 @@ void RtpProcess::onRtpDecode(const uint8_t *packet, int bytes, uint32_t timestam
#define SWITCH_CASE(codec_id) case codec_id : return #codec_id
static const char *getCodecName(int codec_id) {
switch (codec_id) {
SWITCH_CASE(STREAM_VIDEO_MPEG4);
SWITCH_CASE(STREAM_VIDEO_H264);
SWITCH_CASE(STREAM_VIDEO_H265);
SWITCH_CASE(STREAM_VIDEO_SVAC);
SWITCH_CASE(STREAM_AUDIO_MP3);
SWITCH_CASE(STREAM_AUDIO_AAC);
SWITCH_CASE(STREAM_AUDIO_G711);
SWITCH_CASE(STREAM_AUDIO_G722);
SWITCH_CASE(STREAM_AUDIO_G723);
SWITCH_CASE(STREAM_AUDIO_G729);
SWITCH_CASE(STREAM_AUDIO_SVAC);
default:
return "unknown codec";
SWITCH_CASE(PSI_STREAM_MPEG1);
SWITCH_CASE(PSI_STREAM_MPEG2);
SWITCH_CASE(PSI_STREAM_AUDIO_MPEG1);
SWITCH_CASE(PSI_STREAM_MP3);
SWITCH_CASE(PSI_STREAM_AAC);
SWITCH_CASE(PSI_STREAM_MPEG4);
SWITCH_CASE(PSI_STREAM_MPEG4_AAC_LATM);
SWITCH_CASE(PSI_STREAM_H264);
SWITCH_CASE(PSI_STREAM_MPEG4_AAC);
SWITCH_CASE(PSI_STREAM_H265);
SWITCH_CASE(PSI_STREAM_AUDIO_AC3);
SWITCH_CASE(PSI_STREAM_AUDIO_EAC3);
SWITCH_CASE(PSI_STREAM_AUDIO_DTS);
SWITCH_CASE(PSI_STREAM_VIDEO_DIRAC);
SWITCH_CASE(PSI_STREAM_VIDEO_VC1);
SWITCH_CASE(PSI_STREAM_VIDEO_SVAC);
SWITCH_CASE(PSI_STREAM_AUDIO_SVAC);
SWITCH_CASE(PSI_STREAM_AUDIO_G711A);
SWITCH_CASE(PSI_STREAM_AUDIO_G711U);
SWITCH_CASE(PSI_STREAM_AUDIO_G722);
SWITCH_CASE(PSI_STREAM_AUDIO_G723);
SWITCH_CASE(PSI_STREAM_AUDIO_G729);
default : return "unknown codec";
}
}
......@@ -226,7 +236,7 @@ void RtpProcess::onDecode(int stream,int codecid,int flags,int64_t pts,int64_t d
_stamps[codecid].revise(dts,pts,dts,pts,false);
switch (codecid) {
case STREAM_VIDEO_H264: {
case PSI_STREAM_H264: {
_dts = dts;
if (!_codecid_video) {
//获取到视频
......@@ -251,7 +261,7 @@ void RtpProcess::onDecode(int stream,int codecid,int flags,int64_t pts,int64_t d
break;
}
case STREAM_VIDEO_H265: {
case PSI_STREAM_H265: {
_dts = dts;
if (!_codecid_video) {
//获取到视频
......@@ -274,7 +284,7 @@ void RtpProcess::onDecode(int stream,int codecid,int flags,int64_t pts,int64_t d
break;
}
case STREAM_AUDIO_AAC: {
case PSI_STREAM_AAC: {
_dts = dts;
if (!_codecid_audio) {
//获取到音频
......@@ -292,10 +302,10 @@ void RtpProcess::onDecode(int stream,int codecid,int flags,int64_t pts,int64_t d
break;
}
case STREAM_AUDIO_G711: {
case PSI_STREAM_AUDIO_G711A:
case PSI_STREAM_AUDIO_G711U: {
_dts = dts;
//todo 等待陈大佬更新ts/ps解析库,现在暂时固定为G711A
auto codec = CodecG711A;
auto codec = codecid == PSI_STREAM_AUDIO_G711A ? CodecG711A : CodecG711U;
if (!_codecid_audio) {
//获取到音频
_codecid_audio = codecid;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论