mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
lavfi: replace AVFilterContext.input/output_count with nb_inputs/outputs
This is more consistent with naming in the rest of Libav.
This commit is contained in:
parent
9d0bfc5052
commit
9baeff9506
@ -13,6 +13,10 @@ libavutil: 2011-04-18
|
|||||||
|
|
||||||
API changes, most recent first:
|
API changes, most recent first:
|
||||||
|
|
||||||
|
2012-xx-xx - xxxxxxx - lavfi 2.23.0 - avfilter.h
|
||||||
|
Add AVFilterContext.nb_inputs/outputs. Deprecate
|
||||||
|
AVFilterContext.input/output_count.
|
||||||
|
|
||||||
2012-xx-xx - xxxxxxx - lavfi 2.22.0 - avfilter.h
|
2012-xx-xx - xxxxxxx - lavfi 2.22.0 - avfilter.h
|
||||||
Add avfilter_pad_get_type() and avfilter_pad_get_name(). Those
|
Add avfilter_pad_get_type() and avfilter_pad_get_name(). Those
|
||||||
should now be used instead of accessing AVFilterPad members
|
should now be used instead of accessing AVFilterPad members
|
||||||
|
@ -454,10 +454,10 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
|
|||||||
AVFilterLink *outlink = ctx->outputs[0];
|
AVFilterLink *outlink = ctx->outputs[0];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ctx->input_count; i++)
|
for (i = 0; i < ctx->nb_inputs; i++)
|
||||||
if (ctx->inputs[i] == inlink)
|
if (ctx->inputs[i] == inlink)
|
||||||
break;
|
break;
|
||||||
if (i >= ctx->input_count) {
|
if (i >= ctx->nb_inputs) {
|
||||||
av_log(ctx, AV_LOG_ERROR, "unknown input link\n");
|
av_log(ctx, AV_LOG_ERROR, "unknown input link\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -518,7 +518,7 @@ static void uninit(AVFilterContext *ctx)
|
|||||||
av_freep(&s->input_state);
|
av_freep(&s->input_state);
|
||||||
av_freep(&s->input_scale);
|
av_freep(&s->input_scale);
|
||||||
|
|
||||||
for (i = 0; i < ctx->input_count; i++)
|
for (i = 0; i < ctx->nb_inputs; i++)
|
||||||
av_freep(&ctx->input_pads[i].name);
|
av_freep(&ctx->input_pads[i].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ static int query_formats(AVFilterContext *ctx)
|
|||||||
ff_add_channel_layout(&in_layouts, s->channel_layout);
|
ff_add_channel_layout(&in_layouts, s->channel_layout);
|
||||||
ff_channel_layouts_ref(in_layouts, &ctx->inputs[0]->out_channel_layouts);
|
ff_channel_layouts_ref(in_layouts, &ctx->inputs[0]->out_channel_layouts);
|
||||||
|
|
||||||
for (i = 0; i < ctx->output_count; i++) {
|
for (i = 0; i < ctx->nb_outputs; i++) {
|
||||||
AVFilterChannelLayouts *out_layouts = NULL;
|
AVFilterChannelLayouts *out_layouts = NULL;
|
||||||
uint64_t channel = av_channel_layout_extract_channel(s->channel_layout, i);
|
uint64_t channel = av_channel_layout_extract_channel(s->channel_layout, i);
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf)
|
|||||||
AVFilterContext *ctx = inlink->dst;
|
AVFilterContext *ctx = inlink->dst;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ctx->output_count; i++) {
|
for (i = 0; i < ctx->nb_outputs; i++) {
|
||||||
AVFilterBufferRef *buf_out = avfilter_ref_buffer(buf, ~AV_PERM_WRITE);
|
AVFilterBufferRef *buf_out = avfilter_ref_buffer(buf, ~AV_PERM_WRITE);
|
||||||
|
|
||||||
if (!buf_out)
|
if (!buf_out)
|
||||||
|
@ -156,7 +156,7 @@ void ff_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesr
|
|||||||
{
|
{
|
||||||
AVFilterLink *outlink = NULL;
|
AVFilterLink *outlink = NULL;
|
||||||
|
|
||||||
if (inlink->dst->output_count)
|
if (inlink->dst->nb_outputs)
|
||||||
outlink = inlink->dst->outputs[0];
|
outlink = inlink->dst->outputs[0];
|
||||||
|
|
||||||
if (outlink) {
|
if (outlink) {
|
||||||
|
@ -70,8 +70,8 @@ int avfilter_link(AVFilterContext *src, unsigned srcpad,
|
|||||||
{
|
{
|
||||||
AVFilterLink *link;
|
AVFilterLink *link;
|
||||||
|
|
||||||
if (src->output_count <= srcpad || dst->input_count <= dstpad ||
|
if (src->nb_outputs <= srcpad || dst->nb_inputs <= dstpad ||
|
||||||
src->outputs[srcpad] || dst->inputs[dstpad])
|
src->outputs[srcpad] || dst->inputs[dstpad])
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (src->output_pads[srcpad].type != dst->input_pads[dstpad].type) {
|
if (src->output_pads[srcpad].type != dst->input_pads[dstpad].type) {
|
||||||
@ -138,7 +138,7 @@ int avfilter_config_links(AVFilterContext *filter)
|
|||||||
unsigned i;
|
unsigned i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
for (i = 0; i < filter->input_count; i ++) {
|
for (i = 0; i < filter->nb_inputs; i ++) {
|
||||||
AVFilterLink *link = filter->inputs[i];
|
AVFilterLink *link = filter->inputs[i];
|
||||||
|
|
||||||
if (!link) continue;
|
if (!link) continue;
|
||||||
@ -156,7 +156,7 @@ int avfilter_config_links(AVFilterContext *filter)
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (!(config_link = link->srcpad->config_props)) {
|
if (!(config_link = link->srcpad->config_props)) {
|
||||||
if (link->src->input_count != 1) {
|
if (link->src->nb_inputs != 1) {
|
||||||
av_log(link->src, AV_LOG_ERROR, "Source filters and filters "
|
av_log(link->src, AV_LOG_ERROR, "Source filters and filters "
|
||||||
"with more than one input "
|
"with more than one input "
|
||||||
"must set config_props() "
|
"must set config_props() "
|
||||||
@ -171,15 +171,15 @@ int avfilter_config_links(AVFilterContext *filter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (link->time_base.num == 0 && link->time_base.den == 0)
|
if (link->time_base.num == 0 && link->time_base.den == 0)
|
||||||
link->time_base = link->src && link->src->input_count ?
|
link->time_base = link->src && link->src->nb_inputs ?
|
||||||
link->src->inputs[0]->time_base : AV_TIME_BASE_Q;
|
link->src->inputs[0]->time_base : AV_TIME_BASE_Q;
|
||||||
|
|
||||||
if (link->type == AVMEDIA_TYPE_VIDEO) {
|
if (link->type == AVMEDIA_TYPE_VIDEO) {
|
||||||
if (!link->sample_aspect_ratio.num && !link->sample_aspect_ratio.den)
|
if (!link->sample_aspect_ratio.num && !link->sample_aspect_ratio.den)
|
||||||
link->sample_aspect_ratio = link->src->input_count ?
|
link->sample_aspect_ratio = link->src->nb_inputs ?
|
||||||
link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1};
|
link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1};
|
||||||
|
|
||||||
if (link->src->input_count) {
|
if (link->src->nb_inputs) {
|
||||||
if (!link->w)
|
if (!link->w)
|
||||||
link->w = link->src->inputs[0]->w;
|
link->w = link->src->inputs[0]->w;
|
||||||
if (!link->h)
|
if (!link->h)
|
||||||
@ -249,7 +249,7 @@ int ff_poll_frame(AVFilterLink *link)
|
|||||||
if (link->srcpad->poll_frame)
|
if (link->srcpad->poll_frame)
|
||||||
return link->srcpad->poll_frame(link);
|
return link->srcpad->poll_frame(link);
|
||||||
|
|
||||||
for (i = 0; i < link->src->input_count; i++) {
|
for (i = 0; i < link->src->nb_inputs; i++) {
|
||||||
int val;
|
int val;
|
||||||
if (!link->src->inputs[i])
|
if (!link->src->inputs[i])
|
||||||
return -1;
|
return -1;
|
||||||
@ -339,27 +339,31 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret->input_count = pad_count(filter->inputs);
|
ret->nb_inputs = pad_count(filter->inputs);
|
||||||
if (ret->input_count) {
|
if (ret->nb_inputs ) {
|
||||||
ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->input_count);
|
ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_inputs);
|
||||||
if (!ret->input_pads)
|
if (!ret->input_pads)
|
||||||
goto err;
|
goto err;
|
||||||
memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->input_count);
|
memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->nb_inputs);
|
||||||
ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->input_count);
|
ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_inputs);
|
||||||
if (!ret->inputs)
|
if (!ret->inputs)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret->output_count = pad_count(filter->outputs);
|
ret->nb_outputs = pad_count(filter->outputs);
|
||||||
if (ret->output_count) {
|
if (ret->nb_outputs) {
|
||||||
ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->output_count);
|
ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_outputs);
|
||||||
if (!ret->output_pads)
|
if (!ret->output_pads)
|
||||||
goto err;
|
goto err;
|
||||||
memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->output_count);
|
memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->nb_outputs);
|
||||||
ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->output_count);
|
ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_outputs);
|
||||||
if (!ret->outputs)
|
if (!ret->outputs)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
#if FF_API_FOO_COUNT
|
||||||
|
ret->output_count = ret->nb_outputs;
|
||||||
|
ret->input_count = ret->nb_inputs;
|
||||||
|
#endif
|
||||||
|
|
||||||
*filter_ctx = ret;
|
*filter_ctx = ret;
|
||||||
return 0;
|
return 0;
|
||||||
@ -367,10 +371,10 @@ int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *in
|
|||||||
err:
|
err:
|
||||||
av_freep(&ret->inputs);
|
av_freep(&ret->inputs);
|
||||||
av_freep(&ret->input_pads);
|
av_freep(&ret->input_pads);
|
||||||
ret->input_count = 0;
|
ret->nb_inputs = 0;
|
||||||
av_freep(&ret->outputs);
|
av_freep(&ret->outputs);
|
||||||
av_freep(&ret->output_pads);
|
av_freep(&ret->output_pads);
|
||||||
ret->output_count = 0;
|
ret->nb_outputs = 0;
|
||||||
av_freep(&ret->priv);
|
av_freep(&ret->priv);
|
||||||
av_free(ret);
|
av_free(ret);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
@ -384,7 +388,7 @@ void avfilter_free(AVFilterContext *filter)
|
|||||||
if (filter->filter->uninit)
|
if (filter->filter->uninit)
|
||||||
filter->filter->uninit(filter);
|
filter->filter->uninit(filter);
|
||||||
|
|
||||||
for (i = 0; i < filter->input_count; i++) {
|
for (i = 0; i < filter->nb_inputs; i++) {
|
||||||
if ((link = filter->inputs[i])) {
|
if ((link = filter->inputs[i])) {
|
||||||
if (link->src)
|
if (link->src)
|
||||||
link->src->outputs[link->srcpad - link->src->output_pads] = NULL;
|
link->src->outputs[link->srcpad - link->src->output_pads] = NULL;
|
||||||
@ -397,7 +401,7 @@ void avfilter_free(AVFilterContext *filter)
|
|||||||
}
|
}
|
||||||
av_freep(&link);
|
av_freep(&link);
|
||||||
}
|
}
|
||||||
for (i = 0; i < filter->output_count; i++) {
|
for (i = 0; i < filter->nb_outputs; i++) {
|
||||||
if ((link = filter->outputs[i])) {
|
if ((link = filter->outputs[i])) {
|
||||||
if (link->dst)
|
if (link->dst)
|
||||||
link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL;
|
link->dst->inputs[link->dstpad - link->dst->input_pads] = NULL;
|
||||||
@ -453,14 +457,20 @@ void avfilter_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
|
|||||||
void avfilter_insert_inpad(AVFilterContext *f, unsigned index,
|
void avfilter_insert_inpad(AVFilterContext *f, unsigned index,
|
||||||
AVFilterPad *p)
|
AVFilterPad *p)
|
||||||
{
|
{
|
||||||
ff_insert_pad(index, &f->input_count, offsetof(AVFilterLink, dstpad),
|
ff_insert_pad(index, &f->nb_inputs, offsetof(AVFilterLink, dstpad),
|
||||||
&f->input_pads, &f->inputs, p);
|
&f->input_pads, &f->inputs, p);
|
||||||
|
#if FF_API_FOO_COUNT
|
||||||
|
f->input_count = f->nb_inputs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
void avfilter_insert_outpad(AVFilterContext *f, unsigned index,
|
void avfilter_insert_outpad(AVFilterContext *f, unsigned index,
|
||||||
AVFilterPad *p)
|
AVFilterPad *p)
|
||||||
{
|
{
|
||||||
ff_insert_pad(index, &f->output_count, offsetof(AVFilterLink, srcpad),
|
ff_insert_pad(index, &f->nb_outputs, offsetof(AVFilterLink, srcpad),
|
||||||
&f->output_pads, &f->outputs, p);
|
&f->output_pads, &f->outputs, p);
|
||||||
|
#if FF_API_FOO_COUNT
|
||||||
|
f->output_count = f->nb_outputs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
int avfilter_poll_frame(AVFilterLink *link)
|
int avfilter_poll_frame(AVFilterLink *link)
|
||||||
{
|
{
|
||||||
|
@ -488,15 +488,22 @@ struct AVFilterContext {
|
|||||||
|
|
||||||
char *name; ///< name of this filter instance
|
char *name; ///< name of this filter instance
|
||||||
|
|
||||||
unsigned input_count; ///< number of input pads
|
#if FF_API_FOO_COUNT
|
||||||
|
unsigned input_count; ///< @deprecated use nb_inputs
|
||||||
|
#endif
|
||||||
AVFilterPad *input_pads; ///< array of input pads
|
AVFilterPad *input_pads; ///< array of input pads
|
||||||
AVFilterLink **inputs; ///< array of pointers to input links
|
AVFilterLink **inputs; ///< array of pointers to input links
|
||||||
|
|
||||||
unsigned output_count; ///< number of output pads
|
#if FF_API_FOO_COUNT
|
||||||
|
unsigned output_count; ///< @deprecated use nb_outputs
|
||||||
|
#endif
|
||||||
AVFilterPad *output_pads; ///< array of output pads
|
AVFilterPad *output_pads; ///< array of output pads
|
||||||
AVFilterLink **outputs; ///< array of pointers to output links
|
AVFilterLink **outputs; ///< array of pointers to output links
|
||||||
|
|
||||||
void *priv; ///< private data for use by the filter
|
void *priv; ///< private data for use by the filter
|
||||||
|
|
||||||
|
unsigned nb_inputs; ///< number of input pads
|
||||||
|
unsigned nb_outputs; ///< number of output pads
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -109,7 +109,7 @@ static int graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
|
|||||||
for (i = 0; i < graph->filter_count; i++) {
|
for (i = 0; i < graph->filter_count; i++) {
|
||||||
filt = graph->filters[i];
|
filt = graph->filters[i];
|
||||||
|
|
||||||
for (j = 0; j < filt->input_count; j++) {
|
for (j = 0; j < filt->nb_inputs; j++) {
|
||||||
if (!filt->inputs[j] || !filt->inputs[j]->src) {
|
if (!filt->inputs[j] || !filt->inputs[j]->src) {
|
||||||
av_log(log_ctx, AV_LOG_ERROR,
|
av_log(log_ctx, AV_LOG_ERROR,
|
||||||
"Input pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any source\n",
|
"Input pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any source\n",
|
||||||
@ -118,7 +118,7 @@ static int graph_check_validity(AVFilterGraph *graph, AVClass *log_ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < filt->output_count; j++) {
|
for (j = 0; j < filt->nb_outputs; j++) {
|
||||||
if (!filt->outputs[j] || !filt->outputs[j]->dst) {
|
if (!filt->outputs[j] || !filt->outputs[j]->dst) {
|
||||||
av_log(log_ctx, AV_LOG_ERROR,
|
av_log(log_ctx, AV_LOG_ERROR,
|
||||||
"Output pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any destination\n",
|
"Output pad \"%s\" for the filter \"%s\" of type \"%s\" not connected to any destination\n",
|
||||||
@ -144,7 +144,7 @@ static int graph_config_links(AVFilterGraph *graph, AVClass *log_ctx)
|
|||||||
for (i=0; i < graph->filter_count; i++) {
|
for (i=0; i < graph->filter_count; i++) {
|
||||||
filt = graph->filters[i];
|
filt = graph->filters[i];
|
||||||
|
|
||||||
if (!filt->output_count) {
|
if (!filt->nb_outputs) {
|
||||||
if ((ret = avfilter_config_links(filt)))
|
if ((ret = avfilter_config_links(filt)))
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
|
|||||||
for (i = 0; i < graph->filter_count; i++) {
|
for (i = 0; i < graph->filter_count; i++) {
|
||||||
AVFilterContext *filter = graph->filters[i];
|
AVFilterContext *filter = graph->filters[i];
|
||||||
|
|
||||||
for (j = 0; j < filter->input_count; j++) {
|
for (j = 0; j < filter->nb_inputs; j++) {
|
||||||
AVFilterLink *link = filter->inputs[j];
|
AVFilterLink *link = filter->inputs[j];
|
||||||
int convert_needed = 0;
|
int convert_needed = 0;
|
||||||
|
|
||||||
@ -315,7 +315,7 @@ static int pick_format(AVFilterLink *link)
|
|||||||
|
|
||||||
#define REDUCE_FORMATS(fmt_type, list_type, list, var, nb, add_format) \
|
#define REDUCE_FORMATS(fmt_type, list_type, list, var, nb, add_format) \
|
||||||
do { \
|
do { \
|
||||||
for (i = 0; i < filter->input_count; i++) { \
|
for (i = 0; i < filter->nb_inputs; i++) { \
|
||||||
AVFilterLink *link = filter->inputs[i]; \
|
AVFilterLink *link = filter->inputs[i]; \
|
||||||
fmt_type fmt; \
|
fmt_type fmt; \
|
||||||
\
|
\
|
||||||
@ -323,7 +323,7 @@ do { \
|
|||||||
continue; \
|
continue; \
|
||||||
fmt = link->out_ ## list->var[0]; \
|
fmt = link->out_ ## list->var[0]; \
|
||||||
\
|
\
|
||||||
for (j = 0; j < filter->output_count; j++) { \
|
for (j = 0; j < filter->nb_outputs; j++) { \
|
||||||
AVFilterLink *out_link = filter->outputs[j]; \
|
AVFilterLink *out_link = filter->outputs[j]; \
|
||||||
list_type *fmts; \
|
list_type *fmts; \
|
||||||
\
|
\
|
||||||
@ -380,19 +380,19 @@ static void swap_samplerates_on_filter(AVFilterContext *filter)
|
|||||||
int sample_rate;
|
int sample_rate;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (i = 0; i < filter->input_count; i++) {
|
for (i = 0; i < filter->nb_inputs; i++) {
|
||||||
link = filter->inputs[i];
|
link = filter->inputs[i];
|
||||||
|
|
||||||
if (link->type == AVMEDIA_TYPE_AUDIO &&
|
if (link->type == AVMEDIA_TYPE_AUDIO &&
|
||||||
link->out_samplerates->format_count == 1)
|
link->out_samplerates->format_count == 1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == filter->input_count)
|
if (i == filter->nb_inputs)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sample_rate = link->out_samplerates->formats[0];
|
sample_rate = link->out_samplerates->formats[0];
|
||||||
|
|
||||||
for (i = 0; i < filter->output_count; i++) {
|
for (i = 0; i < filter->nb_outputs; i++) {
|
||||||
AVFilterLink *outlink = filter->outputs[i];
|
AVFilterLink *outlink = filter->outputs[i];
|
||||||
int best_idx, best_diff = INT_MAX;
|
int best_idx, best_diff = INT_MAX;
|
||||||
|
|
||||||
@ -427,19 +427,19 @@ static void swap_channel_layouts_on_filter(AVFilterContext *filter)
|
|||||||
uint64_t chlayout;
|
uint64_t chlayout;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (i = 0; i < filter->input_count; i++) {
|
for (i = 0; i < filter->nb_inputs; i++) {
|
||||||
link = filter->inputs[i];
|
link = filter->inputs[i];
|
||||||
|
|
||||||
if (link->type == AVMEDIA_TYPE_AUDIO &&
|
if (link->type == AVMEDIA_TYPE_AUDIO &&
|
||||||
link->out_channel_layouts->nb_channel_layouts == 1)
|
link->out_channel_layouts->nb_channel_layouts == 1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == filter->input_count)
|
if (i == filter->nb_inputs)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
chlayout = link->out_channel_layouts->channel_layouts[0];
|
chlayout = link->out_channel_layouts->channel_layouts[0];
|
||||||
|
|
||||||
for (i = 0; i < filter->output_count; i++) {
|
for (i = 0; i < filter->nb_outputs; i++) {
|
||||||
AVFilterLink *outlink = filter->outputs[i];
|
AVFilterLink *outlink = filter->outputs[i];
|
||||||
int best_idx, best_score = INT_MIN;
|
int best_idx, best_score = INT_MIN;
|
||||||
|
|
||||||
@ -480,20 +480,20 @@ static void swap_sample_fmts_on_filter(AVFilterContext *filter)
|
|||||||
int format, bps;
|
int format, bps;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (i = 0; i < filter->input_count; i++) {
|
for (i = 0; i < filter->nb_inputs; i++) {
|
||||||
link = filter->inputs[i];
|
link = filter->inputs[i];
|
||||||
|
|
||||||
if (link->type == AVMEDIA_TYPE_AUDIO &&
|
if (link->type == AVMEDIA_TYPE_AUDIO &&
|
||||||
link->out_formats->format_count == 1)
|
link->out_formats->format_count == 1)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == filter->input_count)
|
if (i == filter->nb_inputs)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
format = link->out_formats->formats[0];
|
format = link->out_formats->formats[0];
|
||||||
bps = av_get_bytes_per_sample(format);
|
bps = av_get_bytes_per_sample(format);
|
||||||
|
|
||||||
for (i = 0; i < filter->output_count; i++) {
|
for (i = 0; i < filter->nb_outputs; i++) {
|
||||||
AVFilterLink *outlink = filter->outputs[i];
|
AVFilterLink *outlink = filter->outputs[i];
|
||||||
int best_idx, best_score = INT_MIN;
|
int best_idx, best_score = INT_MIN;
|
||||||
|
|
||||||
@ -549,10 +549,10 @@ static int pick_formats(AVFilterGraph *graph)
|
|||||||
for (i = 0; i < graph->filter_count; i++) {
|
for (i = 0; i < graph->filter_count; i++) {
|
||||||
AVFilterContext *filter = graph->filters[i];
|
AVFilterContext *filter = graph->filters[i];
|
||||||
|
|
||||||
for (j = 0; j < filter->input_count; j++)
|
for (j = 0; j < filter->nb_inputs; j++)
|
||||||
if ((ret = pick_format(filter->inputs[j])) < 0)
|
if ((ret = pick_format(filter->inputs[j])) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
for (j = 0; j < filter->output_count; j++)
|
for (j = 0; j < filter->nb_outputs; j++)
|
||||||
if ((ret = pick_format(filter->outputs[j])) < 0)
|
if ((ret = pick_format(filter->outputs[j])) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -330,13 +330,13 @@ void ff_formats_changeref(AVFilterFormats **oldref, AVFilterFormats **newref)
|
|||||||
{ \
|
{ \
|
||||||
int count = 0, i; \
|
int count = 0, i; \
|
||||||
\
|
\
|
||||||
for (i = 0; i < ctx->input_count; i++) { \
|
for (i = 0; i < ctx->nb_inputs; i++) { \
|
||||||
if (ctx->inputs[i]) { \
|
if (ctx->inputs[i]) { \
|
||||||
ref(fmts, &ctx->inputs[i]->out_fmts); \
|
ref(fmts, &ctx->inputs[i]->out_fmts); \
|
||||||
count++; \
|
count++; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
for (i = 0; i < ctx->output_count; i++) { \
|
for (i = 0; i < ctx->nb_outputs; i++) { \
|
||||||
if (ctx->outputs[i]) { \
|
if (ctx->outputs[i]) { \
|
||||||
ref(fmts, &ctx->outputs[i]->in_fmts); \
|
ref(fmts, &ctx->outputs[i]->in_fmts); \
|
||||||
count++; \
|
count++; \
|
||||||
|
@ -226,7 +226,7 @@ static int link_filter_inouts(AVFilterContext *filt_ctx,
|
|||||||
{
|
{
|
||||||
int pad, ret;
|
int pad, ret;
|
||||||
|
|
||||||
for (pad = 0; pad < filt_ctx->input_count; pad++) {
|
for (pad = 0; pad < filt_ctx->nb_inputs; pad++) {
|
||||||
AVFilterInOut *p = *curr_inputs;
|
AVFilterInOut *p = *curr_inputs;
|
||||||
|
|
||||||
if (p) {
|
if (p) {
|
||||||
@ -254,7 +254,7 @@ static int link_filter_inouts(AVFilterContext *filt_ctx,
|
|||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
pad = filt_ctx->output_count;
|
pad = filt_ctx->nb_outputs;
|
||||||
while (pad--) {
|
while (pad--) {
|
||||||
AVFilterInOut *currlinkn = av_mallocz(sizeof(AVFilterInOut));
|
AVFilterInOut *currlinkn = av_mallocz(sizeof(AVFilterInOut));
|
||||||
if (!currlinkn)
|
if (!currlinkn)
|
||||||
|
@ -183,16 +183,22 @@ void ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,
|
|||||||
static inline void ff_insert_inpad(AVFilterContext *f, unsigned index,
|
static inline void ff_insert_inpad(AVFilterContext *f, unsigned index,
|
||||||
AVFilterPad *p)
|
AVFilterPad *p)
|
||||||
{
|
{
|
||||||
ff_insert_pad(index, &f->input_count, offsetof(AVFilterLink, dstpad),
|
ff_insert_pad(index, &f->nb_inputs, offsetof(AVFilterLink, dstpad),
|
||||||
&f->input_pads, &f->inputs, p);
|
&f->input_pads, &f->inputs, p);
|
||||||
|
#if FF_API_FOO_COUNT
|
||||||
|
f->input_count = f->nb_inputs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Insert a new output pad for the filter. */
|
/** Insert a new output pad for the filter. */
|
||||||
static inline void ff_insert_outpad(AVFilterContext *f, unsigned index,
|
static inline void ff_insert_outpad(AVFilterContext *f, unsigned index,
|
||||||
AVFilterPad *p)
|
AVFilterPad *p)
|
||||||
{
|
{
|
||||||
ff_insert_pad(index, &f->output_count, offsetof(AVFilterLink, srcpad),
|
ff_insert_pad(index, &f->nb_outputs, offsetof(AVFilterLink, srcpad),
|
||||||
&f->output_pads, &f->outputs, p);
|
&f->output_pads, &f->outputs, p);
|
||||||
|
#if FF_API_FOO_COUNT
|
||||||
|
f->output_count = f->nb_outputs;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +59,7 @@ static void split_uninit(AVFilterContext *ctx)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ctx->output_count; i++)
|
for (i = 0; i < ctx->nb_outputs; i++)
|
||||||
av_freep(&ctx->output_pads[i].name);
|
av_freep(&ctx->output_pads[i].name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
|
|||||||
AVFilterContext *ctx = inlink->dst;
|
AVFilterContext *ctx = inlink->dst;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ctx->output_count; i++)
|
for (i = 0; i < ctx->nb_outputs; i++)
|
||||||
ff_start_frame(ctx->outputs[i],
|
ff_start_frame(ctx->outputs[i],
|
||||||
avfilter_ref_buffer(picref, ~AV_PERM_WRITE));
|
avfilter_ref_buffer(picref, ~AV_PERM_WRITE));
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
|
|||||||
AVFilterContext *ctx = inlink->dst;
|
AVFilterContext *ctx = inlink->dst;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ctx->output_count; i++)
|
for (i = 0; i < ctx->nb_outputs; i++)
|
||||||
ff_draw_slice(ctx->outputs[i], y, h, slice_dir);
|
ff_draw_slice(ctx->outputs[i], y, h, slice_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ static void end_frame(AVFilterLink *inlink)
|
|||||||
AVFilterContext *ctx = inlink->dst;
|
AVFilterContext *ctx = inlink->dst;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ctx->output_count; i++)
|
for (i = 0; i < ctx->nb_outputs; i++)
|
||||||
ff_end_frame(ctx->outputs[i]);
|
ff_end_frame(ctx->outputs[i]);
|
||||||
|
|
||||||
avfilter_unref_buffer(inlink->cur_buf);
|
avfilter_unref_buffer(inlink->cur_buf);
|
||||||
@ -115,7 +115,7 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
|
|||||||
AVFilterContext *ctx = inlink->dst;
|
AVFilterContext *ctx = inlink->dst;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ctx->output_count; i++)
|
for (i = 0; i < ctx->nb_outputs; i++)
|
||||||
ff_filter_samples(inlink->dst->outputs[i],
|
ff_filter_samples(inlink->dst->outputs[i],
|
||||||
avfilter_ref_buffer(samplesref, ~AV_PERM_WRITE));
|
avfilter_ref_buffer(samplesref, ~AV_PERM_WRITE));
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "libavutil/avutil.h"
|
#include "libavutil/avutil.h"
|
||||||
|
|
||||||
#define LIBAVFILTER_VERSION_MAJOR 2
|
#define LIBAVFILTER_VERSION_MAJOR 2
|
||||||
#define LIBAVFILTER_VERSION_MINOR 22
|
#define LIBAVFILTER_VERSION_MINOR 23
|
||||||
#define LIBAVFILTER_VERSION_MICRO 0
|
#define LIBAVFILTER_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
||||||
@ -62,5 +62,8 @@
|
|||||||
#ifndef FF_API_AVFILTERPAD_PUBLIC
|
#ifndef FF_API_AVFILTERPAD_PUBLIC
|
||||||
#define FF_API_AVFILTERPAD_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 4)
|
#define FF_API_AVFILTERPAD_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 4)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef FF_API_FOO_COUNT
|
||||||
|
#define FF_API_FOO_COUNT (LIBAVFILTER_VERSION_MAJOR < 4)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // AVFILTER_VERSION_H
|
#endif // AVFILTER_VERSION_H
|
||||||
|
@ -169,7 +169,7 @@ static void default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
|
|||||||
{
|
{
|
||||||
AVFilterLink *outlink = NULL;
|
AVFilterLink *outlink = NULL;
|
||||||
|
|
||||||
if (inlink->dst->output_count)
|
if (inlink->dst->nb_outputs)
|
||||||
outlink = inlink->dst->outputs[0];
|
outlink = inlink->dst->outputs[0];
|
||||||
|
|
||||||
if (outlink) {
|
if (outlink) {
|
||||||
@ -220,7 +220,7 @@ static void default_end_frame(AVFilterLink *inlink)
|
|||||||
{
|
{
|
||||||
AVFilterLink *outlink = NULL;
|
AVFilterLink *outlink = NULL;
|
||||||
|
|
||||||
if (inlink->dst->output_count)
|
if (inlink->dst->nb_outputs)
|
||||||
outlink = inlink->dst->outputs[0];
|
outlink = inlink->dst->outputs[0];
|
||||||
|
|
||||||
avfilter_unref_buffer(inlink->cur_buf);
|
avfilter_unref_buffer(inlink->cur_buf);
|
||||||
@ -261,7 +261,7 @@ static void default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir
|
|||||||
{
|
{
|
||||||
AVFilterLink *outlink = NULL;
|
AVFilterLink *outlink = NULL;
|
||||||
|
|
||||||
if (inlink->dst->output_count)
|
if (inlink->dst->nb_outputs)
|
||||||
outlink = inlink->dst->outputs[0];
|
outlink = inlink->dst->outputs[0];
|
||||||
|
|
||||||
if (outlink)
|
if (outlink)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user