mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-24 09:52:21 +08:00
AI automatically translates all comments in the code into English (#3917)
This commit is contained in:
@@ -20,6 +20,9 @@ namespace mediakit{
|
||||
|
||||
/**
|
||||
* 媒体通道描述类,也支持帧输入输出
|
||||
* Media channel description class, also supports frame input and output
|
||||
|
||||
* [AUTO-TRANSLATED:a3acd089]
|
||||
*/
|
||||
class Track : public FrameDispatcher, public CodecInfo {
|
||||
public:
|
||||
@@ -27,12 +30,19 @@ public:
|
||||
|
||||
/**
|
||||
* 默认构造
|
||||
* Default constructor
|
||||
|
||||
* [AUTO-TRANSLATED:acda54ab]
|
||||
*/
|
||||
Track() = default;
|
||||
|
||||
/**
|
||||
* 复制拷贝,只能拷贝派生类的信息,
|
||||
* 环形缓存和代理关系不能拷贝,否则会关系紊乱
|
||||
* Copy, only copy information of derived classes,
|
||||
* Circular buffer and proxy relationships cannot be copied, otherwise the relationship will be disordered
|
||||
|
||||
* [AUTO-TRANSLATED:308e6502]
|
||||
*/
|
||||
Track(const Track &that) {
|
||||
_bit_rate = that._bit_rate;
|
||||
@@ -41,6 +51,9 @@ public:
|
||||
|
||||
/**
|
||||
* 是否准备好,准备好才能获取譬如sps pps等信息
|
||||
* Whether it is ready, it can be used to get information such as sps pps
|
||||
|
||||
* [AUTO-TRANSLATED:6d819ef7]
|
||||
*/
|
||||
virtual bool ready() const = 0;
|
||||
|
||||
@@ -48,39 +61,65 @@ public:
|
||||
* 克隆接口,用于复制本对象用
|
||||
* 在调用该接口时只会复制派生类的信息
|
||||
* 环形缓存和代理关系不能拷贝,否则会关系紊乱
|
||||
* Clone interface, used to copy this object
|
||||
* When calling this interface, only the information of the derived class will be copied
|
||||
* Circular buffer and proxy relationships cannot be copied, otherwise the relationship will be disordered
|
||||
|
||||
* [AUTO-TRANSLATED:270874c6]
|
||||
*/
|
||||
virtual Track::Ptr clone() const = 0;
|
||||
|
||||
/**
|
||||
* 更新track信息,比如触发sps/pps解析
|
||||
* Update track information, such as triggering sps/pps parsing
|
||||
|
||||
* [AUTO-TRANSLATED:324879ef]
|
||||
*/
|
||||
virtual bool update() { return false; }
|
||||
|
||||
/**
|
||||
* 生成sdp
|
||||
* @return sdp对象
|
||||
* Generate sdp
|
||||
* @return sdp object
|
||||
|
||||
* [AUTO-TRANSLATED:3ab2fd30]
|
||||
*/
|
||||
virtual Sdp::Ptr getSdp(uint8_t payload_type) const = 0;
|
||||
|
||||
/**
|
||||
* 获取extra data, 一般用于rtmp/mp4生成
|
||||
* Get extra data, generally used for rtmp/mp4 generation
|
||||
|
||||
* [AUTO-TRANSLATED:d8ff2cd5]
|
||||
*/
|
||||
virtual toolkit::Buffer::Ptr getExtraData() const { return nullptr; }
|
||||
|
||||
/**
|
||||
* 设置extra data,
|
||||
* Set extra data,
|
||||
|
||||
* [AUTO-TRANSLATED:9e551857]
|
||||
*/
|
||||
virtual void setExtraData(const uint8_t *data, size_t size) {}
|
||||
|
||||
/**
|
||||
* 返回比特率
|
||||
* @return 比特率
|
||||
* Return bitrate
|
||||
* @return Bitrate
|
||||
|
||||
* [AUTO-TRANSLATED:265dda35]
|
||||
*/
|
||||
virtual int getBitRate() const { return _bit_rate; }
|
||||
|
||||
/**
|
||||
* 设置比特率
|
||||
* @param bit_rate 比特率
|
||||
* Set bitrate
|
||||
* @param bit_rate Bitrate
|
||||
|
||||
* [AUTO-TRANSLATED:77a43064]
|
||||
*/
|
||||
virtual void setBitRate(int bit_rate) { _bit_rate = bit_rate; }
|
||||
|
||||
@@ -90,6 +129,9 @@ private:
|
||||
|
||||
/**
|
||||
* 视频通道描述Track类,支持获取宽高fps信息
|
||||
* Video channel description Track class, supports getting width, height and fps information
|
||||
|
||||
* [AUTO-TRANSLATED:8d1893c5]
|
||||
*/
|
||||
class VideoTrack : public Track {
|
||||
public:
|
||||
@@ -97,21 +139,33 @@ public:
|
||||
|
||||
/**
|
||||
* 返回视频高度
|
||||
* Return video height
|
||||
|
||||
* [AUTO-TRANSLATED:b24aabc0]
|
||||
*/
|
||||
virtual int getVideoHeight() const { return 0; }
|
||||
|
||||
/**
|
||||
* 返回视频宽度
|
||||
* Return video width
|
||||
|
||||
* [AUTO-TRANSLATED:2f3bb6e3]
|
||||
*/
|
||||
virtual int getVideoWidth() const { return 0; }
|
||||
|
||||
/**
|
||||
* 返回视频fps
|
||||
* Return video fps
|
||||
|
||||
* [AUTO-TRANSLATED:ced99aef]
|
||||
*/
|
||||
virtual float getVideoFps() const { return 0; }
|
||||
|
||||
/**
|
||||
* 返回相关 sps/pps 等
|
||||
* Return related sps/pps, etc.
|
||||
|
||||
* [AUTO-TRANSLATED:30fc4f63]
|
||||
*/
|
||||
virtual std::vector<Frame::Ptr> getConfigFrames() const { return std::vector<Frame::Ptr>{}; }
|
||||
};
|
||||
@@ -126,6 +180,13 @@ public:
|
||||
* @param width 宽
|
||||
* @param height 高
|
||||
* @param fps 帧率
|
||||
* Constructor
|
||||
* @param codec_id Encoding type
|
||||
* @param width Width
|
||||
* @param height Height
|
||||
* @param fps Frame rate
|
||||
|
||||
* [AUTO-TRANSLATED:b3d1ef4d]
|
||||
*/
|
||||
VideoTrackImp(CodecId codec_id, int width, int height, int fps) {
|
||||
_codec_id = codec_id;
|
||||
@@ -152,6 +213,9 @@ private:
|
||||
|
||||
/**
|
||||
* 音频Track派生类,支持采样率通道数,采用位数信息
|
||||
* Audio Track derived class, supports sampling rate, number of channels, and sampling bit information
|
||||
|
||||
* [AUTO-TRANSLATED:5f57819d]
|
||||
*/
|
||||
class AudioTrack : public Track {
|
||||
public:
|
||||
@@ -159,16 +223,25 @@ public:
|
||||
|
||||
/**
|
||||
* 返回音频采样率
|
||||
* Return audio sampling rate
|
||||
|
||||
* [AUTO-TRANSLATED:9af5a0a4]
|
||||
*/
|
||||
virtual int getAudioSampleRate() const {return 0;};
|
||||
|
||||
/**
|
||||
* 返回音频采样位数,一般为16或8
|
||||
* Return audio sampling bit depth, generally 16 or 8
|
||||
|
||||
* [AUTO-TRANSLATED:5fedc65d]
|
||||
*/
|
||||
virtual int getAudioSampleBit() const {return 0;};
|
||||
|
||||
/**
|
||||
* 返回音频通道数
|
||||
* Return audio number of channels
|
||||
|
||||
* [AUTO-TRANSLATED:2613b317]
|
||||
*/
|
||||
virtual int getAudioChannel() const {return 0;};
|
||||
};
|
||||
@@ -183,6 +256,13 @@ public:
|
||||
* @param sample_rate 采样率(HZ)
|
||||
* @param channels 通道数
|
||||
* @param sample_bit 采样位数,一般为16
|
||||
* Constructor
|
||||
* @param codecId Encoding type
|
||||
* @param sample_rate Sampling rate (HZ)
|
||||
* @param channels Number of channels
|
||||
* @param sample_bit Sampling bit depth, generally 16
|
||||
|
||||
* [AUTO-TRANSLATED:0ad0211f]
|
||||
*/
|
||||
AudioTrackImp(CodecId codecId, int sample_rate, int channels, int sample_bit){
|
||||
_codecid = codecId;
|
||||
@@ -193,6 +273,9 @@ public:
|
||||
|
||||
/**
|
||||
* 返回编码类型
|
||||
* Return encoding type
|
||||
|
||||
* [AUTO-TRANSLATED:c8731864]
|
||||
*/
|
||||
CodecId getCodecId() const override{
|
||||
return _codecid;
|
||||
@@ -200,6 +283,9 @@ public:
|
||||
|
||||
/**
|
||||
* 是否已经初始化
|
||||
* Whether it has been initialized
|
||||
|
||||
* [AUTO-TRANSLATED:5dc6693e]
|
||||
*/
|
||||
bool ready() const override {
|
||||
return true;
|
||||
@@ -207,6 +293,9 @@ public:
|
||||
|
||||
/**
|
||||
* 返回音频采样率
|
||||
* Return audio sampling rate
|
||||
|
||||
* [AUTO-TRANSLATED:9af5a0a4]
|
||||
*/
|
||||
int getAudioSampleRate() const override{
|
||||
return _sample_rate;
|
||||
@@ -214,6 +303,9 @@ public:
|
||||
|
||||
/**
|
||||
* 返回音频采样位数,一般为16或8
|
||||
* Return audio sampling bit depth, generally 16 or 8
|
||||
|
||||
* [AUTO-TRANSLATED:5fedc65d]
|
||||
*/
|
||||
int getAudioSampleBit() const override{
|
||||
return _sample_bit;
|
||||
@@ -221,6 +313,9 @@ public:
|
||||
|
||||
/**
|
||||
* 返回音频通道数
|
||||
* Return audio number of channels
|
||||
|
||||
* [AUTO-TRANSLATED:2613b317]
|
||||
*/
|
||||
int getAudioChannel() const override{
|
||||
return _channels;
|
||||
@@ -243,6 +338,10 @@ public:
|
||||
/**
|
||||
* 获取全部的Track
|
||||
* @param trackReady 是否获取全部已经准备好的Track
|
||||
* Get all Tracks
|
||||
* @param trackReady Whether to get all ready Tracks
|
||||
|
||||
* [AUTO-TRANSLATED:f0779985]
|
||||
*/
|
||||
virtual std::vector<Track::Ptr> getTracks(bool trackReady = true) const = 0;
|
||||
|
||||
@@ -250,6 +349,10 @@ public:
|
||||
* 获取特定Track
|
||||
* @param type track类型
|
||||
* @param trackReady 是否获取全部已经准备好的Track
|
||||
* Get specific Track
|
||||
* @param type Track type
|
||||
* @param trackReady Whether to get all ready Tracks
|
||||
* [AUTO-TRANSLATED:c50781b9]
|
||||
*/
|
||||
Track::Ptr getTrack(TrackType type , bool trackReady = true) const {
|
||||
auto tracks = getTracks(trackReady);
|
||||
|
||||
Reference in New Issue
Block a user