The decklink input pixel format can now be specified with the 'raw_format' option. The -bm_v210 option is now deprecated.
Showing the changes to libavdevice/decklink_dec.cpp (1 of 6 files). Show all
Unified · Split
| @@ -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) { |