完成Rtmp解复用器

This commit is contained in:
xiongziliang
2018-10-24 22:03:17 +08:00
parent de50bf03a9
commit 3921bfb2d9
7 changed files with 232 additions and 281 deletions

View File

@@ -3,6 +3,10 @@
//
#include "Factory.h"
#include "RtmpMuxer/H264RtmpCodec.h"
#include "RtmpMuxer/AACRtmpCodec.h"
#include "RtspMuxer/H264RtpCodec.h"
#include "RtspMuxer/AACRtpCodec.h"
namespace mediakit{
@@ -75,7 +79,7 @@ Track::Ptr Factory::getTrackBySdp(const string &sdp) {
}
CodecId getCodecIdByAmf(const AMFValue &val){
CodecId Factory::getCodecIdByAmf(const AMFValue &val){
if (val.type() == AMF_STRING){
auto str = val.as_string();
if(str == "avc1"){
@@ -153,6 +157,17 @@ RtpCodec::Ptr Factory::getRtpDecoderById(CodecId codecId, uint32_t ui32SampleRat
}
}
RtmpCodec::Ptr Factory::getRtmpCodecById(CodecId codecId) {
switch (codecId){
case CodecH264:
return std::make_shared<H264RtmpEncoder>();
case CodecAAC:
return std::make_shared<AACRtmpEncoder>();
default:
return nullptr;
}
}
}//namespace mediakit