This commit is contained in:
xiongziliang
2020-04-18 18:46:20 +08:00
parent 1f43359b31
commit 5c3418a412
21 changed files with 277 additions and 364 deletions

View File

@@ -17,13 +17,13 @@
namespace mediakit{
/**
* G711 Rtmp转adts
* G711 Rtmp转G711 Frame
*/
class G711RtmpDecoder : public RtmpCodec , public ResourcePoolHelper<G711Frame> {
public:
typedef std::shared_ptr<G711RtmpDecoder> Ptr;
G711RtmpDecoder();
G711RtmpDecoder(CodecId codecId);
~G711RtmpDecoder() {}
/**
@@ -37,48 +37,32 @@ public:
return TrackAudio;
}
void setCodecId(CodecId codecId)
{
_codecid = codecId;
}
CodecId getCodecId() const override{
return _codecid;
return _codecId;
}
protected:
void onGetG711(const char* pcData, int iLen, uint32_t ui32TimeStamp);
private:
G711Frame::Ptr obtainFrame();
protected:
G711Frame::Ptr _adts;
CodecId _codecid = CodecInvalid;
private:
G711Frame::Ptr _frame;
CodecId _codecId;
};
/**
* aac adts转Rtmp
* G711 RTMP打包
*/
class G711RtmpEncoder : public G711RtmpDecoder , public ResourcePoolHelper<RtmpPacket> {
public:
typedef std::shared_ptr<G711RtmpEncoder> Ptr;
/**
* 构造函数track可以为空此时则在inputFrame时输入adts头
* 如果track不为空且包含adts头相关信息
* 那么inputFrame时可以不输入adts头
* @param track
*/
G711RtmpEncoder(const Track::Ptr &track);
~G711RtmpEncoder() {}
/**
* 输入aac 数据可以不带adts头
* @param frame aac数据
* 输入G711 数据
*/
void inputFrame(const Frame::Ptr &frame) override;
private:
G711Track::Ptr _track;
uint8_t _g711_flags = 0;
};
}//namespace mediakit