MediaSource类添加getTracks接口

This commit is contained in:
xiongziliang 2019-08-22 17:48:10 +08:00
parent a451da058c
commit 1cff946848
4 changed files with 30 additions and 0 deletions

Binary file not shown.

View File

@ -186,6 +186,14 @@ public:
}
virtual int readerCount() = 0;
/**
* track
* @return
*/
virtual vector<Track::Ptr> getTracks(bool trackReady) const{
return vector<Track::Ptr>(0);
}
protected:
void regist() ;
bool unregist() ;

View File

@ -96,6 +96,17 @@ public:
int readerCount() override {
return RtmpMediaSource::readerCount() + (_muxer ? _muxer->readerCount() : 0);
}
/**
* track
* @return
*/
vector<Track::Ptr> getTracks(bool trackReady) const override {
if(!_demuxer){
return this->RtmpMediaSource::getTracks(trackReady);
}
return _demuxer->getTracks(trackReady);
}
private:
RtmpDemuxer::Ptr _demuxer;
MultiMediaSourceMuxer::Ptr _muxer;

View File

@ -88,6 +88,17 @@ public:
int readerCount() override {
return RtspMediaSource::readerCount() + (_muxer ? _muxer->readerCount() : 0);
}
/**
* track
* @return
*/
vector<Track::Ptr> getTracks(bool trackReady) const override {
if(!_demuxer){
return this->RtspMediaSource::getTracks(trackReady);
}
return _demuxer->getTracks(trackReady);
}
private:
RtspDemuxer::Ptr _demuxer;
MultiMediaSourceMuxer::Ptr _muxer;