Based on the analysis of the FLV format in the previous article, the FLV format includes file header and file body. Therefore, you can define file header and previous tag size #0 as follows:
Const static unsigned char flvfilehdr [] = {
0x46, 0x4c, 0x56, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00
};
The file body consists of the tag header and tag data. Therefore, the tag header can be defined as follows:
Unsigned char flvtaghdr [] = {
0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0 x, 0x00
};
Note: flvtaghdr [4] ~ Flvtaghdr [7] is used to calculate the time stamp of FLV audio data. A simple algorithm is required to calculate the time stamp of each audio data. For details, see the next article.
The tag body must be filled in according to the specific WAV audio data. Therefore, the first byte of the TAG body must include the specific parameter information of the audio data segment, which can be defined as follows:
Const static unsigned char tagdatafirstbyte [] = {
0x06
}; // The first four digits are 0, indicating the linear PCM and platform endian. The binary value is 00000110.
What follows each tag is the size of the previous tag. For example, if the size of the previous tag is 640, it can be defined as follows:
Const static unsigned char flvprevioustagsize [] = {
0x80
};
To be continued ~
PS: I wrote an article at the beginning. Please forgive me. If you have any questions or communication, you can add your YY: 301558660
Reprinted please indicate the source: zhujian blog, http://blog.csdn.net/linyanwen99/article/details/7515309