lavfi: update some deprecated functions

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2012-06-16 09:47:46 +00:00
parent 0354412aa3
commit c9e183b490
34 changed files with 145 additions and 125 deletions

View File

@ -75,14 +75,14 @@ static int query_formats(AVFilterContext *ctx)
AVFilterLink *outlink = ctx->outputs[0];
AVFilterChannelLayouts *layouts;
avfilter_formats_ref(avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO),
ff_formats_ref(avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO),
&inlink->out_formats);
if (aconvert->out_sample_fmt != AV_SAMPLE_FMT_NONE) {
formats = NULL;
avfilter_add_format(&formats, aconvert->out_sample_fmt);
avfilter_formats_ref(formats, &outlink->in_formats);
ff_add_format(&formats, aconvert->out_sample_fmt);
ff_formats_ref(formats, &outlink->in_formats);
} else
avfilter_formats_ref(avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO),
ff_formats_ref(avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO),
&outlink->in_formats);
ff_channel_layouts_ref(ff_all_channel_layouts(),

View File

@ -119,8 +119,8 @@ static int query_formats(AVFilterContext *ctx)
if ((inlayout[i] >> c) & 1)
*(route[i]++) = out_ch_number++;
}
formats = avfilter_make_format_list(ff_packed_sample_fmts_array);
avfilter_set_common_sample_formats(ctx, formats);
formats = ff_make_format_list(ff_packed_sample_fmts_array);
ff_set_common_formats(ctx, formats);
for (i = 0; i < am->nb_inputs; i++) {
layouts = NULL;
ff_add_channel_layout(&layouts, inlayout[i]);
@ -315,7 +315,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
.min_perms = AV_PERM_READ | AV_PERM_PRESERVE,
};
snprintf(name, sizeof(name), "in%d", i);
avfilter_insert_inpad(ctx, i, &pad);
ff_insert_inpad(ctx, i, &pad);
}
return 0;
}

View File

@ -91,29 +91,29 @@ static int query_formats(AVFilterContext *ctx)
AVFilterLink *inlink = ctx->inputs[0];
AVFilterLink *outlink = ctx->outputs[0];
AVFilterFormats *in_formats = avfilter_all_formats(AVMEDIA_TYPE_AUDIO);
AVFilterFormats *in_formats = ff_all_formats(AVMEDIA_TYPE_AUDIO);
AVFilterFormats *out_formats;
AVFilterFormats *in_samplerates = ff_all_samplerates();
AVFilterFormats *out_samplerates;
AVFilterChannelLayouts *in_layouts = ff_all_channel_layouts();
AVFilterChannelLayouts *out_layouts;
avfilter_formats_ref (in_formats, &inlink->out_formats);
avfilter_formats_ref (in_samplerates, &inlink->out_samplerates);
ff_formats_ref (in_formats, &inlink->out_formats);
ff_formats_ref (in_samplerates, &inlink->out_samplerates);
ff_channel_layouts_ref(in_layouts, &inlink->out_channel_layouts);
if(out_rate > 0) {
out_samplerates = avfilter_make_format_list((int[]){ out_rate, -1 });
out_samplerates = ff_make_format_list((int[]){ out_rate, -1 });
} else {
out_samplerates = ff_all_samplerates();
}
avfilter_formats_ref(out_samplerates, &outlink->in_samplerates);
ff_formats_ref(out_samplerates, &outlink->in_samplerates);
if(out_format != AV_SAMPLE_FMT_NONE) {
out_formats = avfilter_make_format_list((int[]){ out_format, -1 });
out_formats = ff_make_format_list((int[]){ out_format, -1 });
} else
out_formats = avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO);
avfilter_formats_ref(out_formats, &outlink->in_formats);
ff_formats_ref(out_formats, &outlink->in_formats);
if(out_layout) {
out_layouts = avfilter_make_format64_list((int64_t[]){ out_layout, -1 });

View File

@ -85,11 +85,11 @@ static int query_formats(AVFilterContext *ctx)
for (i = 0; i < 2; i++) {
formats = ctx->inputs[i]->in_formats;
avfilter_formats_ref(formats, &ctx->inputs[i]->out_formats);
avfilter_formats_ref(formats, &ctx->outputs[i]->in_formats);
ff_formats_ref(formats, &ctx->inputs[i]->out_formats);
ff_formats_ref(formats, &ctx->outputs[i]->in_formats);
rates = ff_all_samplerates();
avfilter_formats_ref(rates, &ctx->inputs[i]->out_samplerates);
avfilter_formats_ref(rates, &ctx->outputs[i]->in_samplerates);
ff_formats_ref(rates, &ctx->inputs[i]->out_samplerates);
ff_formats_ref(rates, &ctx->outputs[i]->in_samplerates);
layouts = ctx->inputs[i]->in_channel_layouts;
ff_channel_layouts_ref(layouts, &ctx->inputs[i]->out_channel_layouts);
ff_channel_layouts_ref(layouts, &ctx->outputs[i]->in_channel_layouts);

View File

@ -82,11 +82,11 @@ static int query_formats(AVFilterContext *ctx)
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layout = NULL;
avfilter_add_format(&formats, AV_SAMPLE_FMT_S16);
avfilter_set_common_sample_formats(ctx, formats);
ff_add_format(&formats, AV_SAMPLE_FMT_S16);
ff_set_common_formats(ctx, formats);
ff_add_channel_layout(&layout, AV_CH_LAYOUT_STEREO);
ff_set_common_channel_layouts(ctx, layout);
ff_set_common_samplerates(ctx, avfilter_make_format_list(sample_rates));
ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates));
return 0;
}

