[FFmpeg-devel] [RFC] Reintroduce sws_getContext() as sws_create_context()

Michael Niedermayer michaelni
Fri Nov 5 17:00:29 CET 2010

On Fri, Nov 05, 2010 at 04:52:50PM +0100, Reimar D?ffinger wrote:
> On Thu, Nov 04, 2010 at 08:46:10PM +0100, Stefano Sabatini wrote:
> > libavcodec API:
> > 
> > avcodec_alloc_context() -> creates a non-opaque context, sets the
> > fields to the default values.
> > 
> > the options can be set explicitely setting the fields or using the 
> > libavutil/opt.h API.
> > 
> > avcodec_open() -> opens the context, fails in case of invalid parameters
> You are leaving out the helper functions like
> avcodec_find_decoder_by_name, avcodec_thread_init and similar.
> > libswscale (new) API:
> > 
> > swsc_alloc_context() -> creates an opaque context, sets the values to
> > the default values (check libswscale/options.c).
> > 
> > The context is opaque, the options can only be set using the
> > sws_setColorspaceDetails() or the libavutil/opt.h API.
> > 
> > swscale_init_context() sets the src and dst filters and intializes the
> > context, fails if the options are not valid, at this point (I
> > suppose) options should not be changed again when using the context.
> The flaw is that sws_setColorspaceDetails requires people to specify
> things that are a pain to set up (note e.g. ff_yuv2rgb_coeffs is
> not public API) and probably 90% of people don't give a damn about,
> while at the same time you have to set width, height, format, ...
> in the struct one by one making you feel like eating soup with a fork.
> I don't have a constructive suggestion to make right now (for that

we can move fields like width/height to the begin of the context and make
the begin public while leaving the remainder opaque and only specify it in a
private header. That would allow direct access to these fields but a seperate
function setting them is an option too. sws_alloc_context() may be a candidate

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101105/f73353e8/attachment.pgp>

More information about the ffmpeg-devel mailing list