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
185 185
186#define DPRINTF_START(ctx, func) dprintf(NULL, "%-16s: ", #func)186#define DPRINTF_START(ctx, func) dprintf(NULL, "%-16s: ", #func)
187 187
188AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms)188AVFilterPicRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
189{189{
190 AVFilterPicRef *ret = NULL;190 AVFilterPicRef *ret = NULL;
191 191
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);
193 193
194 if(link_dpad(link).get_video_buffer)194 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);
196 199
197 if(!ret)200 if(!ret)
198 ret = avfilter_default_get_video_buffer(link, perms);201 ret = avfilter_default_get_video_buffer(link, perms, w, h);
199 202
200 DPRINTF_START(NULL, get_video_buffer); dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); dprintf_picref(NULL, ret, 1);203 DPRINTF_START(NULL, get_video_buffer); dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); dprintf_picref(NULL, ret, 1);
201 204
@@ -251,7 +254,7 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterPicRef *picref) · 49 unmodified lines
251 link_dpad(link).min_perms, link_dpad(link).rej_perms);254 link_dpad(link).min_perms, link_dpad(link).rej_perms);
252 */255 */
253 256
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);
255 link->srcpic = picref;258 link->srcpic = picref;
256 link->cur_pic->pts = link->srcpic->pts;259 link->cur_pic->pts = link->srcpic->pts;
257 link->cur_pic->pixel_aspect = link->srcpic->pixel_aspect;260 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