[FFmpeg-devel] [PATCH 2/6] sink_buffer: make opaque argument optional.

Nicolas George nicolas.george at normalesup.org
Sun Jul 1 15:09:14 CEST 2012

Le decadi 10 messidor, an CCXX, Stefano Sabatini a écrit :
> buffersink is a filter meant to be used by *programs*, and this
> explains why it has an opaque parameter, and it would make sense to
> extend buffer the same way.

I agree with that. My point was not to blame buffersink for using opaque,
but quite the contrary other filters for not doing so when they should have.

> Application-dependant filters also may need to access a global context
> or whatever, and the API should allow that in case it is needed,
> crippling the API because of a biased opinion (it won't serve, it
> isn't "nice") is just silly.

I completely agree with that.

> As for what regards the syntax, many filters were ported from mplayer
> and we tried to keep the same syntax, also when we started working on
> lavfi many parsing facilities were not available (opt/error/eval in
> libavcodec, no parsing facilities).

Thanks for the explanations. Do not take my mail for a reproach about the
past, but as ideas for the future.

> This would require a custom API for each filter which needs opaque
> data, which seems a worse solution than the previous one (before the
> opaque field "cleanup").

The declaration of the opaque structure is already a custom API for each
filter. The function to allocate said structure so as not to make it size
part of the ABI even more so (but this one could be avoided with a field
"opaque_size" in the filter structure).

I do not see the problem with custom API, provided they are well designed
and consistent. Gtk+ does that for object creation, and it never bothered
me, for example.

The other solution would be to use AVOption extensively, but that would
require a redesign of the init mechanism (init assumes that all the
arguments are already set), and extending it with more complex types (lists,
to begin with).


  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/20120701/aaa23e1b/attachment.asc>

More information about the ffmpeg-devel mailing list