View File

@ -217,7 +217,7 @@ static int query_formats(AVFilterContext *ctx)
pan->pure_gains = are_gains_pure(pan);
/* libswr supports any sample and packing formats */
avfilter_set_common_sample_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO));
ff_set_common_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO));
formats = ff_all_samplerates();
if (!formats)

View File

@ -137,10 +137,10 @@ static int query_formats(AVFilterContext *ctx)
return AVERROR(ENOMEM);
ff_set_common_channel_layouts(ctx, layouts);
formats = avfilter_make_format_list(sample_fmts);
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
avfilter_set_common_sample_formats(ctx, formats);
ff_set_common_formats(ctx, formats);
formats = ff_all_samplerates();
if (!formats)

View File

@ -97,10 +97,10 @@ static int query_formats(AVFilterContext *ctx)
return AVERROR(ENOMEM);
ff_set_common_channel_layouts(ctx, layouts);
formats = avfilter_make_format_list(sample_fmts);
formats = ff_make_format_list(sample_fmts);
if (!formats)
return AVERROR(ENOMEM);
avfilter_set_common_sample_formats(ctx, formats);
ff_set_common_formats(ctx, formats);
formats = ff_all_samplerates();
if (!formats)

View File

@ -199,9 +199,9 @@ static int query_formats(AVFilterContext *ctx)
int64_t chlayouts[] = { eval->chlayout, -1 };
int sample_rates[] = { eval->sample_rate, -1 };
avfilter_set_common_sample_formats (ctx, avfilter_make_format_list(sample_fmts));
ff_set_common_formats (ctx, ff_make_format_list(sample_fmts));
ff_set_common_channel_layouts(ctx, avfilter_make_format64_list(chlayouts));
ff_set_common_samplerates(ctx, avfilter_make_format_list(sample_rates));
ff_set_common_samplerates(ctx, ff_make_format_list(sample_rates));
return 0;
}

View File

