mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
wasapi: Implement default audio channel mask
Some multichannel capture devices does not provide a channel mask value which will result in a pipeline failure due to the empty channel mask. Implemented the same fix used for wasapi2 Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1204 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2692>
This commit is contained in:
parent
b06a97c429
commit
76dbe45b83
1 changed files with 77 additions and 0 deletions
|
@ -82,6 +82,72 @@ const IID IID_IAudioRenderClient = { 0xf294acfc, 0x3146, 0x4483,
|
||||||
{0xa7, 0xbf, 0xad, 0xdc, 0xa7, 0xc2, 0x60, 0xe2}
|
{0xa7, 0xbf, 0xad, 0xdc, 0xa7, 0xc2, 0x60, 0xe2}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Desktop only defines */
|
||||||
|
#ifndef KSAUDIO_SPEAKER_MONO
|
||||||
|
#define KSAUDIO_SPEAKER_MONO (SPEAKER_FRONT_CENTER)
|
||||||
|
#endif
|
||||||
|
#ifndef KSAUDIO_SPEAKER_1POINT1
|
||||||
|
#define KSAUDIO_SPEAKER_1POINT1 (SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY)
|
||||||
|
#endif
|
||||||
|
#ifndef KSAUDIO_SPEAKER_STEREO
|
||||||
|
#define KSAUDIO_SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT)
|
||||||
|
#endif
|
||||||
|
#ifndef KSAUDIO_SPEAKER_2POINT1
|
||||||
|
#define KSAUDIO_SPEAKER_2POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_LOW_FREQUENCY)
|
||||||
|
#endif
|
||||||
|
#ifndef KSAUDIO_SPEAKER_3POINT0
|
||||||
|
#define KSAUDIO_SPEAKER_3POINT0 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER)
|
||||||
|
#endif
|
||||||
|
#ifndef KSAUDIO_SPEAKER_3POINT1
|
||||||
|
#define KSAUDIO_SPEAKER_3POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | \
|
||||||
|
SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY)
|
||||||
|
#endif
|
||||||
|
#ifndef KSAUDIO_SPEAKER_QUAD
|
||||||
|
#define KSAUDIO_SPEAKER_QUAD (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | \
|
||||||
|
SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
|
||||||
|
#endif
|
||||||
|
#define KSAUDIO_SPEAKER_SURROUND (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | \
|
||||||
|
SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER)
|
||||||
|
#ifndef KSAUDIO_SPEAKER_5POINT0
|
||||||
|
#define KSAUDIO_SPEAKER_5POINT0 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | \
|
||||||
|
SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
|
||||||
|
#endif
|
||||||
|
#define KSAUDIO_SPEAKER_5POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | \
|
||||||
|
SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | \
|
||||||
|
SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
|
||||||
|
#ifndef KSAUDIO_SPEAKER_7POINT0
|
||||||
|
#define KSAUDIO_SPEAKER_7POINT0 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | SPEAKER_FRONT_CENTER | \
|
||||||
|
SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | \
|
||||||
|
SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
|
||||||
|
#endif
|
||||||
|
#ifndef KSAUDIO_SPEAKER_7POINT1
|
||||||
|
#define KSAUDIO_SPEAKER_7POINT1 (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | \
|
||||||
|
SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | \
|
||||||
|
SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | \
|
||||||
|
SPEAKER_FRONT_LEFT_OF_CENTER | SPEAKER_FRONT_RIGHT_OF_CENTER)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static DWORD default_ch_masks[] = {
|
||||||
|
0,
|
||||||
|
KSAUDIO_SPEAKER_MONO,
|
||||||
|
/* 2ch */
|
||||||
|
KSAUDIO_SPEAKER_STEREO,
|
||||||
|
/* 2.1ch */
|
||||||
|
/* KSAUDIO_SPEAKER_3POINT0 ? */
|
||||||
|
KSAUDIO_SPEAKER_2POINT1,
|
||||||
|
/* 4ch */
|
||||||
|
/* KSAUDIO_SPEAKER_3POINT1 or KSAUDIO_SPEAKER_SURROUND ? */
|
||||||
|
KSAUDIO_SPEAKER_QUAD,
|
||||||
|
/* 5ch */
|
||||||
|
KSAUDIO_SPEAKER_5POINT0,
|
||||||
|
/* 5.1ch */
|
||||||
|
KSAUDIO_SPEAKER_5POINT1,
|
||||||
|
/* 7ch */
|
||||||
|
KSAUDIO_SPEAKER_7POINT0,
|
||||||
|
/* 7.1ch */
|
||||||
|
KSAUDIO_SPEAKER_7POINT1,
|
||||||
|
};
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
|
@ -705,6 +771,17 @@ gst_wasapi_util_waveformatex_to_channel_mask (WAVEFORMATEXTENSIBLE * format,
|
||||||
DWORD dwChannelMask = format->dwChannelMask;
|
DWORD dwChannelMask = format->dwChannelMask;
|
||||||
GstAudioChannelPosition *pos = NULL;
|
GstAudioChannelPosition *pos = NULL;
|
||||||
|
|
||||||
|
if (nChannels > 2 && !dwChannelMask) {
|
||||||
|
GST_WARNING ("Unknown channel mask value for %d channel stream", nChannels);
|
||||||
|
|
||||||
|
if (nChannels >= G_N_ELEMENTS (default_ch_masks)) {
|
||||||
|
GST_ERROR ("Too many channels %d", nChannels);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
dwChannelMask = default_ch_masks[nChannels];
|
||||||
|
}
|
||||||
|
|
||||||
pos = g_new (GstAudioChannelPosition, nChannels);
|
pos = g_new (GstAudioChannelPosition, nChannels);
|
||||||
gst_wasapi_util_channel_position_all_none (nChannels, pos);
|
gst_wasapi_util_channel_position_all_none (nChannels, pos);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue