mirror of https://git.ffmpeg.org/ffmpeg.git
avfilter/vf_remap: add option to control output format
This commit is contained in:
parent
be822eb6f8
commit
54fc8d370e
|
@ -47,9 +47,12 @@
|
|||
|
||||
typedef struct RemapContext {
|
||||
const AVClass *class;
|
||||
int format;
|
||||
|
||||
int nb_planes;
|
||||
int nb_components;
|
||||
int step;
|
||||
|
||||
FFFrameSync fs;
|
||||
|
||||
int (*remap_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
|
||||
|
@ -59,6 +62,9 @@ typedef struct RemapContext {
|
|||
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
|
||||
|
||||
static const AVOption remap_options[] = {
|
||||
{ "format", "set output format", OFFSET(format), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "format" },
|
||||
{ "color", "", 0, AV_OPT_TYPE_CONST, {.i64=0}, .flags = FLAGS, .unit = "format" },
|
||||
{ "gray", "", 0, AV_OPT_TYPE_CONST, {.i64=1}, .flags = FLAGS, .unit = "format" },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -73,6 +79,7 @@ typedef struct ThreadData {
|
|||
|
||||
static int query_formats(AVFilterContext *ctx)
|
||||
{
|
||||
RemapContext *s = ctx->priv;
|
||||
static const enum AVPixelFormat pix_fmts[] = {
|
||||
AV_PIX_FMT_YUVA444P,
|
||||
AV_PIX_FMT_YUV444P,
|
||||
|
@ -88,6 +95,9 @@ static int query_formats(AVFilterContext *ctx)
|
|||
AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
|
||||
AV_PIX_FMT_RGB48, AV_PIX_FMT_BGR48,
|
||||
AV_PIX_FMT_RGBA64, AV_PIX_FMT_BGRA64,
|
||||
AV_PIX_FMT_NONE
|
||||
};
|
||||
static const enum AVPixelFormat gray_pix_fmts[] = {
|
||||
AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9,
|
||||
AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12,
|
||||
AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16,
|
||||
|
@ -100,7 +110,7 @@ static int query_formats(AVFilterContext *ctx)
|
|||
AVFilterFormats *pix_formats = NULL, *map_formats = NULL;
|
||||
int ret;
|
||||
|
||||
if (!(pix_formats = ff_make_format_list(pix_fmts)) ||
|
||||
if (!(pix_formats = ff_make_format_list(s->format ? gray_pix_fmts : pix_fmts)) ||
|
||||
!(map_formats = ff_make_format_list(map_fmts))) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
|
|
Loading…
Reference in New Issue