@ -189,7 +189,7 @@ static int filter_query_formats(AVFilterContext *ctx)
formats = avfilter_make_all_formats(type);
if (!formats)
return AVERROR(ENOMEM);
avfilter_set_common_formats(ctx, formats);
ff_set_common_formats(ctx, formats);
if (type == AVMEDIA_TYPE_AUDIO) {
samplerates = ff_all_samplerates();
if (!samplerates)
@ -231,9 +231,9 @@ static int insert_conv_filter(AVFilterGraph *graph, AVFilterLink *link,
filter_query_formats(filt_ctx);
if ( ((link = filt_ctx-> inputs[0]) &&
!avfilter_merge_formats(link->in_formats, link->out_formats)) ||
!ff_merge_formats(link->in_formats, link->out_formats)) ||
((link = filt_ctx->outputs[0]) &&
!avfilter_merge_formats(link->in_formats, link->out_formats))
!ff_merge_formats(link->in_formats, link->out_formats))
) {
av_log(NULL, AV_LOG_ERROR,
"Impossible to convert between the formats supported by the filter "
@ -295,7 +295,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
return AVERROR(EINVAL);
if (link->type == AVMEDIA_TYPE_VIDEO &&
!avfilter_merge_formats(link->in_formats, link->out_formats)) {
!ff_merge_formats(link->in_formats, link->out_formats)) {
/* couldn't merge format lists, auto-insert scale filter */
snprintf(filt_args, sizeof(filt_args), "0:0:%s",
@ -310,7 +310,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
/* Merge all three list before checking: that way, in all
* three categories, aconvert will use a common format
* whenever possible. */
formats = avfilter_merge_formats(link->in_formats, link->out_formats);
formats = ff_merge_formats(link->in_formats, link->out_formats);
chlayouts = ff_merge_channel_layouts(link->in_channel_layouts , link->out_channel_layouts);
samplerates = ff_merge_samplerates (link->in_samplerates, link->out_samplerates);

View File

@ -34,13 +34,11 @@ static void set_common_formats(AVFilterContext *ctx, AVFilterFormats *fmts,
int i;
for (i = 0; i < ctx->input_count; i++)
if (ctx->inputs[i] && ctx->inputs[i]->type == type)
avfilter_formats_ref(fmts,
(AVFilterFormats **)((uint8_t *)ctx->inputs[i]+offout));
ff_formats_ref(fmts, (AVFilterFormats **)((uint8_t *)ctx->inputs[i]+offout));
for (i = 0; i < ctx->output_count; i++)
if (ctx->outputs[i] && ctx->outputs[i]->type == type)
avfilter_formats_ref(fmts,
(AVFilterFormats **)((uint8_t *)ctx->outputs[i]+offin));
ff_formats_ref(fmts, (AVFilterFormats **)((uint8_t *)ctx->outputs[i]+offin));
if (!fmts->refcount) {
av_free(fmts->formats);

View File

@ -23,6 +23,7 @@
#include "libavutil/colorspace.h"
#include "libavutil/pixdesc.h"
#include "drawutils.h"
#include "formats.h"
enum { RED = 0, GREEN, BLUE, ALPHA };
@ -505,7 +506,7 @@ AVFilterFormats *ff_draw_supported_pixel_formats(unsigned flags)
if (ff_draw_init(&draw, i, flags) >= 0)
pix_fmts[n++] = i;
pix_fmts[n++] = PIX_FMT_NONE;
return avfilter_make_format_list(pix_fmts);
return ff_make_format_list(pix_fmts);
}
#ifdef TEST

View File

@ -299,7 +299,7 @@ AVFilterFormats *avfilter_make_all_packing_formats(void)
-1,
};
return avfilter_make_format_list(packing);
return ff_make_format_list(packing);
}
#endif

View File

@ -152,7 +152,7 @@ int av_buffersink_poll_frame(AVFilterContext *ctx)
BufferSinkContext *buf = ctx->priv;
AVFilterLink *inlink = ctx->inputs[0];
return av_fifo_size(buf->fifo)/sizeof(AVFilterBufferRef *) + avfilter_poll_frame(inlink);
return av_fifo_size(buf->fifo)/sizeof(AVFilterBufferRef *) + ff_poll_frame(inlink);
}
#if FF_API_OLD_VSINK_API
@ -201,9 +201,9 @@ static int vsink_query_formats(AVFilterContext *ctx)
BufferSinkContext *buf = ctx->priv;
if (buf->pixel_fmts)
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(buf->pixel_fmts));
ff_set_common_formats(ctx, ff_make_format_list(buf->pixel_fmts));
else
avfilter_default_query_formats(ctx);
ff_default_query_formats(ctx);
return 0;
}
@ -272,9 +272,9 @@ static int asink_query_formats(AVFilterContext *ctx)
AVFilterFormats *formats = NULL;
AVFilterChannelLayouts *layouts = NULL;
if (!(formats = avfilter_make_format_list(buf->sample_fmts)))
if (!(formats = ff_make_format_list(buf->sample_fmts)))
return AVERROR(ENOMEM);
avfilter_set_common_sample_formats(ctx, formats);
ff_set_common_formats(ctx, formats);
if (!(layouts = avfilter_make_format64_list(buf->channel_layouts)))
return AVERROR(ENOMEM);

View File

@ -371,8 +371,8 @@ static int amovie_query_formats(AVFilterContext *ctx)
int64_t chlayouts[] = { c->channel_layout ? c->channel_layout :
av_get_default_channel_layout(c->channels), -1 };
avfilter_set_common_sample_formats (ctx, avfilter_make_format_list(sample_fmts));
ff_set_common_samplerates (ctx, avfilter_make_format_list(sample_rates));
ff_set_common_formats (ctx, ff_make_format_list(sample_fmts));
ff_set_common_samplerates (ctx, ff_make_format_list(sample_rates));
ff_set_common_channel_layouts(ctx, avfilter_make_format64_list(chlayouts));
return 0;

