[英]does av_read_frame add FF_INPUT_BUFFER_PADDING_SIZE?
I'm using libav to read an MPEG stream. 我正在使用libav来读取MPEG流。
I'm using the function av_read_frame()
to read some frames into packets: 我正在使用函数av_read_frame()
将一些帧读入数据包:
av_read_frame(pFormatCtx, &packet)
I then use the function avcodec_decode_video2
to decode the packet into frame. 然后我使用函数avcodec_decode_video2
将数据包解码为帧。
the documentation of the function avcodec_decode_video2
contains the following warning: 函数avcodec_decode_video2
的文档包含以下警告:
The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than the actual read bytes because some optimized bitstream readers read 32 or 64 bits at once and could read over the end. 输入缓冲区必须大于实际读取字节的FF_INPUT_BUFFER_PADDING_SIZE,因为一些优化的比特流读取器一次读取32位或64位并且可以读取结束。 The end of the input buffer buf should be set to 0 to ensure that no overreading happens for damaged MPEG streams. 输入缓冲区buf的结尾应设置为0,以确保对损坏的MPEG流不会发生过度读取。
I wanted to know if the function av_read_frame
doesn't already allocate the additional FF_INPUT_BUFFER_PADDING_SIZE? 我想知道函数av_read_frame
是否还没有分配额外的FF_INPUT_BUFFER_PADDING_SIZE?
Thank you. 谢谢。
Yes, av_read_frame() always adds FF_INPUT_BUFFER_PADDING_SIZE for you. 是的,av_read_frame()总是为您添加FF_INPUT_BUFFER_PADDING_SIZE。 You only need to care about that if you use your own demuxed data as input to avcodec_decode_video2(), eg if you write your own demuxers (like what VLC or mplayer do). 如果您使用自己的多路分解数据作为avcodec_decode_video2()的输入,您只需要关心它,例如,如果您编写自己的分路器(如VLC或mplayer所做的那样)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.