History

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

Originally committed as revision 22595 to svn://svn.ffmpeg.org/ffmpeg/trunk

Bobby Bingham committed 16 years ago

Commit d313e171 parent 91d1c745 files · +18 −84Browse files

Unified · Split

5 files
  1. libavfilter/vf_aspect.c +4 −16
  2. libavfilter/vf_crop.c +1 −7
  3. libavfilter/vf_format.c +8 −29
  4. libavfilter/vf_null.c +3 −19
  5. libavfilter/vf_slicify.c +2 −13
libavfilter/vf_aspect.c+4−16
@@ -56,13 +56,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque) · 55 unmodified lines
5656 return 0;
5757 }
5858
59−
60−static AVFilterPicRef *get_video_buffer(AVFilterLink *link, int perms,
61− int w, int h)
62−{
63− return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
64−}
65−
6659 static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
6760 {
6861 AspectContext *aspect = link->dst->priv;
@@ -71,11 +64,6 @@ static void start_frame(AVFilterLink *link, AVFilterPicRef *picref) · 2 unmodified lines
7164 avfilter_start_frame(link->dst->outputs[0], picref);
7265 }
7366
74−static void end_frame(AVFilterLink *link)
75−{
76− avfilter_end_frame(link->dst->outputs[0]);
77−}
78−
7967 #if CONFIG_ASPECT_FILTER
8068 /* for aspect filter, convert from frame aspect ratio to pixel aspect ratio */
8169 static int frameaspect_config_props(AVFilterLink *inlink)
@@ -100,9 +88,9 @@ AVFilter avfilter_vf_aspect = { · 18 unmodified lines
10088 .inputs = (AVFilterPad[]) {{ .name = "default",
10189 .type = CODEC_TYPE_VIDEO,
10290 .config_props = frameaspect_config_props,
103− .get_video_buffer = get_video_buffer,
91+ .get_video_buffer = avfilter_null_get_video_buffer,
10492 .start_frame = start_frame,
105− .end_frame = end_frame },
93+ .end_frame = avfilter_null_end_frame },
10694 { .name = NULL}},
10795
10896 .outputs = (AVFilterPad[]) {{ .name = "default",
@@ -122,9 +110,9 @@ AVFilter avfilter_vf_pixelaspect = { · 13 unmodified lines
122110
123111 .inputs = (AVFilterPad[]) {{ .name = "default",
124112 .type = CODEC_TYPE_VIDEO,
125− .get_video_buffer = get_video_buffer,
113+ .get_video_buffer = avfilter_null_get_video_buffer,
126114 .start_frame = start_frame,
127− .end_frame = end_frame },
115+ .end_frame = avfilter_null_end_frame },
128116 { .name = NULL}},
129117
130118 .outputs = (AVFilterPad[]) {{ .name = "default",
libavfilter/vf_crop.c+1−7
@@ -156,12 +156,6 @@ static int config_output(AVFilterLink *link) · 155 unmodified lines
156156 return 0;
157157 }
158158
159−static AVFilterPicRef *get_video_buffer(AVFilterLink *link, int perms,
160− int w, int h)
161−{
162− return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
163−}
164−
165159 static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
166160 {
167161 CropContext *crop = link->dst->priv;
@@ -223,7 +217,7 @@ AVFilter avfilter_vf_crop = { · 55 unmodified lines
223217 .type = CODEC_TYPE_VIDEO,
224218 .start_frame = start_frame,
225219 .draw_slice = draw_slice,
226− .get_video_buffer = get_video_buffer,
220+ .get_video_buffer = avfilter_null_get_video_buffer,
227221 .config_props = config_input, },
228222 { .name = NULL}},
229223 .outputs = (AVFilterPad[]) {{ .name = "default",
libavfilter/vf_format.c+8−29
@@ -85,27 +85,6 @@ static AVFilterFormats *make_format_list(FormatContext *format, int flag) · 84 unmodified lines
8585 return formats;
8686 }
8787
88−static AVFilterPicRef *get_video_buffer(AVFilterLink *link, int perms,
89− int w, int h)
90−{
91− return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
92−}
93−
94−static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
95−{
96− avfilter_start_frame(link->dst->outputs[0], picref);
97−}
98−
99−static void end_frame(AVFilterLink *link)
100−{
101− avfilter_end_frame(link->dst->outputs[0]);
102−}
103−
104−static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
105−{
106− avfilter_draw_slice(link->dst->outputs[0], y, h, slice_dir);
107−}
108−
10988 #if CONFIG_FORMAT_FILTER
11089 static int query_formats_format(AVFilterContext *ctx)
11190 {
@@ -125,10 +104,10 @@ AVFilter avfilter_vf_format = { · 13 unmodified lines
125104
126105 .inputs = (AVFilterPad[]) {{ .name = "default",
127106 .type = CODEC_TYPE_VIDEO,
128− .get_video_buffer= get_video_buffer,
129− .start_frame = start_frame,
130− .draw_slice = draw_slice,
131− .end_frame = end_frame, },
107+ .get_video_buffer= avfilter_null_get_video_buffer,
108+ .start_frame = avfilter_null_start_frame,
109+ .draw_slice = avfilter_null_draw_slice,
110+ .end_frame = avfilter_null_end_frame, },
132111 { .name = NULL}},
133112 .outputs = (AVFilterPad[]) {{ .name = "default",
134113 .type = CODEC_TYPE_VIDEO },
@@ -155,10 +134,10 @@ AVFilter avfilter_vf_noformat = { · 20 unmodified lines
155134
156135 .inputs = (AVFilterPad[]) {{ .name = "default",
157136 .type = CODEC_TYPE_VIDEO,
158− .get_video_buffer= get_video_buffer,
159− .start_frame = start_frame,
160− .draw_slice = draw_slice,
161− .end_frame = end_frame, },
137+ .get_video_buffer= avfilter_null_get_video_buffer,
138+ .start_frame = avfilter_null_start_frame,
139+ .draw_slice = avfilter_null_draw_slice,
140+ .end_frame = avfilter_null_end_frame, },
162141 { .name = NULL}},
163142 .outputs = (AVFilterPad[]) {{ .name = "default",
164143 .type = CODEC_TYPE_VIDEO },
libavfilter/vf_null.c+3−19
@@ -23,22 +23,6 @@ · 22 unmodified lines
2323
2424 #include "avfilter.h"
2525
26−static AVFilterPicRef *get_video_buffer(AVFilterLink *link, int perms,
27− int w, int h)
28−{
29− return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
30−}
31−
32−static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
33−{
34− avfilter_start_frame(link->dst->outputs[0], picref);
35−}
36−
37−static void end_frame(AVFilterLink *link)
38−{
39− avfilter_end_frame(link->dst->outputs[0]);
40−}
41−
4226 AVFilter avfilter_vf_null = {
4327 .name = "null",
4428 .description = NULL_IF_CONFIG_SMALL("Pass the source unchanged to the output."),
@@ -47,9 +31,9 @@ AVFilter avfilter_vf_null = { · 2 unmodified lines
4731
4832 .inputs = (AVFilterPad[]) {{ .name = "default",
4933 .type = CODEC_TYPE_VIDEO,
50− .get_video_buffer = get_video_buffer,
51− .start_frame = start_frame,
52− .end_frame = end_frame },
34+ .get_video_buffer = avfilter_null_get_video_buffer,
35+ .start_frame = avfilter_null_start_frame,
36+ .end_frame = avfilter_null_end_frame },
5337 { .name = NULL}},
5438
5539 .outputs = (AVFilterPad[]) {{ .name = "default",
libavfilter/vf_slicify.c+2−13
@@ -57,12 +57,6 @@ static int config_props(AVFilterLink *link) · 56 unmodified lines
5757 return 0;
5858 }
5959
60−static AVFilterPicRef *get_video_buffer(AVFilterLink *link, int perms,
61− int w, int h)
62−{
63− return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
64−}
65−
6660 static void start_frame(AVFilterLink *link, AVFilterPicRef *picref)
6761 {
6862 SliceContext *slice = link->dst->priv;
@@ -81,11 +75,6 @@ static void start_frame(AVFilterLink *link, AVFilterPicRef *picref) · 12 unmodified lines
8175 avfilter_start_frame(link->dst->outputs[0], picref);
8276 }
8377
84−static void end_frame(AVFilterLink *link)
85−{
86− avfilter_end_frame(link->dst->outputs[0]);
87−}
88−
8978 static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
9079 {
9180 SliceContext *slice = link->dst->priv;
@@ -116,11 +105,11 @@ AVFilter avfilter_vf_slicify = { · 24 unmodified lines
116105
117106 .inputs = (AVFilterPad[]) {{ .name = "default",
118107 .type = CODEC_TYPE_VIDEO,
119− .get_video_buffer = get_video_buffer,
108+ .get_video_buffer = avfilter_null_get_video_buffer,
120109 .start_frame = start_frame,
121110 .draw_slice = draw_slice,
122111 .config_props = config_props,
123− .end_frame = end_frame, },
112+ .end_frame = avfilter_null_end_frame, },
124113 { .name = NULL}},
125114 .outputs = (AVFilterPad[]) {{ .name = "default",
126115 .type = CODEC_TYPE_VIDEO, },

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t