View File

@ -52,7 +52,7 @@ static int query_formats(AVFilterContext *ctx)
PIX_FMT_NONE,
};
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@ -87,7 +87,7 @@ static void end_frame(AVFilterLink *inlink)
bbox->frame++;
avfilter_unref_buffer(picref);
avfilter_end_frame(inlink->dst->outputs[0]);
ff_end_frame(inlink->dst->outputs[0]);
}
AVFilter avfilter_vf_bbox = {
@ -100,7 +100,7 @@ AVFilter avfilter_vf_bbox = {
.inputs = (const AVFilterPad[]) {
{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.get_video_buffer = avfilter_null_get_video_buffer,
.get_video_buffer = ff_null_get_video_buffer,
.start_frame = ff_null_start_frame_keep_ref,
.end_frame = end_frame,
.min_perms = AV_PERM_READ, },

View File

@ -79,7 +79,7 @@ static int query_formats(AVFilterContext *ctx)
PIX_FMT_NONE
};
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@ -134,7 +134,7 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
p += picref->linesize[0];
}
avfilter_draw_slice(ctx->outputs[0], y, h, slice_dir);
ff_draw_slice(ctx->outputs[0], y, h, slice_dir);
}
static void end_frame(AVFilterLink *inlink)
@ -176,7 +176,7 @@ static void end_frame(AVFilterLink *inlink)
blackdetect->frame_count++;
blackdetect->nb_black_pixels = 0;
avfilter_unref_buffer(picref);
avfilter_end_frame(inlink->dst->outputs[0]);
ff_end_frame(inlink->dst->outputs[0]);
}
AVFilter avfilter_vf_blackdetect = {
@ -191,7 +191,7 @@ AVFilter avfilter_vf_blackdetect = {
.type = AVMEDIA_TYPE_VIDEO,
.config_props = config_input,
.draw_slice = draw_slice,
.get_video_buffer = avfilter_null_get_video_buffer,
.get_video_buffer = ff_null_get_video_buffer,
.start_frame = ff_null_start_frame_keep_ref,
.end_frame = end_frame, },
{ .name = NULL }

View File

@ -31,6 +31,8 @@
#include <strings.h>
#include <float.h>
#include "avfilter.h"
#include "formats.h"
#include "video.h"
#include "libavutil/pixdesc.h"
#include "libavutil/avstring.h"
@ -325,7 +327,7 @@ static int query_formats(AVFilterContext *ctx)
PIX_FMT_NONE
};
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@ -333,7 +335,7 @@ static int query_formats(AVFilterContext *ctx)
static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, int w, int h)
{
AVFilterBufferRef *picref =
avfilter_get_video_buffer(inlink->dst->outputs[0], perms, w, h);
ff_get_video_buffer(inlink->dst->outputs[0], perms, w, h);
return picref;
}
@ -343,7 +345,7 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
link->dst->outputs[0]->out_buf = outpicref;
avfilter_start_frame(link->dst->outputs[0], outpicref);
ff_start_frame(link->dst->outputs[0], outpicref);
}
static void end_frame(AVFilterLink *link)
@ -359,8 +361,8 @@ static void end_frame(AVFilterLink *link)
else
process_frame_uyvy422(color, out, link->cur_buf);
avfilter_draw_slice(ctx->outputs[0], 0, link->dst->outputs[0]->h, 1);
avfilter_end_frame(ctx->outputs[0]);
ff_draw_slice(ctx->outputs[0], 0, link->dst->outputs[0]->h, 1);
ff_end_frame(ctx->outputs[0]);
avfilter_unref_buffer(link->cur_buf);
}

View File

@ -50,6 +50,8 @@
*/
#include "avfilter.h"
#include "formats.h"
#include "video.h"
#include "libavutil/common.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
@ -390,7 +392,7 @@ static int query_formats(AVFilterContext *ctx)
PIX_FMT_YUVJ444P, PIX_FMT_YUVJ440P, PIX_FMT_NONE
};
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@ -525,8 +527,8 @@ static void end_frame(AVFilterLink *link)
deshake->ref = in;
// Draw the transformed frame information
avfilter_draw_slice(link->dst->outputs[0], 0, link->h, 1);
avfilter_end_frame(link->dst->outputs[0]);
ff_draw_slice(link->dst->outputs[0], 0, link->h, 1);
ff_end_frame(link->dst->outputs[0]);
avfilter_unref_buffer(out);
}

