summaryrefslogtreecommitdiff
path: root/libavdevice
diff options
context:
space:
mode:
authorMatthias Hunstock <atze@fem.tu-ilmenau.de>2015-12-20 11:57:32 +0000
committerMarton Balint <cus@passwd.hu>2016-02-03 00:34:26 +0100
commite9025573faf69416fcc29a689447e3296c3eaf58 (patch)
treed2eb65fafb2272a3ee8f244eb2e50e10697f695c /libavdevice
parent5fc310f7ca2a5c76da8daadb38f2a4698bfb90b8 (diff)
decklink: support all valid numbers of audio channels
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. Reviewed-by: Deti Fliegl <deti@fliegl.de> Signed-off-by: Matthias Hunstock <atze@fem.tu-ilmenau.de> Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/decklink_common_c.h1
-rw-r--r--libavdevice/decklink_dec.cpp16
-rw-r--r--libavdevice/decklink_dec_c.c1
3 files changed, 16 insertions, 2 deletions
diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h
index ce1dff7d5d..2b5d92f250 100644
--- a/libavdevice/decklink_common_c.h
+++ b/libavdevice/decklink_common_c.h
@@ -33,6 +33,7 @@ struct decklink_cctx {
int64_t teletext_lines;
double preroll;
int v210;
+ int audio_channels;
};
#endif /* AVDEVICE_DECKLINK_COMMON_C_H */
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index 9a721c9ffa..9d7dc97fd5 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -466,6 +466,17 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
}
#endif
+ /* 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");
@@ -543,7 +554,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;
@@ -587,7 +598,8 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
ctx->teletext_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 e5d6bc040f..40c21a753b 100644
--- a/libavdevice/decklink_dec_c.c
+++ b/libavdevice/decklink_dec_c.c
@@ -35,6 +35,7 @@ static const AVOption options[] = {
{ "teletext_lines", "teletext lines bitmask", OFFSET(teletext_lines), AV_OPT_TYPE_INT64, { .i64 = 0 }, 0, 0x7ffffffffLL, DEC, "teletext_lines"},
{ "standard", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0x7fff9fffeLL}, 0, 0, DEC, "teletext_lines"},
{ "all", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = 0x7ffffffffLL}, 0, 0, DEC, "teletext_lines"},
+ { "channels", "number of audio channels", OFFSET(audio_channels), AV_OPT_TYPE_INT , { .i64 = 2 }, 2, 16, DEC },
{ NULL },
};