History

Move default entry point implementations to their own file. Make them externally visible because they may be useful for filters to use.

Commited in SoC by Bobby Bingham on 2007-08-02 15:14:05 Originally committed as revision 11997 to svn://svn.ffmpeg.org/ffmpeg/trunk

Vitor Sessak committed 18 years ago

Commit 78b0c0b1 parent d4169dd1 file · +2 −97Browse files

Showing the changes to libavfilter/avfilter.c (1 of 1 file). Show all

Unified · Split

libavfilter/avfilter.c+2−97
@@ -31,70 +31,6 @@ · 30 unmodified lines
3131 static int filter_count = 0;
3232 static AVFilter **filters = NULL;
3333
34−/* TODO: buffer pool. see comment for avfilter_default_get_video_buffer() */
35−void avfilter_default_free_video_buffer(AVFilterPic *pic)
36−{
37− avpicture_free((AVPicture *) pic);
38− av_free(pic);
39−}
40−
41−/* TODO: set the buffer's priv member to a context structure for the whole
42− * filter chain. This will allow for a buffer pool instead of the constant
43− * alloc & free cycle currently implemented. */
44−AVFilterPicRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms)
45−{
46− AVFilterPic *pic = av_mallocz(sizeof(AVFilterPic));
47− AVFilterPicRef *ref = av_mallocz(sizeof(AVFilterPicRef));
48−
49− ref->pic = pic;
50− ref->w = link->w;
51− ref->h = link->h;
52− ref->perms = perms;
53−
54− pic->refcount = 1;
55− pic->format = link->format;
56− pic->free = avfilter_default_free_video_buffer;
57− avpicture_alloc((AVPicture *)pic, pic->format, ref->w, ref->h);
58−
59− memcpy(ref->data, pic->data, sizeof(pic->data));
60− memcpy(ref->linesize, pic->linesize, sizeof(pic->linesize));
61−
62− return ref;
63−}
64−
65−void avfilter_default_start_frame(AVFilterLink *link, AVFilterPicRef *picref)
66−{
67− AVFilterLink *out = NULL;
68−
69− if(link->dst->output_count)
70− out = link->dst->outputs[0];
71−
72− link->cur_pic = picref;
73−
74− if(out) {
75− out->outpic = avfilter_get_video_buffer(out, AV_PERM_WRITE);
76− out->outpic->pts = picref->pts;
77− avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
78− }
79−}
80−
81−void avfilter_default_end_frame(AVFilterLink *link)
82−{
83− AVFilterLink *out = NULL;
84−
85− if(link->dst->output_count)
86− out = link->dst->outputs[0];
87−
88− avfilter_unref_pic(link->cur_pic);
89− link->cur_pic = NULL;
90−
91− if(out) {
92− avfilter_unref_pic(out->outpic);
93− out->outpic = NULL;
94− avfilter_end_frame(out);
95− }
96−}
97−
9834 AVFilterPicRef *avfilter_ref_pic(AVFilterPicRef *ref, int pmask)
9935 {
10036 AVFilterPicRef *ret = av_malloc(sizeof(AVFilterPicRef));
@@ -111,37 +47,6 @@ void avfilter_unref_pic(AVFilterPicRef *ref) · 10 unmodified lines
11147 av_free(ref);
11248 }
11349
114−/**
115− * default config_link() implementation for output video links to simplify
116− * the implementation of one input one output video filters */
117−static int default_config_output_link(AVFilterLink *link)
118−{
119− if(link->src->input_count && link->src->inputs[0]) {
120− link->w = link->src->inputs[0]->w;
121− link->h = link->src->inputs[0]->h;
122− } else {
123− /* XXX: any non-simple filter which would cause this branch to be taken
124− * really should implement its own config_props() for this link. */
125− link->w =
126− link->h = 0;
127− }
128−
129− return 0;
130−}
131−
132−/**
133− * default query_formats() implementation for output video links to simplify
134− * the implementation of one input one output video filters */
135−static int *default_query_output_formats(AVFilterLink *link)
136−{
137− if(link->src->input_count && link->src->inputs[0])
138− return avfilter_make_format_list(1, link->src->inputs[0]->format);
139− else
140− /* XXX: any non-simple filter which would cause this branch to be taken
141− * really should implement its own query_formats() for this link */
142− return avfilter_make_format_list(0);
143−}
144−
14550 int avfilter_link(AVFilterContext *src, unsigned srcpad,
14651 AVFilterContext *dst, unsigned dstpad)
14752 {
@@ -166,7 +71,7 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, · 18 unmodified lines
16671 if(src->output_pads[srcpad].query_formats)
16772 fmts[0] = src->output_pads[srcpad].query_formats(link);
16873 else
169− fmts[0] = default_query_output_formats(link);
74+ fmts[0] = avfilter_default_query_output_formats(link);
17075 fmts[1] = dst->input_pads[dstpad].query_formats(link);
17176 for(i = 0; fmts[0][i] != -1; i ++)
17277 for(j = 0; fmts[1][j] != -1; j ++)
@@ -189,7 +94,7 @@ format_done: · 16 unmodified lines
18994 if (src->output_pads[srcpad].config_props)
19095 src->output_pads[srcpad].config_props(link);
19196 else
192− default_config_output_link(link);
97+ avfilter_default_config_output_link(link);
19398
19499 if (dst->input_pads[dstpad].config_props)
195100 dst->input_pads[dstpad].config_props(link);

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