mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:46:13 +00:00
alsa: add some debugging output to alsa_detect_channels_mapping()
https://bugzilla.gnome.org/show_bug.cgi?id=763985
This commit is contained in:
parent
3cb08304da
commit
eef7312169
1 changed files with 35 additions and 8 deletions
|
@ -766,14 +766,41 @@ void
|
||||||
alsa_detect_channels_mapping (GstObject * obj, snd_pcm_t * handle,
|
alsa_detect_channels_mapping (GstObject * obj, snd_pcm_t * handle,
|
||||||
GstAudioRingBufferSpec * spec, guint channels, GstAudioRingBuffer * buf)
|
GstAudioRingBufferSpec * spec, guint channels, GstAudioRingBuffer * buf)
|
||||||
{
|
{
|
||||||
if (spec->type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW && channels < 9) {
|
snd_pcm_chmap_t *chmap;
|
||||||
snd_pcm_chmap_t *chmap = snd_pcm_get_chmap (handle);
|
GstAudioChannelPosition pos[8];
|
||||||
if (chmap && chmap->channels == channels) {
|
|
||||||
GstAudioChannelPosition pos[8];
|
if (spec->type != GST_AUDIO_RING_BUFFER_FORMAT_TYPE_RAW || channels >= 9)
|
||||||
if (alsa_chmap_to_channel_positions (chmap, pos))
|
return;
|
||||||
gst_audio_ring_buffer_set_channel_positions (buf, pos);
|
|
||||||
}
|
chmap = snd_pcm_get_chmap (handle);
|
||||||
free (chmap);
|
if (!chmap) {
|
||||||
|
GST_LOG_OBJECT (obj, "ALSA driver does not implement channels mapping API");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (chmap->channels != channels) {
|
||||||
|
GST_LOG_OBJECT (obj,
|
||||||
|
"got channels mapping for %u channels but stream has %u channels; ignoring",
|
||||||
|
chmap->channels, channels);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alsa_chmap_to_channel_positions (chmap, pos)) {
|
||||||
|
#ifndef GST_DISABLE_GST_DEBUG
|
||||||
|
{
|
||||||
|
gchar *tmp = gst_audio_channel_positions_to_string (pos, channels);
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (obj, "got channels mapping %s", tmp);
|
||||||
|
g_free (tmp);
|
||||||
|
}
|
||||||
|
#endif /* GST_DISABLE_GST_DEBUG */
|
||||||
|
|
||||||
|
gst_audio_ring_buffer_set_channel_positions (buf, pos);
|
||||||
|
} else {
|
||||||
|
GST_LOG_OBJECT (obj, "failed to convert ALSA channels mapping");
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
free (chmap);
|
||||||
}
|
}
|
||||||
#endif /* SND_CHMAP_API_VERSION */
|
#endif /* SND_CHMAP_API_VERSION */
|
||||||
|
|
Loading…
Reference in a new issue