mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Change avfilter_add_colorspace() to make it accept **avff rather than
*avff, so that an AVFilterFormats struct is created and returned by the function if *avff is NULL. Make the function use more convenient. Originally committed as revision 21035 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
7659712749
commit
c1d662fd88
@ -25,7 +25,7 @@
|
|||||||
#include "libavutil/avutil.h"
|
#include "libavutil/avutil.h"
|
||||||
|
|
||||||
#define LIBAVFILTER_VERSION_MAJOR 1
|
#define LIBAVFILTER_VERSION_MAJOR 1
|
||||||
#define LIBAVFILTER_VERSION_MINOR 13
|
#define LIBAVFILTER_VERSION_MINOR 14
|
||||||
#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, \
|
||||||
@ -192,12 +192,14 @@ struct AVFilterFormats
|
|||||||
AVFilterFormats *avfilter_make_format_list(const enum PixelFormat *pix_fmts);
|
AVFilterFormats *avfilter_make_format_list(const enum PixelFormat *pix_fmts);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds pix_fmt to the list of pixel formats contained in avff.
|
* Adds pix_fmt to the list of pixel formats contained in *avff.
|
||||||
|
* If *avff is NULL the function allocates the filter formats struct
|
||||||
|
* and puts its pointer in *avff.
|
||||||
*
|
*
|
||||||
* @return a non negative value in case of success, or a negative
|
* @return a non negative value in case of success, or a negative
|
||||||
* value corresponding to an AVERROR code in case of error
|
* value corresponding to an AVERROR code in case of error
|
||||||
*/
|
*/
|
||||||
int avfilter_add_colorspace(AVFilterFormats *avff, enum PixelFormat pix_fmt);
|
int avfilter_add_colorspace(AVFilterFormats **avff, enum PixelFormat pix_fmt);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of all colorspaces supported by FFmpeg.
|
* Returns a list of all colorspaces supported by FFmpeg.
|
||||||
|
@ -86,28 +86,31 @@ AVFilterFormats *avfilter_make_format_list(const enum PixelFormat *pix_fmts)
|
|||||||
return formats;
|
return formats;
|
||||||
}
|
}
|
||||||
|
|
||||||
int avfilter_add_colorspace(AVFilterFormats *avff, enum PixelFormat pix_fmt)
|
int avfilter_add_colorspace(AVFilterFormats **avff, enum PixelFormat pix_fmt)
|
||||||
{
|
{
|
||||||
enum PixelFormat *pix_fmts =
|
enum PixelFormat *pix_fmts;
|
||||||
av_realloc(avff->formats, sizeof(avff->formats) * (avff->format_count+1));
|
|
||||||
|
|
||||||
|
if (!(*avff) && !(*avff = av_mallocz(sizeof(AVFilterFormats))))
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
|
pix_fmts = av_realloc((*avff)->formats,
|
||||||
|
sizeof((*avff)->formats) * ((*avff)->format_count+1));
|
||||||
if (!pix_fmts)
|
if (!pix_fmts)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
avff->formats = pix_fmts;
|
(*avff)->formats = pix_fmts;
|
||||||
avff->formats[avff->format_count++] = pix_fmt;
|
(*avff)->formats[(*avff)->format_count++] = pix_fmt;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
AVFilterFormats *avfilter_all_colorspaces(void)
|
AVFilterFormats *avfilter_all_colorspaces(void)
|
||||||
{
|
{
|
||||||
AVFilterFormats *ret;
|
AVFilterFormats *ret = NULL;
|
||||||
enum PixelFormat pix_fmt;
|
enum PixelFormat pix_fmt;
|
||||||
|
|
||||||
ret = av_mallocz(sizeof(AVFilterFormats));
|
|
||||||
for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
|
for (pix_fmt = 0; pix_fmt < PIX_FMT_NB; pix_fmt++)
|
||||||
if (!(av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL))
|
if (!(av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL))
|
||||||
avfilter_add_colorspace(ret, pix_fmt);
|
avfilter_add_colorspace(&ret, pix_fmt);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user