mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-06 15:49:50 +08:00
lavfi: use int64_t lists in AVFilteFormats
The list type was changed to int64_t to be able to hold channel layouts. avfilter_make_format_list() still takes a int32_t array and converts it to int64_t. A new function, avfilter_make_format64_list, that takes int64_t arrays has been added.
This commit is contained in:

committed by
Stefano Sabatini

parent
8f349b6481
commit
527ca3985c
@ -72,28 +72,44 @@ AVFilterFormats *avfilter_merge_formats(AVFilterFormats *a, AVFilterFormats *b)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define MAKE_FORMAT_LIST() \
|
||||
AVFilterFormats *formats; \
|
||||
int count = 0; \
|
||||
if (fmts) \
|
||||
for (count = 0; fmts[count] != -1; count++) \
|
||||
; \
|
||||
formats = av_mallocz(sizeof(AVFilterFormats)); \
|
||||
if (!formats) return NULL; \
|
||||
formats->format_count = count; \
|
||||
if (count) { \
|
||||
formats->formats = av_malloc(sizeof(*formats->formats)*count); \
|
||||
if (!formats->formats) { \
|
||||
av_free(formats); \
|
||||
return NULL; \
|
||||
} \
|
||||
}
|
||||
|
||||
AVFilterFormats *avfilter_make_format_list(const int *fmts)
|
||||
{
|
||||
AVFilterFormats *formats;
|
||||
int count = 0;
|
||||
|
||||
if (fmts)
|
||||
for (count = 0; fmts[count] != -1; count++)
|
||||
;
|
||||
|
||||
formats = av_mallocz(sizeof(AVFilterFormats));
|
||||
formats->format_count = count;
|
||||
if (count) {
|
||||
formats->formats = av_malloc(sizeof(*formats->formats) * count);
|
||||
memcpy(formats->formats, fmts, sizeof(*formats->formats) * count);
|
||||
}
|
||||
MAKE_FORMAT_LIST();
|
||||
while (count--)
|
||||
formats->formats[count] = fmts[count];
|
||||
|
||||
return formats;
|
||||
}
|
||||
|
||||
int avfilter_add_format(AVFilterFormats **avff, int fmt)
|
||||
AVFilterFormats *avfilter_make_format64_list(const int64_t *fmts)
|
||||
{
|
||||
int *fmts;
|
||||
MAKE_FORMAT_LIST();
|
||||
if (count)
|
||||
memcpy(formats->formats, fmts, sizeof(*formats->formats) * count);
|
||||
|
||||
return formats;
|
||||
}
|
||||
|
||||
int avfilter_add_format(AVFilterFormats **avff, int64_t fmt)
|
||||
{
|
||||
int64_t *fmts;
|
||||
|
||||
if (!(*avff) && !(*avff = av_mallocz(sizeof(AVFilterFormats))))
|
||||
return AVERROR(ENOMEM);
|
||||
|
Reference in New Issue
Block a user