| @@ -28,8 +28,8 @@ · 27 unmodified lines |
| 28 | #include "framesync.h" | 28 | #include "framesync.h" |
| 29 | | 29 | |
| 30 | typedef struct Mapping { | 30 | typedef struct Mapping { |
| 31 | uint8_t input; | 31 | int input; |
| 32 | uint8_t plane; | 32 | int plane; |
| 33 | } Mapping; | 33 | } Mapping; |
| 34 | | 34 | |
| 35 | typedef struct InputParam { | 35 | typedef struct InputParam { |
| @@ -56,8 +56,16 @@ typedef struct MergePlanesContext { · 20 unmodified lines |
| 56 | #define OFFSET(x) offsetof(MergePlanesContext, x) | 56 | #define OFFSET(x) offsetof(MergePlanesContext, x) |
| 57 | #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM | 57 | #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM |
| 58 | static const AVOption mergeplanes_options[] = { | 58 | static const AVOption mergeplanes_options[] = { |
| 59 | { "mapping", "set input to output plane mapping", OFFSET(mapping), AV_OPT_TYPE_INT, {.i64=0}, 0, 0x33333333, FLAGS }, | 59 | { "mapping", "set input to output plane mapping", OFFSET(mapping), AV_OPT_TYPE_INT, {.i64=-1}, -1, 0x33333333, FLAGS }, |
| 60 | { "format", "set output pixel format", OFFSET(out_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64=AV_PIX_FMT_YUVA444P}, 0, INT_MAX, .flags=FLAGS }, | 60 | { "format", "set output pixel format", OFFSET(out_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64=AV_PIX_FMT_YUVA444P}, 0, INT_MAX, .flags=FLAGS }, |
| | 61 | { "map0s", "set 1st input to output stream mapping", OFFSET(map[0].input), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, |
| | 62 | { "map0p", "set 1st input to output plane mapping", OFFSET(map[0].plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, |
| | 63 | { "map1s", "set 2nd input to output stream mapping", OFFSET(map[1].input), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, |
| | 64 | { "map1p", "set 2nd input to output plane mapping", OFFSET(map[1].plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, |
| | 65 | { "map2s", "set 3rd input to output stream mapping", OFFSET(map[2].input), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, |
| | 66 | { "map2p", "set 3rd input to output plane mapping", OFFSET(map[2].plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, |
| | 67 | { "map3s", "set 4th input to output stream mapping", OFFSET(map[3].input), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, |
| | 68 | { "map3p", "set 4th input to output plane mapping", OFFSET(map[3].plane), AV_OPT_TYPE_INT, {.i64=0}, 0, 3, FLAGS }, |
| 61 | { NULL } | 69 | { NULL } |
| 62 | }; | 70 | }; |
| 63 | | 71 | |
| @@ -78,10 +86,12 @@ static av_cold int init(AVFilterContext *ctx) · 14 unmodified lines |
| 78 | s->nb_planes = av_pix_fmt_count_planes(s->out_fmt); | 86 | s->nb_planes = av_pix_fmt_count_planes(s->out_fmt); |
| 79 | | 87 | |
| 80 | for (i = s->nb_planes - 1; i >= 0; i--) { | 88 | for (i = s->nb_planes - 1; i >= 0; i--) { |
| 81 | s->map[i].plane = m & 0xf; | 89 | if (m >= 0 && m <= 0x33333333) { |
| 82 | m >>= 4; | 90 | s->map[i].plane = m & 0xf; |
| 83 | s->map[i].input = m & 0xf; | 91 | m >>= 4; |
| 84 | m >>= 4; | 92 | s->map[i].input = m & 0xf; |
| | 93 | m >>= 4; |
| | 94 | } |
| 85 | | 95 | |
| 86 | if (s->map[i].plane > 3 || s->map[i].input > 3) { | 96 | if (s->map[i].plane > 3 || s->map[i].input > 3) { |
| 87 | av_log(ctx, AV_LOG_ERROR, "Mapping with out of range input and/or plane number.\n"); | 97 | av_log(ctx, AV_LOG_ERROR, "Mapping with out of range input and/or plane number.\n"); |