decklink: Add 2.1 & 4.1 surround layouts

The list of channel layouts available for decklink input is missing 2.1
& 4.1 layouts.  The commit adds them.  This aligns the decklink input
with the speaker layouts available at outputs.  Having different layouts
as input and output invokes FFmpeg resampler, which remixes the channels
in non trivial way except when downmixing to stereo.  This patch allows
to avoid such uncontrolled remix of channels with decklink input.
This commit is contained in:
pkviet 2017-12-05 00:26:47 +01:00 • committed by jp9000
commit 974e64eb23
4 changed files with 35 additions and 8 deletions

View file

@ -46,6 +46,8 @@ static inline int ConvertChannelFormat(speaker_layout format)
static inline audio_repack_mode_t ConvertRepackFormat(speaker_layout format)
{
switch (format) {
case SPEAKERS_2POINT1:
return repack_mode_8to3ch_swap23;
case SPEAKERS_4POINT0:
return repack_mode_8to4ch_swap23;
case SPEAKERS_4POINT1:
@ -103,7 +105,6 @@ void DeckLinkDeviceInstance::HandleAudioPacket(
if (channelFormat != SPEAKERS_UNKNOWN &&
channelFormat != SPEAKERS_MONO &&
channelFormat != SPEAKERS_STEREO &&
channelFormat != SPEAKERS_2POINT1 &&
maxdevicechannel >= 8 &&
isWin) {
@ -247,7 +248,6 @@ bool DeckLinkDeviceInstance::StartCapture(DeckLinkDeviceMode *mode_)
if (channelFormat != SPEAKERS_UNKNOWN &&
channelFormat != SPEAKERS_MONO &&
channelFormat != SPEAKERS_STEREO &&
channelFormat != SPEAKERS_2POINT1 &&
maxdevicechannel >= 8 &&
isWin) {