mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
lavfi: rename AVFilterFormats.format_count to nb_formats
This is more consistent with naming in the rest of Libav.
This commit is contained in:
parent
e27f4b7cbf
commit
b01f6041f4
@ -341,17 +341,17 @@ static int pick_format(AVFilterLink *link)
|
|||||||
if (!link || !link->in_formats)
|
if (!link || !link->in_formats)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
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->nb_channel_layouts) {
|
if (!link->in_channel_layouts->nb_channel_layouts) {
|
||||||
@ -414,9 +414,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_FORMATS(uint64_t, AVFilterChannelLayouts, channel_layouts,
|
REDUCE_FORMATS(uint64_t, AVFilterChannelLayouts, channel_layouts,
|
||||||
channel_layouts, nb_channel_layouts, ff_add_channel_layout);
|
channel_layouts, nb_channel_layouts, ff_add_channel_layout);
|
||||||
|
|
||||||
@ -445,7 +445,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)
|
||||||
@ -458,10 +458,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) {
|
||||||
@ -607,7 +607,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)
|
||||||
@ -621,10 +621,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;
|
||||||
|
@ -83,7 +83,7 @@ int main(int argc, char **argv)
|
|||||||
/* print the supported formats in input */
|
/* print the supported formats in input */
|
||||||
for (i = 0; i < filter_ctx->input_count; i++) {
|
for (i = 0; i < filter_ctx->input_count; i++) {
|
||||||
AVFilterFormats *fmts = filter_ctx->inputs[i]->out_formats;
|
AVFilterFormats *fmts = filter_ctx->inputs[i]->out_formats;
|
||||||
for (j = 0; j < fmts->format_count; j++)
|
for (j = 0; j < fmts->nb_formats; j++)
|
||||||
printf("INPUT[%d] %s: %s\n",
|
printf("INPUT[%d] %s: %s\n",
|
||||||
i, filter_ctx->filter->inputs[i].name,
|
i, filter_ctx->filter->inputs[i].name,
|
||||||
av_get_pix_fmt_name(fmts->formats[j]));
|
av_get_pix_fmt_name(fmts->formats[j]));
|
||||||
@ -92,7 +92,7 @@ int main(int argc, char **argv)
|
|||||||
/* print the supported formats in output */
|
/* print the supported formats in output */
|
||||||
for (i = 0; i < filter_ctx->output_count; i++) {
|
for (i = 0; i < filter_ctx->output_count; i++) {
|
||||||
AVFilterFormats *fmts = filter_ctx->outputs[i]->in_formats;
|
AVFilterFormats *fmts = filter_ctx->outputs[i]->in_formats;
|
||||||
for (j = 0; j < fmts->format_count; j++)
|
for (j = 0; j < fmts->nb_formats; j++)
|
||||||
printf("OUTPUT[%d] %s: %s\n",
|
printf("OUTPUT[%d] %s: %s\n",
|
||||||
i, filter_ctx->filter->outputs[i].name,
|
i, filter_ctx->filter->outputs[i].name,
|
||||||
av_get_pix_fmt_name(fmts->formats[j]));
|
av_get_pix_fmt_name(fmts->formats[j]));
|
||||||
|
@ -84,7 +84,7 @@ AVFilterFormats *ff_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
|
|||||||
if (a == b)
|
if (a == b)
|
||||||
return a;
|
return a;
|
||||||
|
|
||||||
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:
|
||||||
@ -103,9 +103,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 {
|
||||||
@ -173,7 +173,7 @@ AVFilterFormats *ff_make_format_list(const int *fmts)
|
|||||||
formats = av_mallocz(sizeof(*formats));
|
formats = av_mallocz(sizeof(*formats));
|
||||||
if (count)
|
if (count)
|
||||||
formats->formats = av_malloc(sizeof(*formats->formats) * count);
|
formats->formats = av_malloc(sizeof(*formats->formats) * count);
|
||||||
formats->format_count = count;
|
formats->nb_formats = count;
|
||||||
memcpy(formats->formats, fmts, sizeof(*formats->formats) * count);
|
memcpy(formats->formats, fmts, sizeof(*formats->formats) * count);
|
||||||
|
|
||||||
return formats;
|
return formats;
|
||||||
@ -198,7 +198,7 @@ do { \
|
|||||||
|
|
||||||
int ff_add_format(AVFilterFormats **avff, int fmt)
|
int ff_add_format(AVFilterFormats **avff, int fmt)
|
||||||
{
|
{
|
||||||
ADD_FORMAT(avff, fmt, int, formats, format_count);
|
ADD_FORMAT(avff, fmt, int, formats, nb_formats);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)
|
int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)
|
||||||
|
@ -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
|
||||||
|
@ -91,7 +91,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;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user