mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-23 03:10:04 +08:00
完善接口
This commit is contained in:
parent
8d032a40ec
commit
84dbe5597d
@ -42,7 +42,17 @@ using namespace toolkit;
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
class PlayerBase : public mINI{
|
||||
class DemuxerBase {
|
||||
public:
|
||||
typedef std::shared_ptr<DemuxerBase> Ptr;
|
||||
|
||||
virtual float getDuration() const { return 0;}
|
||||
virtual bool isInited() const { return true; }
|
||||
virtual vector<Track::Ptr> getTracks() const { return vector<Track::Ptr>();}
|
||||
};
|
||||
|
||||
|
||||
class PlayerBase : public DemuxerBase, public mINI{
|
||||
public:
|
||||
typedef std::shared_ptr<PlayerBase> Ptr;
|
||||
typedef enum {
|
||||
@ -76,13 +86,8 @@ public:
|
||||
virtual float getProgress() const { return 0;}
|
||||
virtual void seekTo(float fProgress) {}
|
||||
virtual void setMediaSouce(const MediaSource::Ptr & src) {}
|
||||
|
||||
virtual bool isInited() const { return true; }
|
||||
//TrackVideo = 0, TrackAudio = 1
|
||||
virtual float getRtpLossRate(int trackType) const {return 0; }
|
||||
virtual float getDuration() const { return 0;}
|
||||
|
||||
virtual vector<Track::Ptr> getTracks() const { return vector<Track::Ptr>();}
|
||||
protected:
|
||||
virtual void onShutdown(const SockException &ex) {}
|
||||
virtual void onPlayResult(const SockException &ex) {}
|
||||
|
@ -101,6 +101,11 @@ void RtmpMuxer::inputFrame(const Frame::Ptr &frame) {
|
||||
_trackReadyCallback.erase(it_callback);
|
||||
}
|
||||
}
|
||||
|
||||
if(!_inited && _trackReadyCallback.empty()){
|
||||
_inited = true;
|
||||
onInited();
|
||||
}
|
||||
}
|
||||
|
||||
bool RtmpMuxer::inputRtmp(const RtmpPacket::Ptr &rtmp , bool key_pos) {
|
||||
|
@ -72,11 +72,15 @@ public:
|
||||
* @return
|
||||
*/
|
||||
RtmpRingInterface::RingType::Ptr getRtmpRing() const;
|
||||
|
||||
protected:
|
||||
virtual void onInited(){};
|
||||
private:
|
||||
map<int,Track::Ptr> _track_map;
|
||||
map<int,function<void()> > _trackReadyCallback;
|
||||
RtmpRingInterface::RingType::Ptr _rtmpRing;
|
||||
AMFValue _metedata;
|
||||
bool _inited = false;
|
||||
};
|
||||
|
||||
|
||||
|
@ -89,6 +89,11 @@ void RtspMuxer::inputFrame(const Frame::Ptr &frame) {
|
||||
_trackReadyCallback.erase(it_callback);
|
||||
}
|
||||
}
|
||||
|
||||
if(!_inited && _trackReadyCallback.empty()){
|
||||
_inited = true;
|
||||
onInited();
|
||||
}
|
||||
}
|
||||
|
||||
bool RtspMuxer::inputRtp(const RtpPacket::Ptr &rtp, bool key_pos) {
|
||||
|
@ -76,11 +76,15 @@ public:
|
||||
* @return
|
||||
*/
|
||||
RtpRingInterface::RingType::Ptr getRtpRing() const;
|
||||
|
||||
protected:
|
||||
virtual void onInited(){};
|
||||
private:
|
||||
map<int,Track::Ptr> _track_map;
|
||||
map<int,function<void()> > _trackReadyCallback;
|
||||
RtpRingInterface::RingType::Ptr _rtpRing;
|
||||
string _sdp;
|
||||
bool _inited = false;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user