[FFmpeg-devel] [PATCH] libavfilter: add a set of callbacks for null filters

Michael Niedermayer michaelni
Thu Mar 18 12:34:46 CET 2010


On Wed, Mar 17, 2010 at 10:59:03PM -0500, Bobby Bingham wrote:
> This series of patches adds a set of callback functions (start_frame,
> draw_slice, etc) that the filters can use.  There is already a default
> set of callbacks that get used if the filter specifies NULL for its
> callback, but these aren't very good default implementations for those
> filters which don't modify the video image data in any way:
> - (pixel)aspect, crop, slicify, null, setpts, (no)format
> 
> Each of these filters was independently reimplementing most of these
> callbacks already.
> -- 
> Bobby Bingham
> ??????????????????????

>  avfilter.h |   10 ++++++++++
>  defaults.c |   20 ++++++++++++++++++++
>  2 files changed, 30 insertions(+)
> 1f9791c5a379b6b950ea4374e22419ce8b775ea1  01-null-callbacks.patch
> Create a set of null callback functions.
> 
> From: Bobby Bingham <uhmmmm at gmail.com>
> 
> These are useful for filters which don't modify the image data.
> ---
>  libavfilter/avfilter.h |   10 ++++++++++
>  libavfilter/defaults.c |   20 ++++++++++++++++++++
>  2 files changed, 30 insertions(+), 0 deletions(-)
> 
> diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
> index 060c675..59364ff 100644
> --- a/libavfilter/avfilter.h
> +++ b/libavfilter/avfilter.h
> @@ -395,6 +395,16 @@ void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
>  /** Default handler for query_formats() */
>  int avfilter_default_query_formats(AVFilterContext *ctx);
>  
> +/** start_frame() handler for filters which simply pass video along */
> +void avfilter_null_start_frame(AVFilterLink *link, AVFilterPicRef *picref);

> +/** draw_slice() handler for filters which simply pass video along */
> +void avfilter_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);

> +/** end_frame() handler for filters which simply pass video along */
> +void avfilter_null_end_frame(AVFilterLink *link);

> +/** get_video_buffer() handler for filters which simply pass video along */
> +AVFilterPicRef *avfilter_null_get_video_buffer(AVFilterLink *link,
> +                                                  int perms, int w, int h);

some empty lines make these more readable


[...]

>  vf_aspect.c  |   20 ++++----------------
>  vf_crop.c    |    8 +-------
>  vf_format.c  |   37 ++++++++-----------------------------
>  vf_null.c    |   22 +++-------------------
>  vf_slicify.c |   15 ++-------------
>  5 files changed, 18 insertions(+), 84 deletions(-)
> 1381c6189afc54ba1837a40ab5c1fd4de94e5be7  02-use-callbacks.patch
> Use the new null callbacks to simplify filters and reduce duplicated code.

ok

[...]


>  vf_vflip.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 1a284ccbfd25ae513fcdced3604fc1b3803a4411  03-convert-filters.patch
> The vflip filter does not need to keep ownership of a picture reference.
> 
> From: Bobby Bingham <uhmmmm at gmail.com>
> 
> Avoid creating and releasing useless extra picture references in the
> start_frame and end_frame callbacks.

ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100318/932424fd/attachment.pgp>



More information about the ffmpeg-devel mailing list