规范对象命名

This commit is contained in:
xiongziliang 2018-10-23 11:47:27 +08:00
parent 2307404847
commit 4af9927e8c
3 changed files with 20 additions and 24 deletions

View File

@ -109,7 +109,7 @@ public:
virtual bool containVideo() const { return false; }; virtual bool containVideo() const { return false; };
virtual int getTrackCount() const { return 0;}; 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: 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) {};

View File

@ -14,14 +14,14 @@
using namespace std; using namespace std;
using namespace ZL::Util; using namespace ZL::Util;
class TrackFormat : public FrameRingInterface , public CodecInfo{ class Track : public FrameRingInterface , public CodecInfo{
public: public:
typedef std::shared_ptr<TrackFormat> Ptr; typedef std::shared_ptr<Track> Ptr;
TrackFormat(){} Track(){}
virtual ~TrackFormat(){} virtual ~Track(){}
}; };
class VideoTrackFormat : public TrackFormat { class VideoTrack : public Track {
public: public:
TrackType getTrackType() const override { return TrackVideo;}; TrackType getTrackType() const override { return TrackVideo;};
virtual int getVideoHeight() const = 0; virtual int getVideoHeight() const = 0;
@ -29,7 +29,7 @@ public:
virtual float getVideoFps() const = 0; virtual float getVideoFps() const = 0;
}; };
class AudioTrackFormat : public TrackFormat { class AudioTrack : public Track {
public: public:
TrackType getTrackType() const override { return TrackAudio;}; TrackType getTrackType() const override { return TrackAudio;};
virtual int getAudioSampleRate() const = 0; virtual int getAudioSampleRate() const = 0;
@ -37,9 +37,9 @@ public:
virtual int getAudioChannel() const = 0; virtual int getAudioChannel() const = 0;
}; };
class H264TrackFormat : public VideoTrackFormat{ class H264Track : public VideoTrack{
public: public:
H264TrackFormat(const string &sps,const string &pps){ H264Track(const string &sps,const string &pps){
_sps = sps; _sps = sps;
_pps = pps; _pps = pps;
} }
@ -57,9 +57,9 @@ private:
string _pps; string _pps;
}; };
class AACTrackFormat : public AudioTrackFormat{ class AACTrack : public AudioTrack{
public: public:
AACTrackFormat(const string &aac_cfg){ AACTrack(const string &aac_cfg){
_cfg = aac_cfg; _cfg = aac_cfg;
} }
const string &getAacCfg() const{ const string &getAacCfg() const{

View File

@ -15,7 +15,7 @@ namespace Rtsp{
/** /**
* sdp基类 * sdp基类
*/ */
class Sdp : public TrackFormat , public RtpRingInterface{ class Sdp : public Track , public RtpRingInterface{
public: public:
typedef std::shared_ptr<Sdp> Ptr; typedef std::shared_ptr<Sdp> Ptr;
Sdp(uint32_t sample_rate, uint8_t playload_type){ Sdp(uint32_t sample_rate, uint8_t playload_type){
@ -54,15 +54,11 @@ public:
} }
void setFrameRing(const FrameRingInterface::RingType::Ptr &ring) override{ void setFrameRing(const FrameRingInterface::RingType::Ptr &ring) override{
if(_encoder){
_encoder->setFrameRing(ring); _encoder->setFrameRing(ring);
} }
}
void setRtpRing(const RtpRingInterface::RingType::Ptr &ring) override{ void setRtpRing(const RtpRingInterface::RingType::Ptr &ring) override{
if(_encoder){
_encoder->setRtpRing(ring); _encoder->setRtpRing(ring);
} }
}
virtual void createRtpEncoder(uint32_t ssrc, int mtu) { virtual void createRtpEncoder(uint32_t ssrc, int mtu) {
_encoder = RtpCodec::getRtpCodec (getCodecId(), _encoder = RtpCodec::getRtpCodec (getCodecId(),
@ -81,7 +77,7 @@ private:
/** /**
* sdp中除音视频外的其他描述部分 * sdp中除音视频外的其他描述部分
*/ */
class SdpTitle : public Sdp{ class TitleSdp : public Sdp{
public: public:
/** /**
@ -90,7 +86,7 @@ public:
* @param header sdp描述 * @param header sdp描述
* @param version sdp版本 * @param version sdp版本
*/ */
SdpTitle(float dur_sec = 0, TitleSdp(float dur_sec = 0,
const map<string,string> &header = map<string,string>(), const map<string,string> &header = map<string,string>(),
int version = 0) : Sdp(0,0){ int version = 0) : Sdp(0,0){
_printer << "v=" << version << "\r\n"; _printer << "v=" << version << "\r\n";
@ -124,7 +120,7 @@ private:
/** /**
* h264类型sdp * h264类型sdp
*/ */
class SdpH264 : public Sdp { class H264Sdp : public Sdp {
public: public:
/** /**
@ -136,7 +132,7 @@ public:
* @param track_id trackID TrackVideo * @param track_id trackID TrackVideo
* @param bitrate * @param bitrate
*/ */
SdpH264(const string &sps, H264Sdp(const string &sps,
const string &pps, const string &pps,
int sample_rate = 90000, int sample_rate = 90000,
int playload_type = 96, int playload_type = 96,
@ -186,7 +182,7 @@ private:
/** /**
* aac类型SDP * aac类型SDP
*/ */
class SdpAAC : public Sdp { class AACSdp : public Sdp {
public: public:
/** /**
@ -197,7 +193,7 @@ public:
* @param track_id trackID TrackVideo * @param track_id trackID TrackVideo
* @param bitrate * @param bitrate
*/ */
SdpAAC(const string &aac_cfg, AACSdp(const string &aac_cfg,
int sample_rate, int sample_rate,
int playload_type = 98, int playload_type = 98,
int bitrate = 128) : Sdp(sample_rate,playload_type){ int bitrate = 128) : Sdp(sample_rate,playload_type){