aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2022-01-17 12:38:47 -0300
committerJames Almer <jamrial@gmail.com>2022-03-15 09:42:31 -0300
commitd03b32778753ec594e78cb0af6d6b389d5a05afa (patch)
treef05bb0b8a56fa618de37b8e47cb12ca0700e6b08
parent6a9668e17fc7cbc3e2ce0cc2e0d4f8c03f1127b8 (diff)
downloadffmpeg-d03b32778753ec594e78cb0af6d6b389d5a05afa.tar.gz
decklink: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavdevice/decklink_dec.cpp8
-rw-r--r--libavdevice/decklink_enc.cpp6
2 files changed, 7 insertions, 7 deletions
diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp
index c97a72d93d..7bf5e3724c 100644
--- a/libavdevice/decklink_dec.cpp
+++ b/libavdevice/decklink_dec.cpp
@@ -1060,7 +1060,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
BMDTimeValue audio_pts;
//hack among hacks
- pkt.size = audioFrame->GetSampleFrameCount() * ctx->audio_st->codecpar->channels * (ctx->audio_depth / 8);
+ pkt.size = audioFrame->GetSampleFrameCount() * ctx->audio_st->codecpar->ch_layout.nb_channels * (ctx->audio_depth / 8);
audioFrame->GetBytes(&audioFrameBytes);
audioFrame->GetPacketTime(&audio_pts, ctx->audio_st->time_base.den);
pkt.pts = get_pkt_pts(videoFrame, audioFrame, wallclock, abs_wallclock, ctx->audio_pts_source, ctx->audio_st->time_base, &initial_audio_pts, cctx->copyts);
@@ -1296,7 +1296,7 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
st->codecpar->codec_id = cctx->audio_depth == 32 ? AV_CODEC_ID_PCM_S32LE : AV_CODEC_ID_PCM_S16LE;
st->codecpar->sample_rate = bmdAudioSampleRate48kHz;
- st->codecpar->channels = cctx->audio_channels;
+ st->codecpar->ch_layout.nb_channels = cctx->audio_channels;
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
ctx->audio_st=st;
@@ -1392,8 +1392,8 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
ctx->teletext_st = st;
}
- av_log(avctx, AV_LOG_VERBOSE, "Using %d input audio channels\n", ctx->audio_st->codecpar->channels);
- result = ctx->dli->EnableAudioInput(bmdAudioSampleRate48kHz, cctx->audio_depth == 32 ? bmdAudioSampleType32bitInteger : bmdAudioSampleType16bitInteger, ctx->audio_st->codecpar->channels);
+ av_log(avctx, AV_LOG_VERBOSE, "Using %d input audio channels\n", ctx->audio_st->codecpar->ch_layout.nb_channels);
+ result = ctx->dli->EnableAudioInput(bmdAudioSampleRate48kHz, cctx->audio_depth == 32 ? bmdAudioSampleType32bitInteger : bmdAudioSampleType16bitInteger, ctx->audio_st->codecpar->ch_layout.nb_channels);
if (result != S_OK) {
av_log(avctx, AV_LOG_ERROR, "Cannot enable audio input\n");
diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp
index 6dec5f35ea..fb686b9032 100644
--- a/libavdevice/decklink_enc.cpp
+++ b/libavdevice/decklink_enc.cpp
@@ -248,14 +248,14 @@ static int decklink_setup_audio(AVFormatContext *avctx, AVStream *st)
" Only 48kHz is supported.\n");
return -1;
}
- if (c->channels != 2 && c->channels != 8 && c->channels != 16) {
+ if (c->ch_layout.nb_channels != 2 && c->ch_layout.nb_channels != 8 && c->ch_layout.nb_channels != 16) {
av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels!"
" Only 2, 8 or 16 channels are supported.\n");
return -1;
}
if (ctx->dlo->EnableAudioOutput(bmdAudioSampleRate48kHz,
bmdAudioSampleType16bitInteger,
- c->channels,
+ c->ch_layout.nb_channels,
bmdAudioOutputStreamTimestamped) != S_OK) {
av_log(avctx, AV_LOG_ERROR, "Could not enable audio output!\n");
return -1;
@@ -267,7 +267,7 @@ static int decklink_setup_audio(AVFormatContext *avctx, AVStream *st)
/* The device expects the sample rate to be fixed. */
avpriv_set_pts_info(st, 64, 1, c->sample_rate);
- ctx->channels = c->channels;
+ ctx->channels = c->ch_layout.nb_channels;
ctx->audio = 1;