2018-10-21 21:21:14 +08:00
|
|
|
//
|
|
|
|
// Created by xzl on 2018/10/21.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef ZLMEDIAKIT_TRACK_H
|
|
|
|
#define ZLMEDIAKIT_TRACK_H
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include "Frame.h"
|
|
|
|
#include "Util/RingBuffer.h"
|
|
|
|
#include "Rtsp/Rtsp.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace ZL::Util;
|
|
|
|
|
2018-10-23 11:47:27 +08:00
|
|
|
class Track : public FrameRingInterface , public CodecInfo{
|
2018-10-21 21:21:14 +08:00
|
|
|
public:
|
2018-10-23 11:47:27 +08:00
|
|
|
typedef std::shared_ptr<Track> Ptr;
|
|
|
|
Track(){}
|
|
|
|
virtual ~Track(){}
|
2018-10-21 21:21:14 +08:00
|
|
|
};
|
|
|
|
|
2018-10-23 11:47:27 +08:00
|
|
|
class VideoTrack : public Track {
|
2018-10-21 21:21:14 +08:00
|
|
|
public:
|
|
|
|
TrackType getTrackType() const override { return TrackVideo;};
|
|
|
|
virtual int getVideoHeight() const = 0;
|
|
|
|
virtual int getVideoWidth() const = 0;
|
|
|
|
virtual float getVideoFps() const = 0;
|
|
|
|
};
|
|
|
|
|
2018-10-23 11:47:27 +08:00
|
|
|
class AudioTrack : public Track {
|
2018-10-21 21:21:14 +08:00
|
|
|
public:
|
|
|
|
TrackType getTrackType() const override { return TrackAudio;};
|
|
|
|
virtual int getAudioSampleRate() const = 0;
|
|
|
|
virtual int getAudioSampleBit() const = 0;
|
|
|
|
virtual int getAudioChannel() const = 0;
|
|
|
|
};
|
|
|
|
|
2018-10-23 11:47:27 +08:00
|
|
|
class H264Track : public VideoTrack{
|
2018-10-21 21:21:14 +08:00
|
|
|
public:
|
2018-10-23 11:47:27 +08:00
|
|
|
H264Track(const string &sps,const string &pps){
|
2018-10-21 21:21:14 +08:00
|
|
|
_sps = sps;
|
|
|
|
_pps = pps;
|
|
|
|
}
|
|
|
|
const string &getSps() const{
|
|
|
|
return _sps;
|
|
|
|
}
|
|
|
|
const string &getPps() const{
|
|
|
|
return _pps;
|
|
|
|
}
|
2018-10-23 11:09:21 +08:00
|
|
|
CodecId getCodecId() const override{
|
|
|
|
return CodecH264;
|
2018-10-21 21:21:14 +08:00
|
|
|
}
|
|
|
|
private:
|
|
|
|
string _sps;
|
|
|
|
string _pps;
|
|
|
|
};
|
|
|
|
|
2018-10-23 11:47:27 +08:00
|
|
|
class AACTrack : public AudioTrack{
|
2018-10-21 21:21:14 +08:00
|
|
|
public:
|
2018-10-23 11:47:27 +08:00
|
|
|
AACTrack(const string &aac_cfg){
|
2018-10-21 21:21:14 +08:00
|
|
|
_cfg = aac_cfg;
|
|
|
|
}
|
|
|
|
const string &getAacCfg() const{
|
|
|
|
return _cfg;
|
|
|
|
}
|
2018-10-23 11:09:21 +08:00
|
|
|
CodecId getCodecId() const override{
|
|
|
|
return CodecAAC;
|
2018-10-21 21:21:14 +08:00
|
|
|
}
|
|
|
|
private:
|
|
|
|
string _cfg;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //ZLMEDIAKIT_TRACK_H
|