History

avdevice/decklink_dec: map the raw_format instead of hardcode

The patch will change the numerical values for the string constants so bump micro version.

Limin Wang committed 5 years ago

Commit 09f1d151 parent c055a474 files · +19 −9Browse files

Unified · Split

4 files
  1. libavdevice/decklink_common.h +9 −0
  2. libavdevice/decklink_dec.cpp +2 −1
  3. libavdevice/decklink_dec_c.c +7 −7
  4. libavdevice/version.h +1 −1
libavdevice/decklink_common.h+9−0
@@ -162,6 +162,15 @@ IDeckLinkIterator *CreateDeckLinkIteratorInstance(void); · 161 unmodified lines
162162 typedef uint32_t buffercount_type;
163163 #endif
164164
165+static const BMDPixelFormat decklink_raw_format_map[] = {
166+ (BMDPixelFormat)0,
167+ bmdFormat8BitYUV,
168+ bmdFormat10BitYUV,
169+ bmdFormat8BitARGB,
170+ bmdFormat8BitBGRA,
171+ bmdFormat10BitRGB,
172+};
173+
165174 static const BMDAudioConnection decklink_audio_connection_map[] = {
166175 (BMDAudioConnection)0,
167176 bmdAudioConnectionEmbedded,
libavdevice/decklink_dec.cpp+2−1
@@ -1152,7 +1152,8 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 1151 unmodified lines
11521152 ctx->video_pts_source = cctx->video_pts_source;
11531153 ctx->draw_bars = cctx->draw_bars;
11541154 ctx->audio_depth = cctx->audio_depth;
1155− ctx->raw_format = (BMDPixelFormat)cctx->raw_format;
1155+ if (cctx->raw_format > 0 && (unsigned int)cctx->raw_format < FF_ARRAY_ELEMS(decklink_raw_format_map))
1156+ ctx->raw_format = decklink_raw_format_map[cctx->raw_format];
11561157 cctx->ctx = ctx;
11571158
11581159 /* Check audio channel option for valid values: 2, 8 or 16 */
libavdevice/decklink_dec_c.c+7−7
@@ -33,13 +33,13 @@ static const AVOption options[] = { · 32 unmodified lines
3333 { "list_devices", "list available devices" , OFFSET(list_devices), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, DEC },
3434 { "list_formats", "list supported formats" , OFFSET(list_formats), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, DEC },
3535 { "format_code", "set format by fourcc" , OFFSET(format_code), AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, DEC },
36− { "raw_format", "pixel format to be returned by the card when capturing" , OFFSET(raw_format), AV_OPT_TYPE_INT, { .i64 = 0}, 0, UINT_MAX, DEC, "raw_format" },
37− { "auto", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, DEC, "raw_format"},
38− { "uyvy422", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MKBETAG('2','v','u','y') }, 0, 0, DEC, "raw_format"},
39− { "yuv422p10", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MKBETAG('v','2','1','0') }, 0, 0, DEC, "raw_format"},
40− { "argb", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 32 }, 0, 0, DEC, "raw_format"},
41− { "bgra", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MKBETAG('B','G','R','A') }, 0, 0, DEC, "raw_format"},
42− { "rgb10", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = MKBETAG('r','2','1','0') }, 0, 0, DEC, "raw_format"},
36+ { "raw_format", "pixel format to be returned by the card when capturing" , OFFSET(raw_format), AV_OPT_TYPE_INT, { .i64 = 0}, 0, 5, DEC, "raw_format" },
37+ { "auto", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0 }, 0, 0, DEC, "raw_format"},
38+ { "uyvy422", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 1 }, 0, 0, DEC, "raw_format"},
39+ { "yuv422p10", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, DEC, "raw_format"},
40+ { "argb", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 3 }, 0, 0, DEC, "raw_format"},
41+ { "bgra", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 4 }, 0, 0, DEC, "raw_format"},
42+ { "rgb10", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 5 }, 0, 0, DEC, "raw_format"},
4343 { "enable_klv", "output klv if present in vanc", OFFSET(enable_klv), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, DEC },
4444 { "teletext_lines", "teletext lines bitmask", OFFSET(teletext_lines), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, 0x7ffffffffLL, DEC, "teletext_lines"},
4545 { "standard", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0x7fff9fffeLL}, 0, 0, DEC, "teletext_lines"},
libavdevice/version.h+1−1
@@ -29,7 +29,7 @@ · 28 unmodified lines
2929
3030 #define LIBAVDEVICE_VERSION_MAJOR 58
3131 #define LIBAVDEVICE_VERSION_MINOR 11
32−#define LIBAVDEVICE_VERSION_MICRO 102
32+#define LIBAVDEVICE_VERSION_MICRO 103
3333
3434 #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \
3535 LIBAVDEVICE_VERSION_MINOR, \

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