History

avdevice/decklink_dec: add support for more pixel formats

The decklink input pixel format can now be specified with the 'raw_format' option. The -bm_v210 option is now deprecated.

Gildas Fargeas committed 9 years ago

Commit cb8b7291 parent 00a61f36 files · +68 −11Browse files

Showing the changes to libavdevice/decklink_dec.cpp (1 of 6 files). Show all

Unified · Split

libavdevice/decklink_dec.cpp+39−7
@@ -651,6 +651,11 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 650 unmodified lines
651651 return AVERROR_EXIT;
652652 }
653653
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+
654659 strcpy (fname, avctx->filename);
655660 tmp=strchr (fname, '@');
656661 if (tmp != NULL) {
@@ -723,15 +728,42 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 66 unmodified lines
723728 st->time_base.num = ctx->bmd_tb_num;
724729 av_stream_set_r_frame_rate(st, av_make_q(st->time_base.den, st->time_base.num));
725730
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:
731733 st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
732− st->codecpar->format = AV_PIX_FMT_UYVY422;
733734 st->codecpar->codec_tag = MKTAG('U', 'Y', 'V', 'Y');
735+ st->codecpar->format = AV_PIX_FMT_UYVY422;
734736 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;
735767 }
736768
737769 switch (ctx->bmd_field_dominance) {
@@ -776,7 +808,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) · 38 unmodified lines
776808 }
777809
778810 result = ctx->dli->EnableVideoInput(ctx->bmd_mode,
779− cctx->v210 ? bmdFormat10BitYUV : bmdFormat8BitYUV,
811+ (BMDPixelFormat) cctx->raw_format,
780812 bmdVideoInputFlagDefault);
781813
782814 if (result != S_OK) {

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