整理代码 添加注释

This commit is contained in:
xiongziliang
2018-10-21 22:24:24 +08:00
parent 0f6a7c1656
commit 393f123e28
5 changed files with 116 additions and 44 deletions

View File

@@ -13,7 +13,16 @@ class Frame : public Buffer {
public:
typedef std::shared_ptr<Frame> Ptr;
virtual ~Frame(){}
/**
* 时间戳
*/
virtual uint32_t stamp() = 0;
/**
* 前缀长度譬如264前缀为0x00 00 00 01,那么前缀长度就是4
* aac前缀则为7个字节
*/
virtual uint32_t prefixSize() = 0;
};
class H264Frame : public Frame {
@@ -29,15 +38,17 @@ public:
uint32_t stamp() override {
return timeStamp;
}
uint32_t prefixSize() override{
return iPrefixSize;
}
public:
uint16_t sequence;
uint32_t timeStamp;
unsigned char type;
string buffer;
uint32_t iPrefixSize = 4;
};
//ADTS 头中相对有用的信息 采样率、声道数、帧长度
class AdtsFrame : public Frame {
public:
@@ -52,6 +63,9 @@ public:
uint32_t stamp() override {
return timeStamp;
}
uint32_t prefixSize() override{
return iPrefixSize;
}
public:
unsigned int syncword; //12 bslbf 同步字The bit string 1111 1111 1111说明一个ADTS帧的开始
unsigned int id; //1 bslbf MPEG 标示符, 设置为1
@@ -75,6 +89,7 @@ public:
unsigned char buffer[2 * 1024 + 7];
uint16_t sequence;
uint32_t timeStamp;
uint32_t iPrefixSize = 4;
} ;