History

Make avfilter_get_video_buffer() recursive.

When called on a link with a filter whose destination pad has not a get_video_buffer callback defined, it will call avfilter_get_video_buffer() on the first output link of the destination filer, rather than use avfilter_default_get_buffer(), so the video buffer can be allocated forward in the filterchain. Also add the w and h parameters to avfilter_get_video_buffer(), as the minimum width and height requested by each filter in the filterchain may change, this allows for example a memcpy-less pad filter. This change breaks API / ABI backward compatibility. See the thread: "[PATCH] Implement recusive avfilter_get_video_buffer()". Originally committed as revision 20272 to svn://svn.ffmpeg.org/ffmpeg/trunk

Stefano Sabatini committed 17 years ago

Commit 0eb4ff91 parent 1f09ab53 files · +21 −15Browse files

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

Unified · Split

libavfilter/avfilter.c+8−5
@@ -185,17 +185,20 @@ static void dprintf_link(void *ctx, AVFilterLink *link, int end) · 184 unmodified lines
185185
186186 #define DPRINTF_START(ctx, func) dprintf(NULL, "%-16s: ", #func)
187187
188−AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms)
188+AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
189189 {
190190 AVFilterPicRef *ret = NULL;
191191
192− DPRINTF_START(NULL, get_video_buffer); dprintf_link(NULL, link, 0); dprintf(NULL, " perms:%d\n", perms);
192+ DPRINTF_START(NULL, get_video_buffer); dprintf_link(NULL, link, 0); dprintf(NULL, " perms:%d w:%d h:%d\n", perms, w, h);
193193
194194 if(link_dpad(link).get_video_buffer)
195− ret = link_dpad(link).get_video_buffer(link, perms);
195+ ret = link_dpad(link).get_video_buffer(link, perms, w, h);
196+
197+ if(!ret && link->dst->output_count)
198+ ret = avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
196199
197200 if(!ret)
198− ret = avfilter_default_get_video_buffer(link, perms);
201+ ret = avfilter_default_get_video_buffer(link, perms, w, h);
199202
200203 DPRINTF_START(NULL, get_video_buffer); dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); dprintf_picref(NULL, ret, 1);
201204
@@ -251,7 +254,7 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref) · 49 unmodified lines
251254 link_dpad(link).min_perms, link_dpad(link).rej_perms);
252255 */
253256
254− link->cur_pic = avfilter_default_get_video_buffer(link, dst->min_perms);
257+ link->cur_pic = avfilter_default_get_video_buffer(link, dst->min_perms, link->w, link->h);
255258 link->srcpic = picref;
256259 link->cur_pic->pts = link->srcpic->pts;
257260 link->cur_pic->pixel_aspect = link->srcpic->pixel_aspect;

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