AI automatically translates all comments in the code into English (#3917)

This commit is contained in:
alex
2024-09-19 14:53:50 +08:00
committed by GitHub
parent 046de691cb
commit 4152dcd409
279 changed files with 10602 additions and 3038 deletions

View File

@@ -27,12 +27,19 @@ public:
* @param stamp 绝对时间戳
* @param enable_rollback 是否允许相当时间戳回退
* @return 时间戳增量
* Calculate the timestamp increment
* @param stamp Absolute timestamp
* @param enable_rollback Whether to allow the timestamp to roll back
* @return Timestamp increment
* [AUTO-TRANSLATED:e8d21dcd]
*/
int64_t deltaStamp(int64_t stamp, bool enable_rollback = true);
int64_t relativeStamp(int64_t stamp, bool enable_rollback = true);
int64_t relativeStamp();
// 设置最大允许回退或跳跃幅度
// 设置最大允许回退或跳跃幅度 [AUTO-TRANSLATED:e5b44ede]
// Set the maximum allowed rollback or jump amplitude
void setMaxDelta(size_t max_delta);
protected:
@@ -44,8 +51,10 @@ protected:
int64_t _relative_stamp = 0;
};
//该类解决时间戳回环、回退问题
//计算相对时间戳或者产生平滑时间戳
// 该类解决时间戳回环、回退问题 [AUTO-TRANSLATED:b442692c]
// This class solves the problem of timestamp loopback and rollback
// 计算相对时间戳或者产生平滑时间戳 [AUTO-TRANSLATED:0deabd6e]
// Calculate the relative timestamp or generate a smooth timestamp
class Stamp : public DeltaStamp{
public:
/**
@@ -55,43 +64,72 @@ public:
* @param dts_out 输出dts
* @param pts_out 输出pts
* @param modifyStamp 是否用系统时间戳覆盖
* Get the relative timestamp, which also implements audio and video synchronization, limits dts rollback, etc.
* @param dts Input dts, if it is 0, it will be generated according to the system timestamp
* @param pts Input pts, if it is 0, it is equal to dts
* @param dts_out Output dts
* @param pts_out Output pts
* @param modifyStamp Whether to overwrite with the system timestamp
* [AUTO-TRANSLATED:0b939dc5]
*/
void revise(int64_t dts, int64_t pts, int64_t &dts_out, int64_t &pts_out,bool modifyStamp = false);
/**
* 再设置相对时间戳用于seek用
* @param relativeStamp 相对时间戳
* Set the relative timestamp again, used for seek
* @param relativeStamp Relative timestamp
* [AUTO-TRANSLATED:fc087399]
*/
void setRelativeStamp(int64_t relativeStamp);
/**
* 获取当前相对时间戳
* @return
* Get the current relative timestamp
* @return
* [AUTO-TRANSLATED:7ca29fde]
*/
int64_t getRelativeStamp() const ;
/**
* 设置是否为回放模式,回放模式运行时间戳回退
* @param playback 是否为回放模式
* Set whether it is playback mode, playback mode allows timestamp rollback
* @param playback Whether it is playback mode
* [AUTO-TRANSLATED:ffe5e40b]
*/
void setPlayBack(bool playback = true);
/**
* 音视频同步用,音频应该同步于视频(只修改音频时间戳)
* 因为音频时间戳修改后不影响播放速度
* Used for audio and video synchronization, audio should be synchronized with video (only modify audio timestamp)
* Because modifying the audio timestamp does not affect the playback speed
* [AUTO-TRANSLATED:7ac41a76]
*/
void syncTo(Stamp &other);
/**
* 是否允许时间戳回退
* Whether to allow timestamp rollback
* [AUTO-TRANSLATED:1d32f7e3]
*/
void enableRollback(bool flag);
private:
//主要实现音视频时间戳同步功能
// 主要实现音视频时间戳同步功能 [AUTO-TRANSLATED:45863fce]
// Mainly implements audio and video timestamp synchronization function
void revise_l(int64_t dts, int64_t pts, int64_t &dts_out, int64_t &pts_out,bool modifyStamp = false);
//主要实现获取相对时间戳功能
// 主要实现获取相对时间戳功能 [AUTO-TRANSLATED:4e042942]
// Mainly implements the function of obtaining the relative timestamp
void revise_l2(int64_t dts, int64_t pts, int64_t &dts_out, int64_t &pts_out,bool modifyStamp = false);
void needSync() override;
@@ -99,7 +137,8 @@ private:
private:
bool _playback = false;
bool _need_sync = false;
// 默认不允许时间戳回滚
// 默认不允许时间戳回滚 [AUTO-TRANSLATED:0163ff03]
// Default does not allow timestamp rollback
bool _enable_rollback = false;
int64_t _relative_stamp = 0;
int64_t _last_dts_in = 0;
@@ -109,8 +148,10 @@ private:
Stamp *_sync_master = nullptr;
};
//dts生成器
//pts排序后就是dts
// dts生成器 [AUTO-TRANSLATED:d8a794a2]
// dts generator,
// pts排序后就是dts [AUTO-TRANSLATED:439ac368]
// pts after sorting is dts
class DtsGenerator{
public:
bool getDts(uint64_t pts, uint64_t &dts);