History

avfilter/vf_remap: add option to control output format

Paul B Mahol committed 7 years ago

Commit 54fc8d31 parent be822eb1 file · +11 −1Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_remap.c+11−1
@@ -47,9 +47,12 @@ · 46 unmodified lines
4747
4848 typedef struct RemapContext {
4949 const AVClass *class;
50+ int format;
51+
5052 int nb_planes;
5153 int nb_components;
5254 int step;
55+
5356 FFFrameSync fs;
5457
5558 int (*remap_slice)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
@@ -59,6 +62,9 @@ typedef struct RemapContext { · 3 unmodified lines
5962 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
6063
6164 static const AVOption remap_options[] = {
65+ { "format", "set output format", OFFSET(format), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, "format" },
66+ { "color", "", 0, AV_OPT_TYPE_CONST, {.i64=0}, .flags = FLAGS, .unit = "format" },
67+ { "gray", "", 0, AV_OPT_TYPE_CONST, {.i64=1}, .flags = FLAGS, .unit = "format" },
6268 { NULL }
6369 };
6470
@@ -73,6 +79,7 @@ typedef struct ThreadData { · 8 unmodified lines
7379
7480 static int query_formats(AVFilterContext *ctx)
7581 {
82+ RemapContext *s = ctx->priv;
7683 static const enum AVPixelFormat pix_fmts[] = {
7784 AV_PIX_FMT_YUVA444P,
7885 AV_PIX_FMT_YUV444P,
@@ -88,6 +95,9 @@ static int query_formats(AVFilterContext *ctx) · 9 unmodified lines
8895 AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
8996 AV_PIX_FMT_RGB48, AV_PIX_FMT_BGR48,
9097 AV_PIX_FMT_RGBA64, AV_PIX_FMT_BGRA64,
98+ AV_PIX_FMT_NONE
99+ };
100+ static const enum AVPixelFormat gray_pix_fmts[] = {
91101 AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9,
92102 AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12,
93103 AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16,
@@ -100,7 +110,7 @@ static int query_formats(AVFilterContext *ctx) · 6 unmodified lines
100110 AVFilterFormats *pix_formats = NULL, *map_formats = NULL;
101111 int ret;
102112
103− if (!(pix_formats = ff_make_format_list(pix_fmts)) ||
113+ if (!(pix_formats = ff_make_format_list(s->format ? gray_pix_fmts : pix_fmts)) ||
104114 !(map_formats = ff_make_format_list(map_fmts))) {
105115 ret = AVERROR(ENOMEM);
106116 goto fail;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t