View File

@ -88,14 +88,14 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
AVFilterLink *outlink = inlink->dst->outputs[0];
outlink->out_buf =
avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
avfilter_copy_buffer_ref_props(outlink->out_buf, picref);
/* copy palette if required */
if (av_pix_fmt_descriptors[inlink->format].flags & PIX_FMT_PAL)
memcpy(inlink->dst->outputs[0]->out_buf->data[1], picref->data[1], AVPALETTE_SIZE);
avfilter_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
ff_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
}
static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)

View File

@ -22,6 +22,7 @@
#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "internal.h"
#undef NDEBUG
#include <assert.h>
@ -185,7 +186,7 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
if (!idet->prev)
idet->prev = avfilter_ref_buffer(idet->cur, AV_PERM_READ);
avfilter_start_frame(ctx->outputs[0], avfilter_ref_buffer(idet->cur, AV_PERM_READ));
ff_start_frame(ctx->outputs[0], avfilter_ref_buffer(idet->cur, AV_PERM_READ));
}
static void end_frame(AVFilterLink *link)
@ -203,8 +204,8 @@ static void end_frame(AVFilterLink *link)
filter(ctx);
avfilter_draw_slice(ctx->outputs[0], 0, link->h, 1);
avfilter_end_frame(ctx->outputs[0]);
ff_draw_slice(ctx->outputs[0], 0, link->h, 1);
ff_end_frame(ctx->outputs[0]);
}
static int request_frame(AVFilterLink *link)
@ -227,12 +228,12 @@ static int poll_frame(AVFilterLink *link)
IDETContext *idet = link->src->priv;
int ret, val;
val = avfilter_poll_frame(link->src->inputs[0]);
val = ff_poll_frame(link->src->inputs[0]);
if (val >= 1 && !idet->next) { //FIXME change API to not requre this red tape
if ((ret = avfilter_request_frame(link->src->inputs[0])) < 0)
return ret;
val = avfilter_poll_frame(link->src->inputs[0]);
val = ff_poll_frame(link->src->inputs[0]);
}
assert(idet->next || !val);
@ -286,7 +287,7 @@ static int query_formats(AVFilterContext *ctx)
PIX_FMT_NONE
};
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}

View File

@ -71,6 +71,8 @@
#include "libavutil/imgutils.h"
#include "avfilter.h"
#include "formats.h"
#include "video.h"
#include "bbox.h"
#include "lavfutils.h"
#include "lswsutils.h"
@ -190,7 +192,7 @@ static void convert_mask_to_strength_mask(uint8_t *data, int linesize,
static int query_formats(AVFilterContext *ctx)
{
enum PixelFormat pix_fmts[] = { PIX_FMT_YUV420P, PIX_FMT_NONE };
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@ -476,7 +478,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
AVFilterBufferRef *outpicref;
if (inpicref->perms & AV_PERM_PRESERVE) {
outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE,
outlink->w, outlink->h);
avfilter_copy_buffer_ref_props(outpicref, inpicref);
outpicref->video->w = outlink->w;
@ -485,7 +487,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
outpicref = inpicref;
outlink->out_buf = outpicref;
avfilter_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0));
ff_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0));
}
static void end_frame(AVFilterLink *inlink)
@ -512,8 +514,8 @@ static void end_frame(AVFilterLink *inlink)
removelogo->half_mask_data, inlink->w/2,
inlink->w/2, inlink->h/2, direct, &removelogo->half_mask_bbox);
avfilter_draw_slice(outlink, 0, inlink->h, 1);
avfilter_end_frame(outlink);
ff_draw_slice(outlink, 0, inlink->h, 1);
ff_end_frame(outlink);
avfilter_unref_buffer(inpicref);
if (!direct)
avfilter_unref_buffer(outpicref);
@ -554,7 +556,7 @@ AVFilter avfilter_vf_removelogo = {
.inputs = (const AVFilterPad[]) {
{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.get_video_buffer = avfilter_null_get_video_buffer,
.get_video_buffer = ff_null_get_video_buffer,
.config_props = config_props_input,
.draw_slice = null_draw_slice,
.start_frame = start_frame,

View File

@ -390,7 +390,7 @@ static int query_formats(AVFilterContext *ctx)
PIX_FMT_RGB24, PIX_FMT_BGR24,
PIX_FMT_NONE
};
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
}
return 0;
}

