mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-04-01 22:49:21 +00:00
avfilter: make AVFilterFormats compatible with libav.
The list goes back to being simple integers, and avfilter_make_format64_list is fixed to work with the correct structure directly.
This commit is contained in:
parent
0e82d317eb
commit
5ac9ef6493
@ -260,8 +260,8 @@ void avfilter_unref_bufferp(AVFilterBufferRef **ref);
|
|||||||
* pointer to each of the pointers to itself.
|
* pointer to each of the pointers to itself.
|
||||||
*/
|
*/
|
||||||
typedef struct AVFilterFormats {
|
typedef struct AVFilterFormats {
|
||||||
int64_t *formats; ///< list of media formats
|
|
||||||
unsigned format_count; ///< number of formats
|
unsigned format_count; ///< number of formats
|
||||||
|
int *formats; ///< list of media formats
|
||||||
|
|
||||||
unsigned refcount; ///< number of references to this list
|
unsigned refcount; ///< number of references to this list
|
||||||
struct AVFilterFormats ***refs; ///< references to this list
|
struct AVFilterFormats ***refs; ///< references to this list
|
||||||
|
@ -196,18 +196,18 @@ int64_t *ff_copy_int64_list(const int64_t * const list)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAKE_FORMAT_LIST() \
|
#define MAKE_FORMAT_LIST(type, field, count_field) \
|
||||||
AVFilterFormats *formats; \
|
type *formats; \
|
||||||
int count = 0; \
|
int count = 0; \
|
||||||
if (fmts) \
|
if (fmts) \
|
||||||
for (count = 0; fmts[count] != -1; count++) \
|
for (count = 0; fmts[count] != -1; count++) \
|
||||||
; \
|
; \
|
||||||
formats = av_mallocz(sizeof(AVFilterFormats)); \
|
formats = av_mallocz(sizeof(*formats)); \
|
||||||
if (!formats) return NULL; \
|
if (!formats) return NULL; \
|
||||||
formats->format_count = count; \
|
formats->count_field = count; \
|
||||||
if (count) { \
|
if (count) { \
|
||||||
formats->formats = av_malloc(sizeof(*formats->formats)*count); \
|
formats->field = av_malloc(sizeof(*formats->field)*count); \
|
||||||
if (!formats->formats) { \
|
if (!formats->field) { \
|
||||||
av_free(formats); \
|
av_free(formats); \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
} \
|
} \
|
||||||
@ -215,7 +215,7 @@ int64_t *ff_copy_int64_list(const int64_t * const list)
|
|||||||
|
|
||||||
AVFilterFormats *avfilter_make_format_list(const int *fmts)
|
AVFilterFormats *avfilter_make_format_list(const int *fmts)
|
||||||
{
|
{
|
||||||
MAKE_FORMAT_LIST();
|
MAKE_FORMAT_LIST(AVFilterFormats, formats, format_count);
|
||||||
while (count--)
|
while (count--)
|
||||||
formats->formats[count] = fmts[count];
|
formats->formats[count] = fmts[count];
|
||||||
|
|
||||||
@ -224,11 +224,13 @@ AVFilterFormats *avfilter_make_format_list(const int *fmts)
|
|||||||
|
|
||||||
AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts)
|
AVFilterChannelLayouts *avfilter_make_format64_list(const int64_t *fmts)
|
||||||
{
|
{
|
||||||
MAKE_FORMAT_LIST();
|
MAKE_FORMAT_LIST(AVFilterChannelLayouts,
|
||||||
|
channel_layouts, nb_channel_layouts);
|
||||||
if (count)
|
if (count)
|
||||||
memcpy(formats->formats, fmts, sizeof(*formats->formats) * count);
|
memcpy(formats->channel_layouts, fmts,
|
||||||
|
sizeof(*formats->channel_layouts) * count);
|
||||||
|
|
||||||
return (AVFilterChannelLayouts*)formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ADD_FORMAT(f, fmt, type, list, nb) \
|
#define ADD_FORMAT(f, fmt, type, list, nb) \
|
||||||
@ -250,7 +252,7 @@ do { \
|
|||||||
|
|
||||||
int avfilter_add_format(AVFilterFormats **avff, int64_t fmt)
|
int avfilter_add_format(AVFilterFormats **avff, int64_t fmt)
|
||||||
{
|
{
|
||||||
ADD_FORMAT(avff, fmt, int64_t, formats, format_count);
|
ADD_FORMAT(avff, fmt, int, formats, format_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)
|
int ff_add_channel_layout(AVFilterChannelLayouts **l, uint64_t channel_layout)
|
||||||
|
Loading…
Reference in New Issue
Block a user