[FFmpeg-devel] Can BSF delay packets?

Ronald S. Bultje rsbultje at gmail.com
Mon Feb 6 16:06:37 EET 2017


Hi Aleksey,

On Mon, Feb 6, 2017 at 8:45 AM, Aleksey M <hex000 at gmail.com> wrote:

> Hi Ronald.
>
> Thank you for replying!
>
> If I return 0 -- how the calling function determines that I've produced an
> output packet?
>
> What do I do to signal caller that I don't want to produce an output
> packet?


Please don't top-post.

I have to admit the new BSF API is super-confusing. I think you return
EAGAIN but you also have to deallocate the "out" AVPacket. See
http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/vp9_superframe_bsf.c;h=b686adbe1673f564d252a30cff11c5895a9a3b55;hb=HEAD
as an example.

The EAGAIN is handled here:
http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/bitstream_filter.c;h=02878e3bf3e9771f5921ce218771f041e19f2d59;hb=HEAD#l144
and the unref will zero the packet, which invokes this code:
http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/utils.c;h=07113107920a910d3b3094f01a1b3f8a58b11072;hb=HEAD#l5256
and then it will skip the packet and wait for the next.

I'm not sure how to retrieve delayed packets though, it seems that's simply
not possible ATM, not in FFmpeg but also not in Libav - at least using the
av_bitstream_filter_filter() function... (?)

Ronald


More information about the ffmpeg-devel mailing list