View File

@ -24,6 +24,7 @@
*/
#include "avfilter.h"
#include "video.h"
enum SetFieldMode {
MODE_AUTO = -1,
@ -79,7 +80,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
outpicref->video->interlaced = 1;
outpicref->video->top_field_first = setfield->mode;
}
avfilter_start_frame(inlink->dst->outputs[0], outpicref);
ff_start_frame(inlink->dst->outputs[0], outpicref);
}
AVFilter avfilter_vf_setfield = {
@ -92,7 +93,7 @@ AVFilter avfilter_vf_setfield = {
.inputs = (const AVFilterPad[]) {
{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.get_video_buffer = avfilter_null_get_video_buffer,
.get_video_buffer = ff_null_get_video_buffer,
.start_frame = start_frame, },
{ .name = NULL }
},

View File

@ -29,6 +29,8 @@
#include "libavutil/pixdesc.h"
#include "libavutil/intreadwrite.h"
#include "avfilter.h"
#include "formats.h"
#include "video.h"
typedef struct {
/* masks used for two pixels interpolation */
@ -238,7 +240,7 @@ static int query_formats(AVFilterContext *ctx)
PIX_FMT_NONE
};
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@ -313,8 +315,8 @@ static void end_frame(AVFilterLink *inlink)
inlink->w, inlink->h);
avfilter_unref_buffer(inpicref);
avfilter_draw_slice(outlink, 0, outlink->h, 1);
avfilter_end_frame(outlink);
ff_draw_slice(outlink, 0, outlink->h, 1);
ff_end_frame(outlink);
avfilter_unref_buffer(outpicref);
}

View File

@ -24,12 +24,14 @@
*/
#include "avfilter.h"
#include "formats.h"
#include "video.h"
static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms,
int w, int h)
{
AVFilterBufferRef *picref =
avfilter_default_get_video_buffer(link, perms, w, h);
ff_default_get_video_buffer(link, perms, w, h);
uint8_t *tmp;
int tmp2;
@ -54,7 +56,7 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *inpicref)
outpicref->linesize[1] = inpicref->linesize[2];
outpicref->linesize[2] = inpicref->linesize[1];
avfilter_start_frame(link->dst->outputs[0], outpicref);
ff_start_frame(link->dst->outputs[0], outpicref);
}
static int query_formats(AVFilterContext *ctx)
@ -68,7 +70,7 @@ static int query_formats(AVFilterContext *ctx)
PIX_FMT_NONE,
};
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}

View File

