[FFmpeg-cvslog] r22595 - in trunk/libavfilter: vf_aspect.c vf_crop.c vf_format.c vf_null.c vf_slicify.c

koorogi subversion
Fri Mar 19 00:13:02 CET 2010


Author: koorogi
Date: Fri Mar 19 00:13:02 2010
New Revision: 22595

Log:
Use the new null callbacks to simplify filters and reduce duplicated code.

Modified:
   trunk/libavfilter/vf_aspect.c
   trunk/libavfilter/vf_crop.c
   trunk/libavfilter/vf_format.c
   trunk/libavfilter/vf_null.c
   trunk/libavfilter/vf_slicify.c

Modified: trunk/libavfilter/vf_aspect.c
==============================================================================
--- trunk/libavfilter/vf_aspect.c	Fri Mar 19 00:12:48 2010	(r22594)
+++ trunk/libavfilter/vf_aspect.c	Fri Mar 19 00:13:02 2010	(r22595)
@@ -56,13 +56,6 @@ static av_cold int init(AVFilterContext 
     return 0;
 }
 
-
-static AVFilterPicRef *get_video_buffer(AVFilterLink *link, int perms,
-                                        int w, int h)
-{
-    return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
-}
-
 static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
 {
     AspectContext *aspect = link->dst->priv;
@@ -71,11 +64,6 @@ static void start_frame(AVFilterLink *li
     avfilter_start_frame(link->dst->outputs[0], picref);
 }
 
-static void end_frame(AVFilterLink *link)
-{
-    avfilter_end_frame(link->dst->outputs[0]);
-}
-
 #if CONFIG_ASPECT_FILTER
 /* for aspect filter, convert from frame aspect ratio to pixel aspect ratio */
 static int frameaspect_config_props(AVFilterLink *inlink)
@@ -100,9 +88,9 @@ AVFilter avfilter_vf_aspect = {
     .inputs    = (AVFilterPad[]) {{ .name             = "default",
                                     .type             = CODEC_TYPE_VIDEO,
                                     .config_props     = frameaspect_config_props,
-                                    .get_video_buffer = get_video_buffer,
+                                    .get_video_buffer = avfilter_null_get_video_buffer,
                                     .start_frame      = start_frame,
-                                    .end_frame        = end_frame },
+                                    .end_frame        = avfilter_null_end_frame },
                                   { .name = NULL}},
 
     .outputs   = (AVFilterPad[]) {{ .name             = "default",
@@ -122,9 +110,9 @@ AVFilter avfilter_vf_pixelaspect = {
 
     .inputs    = (AVFilterPad[]) {{ .name             = "default",
                                     .type             = CODEC_TYPE_VIDEO,
-                                    .get_video_buffer = get_video_buffer,
+                                    .get_video_buffer = avfilter_null_get_video_buffer,
                                     .start_frame      = start_frame,
-                                    .end_frame        = end_frame },
+                                    .end_frame        = avfilter_null_end_frame },
                                   { .name = NULL}},
 
     .outputs   = (AVFilterPad[]) {{ .name             = "default",

Modified: trunk/libavfilter/vf_crop.c
==============================================================================
--- trunk/libavfilter/vf_crop.c	Fri Mar 19 00:12:48 2010	(r22594)
+++ trunk/libavfilter/vf_crop.c	Fri Mar 19 00:13:02 2010	(r22595)
@@ -156,12 +156,6 @@ static int config_output(AVFilterLink *l
     return 0;
 }
 
-static AVFilterPicRef *get_video_buffer(AVFilterLink *link, int perms,
-                                        int w, int h)
-{
-    return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
-}
-
 static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
 {
     CropContext *crop = link->dst->priv;
@@ -223,7 +217,7 @@ AVFilter avfilter_vf_crop = {
                                     .type             = CODEC_TYPE_VIDEO,
                                     .start_frame      = start_frame,
                                     .draw_slice       = draw_slice,
-                                    .get_video_buffer = get_video_buffer,
+                                    .get_video_buffer = avfilter_null_get_video_buffer,
                                     .config_props     = config_input, },
                                   { .name = NULL}},
     .outputs   = (AVFilterPad[]) {{ .name             = "default",

Modified: trunk/libavfilter/vf_format.c
==============================================================================
--- trunk/libavfilter/vf_format.c	Fri Mar 19 00:12:48 2010	(r22594)
+++ trunk/libavfilter/vf_format.c	Fri Mar 19 00:13:02 2010	(r22595)
@@ -85,27 +85,6 @@ static AVFilterFormats *make_format_list
     return formats;
 }
 
-static AVFilterPicRef *get_video_buffer(AVFilterLink *link, int perms,
-                                        int w, int h)
-{
-    return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
-}
-
-static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
-{
-    avfilter_start_frame(link->dst->outputs[0], picref);
-}
-
-static void end_frame(AVFilterLink *link)
-{
-    avfilter_end_frame(link->dst->outputs[0]);
-}
-
-static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
-    avfilter_draw_slice(link->dst->outputs[0], y, h, slice_dir);
-}
-
 #if CONFIG_FORMAT_FILTER
 static int query_formats_format(AVFilterContext *ctx)
 {
@@ -125,10 +104,10 @@ AVFilter avfilter_vf_format = {
 
     .inputs    = (AVFilterPad[]) {{ .name            = "default",
                                     .type            = CODEC_TYPE_VIDEO,
-                                    .get_video_buffer= get_video_buffer,
-                                    .start_frame     = start_frame,
-                                    .draw_slice      = draw_slice,
-                                    .end_frame       = end_frame, },
+                                    .get_video_buffer= avfilter_null_get_video_buffer,
+                                    .start_frame     = avfilter_null_start_frame,
+                                    .draw_slice      = avfilter_null_draw_slice,
+                                    .end_frame       = avfilter_null_end_frame, },
                                   { .name = NULL}},
     .outputs   = (AVFilterPad[]) {{ .name            = "default",
                                     .type            = CODEC_TYPE_VIDEO },
@@ -155,10 +134,10 @@ AVFilter avfilter_vf_noformat = {
 
     .inputs    = (AVFilterPad[]) {{ .name            = "default",
                                     .type            = CODEC_TYPE_VIDEO,
-                                    .get_video_buffer= get_video_buffer,
-                                    .start_frame     = start_frame,
-                                    .draw_slice      = draw_slice,
-                                    .end_frame       = end_frame, },
+                                    .get_video_buffer= avfilter_null_get_video_buffer,
+                                    .start_frame     = avfilter_null_start_frame,
+                                    .draw_slice      = avfilter_null_draw_slice,
+                                    .end_frame       = avfilter_null_end_frame, },
                                   { .name = NULL}},
     .outputs   = (AVFilterPad[]) {{ .name            = "default",
                                     .type            = CODEC_TYPE_VIDEO },

Modified: trunk/libavfilter/vf_null.c
==============================================================================
--- trunk/libavfilter/vf_null.c	Fri Mar 19 00:12:48 2010	(r22594)
+++ trunk/libavfilter/vf_null.c	Fri Mar 19 00:13:02 2010	(r22595)
@@ -23,22 +23,6 @@
 
 #include "avfilter.h"
 
-static AVFilterPicRef *get_video_buffer(AVFilterLink *link, int perms,
-                                        int w, int h)
-{
-    return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
-}
-
-static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
-{
-    avfilter_start_frame(link->dst->outputs[0], picref);
-}
-
-static void end_frame(AVFilterLink *link)
-{
-    avfilter_end_frame(link->dst->outputs[0]);
-}
-
 AVFilter avfilter_vf_null = {
     .name      = "null",
     .description = NULL_IF_CONFIG_SMALL("Pass the source unchanged to the output."),
@@ -47,9 +31,9 @@ AVFilter avfilter_vf_null = {
 
     .inputs    = (AVFilterPad[]) {{ .name             = "default",
                                     .type             = CODEC_TYPE_VIDEO,
-                                    .get_video_buffer = get_video_buffer,
-                                    .start_frame      = start_frame,
-                                    .end_frame        = end_frame },
+                                    .get_video_buffer = avfilter_null_get_video_buffer,
+                                    .start_frame      = avfilter_null_start_frame,
+                                    .end_frame        = avfilter_null_end_frame },
                                   { .name = NULL}},
 
     .outputs   = (AVFilterPad[]) {{ .name             = "default",

Modified: trunk/libavfilter/vf_slicify.c
==============================================================================
--- trunk/libavfilter/vf_slicify.c	Fri Mar 19 00:12:48 2010	(r22594)
+++ trunk/libavfilter/vf_slicify.c	Fri Mar 19 00:13:02 2010	(r22595)
@@ -57,12 +57,6 @@ static int config_props(AVFilterLink *li
     return 0;
 }
 
-static AVFilterPicRef *get_video_buffer(AVFilterLink *link, int perms,
-                                        int w, int h)
-{
-    return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
-}
-
 static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
 {
     SliceContext *slice = link->dst->priv;
@@ -81,11 +75,6 @@ static void start_frame(AVFilterLink *li
     avfilter_start_frame(link->dst->outputs[0], picref);
 }
 
-static void end_frame(AVFilterLink *link)
-{
-    avfilter_end_frame(link->dst->outputs[0]);
-}
-
 static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
 {
     SliceContext *slice = link->dst->priv;
@@ -116,11 +105,11 @@ AVFilter avfilter_vf_slicify = {
 
     .inputs    = (AVFilterPad[]) {{ .name             = "default",
                                     .type             = CODEC_TYPE_VIDEO,
-                                    .get_video_buffer = get_video_buffer,
+                                    .get_video_buffer = avfilter_null_get_video_buffer,
                                     .start_frame      = start_frame,
                                     .draw_slice       = draw_slice,
                                     .config_props     = config_props,
-                                    .end_frame        = end_frame, },
+                                    .end_frame        = avfilter_null_end_frame, },
                                   { .name = NULL}},
     .outputs   = (AVFilterPad[]) {{ .name            = "default",
                                     .type            = CODEC_TYPE_VIDEO, },



More information about the ffmpeg-cvslog mailing list