From 4af9927e8cda7dfdf773af260905350130a5aac2 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Tue, 23 Oct 2018 11:47:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E5=AF=B9=E8=B1=A1=E5=91=BD?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Player/PlayerBase.h | 2 +- src/Player/Track.h | 20 ++++++++++---------- src/Rtsp/RtspEncoder.h | 22 +++++++++------------- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/Player/PlayerBase.h b/src/Player/PlayerBase.h index 0b91da62..5d537072 100644 --- a/src/Player/PlayerBase.h +++ b/src/Player/PlayerBase.h @@ -109,7 +109,7 @@ public: virtual bool containVideo() const { return false; }; virtual int getTrackCount() const { return 0;}; - virtual TrackFormat::Ptr getTrack(int index) const {return nullptr;}; + virtual Track::Ptr getTrack(int index) const {return nullptr;}; protected: virtual void onShutdown(const SockException &ex) {}; virtual void onPlayResult(const SockException &ex) {}; diff --git a/src/Player/Track.h b/src/Player/Track.h index b9421f53..21718f45 100644 --- a/src/Player/Track.h +++ b/src/Player/Track.h @@ -14,14 +14,14 @@ using namespace std; using namespace ZL::Util; -class TrackFormat : public FrameRingInterface , public CodecInfo{ +class Track : public FrameRingInterface , public CodecInfo{ public: - typedef std::shared_ptr Ptr; - TrackFormat(){} - virtual ~TrackFormat(){} + typedef std::shared_ptr Ptr; + Track(){} + virtual ~Track(){} }; -class VideoTrackFormat : public TrackFormat { +class VideoTrack : public Track { public: TrackType getTrackType() const override { return TrackVideo;}; virtual int getVideoHeight() const = 0; @@ -29,7 +29,7 @@ public: virtual float getVideoFps() const = 0; }; -class AudioTrackFormat : public TrackFormat { +class AudioTrack : public Track { public: TrackType getTrackType() const override { return TrackAudio;}; virtual int getAudioSampleRate() const = 0; @@ -37,9 +37,9 @@ public: virtual int getAudioChannel() const = 0; }; -class H264TrackFormat : public VideoTrackFormat{ +class H264Track : public VideoTrack{ public: - H264TrackFormat(const string &sps,const string &pps){ + H264Track(const string &sps,const string &pps){ _sps = sps; _pps = pps; } @@ -57,9 +57,9 @@ private: string _pps; }; -class AACTrackFormat : public AudioTrackFormat{ +class AACTrack : public AudioTrack{ public: - AACTrackFormat(const string &aac_cfg){ + AACTrack(const string &aac_cfg){ _cfg = aac_cfg; } const string &getAacCfg() const{ diff --git a/src/Rtsp/RtspEncoder.h b/src/Rtsp/RtspEncoder.h index 64f697b9..aff44e75 100644 --- a/src/Rtsp/RtspEncoder.h +++ b/src/Rtsp/RtspEncoder.h @@ -15,7 +15,7 @@ namespace Rtsp{ /** * sdp基类 */ -class Sdp : public TrackFormat , public RtpRingInterface{ +class Sdp : public Track , public RtpRingInterface{ public: typedef std::shared_ptr Ptr; Sdp(uint32_t sample_rate, uint8_t playload_type){ @@ -54,14 +54,10 @@ public: } void setFrameRing(const FrameRingInterface::RingType::Ptr &ring) override{ - if(_encoder){ - _encoder->setFrameRing(ring); - } + _encoder->setFrameRing(ring); } void setRtpRing(const RtpRingInterface::RingType::Ptr &ring) override{ - if(_encoder){ - _encoder->setRtpRing(ring); - } + _encoder->setRtpRing(ring); } virtual void createRtpEncoder(uint32_t ssrc, int mtu) { @@ -81,7 +77,7 @@ private: /** * sdp中除音视频外的其他描述部分 */ -class SdpTitle : public Sdp{ +class TitleSdp : public Sdp{ public: /** @@ -90,7 +86,7 @@ public: * @param header 自定义sdp描述 * @param version sdp版本 */ - SdpTitle(float dur_sec = 0, + TitleSdp(float dur_sec = 0, const map &header = map(), int version = 0) : Sdp(0,0){ _printer << "v=" << version << "\r\n"; @@ -124,7 +120,7 @@ private: /** * h264类型sdp */ -class SdpH264 : public Sdp { +class H264Sdp : public Sdp { public: /** @@ -136,7 +132,7 @@ public: * @param track_id trackID 默认为TrackVideo * @param bitrate 比特率 */ - SdpH264(const string &sps, + H264Sdp(const string &sps, const string &pps, int sample_rate = 90000, int playload_type = 96, @@ -186,7 +182,7 @@ private: /** * aac类型SDP */ -class SdpAAC : public Sdp { +class AACSdp : public Sdp { public: /** @@ -197,7 +193,7 @@ public: * @param track_id trackID 默认为TrackVideo * @param bitrate 比特率 */ - SdpAAC(const string &aac_cfg, + AACSdp(const string &aac_cfg, int sample_rate, int playload_type = 98, int bitrate = 128) : Sdp(sample_rate,playload_type){