decklink: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
@@ -1060,7 +1060,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived(
|
|||||||
BMDTimeValue audio_pts;
|
BMDTimeValue audio_pts;
|
||||||
|
|
||||||
//hack among hacks
|
//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->GetBytes(&audioFrameBytes);
|
||||||
audioFrame->GetPacketTime(&audio_pts, ctx->audio_st->time_base.den);
|
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);
|
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_type = AVMEDIA_TYPE_AUDIO;
|
||||||
st->codecpar->codec_id = cctx->audio_depth == 32 ? AV_CODEC_ID_PCM_S32LE : AV_CODEC_ID_PCM_S16LE;
|
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->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 */
|
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
|
||||||
ctx->audio_st=st;
|
ctx->audio_st=st;
|
||||||
|
|
||||||
@@ -1392,8 +1392,8 @@ av_cold int ff_decklink_read_header(AVFormatContext *avctx)
|
|||||||
ctx->teletext_st = st;
|
ctx->teletext_st = st;
|
||||||
}
|
}
|
||||||
|
|
||||||
av_log(avctx, AV_LOG_VERBOSE, "Using %d input audio channels\n", 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->channels);
|
result = ctx->dli->EnableAudioInput(bmdAudioSampleRate48kHz, cctx->audio_depth == 32 ? bmdAudioSampleType32bitInteger : bmdAudioSampleType16bitInteger, ctx->audio_st->codecpar->ch_layout.nb_channels);
|
||||||
|
|
||||||
if (result != S_OK) {
|
if (result != S_OK) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Cannot enable audio input\n");
|
av_log(avctx, AV_LOG_ERROR, "Cannot enable audio input\n");
|
||||||
|
|||||||
@@ -248,14 +248,14 @@ static int decklink_setup_audio(AVFormatContext *avctx, AVStream *st)
|
|||||||
" Only 48kHz is supported.\n");
|
" Only 48kHz is supported.\n");
|
||||||
return -1;
|
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!"
|
av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels!"
|
||||||
" Only 2, 8 or 16 channels are supported.\n");
|
" Only 2, 8 or 16 channels are supported.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (ctx->dlo->EnableAudioOutput(bmdAudioSampleRate48kHz,
|
if (ctx->dlo->EnableAudioOutput(bmdAudioSampleRate48kHz,
|
||||||
bmdAudioSampleType16bitInteger,
|
bmdAudioSampleType16bitInteger,
|
||||||
c->channels,
|
c->ch_layout.nb_channels,
|
||||||
bmdAudioOutputStreamTimestamped) != S_OK) {
|
bmdAudioOutputStreamTimestamped) != S_OK) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Could not enable audio output!\n");
|
av_log(avctx, AV_LOG_ERROR, "Could not enable audio output!\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -267,7 +267,7 @@ static int decklink_setup_audio(AVFormatContext *avctx, AVStream *st)
|
|||||||
|
|
||||||
/* The device expects the sample rate to be fixed. */
|
/* The device expects the sample rate to be fixed. */
|
||||||
avpriv_set_pts_info(st, 64, 1, c->sample_rate);
|
avpriv_set_pts_info(st, 64, 1, c->sample_rate);
|
||||||
ctx->channels = c->channels;
|
ctx->channels = c->ch_layout.nb_channels;
|
||||||
|
|
||||||
ctx->audio = 1;
|
ctx->audio = 1;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user