On Tue, 29 Apr 2014 15:45:29 +0200, Alessandro Ghedini <[email protected]> wrote: > On lun, apr 28, 2014 at 08:01:11 +0200, Anton Khirnov wrote: > > > > Hi, > > Nice patch. I've been considering stealing it from mplayer for some time, > > thanks > > for beating me to it. > > > > My comments are mostly details, feel free to ignore the ones prefixed with > > nit: > > > > On Sun, 27 Apr 2014 15:37:03 +0200, Alessandro Ghedini > > <[email protected]> wrote: > > > +static int query_formats(AVFilterContext *ctx) > > > +{ > > > + AVFilterFormats *formats = NULL; > > > + AVFilterChannelLayouts *layouts; > > > + > > > + static const enum AVSampleFormat sample_fmts[] = { > > > + AV_SAMPLE_FMT_U8, > > > + AV_SAMPLE_FMT_S16, > > > + AV_SAMPLE_FMT_S32, > > > + AV_SAMPLE_FMT_FLT, > > > + AV_SAMPLE_FMT_DBL, > > > + AV_SAMPLE_FMT_NONE, > > > + }; > > > + > > > + layouts = ff_all_channel_layouts(); > > > + ff_add_channel_layout(&layouts, av_get_default_channel_layout(2)); > > > > Why is this line here? > > Well, my intention was to limit the filter to only stereo streams, but maybe > it's the wrong way to do it (or maybe it shouldn't be done in the first > place?). > > Also, did you see this message [0]? > > [0] http://lists.libav.org/pipermail/libav-devel/2014-April/059247.html
Hmm, missed that. Anyway, unless I failed a reading check, the current code looks correct. It basically works like this: - the frame passed to the filter in filter_frame() is owned by the filter - passing a frame to ff_filter_frame() gives up the ownership of that frame For normal filters with one input and one output, this means that on ANY exit path from filter_frame, EXACTLY one of the following must be done: - the input frame is av_frame_free()'ed - the input frame is passed to the following filter with ff_filter_frame() - the input frame is stored in the filter context, and the filter has an uninit() callback that makes sure that it's freed when the filter is destroyed Of course the same applies to any frames you allocate manually with get_buffer(). -- Anton Khirnov _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
