mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-06 11:38:11 +08:00
删除冗余设计
This commit is contained in:
@@ -34,25 +34,29 @@ using namespace toolkit;
|
||||
|
||||
namespace mediakit{
|
||||
|
||||
class RtmpRingInterface {
|
||||
class RtmpRing{
|
||||
public:
|
||||
typedef std::shared_ptr<RtmpRing> Ptr;
|
||||
typedef RingBuffer<RtmpPacket::Ptr> RingType;
|
||||
typedef std::shared_ptr<RtmpRingInterface> Ptr;
|
||||
|
||||
RtmpRingInterface(){}
|
||||
virtual ~RtmpRingInterface(){}
|
||||
RtmpRing(){}
|
||||
virtual ~RtmpRing(){}
|
||||
|
||||
/**
|
||||
* 获取rtmp环形缓存
|
||||
* @return
|
||||
*/
|
||||
virtual RingType::Ptr getRtmpRing() const = 0;
|
||||
virtual RingType::Ptr getRtmpRing() const{
|
||||
return _rtmpRing;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置rtmp环形缓存
|
||||
* @param ring
|
||||
*/
|
||||
virtual void setRtmpRing(const RingType::Ptr &ring) = 0;
|
||||
virtual void setRtmpRing(const RingType::Ptr &ring){
|
||||
_rtmpRing = ring;
|
||||
}
|
||||
|
||||
/**
|
||||
* 输入rtmp包
|
||||
@@ -60,26 +64,7 @@ public:
|
||||
* @param key_pos 是否为关键帧
|
||||
* @return 是否为关键帧
|
||||
*/
|
||||
virtual bool inputRtmp(const RtmpPacket::Ptr &rtmp, bool key_pos) = 0;
|
||||
};
|
||||
|
||||
class RtmpRing : public RtmpRingInterface {
|
||||
public:
|
||||
typedef std::shared_ptr<RtmpRing> Ptr;
|
||||
|
||||
RtmpRing(){
|
||||
}
|
||||
virtual ~RtmpRing(){}
|
||||
|
||||
RingType::Ptr getRtmpRing() const override {
|
||||
return _rtmpRing;
|
||||
}
|
||||
|
||||
void setRtmpRing(const RingType::Ptr &ring) override {
|
||||
_rtmpRing = ring;
|
||||
}
|
||||
|
||||
bool inputRtmp(const RtmpPacket::Ptr &rtmp, bool key_pos) override{
|
||||
virtual bool inputRtmp(const RtmpPacket::Ptr &rtmp, bool key_pos){
|
||||
if(_rtmpRing){
|
||||
_rtmpRing->write(rtmp,key_pos);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ RtmpMuxer::RtmpMuxer(const TitleMeta::Ptr &title) {
|
||||
}else{
|
||||
_metadata = title->getMetadata();
|
||||
}
|
||||
_rtmpRing = std::make_shared<RtmpRingInterface::RingType>();
|
||||
_rtmpRing = std::make_shared<RtmpRing::RingType>();
|
||||
}
|
||||
|
||||
void RtmpMuxer::addTrack(const Track::Ptr &track) {
|
||||
@@ -82,7 +82,7 @@ const AMFValue &RtmpMuxer::getMetadata() const {
|
||||
return _metadata;
|
||||
}
|
||||
|
||||
RtmpRingInterface::RingType::Ptr RtmpMuxer::getRtmpRing() const {
|
||||
RtmpRing::RingType::Ptr RtmpMuxer::getRtmpRing() const {
|
||||
return _rtmpRing;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
* 获取rtmp环形缓存
|
||||
* @return
|
||||
*/
|
||||
RtmpRingInterface::RingType::Ptr getRtmpRing() const;
|
||||
RtmpRing::RingType::Ptr getRtmpRing() const;
|
||||
|
||||
/**
|
||||
* 添加ready状态的track
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
*/
|
||||
void resetTracks() override ;
|
||||
private:
|
||||
RtmpRingInterface::RingType::Ptr _rtmpRing;
|
||||
RtmpRing::RingType::Ptr _rtmpRing;
|
||||
AMFValue _metadata;
|
||||
RtmpCodec::Ptr _encoder[TrackMax];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user