Commit e816c56f by xiongziliang

完善播放器接口

parent bdc1f0cd
......@@ -49,6 +49,15 @@ public:
virtual float getDuration() const { return 0;}
virtual bool isInited() const { return true; }
virtual vector<Track::Ptr> getTracks() const { return vector<Track::Ptr>();}
virtual Track::Ptr getTrack(TrackType type) const {
auto tracks = getTracks();
for(auto &track : tracks){
if(track->getTrackType() == type){
return track;
}
}
return nullptr;
}
};
......@@ -85,9 +94,9 @@ public:
virtual float getProgress() const { return 0;}
virtual void seekTo(float fProgress) {}
virtual void setMediaSouce(const MediaSource::Ptr & src) {}
//TrackVideo = 0, TrackAudio = 1
virtual float getRtpLossRate(int trackType) const {return 0; }
virtual float getRtpLossRate(TrackType trackType) const {return 0; }
protected:
virtual void onShutdown(const SockException &ex) {}
virtual void onPlayResult(const SockException &ex) {}
......
......@@ -684,8 +684,8 @@ void RtspPlayer::onRecvRTP_l(const RtpPacket::Ptr &rtppt, int trackidx){
onRecvRTP_l(rtppt,_aTrackInfo[trackidx]);
}
float RtspPlayer::getRtpLossRate(int iTrackType) const{
int iTrackIdx = getTrackIndexByTrackType((TrackType)iTrackType);
float RtspPlayer::getRtpLossRate(TrackType type) const{
int iTrackIdx = getTrackIndexByTrackType(type);
if(iTrackIdx == -1){
uint64_t totalRecv = 0;
uint64_t totalSend = 0;
......
......@@ -55,7 +55,7 @@ public:
void play(const char* strUrl) override;
void pause(bool bPause) override;
void teardown() override;
float getRtpLossRate(int iTrackType) const override;
float getRtpLossRate(TrackType type) const override;
protected:
//派生类回调函数
virtual bool onCheckSDP(const string &strSdp, const SdpAttr &sdpAttr) = 0;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论