stdstring-GetF4vHeaderBufferconst-char--buf-size_t-lennn----const-int-THIS_BUFFER_SIZE-=-len;n----if-THIS_BUFFER_SIZE--FLV_HEADER_SIZE-+-PRE_TAG_SIZE-n--------return-;n----n----const-char-pbuffer-=-buf;n----flv_header-header--=-flv_header-pbuffer;n--
This function takes a buffer of binary data and its length as input, and returns a string containing the F4V header of the video contained in the buffer. The F4V header includes information about the video format, codec, and metadata.
The function first checks if the buffer is large enough to contain the FLV header and at least one pre-tag. If not, it returns an empty string.
Then, it extracts the FLV header from the buffer and checks if it has the correct signature ('FLV'). If not, it returns an empty string.
Next, the function iterates through the buffer to find the first audio and video tags, and extracts their headers. It also checks for any script tags, but does not extract them.
Finally, the function constructs a new buffer containing the FLV header and the headers of the audio and video tags, and returns it as a string. If no audio or video tags are found, the function returns only the FLV header.
原文地址: https://www.cveoy.top/t/topic/qf4 著作权归作者所有。请勿转载和采集!