The decklink input pixel format can now be specified with the 'raw_format' option. The -bm_v210 option is now deprecated.
Unified · Split
| @@ -214,8 +214,9 @@ need to configure with the appropriate @code{--extra-cflags} · 213 unmodified lines | ||
| 214 | 214 | and @code{--extra-ldflags}. |
| 215 | 215 | On Windows, you need to run the IDL files through @command{widl}. |
| 216 | 216 | |
| 217 | −DeckLink is very picky about the formats it supports. Pixel format is | |
| 218 | −uyvy422 or v210, framerate and video size must be determined for your device with | |
| 217 | +DeckLink is very picky about the formats it supports. Pixel format of the | |
| 218 | +input can be set with @option{raw_format}. | |
| 219 | +Framerate and video size must be determined for your device with | |
| 219 | 220 | @command{-list_formats 1}. Audio sample rate is always 48 kHz and the number |
| 220 | 221 | of channels can be 2, 8 or 16. Note that all audio channels are bundled in one single |
| 221 | 222 | audio track. |
| @@ -239,9 +240,26 @@ Note that there is a FourCC @option{'pal '} that can also be used · 17 unmodified lines | ||
| 239 | 240 | as @option{pal} (3 letters). |
| 240 | 241 | |
| 241 | 242 | @item bm_v210 |
| 243 | +This is a deprecated option, you can use @option{raw_format} instead. | |
| 242 | 244 | If set to @samp{1}, video is captured in 10 bit v210 instead |
| 243 | 245 | of uyvy422. Not all Blackmagic devices support this option. |
| 244 | 246 | |
| 247 | +@item raw_format | |
| 248 | +Set the pixel format of the captured video. | |
| 249 | +Available values are: | |
| 250 | +@table @samp | |
| 251 | +@item uyvy422 | |
| 252 | + | |
| 253 | +@item yuv422p10 | |
| 254 | + | |
| 255 | +@item argb | |
| 256 | + | |
| 257 | +@item bgra | |
| 258 | + | |
| 259 | +@item rgb10 | |
| 260 | + | |
| 261 | +@end table | |
| 262 | + | |
| 245 | 263 | @item teletext_lines |
| 246 | 264 | If set to nonzero, an additional teletext stream will be captured from the |
| 247 | 265 | vertical ancillary data. Both SD PAL (576i) and HD (1080i or 1080p) |
| @@ -241,7 +241,7 @@ int ff_decklink_set_format(AVFormatContext *avctx, · 240 unmodified lines | ||
| 241 | 241 | if (ctx->bmd_mode == bmdModeUnknown) |
| 242 | 242 | return -1; |
| 243 | 243 | if (direction == DIRECTION_IN) { |
| 244 | − if (ctx->dli->DoesSupportVideoMode(ctx->bmd_mode, bmdFormat8BitYUV, | |
| 244 | + if (ctx->dli->DoesSupportVideoMode(ctx->bmd_mode, (BMDPixelFormat) cctx->raw_format, | |
| 245 | 245 | bmdVideoOutputFlagDefault, |
| 246 | 246 | &support, NULL) != S_OK) |
| 247 | 247 | return -1; |
| @@ -49,6 +49,7 @@ struct decklink_cctx { · 48 unmodified lines | ||
| 49 | 49 | int video_input; |
| 50 | 50 | int draw_bars; |
| 51 | 51 | char *format_code; |
| 52 | + int raw_format; | |
| 52 | 53 | int64_t queue_size; |
| 53 | 54 | }; |
| 54 | 55 | |
| @@ -651,6 +651,11 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 650 unmodified lines | ||
| 651 | 651 | return AVERROR_EXIT; |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | + if (cctx->v210) { | |
| 655 | + av_log(avctx, AV_LOG_WARNING, "The bm_v210 option is deprecated and will be removed. Please use the -raw_format yuv422p10.\n"); | |
| 656 | + cctx->raw_format = MKBETAG('v','2','1','0'); | |
| 657 | + } | |
| 658 | + | |
| 654 | 659 | strcpy (fname, avctx->filename); |
| 655 | 660 | tmp=strchr (fname, '@'); |
| 656 | 661 | if (tmp != NULL) { |
| @@ -723,15 +728,42 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 66 unmodified lines | ||
| 723 | 728 | st->time_base.num = ctx->bmd_tb_num; |
| 724 | 729 | av_stream_set_r_frame_rate(st, av_make_q(st->time_base.den, st->time_base.num)); |
| 725 | 730 | |
| 726 | − if (cctx->v210) { | |
| 727 | − st->codecpar->codec_id = AV_CODEC_ID_V210; | |
| 728 | − st->codecpar->codec_tag = MKTAG('V', '2', '1', '0'); | |
| 729 | − st->codecpar->bit_rate = av_rescale(ctx->bmd_width * ctx->bmd_height * 64, st->time_base.den, st->time_base.num * 3); | |
| 730 | − } else { | |
| 731 | + switch((BMDPixelFormat)cctx->raw_format) { | |
| 732 | + case bmdFormat8BitYUV: | |
| 731 | 733 | st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; |
| 732 | − st->codecpar->format = AV_PIX_FMT_UYVY422; | |
| 733 | 734 | st->codecpar->codec_tag = MKTAG('U', 'Y', 'V', 'Y'); |
| 735 | + st->codecpar->format = AV_PIX_FMT_UYVY422; | |
| 734 | 736 | st->codecpar->bit_rate = av_rescale(ctx->bmd_width * ctx->bmd_height * 16, st->time_base.den, st->time_base.num); |
| 737 | + break; | |
| 738 | + case bmdFormat10BitYUV: | |
| 739 | + st->codecpar->codec_id = AV_CODEC_ID_V210; | |
| 740 | + st->codecpar->codec_tag = MKTAG('V','2','1','0'); | |
| 741 | + st->codecpar->bit_rate = av_rescale(ctx->bmd_width * ctx->bmd_height * 64, st->time_base.den, st->time_base.num * 3); | |
| 742 | + st->codecpar->bits_per_coded_sample = 10; | |
| 743 | + break; | |
| 744 | + case bmdFormat8BitARGB: | |
| 745 | + st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; | |
| 746 | + st->codecpar->codec_tag = avcodec_pix_fmt_to_codec_tag((enum AVPixelFormat)st->codecpar->format);; | |
| 747 | + st->codecpar->format = AV_PIX_FMT_ARGB; | |
| 748 | + st->codecpar->bit_rate = av_rescale(ctx->bmd_width * ctx->bmd_height * 32, st->time_base.den, st->time_base.num); | |
| 749 | + break; | |
| 750 | + case bmdFormat8BitBGRA: | |
| 751 | + st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; | |
| 752 | + st->codecpar->codec_tag = avcodec_pix_fmt_to_codec_tag((enum AVPixelFormat)st->codecpar->format); | |
| 753 | + st->codecpar->format = AV_PIX_FMT_BGRA; | |
| 754 | + st->codecpar->bit_rate = av_rescale(ctx->bmd_width * ctx->bmd_height * 32, st->time_base.den, st->time_base.num); | |
| 755 | + break; | |
| 756 | + case bmdFormat10BitRGB: | |
| 757 | + st->codecpar->codec_id = AV_CODEC_ID_R210; | |
| 758 | + st->codecpar->codec_tag = MKTAG('R','2','1','0'); | |
| 759 | + st->codecpar->format = AV_PIX_FMT_RGB48LE; | |
| 760 | + st->codecpar->bit_rate = av_rescale(ctx->bmd_width * ctx->bmd_height * 30, st->time_base.den, st->time_base.num); | |
| 761 | + st->codecpar->bits_per_coded_sample = 10; | |
| 762 | + break; | |
| 763 | + default: | |
| 764 | + av_log(avctx, AV_LOG_ERROR, "Raw Format %.4s not supported\n", (char*) &cctx->raw_format); | |
| 765 | + ret = AVERROR(EINVAL); | |
| 766 | + goto error; | |
| 735 | 767 | } |
| 736 | 768 | |
| 737 | 769 | switch (ctx->bmd_field_dominance) { |
| @@ -776,7 +808,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 38 unmodified lines | ||
| 776 | 808 | } |
| 777 | 809 | |
| 778 | 810 | result = ctx->dli->EnableVideoInput(ctx->bmd_mode, |
| 779 | − cctx->v210 ? bmdFormat10BitYUV : bmdFormat8BitYUV, | |
| 811 | + (BMDPixelFormat) cctx->raw_format, | |
| 780 | 812 | bmdVideoInputFlagDefault); |
| 781 | 813 | |
| 782 | 814 | if (result != S_OK) { |
| @@ -34,6 +34,12 @@ static const AVOption options[] = { · 33 unmodified lines | ||
| 34 | 34 | { "list_formats", "list supported formats" , OFFSET(list_formats), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, DEC }, |
| 35 | 35 | { "format_code", "set format by fourcc" , OFFSET(format_code), AV_OPT_TYPE_STRING, { .str = NULL}, 0, 0, DEC }, |
| 36 | 36 | { "bm_v210", "v210 10 bit per channel" , OFFSET(v210), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, DEC }, |
| 37 | + { "raw_format", "pixel format to be returned by the card when capturing" , OFFSET(raw_format), AV_OPT_TYPE_INT, { .i64 = MKBETAG('2','v','u','y')}, 0, UINT_MAX, 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"}, | |
| 37 | 43 | { "teletext_lines", "teletext lines bitmask", OFFSET(teletext_lines), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, 0x7ffffffffLL, DEC, "teletext_lines"}, |
| 38 | 44 | { "standard", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0x7fff9fffeLL}, 0, 0, DEC, "teletext_lines"}, |
| 39 | 45 | { "all", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0x7ffffffffLL}, 0, 0, DEC, "teletext_lines"}, |
| @@ -29,7 +29,7 @@ · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | #define LIBAVDEVICE_VERSION_MAJOR 57 |
| 31 | 31 | #define LIBAVDEVICE_VERSION_MINOR 9 |
| 32 | −#define LIBAVDEVICE_VERSION_MICRO 100 | |
| 32 | +#define LIBAVDEVICE_VERSION_MICRO 101 | |
| 33 | 33 | |
| 34 | 34 | #define LIBAVDEVICE_VERSION_INT AV_VERSION_INT(LIBAVDEVICE_VERSION_MAJOR, \ |
| 35 | 35 | LIBAVDEVICE_VERSION_MINOR, \ |