@ -28,6 +28,7 @@
*/
#include "avfilter.h"
#include "internal.h"
#define HIST_SIZE (3*256)
@ -151,10 +152,10 @@ static void end_frame(AVFilterLink *inlink)
picref = thumb->frames[best_frame_idx].buf;
av_log(ctx, AV_LOG_INFO, "frame id #%d (pts_time=%f) selected\n",
best_frame_idx, picref->pts * av_q2d(inlink->time_base));
avfilter_start_frame(outlink, picref);
ff_start_frame(outlink, picref);
thumb->frames[best_frame_idx].buf = NULL;
avfilter_draw_slice(outlink, 0, inlink->h, 1);
avfilter_end_frame(outlink);
ff_draw_slice(outlink, 0, inlink->h, 1);
ff_end_frame(outlink);
}
static av_cold void uninit(AVFilterContext *ctx)
@ -188,7 +189,7 @@ static int poll_frame(AVFilterLink *link)
{
ThumbContext *thumb = link->src->priv;
AVFilterLink *inlink = link->src->inputs[0];
int ret, available_frames = avfilter_poll_frame(inlink);
int ret, available_frames = ff_poll_frame(inlink);
/* If the input link is not able to provide any frame, we can't do anything
* at the moment and thus have zero thumbnail available. */
@ -212,7 +213,7 @@ static int query_formats(AVFilterContext *ctx)
PIX_FMT_RGB24, PIX_FMT_BGR24,
PIX_FMT_NONE
};
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@ -226,7 +227,7 @@ AVFilter avfilter_vf_thumbnail = {
.inputs = (const AVFilterPad[]) {
{ .name = "default",
.type = AVMEDIA_TYPE_VIDEO,
.get_video_buffer = avfilter_null_get_video_buffer,
.get_video_buffer = ff_null_get_video_buffer,
.start_frame = null_start_frame,
.draw_slice = draw_slice,
.end_frame = end_frame,

View File

@ -103,7 +103,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
if (tile->current)
return;
outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
outlink->out_buf = ff_get_video_buffer(outlink, AV_PERM_WRITE,
outlink->w, outlink->h);
avfilter_copy_buffer_ref_props(outlink->out_buf, picref);
outlink->out_buf->video->w = outlink->w;

View File

@ -76,7 +76,7 @@ static int query_formats(AVFilterContext *ctx)
PIX_FMT_NONE
};
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@ -224,7 +224,7 @@ static void end_frame(AVFilterLink *inlink)
switch (tinterlace->mode) {
case MODE_MERGE: /* move the odd frame into the upper field of the new image, even into
* the lower field, generating a double-height video at half framerate */
out = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
avfilter_copy_buffer_ref_props(out, cur);
out->video->h = outlink->h;
out->video->interlaced = 1;
@ -251,7 +251,7 @@ static void end_frame(AVFilterLink *inlink)
case MODE_PAD: /* expand each frame to double height, but pad alternate
* lines with black; framerate unchanged */
out = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
avfilter_copy_buffer_ref_props(out, cur);
out->video->h = outlink->h;
@ -273,7 +273,7 @@ static void end_frame(AVFilterLink *inlink)
case MODE_INTERLEAVE_TOP: /* top field first */
case MODE_INTERLEAVE_BOTTOM: /* bottom field first */
tff = tinterlace->mode == MODE_INTERLEAVE_TOP;
out = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
avfilter_copy_buffer_ref_props(out, cur);
out->video->interlaced = 1;
out->video->top_field_first = tff;
@ -295,13 +295,13 @@ static void end_frame(AVFilterLink *inlink)
out = avfilter_ref_buffer(cur, AV_PERM_READ);
out->video->interlaced = 1;
avfilter_start_frame(outlink, out);
avfilter_draw_slice(outlink, 0, outlink->h, 1);
avfilter_end_frame(outlink);
ff_start_frame(outlink, out);
ff_draw_slice(outlink, 0, outlink->h, 1);
ff_end_frame(outlink);
/* output mix of current and next frame */
tff = next->video->top_field_first;
out = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
out = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
avfilter_copy_buffer_ref_props(out, next);
out->video->interlaced = 1;
@ -318,9 +318,9 @@ static void end_frame(AVFilterLink *inlink)
break;
}
avfilter_start_frame(outlink, out);
avfilter_draw_slice(outlink, 0, outlink->h, 1);
avfilter_end_frame(outlink);
ff_start_frame(outlink, out);
ff_draw_slice(outlink, 0, outlink->h, 1);
ff_end_frame(outlink);
tinterlace->frame++;
}
@ -331,12 +331,12 @@ static int poll_frame(AVFilterLink *outlink)
AVFilterLink *inlink = outlink->src->inputs[0];
int ret, val;
val = avfilter_poll_frame(inlink);
val = ff_poll_frame(inlink);
if (val == 1 && !tinterlace->next) {
if ((ret = avfilter_request_frame(inlink)) < 0)
return ret;
val = avfilter_poll_frame(inlink);
val = ff_poll_frame(inlink);
}
assert(tinterlace->next);

View File

@ -220,7 +220,7 @@ void ff_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
void ff_null_start_frame_keep_ref(AVFilterLink *inlink,
AVFilterBufferRef *picref)
{
avfilter_start_frame(inlink->dst->outputs[0], avfilter_ref_buffer(picref, ~0));
ff_start_frame(inlink->dst->outputs[0], avfilter_ref_buffer(picref, ~0));
}
void ff_null_end_frame(AVFilterLink *link)

View File

@ -31,6 +31,8 @@
#include "libavutil/parseutils.h"
#include "libavutil/random_seed.h"
#include "avfilter.h"
#include "formats.h"
#include "video.h"
typedef struct {
const AVClass *class;
@ -305,7 +307,7 @@ static int request_frame(AVFilterLink *outlink)
{
CellAutoContext *cellauto = outlink->src->priv;
AVFilterBufferRef *picref =
avfilter_get_video_buffer(outlink, AV_PERM_WRITE, cellauto->w, cellauto->h);
ff_get_video_buffer(outlink, AV_PERM_WRITE, cellauto->w, cellauto->h);
picref->video->sample_aspect_ratio = (AVRational) {1, 1};
if (cellauto->generation == 0 && cellauto->start_full) {
int i;
@ -322,9 +324,9 @@ static int request_frame(AVFilterLink *outlink)
show_cellauto_row(outlink->src);
#endif
avfilter_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
avfilter_draw_slice(outlink, 0, cellauto->h, 1);
avfilter_end_frame(outlink);
ff_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
ff_draw_slice(outlink, 0, cellauto->h, 1);
ff_end_frame(outlink);
avfilter_unref_buffer(picref);
return 0;
@ -333,7 +335,7 @@ static int request_frame(AVFilterLink *outlink)
static int query_formats(AVFilterContext *ctx)
{
static const enum PixelFormat pix_fmts[] = { PIX_FMT_MONOBLACK, PIX_FMT_NONE };
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}

View File

@ -32,6 +32,8 @@
#include "libavutil/parseutils.h"
#include "libavutil/random_seed.h"
#include "avfilter.h"
#include "formats.h"
#include "video.h"
typedef struct {
const AVClass *class;
@ -431,7 +433,7 @@ static void fill_picture_rgb(AVFilterContext *ctx, AVFilterBufferRef *picref)
static int request_frame(AVFilterLink *outlink)
{
LifeContext *life = outlink->src->priv;
AVFilterBufferRef *picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, life->w, life->h);
AVFilterBufferRef *picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, life->w, life->h);
picref->video->sample_aspect_ratio = (AVRational) {1, 1};
picref->pts = life->pts++;
picref->pos = -1;
@ -442,9 +444,9 @@ static int request_frame(AVFilterLink *outlink)
show_life_grid(outlink->src);
#endif
avfilter_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
avfilter_draw_slice(outlink, 0, life->h, 1);
avfilter_end_frame(outlink);
ff_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
ff_draw_slice(outlink, 0, life->h, 1);
ff_end_frame(outlink);
avfilter_unref_buffer(picref);
return 0;
@ -462,7 +464,7 @@ static int query_formats(AVFilterContext *ctx)
pix_fmts[0] = PIX_FMT_MONOBLACK;
life->draw = fill_picture_monoblack;
}
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}

View File

@ -27,6 +27,8 @@
*/
#include "avfilter.h"
#include "formats.h"
#include "video.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
@ -161,7 +163,7 @@ static int query_formats(AVFilterContext *ctx)
PIX_FMT_NONE
};
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@ -385,15 +387,15 @@ static void draw_mandelbrot(AVFilterContext *ctx, uint32_t *color, int linesize,
static int request_frame(AVFilterLink *link)
{
MBContext *mb = link->src->priv;
AVFilterBufferRef *picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, mb->w, mb->h);
AVFilterBufferRef *picref = ff_get_video_buffer(link, AV_PERM_WRITE, mb->w, mb->h);
picref->video->sample_aspect_ratio = (AVRational) {1, 1};
picref->pts = mb->pts++;
picref->pos = -1;
avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
ff_start_frame(link, avfilter_ref_buffer(picref, ~0));
draw_mandelbrot(link->src, (uint32_t*)picref->data[0], picref->linesize[0]/4, picref->pts);
avfilter_draw_slice(link, 0, mb->h, 1);
avfilter_end_frame(link);
ff_draw_slice(link, 0, mb->h, 1);
ff_end_frame(link);
avfilter_unref_buffer(picref);
return 0;

View File

@ -28,6 +28,8 @@
#include "libavutil/parseutils.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
#include "video.h"
#define WIDTH 512
#define HEIGHT 512
@ -320,7 +322,7 @@ static int query_formats(AVFilterContext *ctx)
PIX_FMT_YUV420P, PIX_FMT_NONE
};
avfilter_set_common_pixel_formats(ctx, avfilter_make_format_list(pix_fmts));
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
@ -334,7 +336,7 @@ static int request_frame(AVFilterLink *outlink)
if (test->max_pts >= 0 && test->pts > test->max_pts)
return AVERROR_EOF;
picref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, w, h);
picref = ff_get_video_buffer(outlink, AV_PERM_WRITE, w, h);
picref->pts = test->pts++;
// clean image
@ -360,9 +362,9 @@ static int request_frame(AVFilterLink *outlink)
test->frame_nb++;
avfilter_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
avfilter_draw_slice(outlink, 0, picref->video->h, 1);
avfilter_end_frame(outlink);
ff_start_frame(outlink, avfilter_ref_buffer(picref, ~0));
ff_draw_slice(outlink, 0, picref->video->h, 1);
ff_end_frame(outlink);
avfilter_unref_buffer(picref);
return 0;