[FFmpeg-devel] [PATCH] libavfilter - avfilter_make_format_list skips sentinel -1

Michael Niedermayer michaelni at gmx.at
Wed Nov 23 15:09:08 CET 2011


On Wed, Nov 23, 2011 at 01:41:26PM +0100, Robert Nagy wrote:
> T <http://pastebin.com/JDPhT8Vh>he following code causes the problem for me
> (I rewrite it to C so that you can compile it).
> 
> void foo()
> {
> AVFilterGraph* graph = avfilter_graph_alloc();
> AVFilterContext* buffersink_ctx = nullptr;
> AVFilterContext* buffersrc_ctx = nullptr;
> 
> char args[1024] = {};
> sprintf(args, "%d:%d:%d:%d:%d:%d:%d", 1024, 576, PIX_FMT_BGRA, 0, 0, 0, 0);
> 
> avfilter_graph_create_filter(&buffersrc_ctx,
> avfilter_get_by_name("buffer"), "src", args, NULL, graph);
> 
> AVBufferSinkParams* buffersink_params = av_buffersink_params_alloc();
> PixelFormat fmts[] = {PIX_FMT_BGRA, PIX_FMT_NONE};
> buffersink_params->pixel_fmts = fmts;
> avfilter_graph_create_filter(&buffersink_ctx,

> avfilter_get_by_name("buffersink"), "out", NULL, buffersink_params, graph);

the problem is here.
see:

#if FF_API_OLD_VSINK_API
        buf->pixel_fmts = (const enum PixelFormat *)opaque;
#else
        params = (AVBufferSinkParams *)opaque;
        buf->pixel_fmts = params->pixel_fmts;
#endif

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- 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/20111123/eb0a700b/attachment.asc>


More information about the ffmpeg-devel mailing list