Merge commit 'b01f6041f4260fba053c2f96ce1611ea77e833a0'

* commit 'b01f6041f4260fba053c2f96ce1611ea77e833a0':
  lavfi: rename AVFilterFormats.format_count to nb_formats

Conflicts:
	libavfilter/avfiltergraph.c
	libavfilter/filtfmts.c
	libavfilter/formats.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-05-18 11:40:38 +02:00
commit 74cb7ef851
6 changed files with 29 additions and 29 deletions

View File

@ -503,28 +503,28 @@ static int pick_format(AVFilterLink *link, AVFilterLink *ref)
int has_alpha= av_pix_fmt_desc_get(ref->format)->nb_components % 2 == 0; int has_alpha= av_pix_fmt_desc_get(ref->format)->nb_components % 2 == 0;
enum AVPixelFormat best= AV_PIX_FMT_NONE; enum AVPixelFormat best= AV_PIX_FMT_NONE;
int i; int i;
for (i=0; i<link->in_formats->format_count; i++) { for (i=0; i<link->in_formats->nb_formats; i++) {
enum AVPixelFormat p = link->in_formats->formats[i]; enum AVPixelFormat p = link->in_formats->formats[i];
best= avcodec_find_best_pix_fmt_of_2(best, p, ref->format, has_alpha, NULL); best= avcodec_find_best_pix_fmt_of_2(best, p, ref->format, has_alpha, NULL);
} }
av_log(link->src,AV_LOG_DEBUG, "picking %s out of %d ref:%s alpha:%d\n", av_log(link->src,AV_LOG_DEBUG, "picking %s out of %d ref:%s alpha:%d\n",
av_get_pix_fmt_name(best), link->in_formats->format_count, av_get_pix_fmt_name(best), link->in_formats->nb_formats,
av_get_pix_fmt_name(ref->format), has_alpha); av_get_pix_fmt_name(ref->format), has_alpha);
link->in_formats->formats[0] = best; link->in_formats->formats[0] = best;
} }
} }
link->in_formats->format_count = 1; link->in_formats->nb_formats = 1;
link->format = link->in_formats->formats[0]; link->format = link->in_formats->formats[0];
if (link->type == AVMEDIA_TYPE_AUDIO) { if (link->type == AVMEDIA_TYPE_AUDIO) {
if (!link->in_samplerates->format_count) { if (!link->in_samplerates->nb_formats) {
av_log(link->src, AV_LOG_ERROR, "Cannot select sample rate for" av_log(link->src, AV_LOG_ERROR, "Cannot select sample rate for"
" the link between filters %s and %s.\n", link->src->name, " the link between filters %s and %s.\n", link->src->name,
link->dst->name); link->dst->name);
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
link->in_samplerates->format_count = 1; link->in_samplerates->nb_formats = 1;
link->sample_rate = link->in_samplerates->formats[0]; link->sample_rate = link->in_samplerates->formats[0];
if (link->in_channel_layouts->all_layouts) { if (link->in_channel_layouts->all_layouts) {
@ -591,9 +591,9 @@ static int reduce_formats_on_filter(AVFilterContext *filter)
int i, j, k, ret = 0; int i, j, k, ret = 0;
REDUCE_FORMATS(int, AVFilterFormats, formats, formats, REDUCE_FORMATS(int, AVFilterFormats, formats, formats,
format_count, ff_add_format); nb_formats, ff_add_format);
REDUCE_FORMATS(int, AVFilterFormats, samplerates, formats, REDUCE_FORMATS(int, AVFilterFormats, samplerates, formats,
format_count, ff_add_format); nb_formats, ff_add_format);
/* reduce channel layouts */ /* reduce channel layouts */
for (i = 0; i < filter->nb_inputs; i++) { for (i = 0; i < filter->nb_inputs; i++) {
@ -656,7 +656,7 @@ static void swap_samplerates_on_filter(AVFilterContext *filter)
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->nb_formats== 1)
break; break;
} }
if (i == filter->nb_inputs) if (i == filter->nb_inputs)
@ -669,10 +669,10 @@ static void swap_samplerates_on_filter(AVFilterContext *filter)
int best_idx, best_diff = INT_MAX; int best_idx, best_diff = INT_MAX;
if (outlink->type != AVMEDIA_TYPE_AUDIO || if (outlink->type != AVMEDIA_TYPE_AUDIO ||
outlink->in_samplerates->format_count < 2) outlink->in_samplerates->nb_formats < 2)
continue; continue;
for (j = 0; j < outlink->in_samplerates->format_count; j++) { for (j = 0; j < outlink->in_samplerates->nb_formats; j++) {
int diff = abs(sample_rate - outlink->in_samplerates->formats[j]); int diff = abs(sample_rate - outlink->in_samplerates->formats[j]);
if (diff < best_diff) { if (diff < best_diff) {
@ -834,7 +834,7 @@ static void swap_sample_fmts_on_filter(AVFilterContext *filter)
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->nb_formats == 1)
break; break;
} }
if (i == filter->nb_inputs) if (i == filter->nb_inputs)
@ -848,10 +848,10 @@ static void swap_sample_fmts_on_filter(AVFilterContext *filter)
int best_idx = -1, best_score = INT_MIN; int best_idx = -1, best_score = INT_MIN;
if (outlink->type != AVMEDIA_TYPE_AUDIO || if (outlink->type != AVMEDIA_TYPE_AUDIO ||
outlink->in_formats->format_count < 2) outlink->in_formats->nb_formats < 2)
continue; continue;
for (j = 0; j < outlink->in_formats->format_count; j++) { for (j = 0; j < outlink->in_formats->nb_formats; j++) {
int out_format = outlink->in_formats->formats[j]; int out_format = outlink->in_formats->formats[j];
int out_bps = av_get_bytes_per_sample(out_format); int out_bps = av_get_bytes_per_sample(out_format);
int score; int score;
@ -904,7 +904,7 @@ static int pick_formats(AVFilterGraph *graph)
AVFilterContext *filter = graph->filters[i]; AVFilterContext *filter = graph->filters[i];
if (filter->nb_inputs){ if (filter->nb_inputs){
for (j = 0; j < filter->nb_inputs; j++){ for (j = 0; j < filter->nb_inputs; j++){
if(filter->inputs[j]->in_formats && filter->inputs[j]->in_formats->format_count == 1) { if(filter->inputs[j]->in_formats && filter->inputs[j]->in_formats->nb_formats == 1) {
if ((ret = pick_format(filter->inputs[j], NULL)) < 0) if ((ret = pick_format(filter->inputs[j], NULL)) < 0)
return ret; return ret;
change = 1; change = 1;
@ -913,7 +913,7 @@ static int pick_formats(AVFilterGraph *graph)
} }
if (filter->nb_outputs){ if (filter->nb_outputs){
for (j = 0; j < filter->nb_outputs; j++){ for (j = 0; j < filter->nb_outputs; j++){
if(filter->outputs[j]->in_formats && filter->outputs[j]->in_formats->format_count == 1) { if(filter->outputs[j]->in_formats && filter->outputs[j]->in_formats->nb_formats == 1) {
if ((ret = pick_format(filter->outputs[j], NULL)) < 0) if ((ret = pick_format(filter->outputs[j], NULL)) < 0)
return ret; return ret;
change = 1; change = 1;

View File

@ -35,7 +35,7 @@ static void print_formats(AVFilterContext *filter_ctx)
if (filter_ctx->inout##puts[i]->type == AVMEDIA_TYPE_VIDEO) { \ if (filter_ctx->inout##puts[i]->type == AVMEDIA_TYPE_VIDEO) { \
AVFilterFormats *fmts = \ AVFilterFormats *fmts = \
filter_ctx->inout##puts[i]->outin##_formats; \ filter_ctx->inout##puts[i]->outin##_formats; \
for (j = 0; j < fmts->format_count; j++) \ for (j = 0; j < fmts->nb_formats; j++) \
if(av_get_pix_fmt_name(fmts->formats[j])) \ if(av_get_pix_fmt_name(fmts->formats[j])) \
printf(#INOUT "PUT[%d] %s: fmt:%s\n", \ printf(#INOUT "PUT[%d] %s: fmt:%s\n", \
i, filter_ctx->filter->inout##puts[i].name, \ i, filter_ctx->filter->inout##puts[i].name, \
@ -45,7 +45,7 @@ static void print_formats(AVFilterContext *filter_ctx)
AVFilterChannelLayouts *layouts; \ AVFilterChannelLayouts *layouts; \
\ \
fmts = filter_ctx->inout##puts[i]->outin##_formats; \ fmts = filter_ctx->inout##puts[i]->outin##_formats; \
for (j = 0; j < fmts->format_count; j++) \ for (j = 0; j < fmts->nb_formats; j++) \
printf(#INOUT "PUT[%d] %s: fmt:%s\n", \ printf(#INOUT "PUT[%d] %s: fmt:%s\n", \
i, filter_ctx->filter->inout##puts[i].name, \ i, filter_ctx->filter->inout##puts[i].name, \
av_get_sample_fmt_name(fmts->formats[j])); \ av_get_sample_fmt_name(fmts->formats[j])); \

View File

@ -108,8 +108,8 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b,
To avoid that, pretend that there are no common formats to force the To avoid that, pretend that there are no common formats to force the
insertion of a conversion filter. */ insertion of a conversion filter. */
if (type == AVMEDIA_TYPE_VIDEO) if (type == AVMEDIA_TYPE_VIDEO)
for (i = 0; i < a->format_count; i++) for (i = 0; i < a->nb_formats; i++)
for (j = 0; j < b->format_count; j++) { for (j = 0; j < b->nb_formats; j++) {
const AVPixFmtDescriptor *adesc = av_pix_fmt_desc_get(a->formats[i]); const AVPixFmtDescriptor *adesc = av_pix_fmt_desc_get(a->formats[i]);
const AVPixFmtDescriptor *bdesc = av_pix_fmt_desc_get(b->formats[j]); const AVPixFmtDescriptor *bdesc = av_pix_fmt_desc_get(b->formats[j]);
alpha2 |= adesc->flags & bdesc->flags & AV_PIX_FMT_FLAG_ALPHA; alpha2 |= adesc->flags & bdesc->flags & AV_PIX_FMT_FLAG_ALPHA;
@ -124,7 +124,7 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b,
if (alpha2 > alpha1 || chroma2 > chroma1) if (alpha2 > alpha1 || chroma2 > chroma1)
return NULL; return NULL;
MERGE_FORMATS(ret, a, b, formats, format_count, AVFilterFormats, fail); MERGE_FORMATS(ret, a, b, formats, nb_formats, AVFilterFormats, fail);
return ret; return ret;
fail: fail:
@ -143,9 +143,9 @@ AVFilterFormats *ff_merge_samplerates(AVFilterFormats *a,
if (a == b) return a; if (a == b) return a;
if (a->format_count && b->format_count) { if (a->nb_formats && b->nb_formats) {
MERGE_FORMATS(ret, a, b, formats, format_count, AVFilterFormats, fail); MERGE_FORMATS(ret, a, b, formats, nb_formats, AVFilterFormats, fail);
} else if (a->format_count) { } else if (a->nb_formats) {
MERGE_REF(a, b, formats, AVFilterFormats, fail); MERGE_REF(a, b, formats, AVFilterFormats, fail);
ret = a; ret = a;
} else { } else {
@ -307,7 +307,7 @@ int64_t *ff_copy_int64_list(const int64_t * const list)
AVFilterFormats *ff_make_format_list(const int *fmts) AVFilterFormats *ff_make_format_list(const int *fmts)
{ {
MAKE_FORMAT_LIST(AVFilterFormats, formats, format_count); MAKE_FORMAT_LIST(AVFilterFormats, formats, nb_formats);
while (count--) while (count--)
formats->formats[count] = fmts[count]; formats->formats[count] = fmts[count];
@ -343,7 +343,7 @@ do { \
int ff_add_format(AVFilterFormats **avff, int64_t fmt) int ff_add_format(AVFilterFormats **avff, int64_t fmt)
{ {
ADD_FORMAT(avff, fmt, int, formats, format_count); ADD_FORMAT(avff, fmt, int, formats, nb_formats);
return 0; return 0;
} }

View File

@ -62,7 +62,7 @@
* pointer to each of the pointers to itself. * pointer to each of the pointers to itself.
*/ */
struct AVFilterFormats { struct AVFilterFormats {
unsigned format_count; ///< number of formats unsigned nb_formats; ///< number of formats
int *formats; ///< list of media formats int *formats; ///< list of media formats
unsigned refcount; ///< number of references to this list unsigned refcount; ///< number of references to this list

View File

@ -100,7 +100,7 @@ static int query_formats(AVFilterContext *ctx)
int i, depth = 0, be = 0; int i, depth = 0, be = 0;
if (!ctx->inputs[0]->in_formats || if (!ctx->inputs[0]->in_formats ||
!ctx->inputs[0]->in_formats->format_count) { !ctx->inputs[0]->in_formats->nb_formats) {
return AVERROR(EAGAIN); return AVERROR(EAGAIN);
} }
@ -111,7 +111,7 @@ static int query_formats(AVFilterContext *ctx)
desc = av_pix_fmt_desc_get(avff->formats[0]); desc = av_pix_fmt_desc_get(avff->formats[0]);
depth = desc->comp[0].depth_minus1; depth = desc->comp[0].depth_minus1;
be = desc->flags & AV_PIX_FMT_FLAG_BE; be = desc->flags & AV_PIX_FMT_FLAG_BE;
for (i = 1; i < avff->format_count; i++) { for (i = 1; i < avff->nb_formats; i++) {
desc = av_pix_fmt_desc_get(avff->formats[i]); desc = av_pix_fmt_desc_get(avff->formats[i]);
if (depth != desc->comp[0].depth_minus1 || if (depth != desc->comp[0].depth_minus1 ||
be != (desc->flags & AV_PIX_FMT_FLAG_BE)) { be != (desc->flags & AV_PIX_FMT_FLAG_BE)) {

View File

@ -89,7 +89,7 @@ static AVFilterFormats *make_format_list(FormatContext *s, int flag)
for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++) for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++)
if (s->listed_pix_fmt_flags[pix_fmt] == flag) if (s->listed_pix_fmt_flags[pix_fmt] == flag)
formats->formats[formats->format_count++] = pix_fmt; formats->formats[formats->nb_formats++] = pix_fmt;
return formats; return formats;
} }