[FFmpeg-devel] [PATCH 1/4] lavf: add write_uncoded_frame() API.

Stefano Sabatini stefasab at gmail.com
Thu Jan 2 11:29:25 CET 2014

On date Thursday 2014-01-02 00:48:15 +0100, Nicolas George encoded:
> Le duodi 12 nivôse, an CCXXII, Stefano Sabatini a écrit :
> > This sounds a bit weird. Indeed the feature should be directly
> > accessible, without the need to use some testing code.
> I do not understand what you mean here. What happens if the application
> tries to write an uncoded frame to, for example, Matroska, where it makes no
> sense because byte packets are needed? I see several possibilities:

[Note: please do not be overeager when trimming a message, leave some
context so I know what I was referring to when I replied.]

You have a format context, a stream index, now you want to know if
stream supports uncoded frames. So you do:

ret = av_write_uncoded_frame(s, stream_index, NULL, QUERY);

and check the result.

So you are basically using the av_write_uncoded_frame() function to
check functionality of the muxer. This rings a bell in my head since
you are basically overloading the write frame function with a query

This may be bad in some cases. Suppose for example you have a complex
logic to set what is accepted by the muxer, if you have the query code
in the frame writing function you call it for every frame.

Probably a better way would be to do something like:
ret = avformat_support_uncoded_frame_muxing(s, stream_index);

Note that this is not a strong objection (for example you could lazily
evaluate the check only on the first call) but I feel like there is
probably a cleaner way to implement this.

FFmpeg = Faithless and Fast Martial Perfectionist Eccentric God

More information about the ffmpeg-devel mailing list