They are only useful inside filters and we don't allow user filters for now.
Showing the changes to libavfilter (18 of 18 files). Show all
Unified · Split
| @@ -573,19 +573,11 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad, · 572 unmodified lines | ||
| 573 | 573 | */ |
| 574 | 574 | int avfilter_config_links(AVFilterContext *filter); |
| 575 | 575 | |
| 576 | −/** | |
| 577 | − * Request a picture buffer with a specific set of permissions. | |
| 578 | − * | |
| 579 | − * @param link the output link to the filter from which the buffer will | |
| 580 | − * be requested | |
| 581 | − * @param perms the required access permissions | |
| 582 | − * @param w the minimum width of the buffer to allocate | |
| 583 | − * @param h the minimum height of the buffer to allocate | |
| 584 | − * @return A reference to the buffer. This must be unreferenced with | |
| 585 | − * avfilter_unref_buffer when you are finished with it. | |
| 586 | − */ | |
| 576 | +#if FF_API_FILTERS_PUBLIC | |
| 577 | +attribute_deprecated | |
| 587 | 578 | AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, |
| 588 | 579 | int w, int h); |
| 580 | +#endif | |
| 589 | 581 | |
| 590 | 582 | /** |
| 591 | 583 | * Create a buffer reference wrapped around an already allocated image |
| @@ -109,8 +109,8 @@ int av_buffersrc_write_frame(AVFilterContext *buffer_filter, AVFrame *frame) · 108 unmodified lines | ||
| 109 | 109 | case AVMEDIA_TYPE_VIDEO: |
| 110 | 110 | CHECK_VIDEO_PARAM_CHANGE(buffer_filter, c, frame->width, frame->height, |
| 111 | 111 | frame->format); |
| 112 | − buf = avfilter_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE, | |
| 113 | − c->w, c->h); | |
| 112 | + buf = ff_get_video_buffer(buffer_filter->outputs[0], AV_PERM_WRITE, | |
| 113 | + c->w, c->h); | |
| 114 | 114 | av_image_copy(buf->data, buf->linesize, frame->data, frame->linesize, |
| 115 | 115 | c->pix_fmt, c->w, c->h); |
| 116 | 116 | break; |
| @@ -219,8 +219,8 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) · 218 unmodified lines | ||
| 219 | 219 | AVFilterBufferRef *outpicref; |
| 220 | 220 | |
| 221 | 221 | if (inpicref->perms & AV_PERM_PRESERVE) { |
| 222 | − outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, | |
| 223 | − outlink->w, outlink->h); | |
| 222 | + outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE, | |
| 223 | + outlink->w, outlink->h); | |
| 224 | 224 | avfilter_copy_buffer_ref_props(outpicref, inpicref); |
| 225 | 225 | outpicref->video->w = outlink->w; |
| 226 | 226 | outpicref->video->h = outlink->h; |
| @@ -112,7 +112,7 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, int · 111 unmodified lines | ||
| 112 | 112 | AVFilterContext *ctx = inlink->dst; |
| 113 | 113 | AVFilterLink *outlink = ctx->outputs[0]; |
| 114 | 114 | |
| 115 | − return avfilter_get_video_buffer(outlink, perms, w, h); | |
| 115 | + return ff_get_video_buffer(outlink, perms, w, h); | |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) |
| @@ -432,7 +432,7 @@ static int source_config_props(AVFilterLink *outlink) · 431 unmodified lines | ||
| 432 | 432 | static int source_request_frame(AVFilterLink *outlink) |
| 433 | 433 | { |
| 434 | 434 | Frei0rContext *frei0r = outlink->src->priv; |
| 435 | − AVFilterBufferRef *picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); | |
| 435 | + AVFilterBufferRef *picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); | |
| 436 | 436 | picref->video->pixel_aspect = (AVRational) {1, 1}; |
| 437 | 437 | picref->pts = frei0r->pts++; |
| 438 | 438 | picref->pos = -1; |
| @@ -190,7 +190,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) · 189 unmodified lines | ||
| 190 | 190 | AVFilterBufferRef *outpicref; |
| 191 | 191 | |
| 192 | 192 | if (inpicref->perms & AV_PERM_PRESERVE) { |
| 193 | − outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); | |
| 193 | + outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); | |
| 194 | 194 | avfilter_copy_buffer_ref_props(outpicref, inpicref); |
| 195 | 195 | outpicref->video->w = outlink->w; |
| 196 | 196 | outpicref->video->h = outlink->h; |
| @@ -205,7 +205,7 @@ static int config_output(AVFilterLink *outlink) · 204 unmodified lines | ||
| 205 | 205 | |
| 206 | 206 | static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, int w, int h) |
| 207 | 207 | { |
| 208 | − return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h); | |
| 208 | + return ff_get_video_buffer(link->dst->outputs[0], perms, w, h); | |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) |
| @@ -256,9 +256,9 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, int · 255 unmodified lines | ||
| 256 | 256 | { |
| 257 | 257 | PadContext *pad = inlink->dst->priv; |
| 258 | 258 | |
| 259 | − AVFilterBufferRef *picref = avfilter_get_video_buffer(inlink->dst->outputs[0], perms, | |
| 260 | − w + (pad->w - pad->in_w), | |
| 261 | − h + (pad->h - pad->in_h)); | |
| 259 | + AVFilterBufferRef *picref = ff_get_video_buffer(inlink->dst->outputs[0], perms, | |
| 260 | + w + (pad->w - pad->in_w), | |
| 261 | + h + (pad->h - pad->in_h)); | |
| 262 | 262 | int plane; |
| 263 | 263 | |
| 264 | 264 | picref->video->w = w; |
| @@ -327,9 +327,9 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) · 62 unmodified lines | ||
| 327 | 327 | if(pad->needs_copy){ |
| 328 | 328 | av_log(inlink->dst, AV_LOG_DEBUG, "Direct padding impossible allocating new frame\n"); |
| 329 | 329 | avfilter_unref_buffer(outpicref); |
| 330 | − outpicref = avfilter_get_video_buffer(inlink->dst->outputs[0], AV_PERM_WRITE | AV_PERM_NEG_LINESIZES, | |
| 331 | − FFMAX(inlink->w, pad->w), | |
| 332 | − FFMAX(inlink->h, pad->h)); | |
| 330 | + outpicref = ff_get_video_buffer(inlink->dst->outputs[0], AV_PERM_WRITE | AV_PERM_NEG_LINESIZES, | |
| 331 | + FFMAX(inlink->w, pad->w), | |
| 332 | + FFMAX(inlink->h, pad->h)); | |
| 333 | 333 | avfilter_copy_buffer_ref_props(outpicref, inpicref); |
| 334 | 334 | } |
| 335 | 335 | |
| @@ -57,8 +57,8 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 56 unmodified lines | ||
| 57 | 57 | AVFilterBufferRef *outpicref; |
| 58 | 58 | int i; |
| 59 | 59 | |
| 60 | − outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, | |
| 61 | − outlink->w, outlink->h); | |
| 60 | + outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, | |
| 61 | + outlink->w, outlink->h); | |
| 62 | 62 | outpicref = outlink->out_buf; |
| 63 | 63 | avfilter_copy_buffer_ref_props(outpicref, picref); |
| 64 | 64 | |
| @@ -265,7 +265,7 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 264 unmodified lines | ||
| 265 | 265 | scale->hsub = av_pix_fmt_descriptors[link->format].log2_chroma_w; |
| 266 | 266 | scale->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; |
| 267 | 267 | |
| 268 | − outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); | |
| 268 | + outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); | |
| 269 | 269 | avfilter_copy_buffer_ref_props(outpicref, picref); |
| 270 | 270 | outpicref->video->w = outlink->w; |
| 271 | 271 | outpicref->video->h = outlink->h; |
| @@ -120,8 +120,8 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 119 unmodified lines | ||
| 120 | 120 | { |
| 121 | 121 | AVFilterLink *outlink = inlink->dst->outputs[0]; |
| 122 | 122 | |
| 123 | − outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, | |
| 124 | − outlink->w, outlink->h); | |
| 123 | + outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, | |
| 124 | + outlink->w, outlink->h); | |
| 125 | 125 | outlink->out_buf->pts = picref->pts; |
| 126 | 126 | |
| 127 | 127 | if (picref->video->pixel_aspect.num == 0) { |
| @@ -50,7 +50,7 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, · 49 unmodified lines | ||
| 50 | 50 | if (!(perms & AV_PERM_NEG_LINESIZES)) |
| 51 | 51 | return ff_default_get_video_buffer(link, perms, w, h); |
| 52 | 52 | |
| 53 | − picref = avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h); | |
| 53 | + picref = ff_get_video_buffer(link->dst->outputs[0], perms, w, h); | |
| 54 | 54 | for (i = 0; i < 4; i ++) { |
| 55 | 55 | int vsub = i == 1 || i == 2 ? flip->vsub : 0; |
| 56 | 56 | |
| @@ -208,8 +208,8 @@ static void return_frame(AVFilterContext *ctx, int is_second) · 207 unmodified lines | ||
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | if (is_second) { |
| 211 | − yadif->out = avfilter_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE | | |
| 212 | − AV_PERM_REUSE, link->w, link->h); | |
| 211 | + yadif->out = ff_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE | | |
| 212 | + AV_PERM_REUSE, link->w, link->h); | |
| 213 | 213 | avfilter_copy_buffer_ref_props(yadif->out, yadif->cur); |
| 214 | 214 | yadif->out->video->interlaced = 0; |
| 215 | 215 | } |
| @@ -268,8 +268,8 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 52 unmodified lines | ||
| 268 | 268 | if (!yadif->prev) |
| 269 | 269 | yadif->prev = avfilter_ref_buffer(yadif->cur, AV_PERM_READ); |
| 270 | 270 | |
| 271 | − yadif->out = avfilter_get_video_buffer(ctx->outputs[0], AV_PERM_WRITE | AV_PERM_PRESERVE | | |
| 272 | − AV_PERM_REUSE, link->w, link->h); | |
| 271 | + yadif->out = ff_get_video_buffer(ctx->outputs[0], AV_PERM_WRITE | AV_PERM_PRESERVE | | |
| 272 | + AV_PERM_REUSE, link->w, link->h); | |
| 273 | 273 | |
| 274 | 274 | avfilter_copy_buffer_ref_props(yadif->out, yadif->cur); |
| 275 | 275 | yadif->out->video->interlaced = 0; |
| @@ -67,7 +67,7 @@ static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) · 66 unmodified lines | ||
| 67 | 67 | |
| 68 | 68 | AVFilterBufferRef *ff_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h) |
| 69 | 69 | { |
| 70 | − return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h); | |
| 70 | + return ff_get_video_buffer(link->dst->outputs[0], perms, w, h); | |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /* TODO: set the buffer's priv member to a context structure for the whole |
| @@ -138,7 +138,7 @@ fail: · 64 unmodified lines | ||
| 138 | 138 | return NULL; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | −AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) | |
| 141 | +AVFilterBufferRef *ff_get_video_buffer(AVFilterLink *link, int perms, int w, int h) | |
| 142 | 142 | { |
| 143 | 143 | AVFilterBufferRef *ret = NULL; |
| 144 | 144 | |
| @@ -173,7 +173,7 @@ static void default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 28 unmodified lines | ||
| 173 | 173 | outlink = inlink->dst->outputs[0]; |
| 174 | 174 | |
| 175 | 175 | if (outlink) { |
| 176 | − outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); | |
| 176 | + outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); | |
| 177 | 177 | avfilter_copy_buffer_ref_props(outlink->out_buf, picref); |
| 178 | 178 | ff_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0)); |
| 179 | 179 | } |
| @@ -201,7 +201,7 @@ void ff_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 21 unmodified lines | ||
| 201 | 201 | picref->perms, |
| 202 | 202 | link->dstpad->min_perms, link->dstpad->rej_perms); |
| 203 | 203 | |
| 204 | − link->cur_buf = avfilter_get_video_buffer(link, dst->min_perms, link->w, link->h); | |
| 204 | + link->cur_buf = ff_get_video_buffer(link, dst->min_perms, link->w, link->h); | |
| 205 | 205 | link->src_buf = picref; |
| 206 | 206 | avfilter_copy_buffer_ref_props(link->cur_buf, link->src_buf); |
| 207 | 207 | } |
| @@ -354,4 +354,8 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) · 146 unmodified lines | ||
| 354 | 354 | { |
| 355 | 355 | ff_draw_slice(link, y, h, slice_dir); |
| 356 | 356 | } |
| 357 | +AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) | |
| 358 | +{ | |
| 359 | + return ff_get_video_buffer(link, perms, w, h); | |
| 360 | +} | |
| 357 | 361 | #endif |
| @@ -25,6 +25,20 @@ AVFilterBufferRef *ff_default_get_video_buffer(AVFilterLink *link, · 24 unmodified lines | ||
| 25 | 25 | int perms, int w, int h); |
| 26 | 26 | AVFilterBufferRef *ff_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h); |
| 27 | 27 | |
| 28 | +/** | |
| 29 | + * Request a picture buffer with a specific set of permissions. | |
| 30 | + * | |
| 31 | + * @param link the output link to the filter from which the buffer will | |
| 32 | + * be requested | |
| 33 | + * @param perms the required access permissions | |
| 34 | + * @param w the minimum width of the buffer to allocate | |
| 35 | + * @param h the minimum height of the buffer to allocate | |
| 36 | + * @return A reference to the buffer. This must be unreferenced with | |
| 37 | + * avfilter_unref_buffer when you are finished with it. | |
| 38 | + */ | |
| 39 | +AVFilterBufferRef *ff_get_video_buffer(AVFilterLink *link, int perms, | |
| 40 | + int w, int h); | |
| 41 | + | |
| 28 | 42 | void ff_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref); |
| 29 | 43 | void ff_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir); |
| 30 | 44 | void ff_null_end_frame(AVFilterLink *link); |
| @@ -140,7 +140,7 @@ static int color_config_props(AVFilterLink *inlink) · 139 unmodified lines | ||
| 140 | 140 | static int color_request_frame(AVFilterLink *link) |
| 141 | 141 | { |
| 142 | 142 | ColorContext *color = link->src->priv; |
| 143 | − AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h); | |
| 143 | + AVFilterBufferRef *picref = ff_get_video_buffer(link, AV_PERM_WRITE, color->w, color->h); | |
| 144 | 144 | picref->video->pixel_aspect = (AVRational) {1, 1}; |
| 145 | 145 | picref->pts = color->pts++; |
| 146 | 146 | picref->pos = -1; |
| @@ -237,8 +237,8 @@ static int movie_get_frame(AVFilterLink *outlink) · 236 unmodified lines | ||
| 237 | 237 | |
| 238 | 238 | if (frame_decoded) { |
| 239 | 239 | /* FIXME: avoid the memcpy */ |
| 240 | − movie->picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE | AV_PERM_PRESERVE | | |
| 241 | − AV_PERM_REUSE2, outlink->w, outlink->h); | |
| 240 | + movie->picref = ff_get_video_buffer(outlink, AV_PERM_WRITE | AV_PERM_PRESERVE | | |
| 241 | + AV_PERM_REUSE2, outlink->w, outlink->h); | |
| 242 | 242 | av_image_copy(movie->picref->data, movie->picref->linesize, |
| 243 | 243 | movie->frame->data, movie->frame->linesize, |
| 244 | 244 | movie->picref->format, outlink->w, outlink->h); |
| @@ -132,8 +132,7 @@ static int request_frame(AVFilterLink *outlink) · 131 unmodified lines | ||
| 132 | 132 | |
| 133 | 133 | if (test->max_pts >= 0 && test->pts > test->max_pts) |
| 134 | 134 | return AVERROR_EOF; |
| 135 | − picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, | |
| 136 | − test->w, test->h); | |
| 135 | + picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, test->w, test->h); | |
| 137 | 136 | picref->pts = test->pts++; |
| 138 | 137 | picref->pos = -1; |
| 139 | 138 | picref->video->key_frame = 1; |