[FFmpeg-devel] [PATCH] lavfi/overlay: add format option

Nicolas George nicolas.george at normalesup.org
Wed Feb 20 17:45:01 CET 2013

Le duodi 2 ventôse, an CCXXI, Stefano Sabatini a écrit :
> This can't work, since I need to know the output when doing
> query_formats(), and set main and overlay input accordingly.

I see, thanks for explaining.

> Note that a possibly better fix would be to rescale the main and
> overlay input to the output format, forced with another mechanism, but
> this would add a dependency on libswscale and would possibly
> complicate the logic, thus the current hack is good enough for me.

There is format negotiation and automatic insertion of scale filters
specifically to avoid all filters reinventing the (square) wheel by doing
their own format conversions, so I agree with you for not wanting to
implement that, although not for the same reason.

Therefore, I have no objection to the patch. The code looks right to me; you
may be able to make it slightly simpler with an array of arrays for the
format lists, but this is very minor.

> Feel free to propose a better fix.

It seems to me the problem is the same as amerge: you have a relation
between the format of the various pads that is more subtle than just "be the
same". I have on my TODO list the task of finding a solution.

My idea for that is to let query_formats() return EAGAIN: if that happens,
lavfi is supposed to leave that filter alone for the time being and merge
some other formats, then it can call query_formats() again, looping until
all filters are finally configured. Filters that need something subtle just
return EAGAIN until their input and/or output pads are reduced enough to let
them make a decision. I have implemented nothing yet.


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130220/0275dcfb/attachment.asc>

More information about the ffmpeg-devel mailing list