As it is already written in the documentation, BMD DeckLink cards are capable of capturing 2, 8 or 16 audio channels (for SDI Inputs). Currently the value is hardcoded to 2. Introduces new option.
Signed-off-by: Matthias Hunstock <a...@fem.tu-ilmenau.de> --- doc/indevs.texi | 13 ++++++++++++- libavdevice/decklink_common_c.h | 1 + libavdevice/decklink_dec.cpp | 16 ++++++++++++++-- libavdevice/decklink_dec_c.c | 2 ++ 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/doc/indevs.texi b/doc/indevs.texi index 6cf626d..6003b9f 100644 --- a/doc/indevs.texi +++ b/doc/indevs.texi @@ -218,7 +218,8 @@ On Windows, you need to run the IDL files through @command{widl}. DeckLink is very picky about the formats it supports. Pixel format is uyvy422 or v210, framerate and video size must be determined for your device with @command{-list_formats 1}. Audio sample rate is always 48 kHz and the number -of channels can be 2, 8 or 16. +of channels can be 2, 8 or 16. Note that all audio channels are bundled in one single +audio track. @subsection Options @@ -236,6 +237,10 @@ Defaults to @option{false}. If set to @samp{1}, video is captured in 10 bit v210 instead of uyvy422. Not all Blackmagic devices support this option. +@item channels +Defines number of audio channels to capture. Must be @samp{2}, @samp{8} or @samp{16}. +Defaults to @samp{2}. + @end table @subsection Examples @@ -266,6 +271,12 @@ Capture video clip at 1080i50 10 bit: ffmpeg -bm_v210 1 -f decklink -i 'UltraStudio Mini Recorder@@11' -acodec copy -vcodec copy output.avi @end example +@item +Capture video clip at 1080i50 with 16 audio channels: +@example +ffmpeg -channels 16 -f decklink -i 'UltraStudio Mini Recorder@@11' -acodec copy -vcodec copy output.avi +@end example + @end itemize @section dshow diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h index fb2b788..403956f 100644 --- a/libavdevice/decklink_common_c.h +++ b/libavdevice/decklink_common_c.h @@ -29,5 +29,6 @@ struct decklink_cctx { int list_formats; double preroll; int v210; + int audio_channels; }; diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp index 89f93de..1588933 100644 --- a/libavdevice/decklink_dec.cpp +++ b/libavdevice/decklink_dec.cpp @@ -381,6 +381,17 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) ctx->preroll = cctx->preroll; cctx->ctx = ctx; + /* Check audio channel option for valid values: 2, 8 or 16 */ + switch (cctx->audio_channels) { + case 2: + case 8: + case 16: + break; + default: + av_log(avctx, AV_LOG_ERROR, "Value of channels option must be one of 2, 8 or 16\n"); + return AVERROR(EINVAL); + } + iter = CreateDeckLinkIteratorInstance(); if (!iter) { av_log(avctx, AV_LOG_ERROR, "Could not create DeckLink iterator\n"); @@ -458,7 +469,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = AV_CODEC_ID_PCM_S16LE; st->codec->sample_rate = bmdAudioSampleRate48kHz; - st->codec->channels = 2; + st->codec->channels = cctx->audio_channels; avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */ ctx->audio_st=st; @@ -488,7 +499,8 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx) ctx->video_st=st; - result = ctx->dli->EnableAudioInput(bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger, 2); + av_log(avctx, AV_LOG_VERBOSE, "Using %d input audio channels\n", ctx->audio_st->codec->channels); + result = ctx->dli->EnableAudioInput(bmdAudioSampleRate48kHz, bmdAudioSampleType16bitInteger, ctx->audio_st->codec->channels); if (result != S_OK) { av_log(avctx, AV_LOG_ERROR, "Cannot enable audio input\n"); diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/decklink_dec_c.c index b1a65e6..487bfd6 100644 --- a/libavdevice/decklink_dec_c.c +++ b/libavdevice/decklink_dec_c.c @@ -32,6 +32,7 @@ static const AVOption options[] = { { "list_devices", "list available devices" , OFFSET(list_devices), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, DEC }, { "list_formats", "list supported formats" , OFFSET(list_formats), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, DEC }, { "bm_v210", "v210 10 bit per channel" , OFFSET(v210), AV_OPT_TYPE_INT , { .i64 = 0 }, 0, 1, DEC }, + { "channels", "number of audio channels", OFFSET(audio_channels), AV_OPT_TYPE_INT , { .i64 = 2 }, 2, 16, DEC }, { NULL }, }; -- 2.4.10 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel