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