mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-26 09:08:14 +00:00
alsasink: check for spdif support only in the current device
This commit is contained in:
parent
b0cc0a31e2
commit
2434f2932b
4 changed files with 14 additions and 12 deletions
|
@ -398,7 +398,7 @@ max_chan_error:
|
|||
}
|
||||
|
||||
snd_pcm_t *
|
||||
gst_alsa_open_iec958_pcm (GstObject * obj)
|
||||
gst_alsa_open_iec958_pcm (GstObject * obj, gchar * device)
|
||||
{
|
||||
char *iec958_pcm_name = NULL;
|
||||
snd_pcm_t *pcm = NULL;
|
||||
|
@ -417,7 +417,8 @@ gst_alsa_open_iec958_pcm (GstObject * obj)
|
|||
* spdif:{AES0 0x2 AES1 0x82 AES2 0x0 AES3 0x2}
|
||||
*/
|
||||
sprintf (devstr,
|
||||
"iec958:{AES0 0x%02x AES1 0x%02x AES2 0x%02x AES3 0x%02x}",
|
||||
"%s:{AES0 0x%02x AES1 0x%02x AES2 0x%02x AES3 0x%02x}",
|
||||
device,
|
||||
IEC958_AES0_CON_EMPHASIS_NONE | IEC958_AES0_NONAUDIO,
|
||||
IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER,
|
||||
0, IEC958_AES3_CON_FS_48000);
|
||||
|
@ -445,8 +446,8 @@ gst_alsa_open_iec958_pcm (GstObject * obj)
|
|||
*/
|
||||
|
||||
GstCaps *
|
||||
gst_alsa_probe_supported_formats (GstObject * obj, snd_pcm_t * handle,
|
||||
const GstCaps * template_caps)
|
||||
gst_alsa_probe_supported_formats (GstObject * obj, gchar * device,
|
||||
snd_pcm_t * handle, const GstCaps * template_caps)
|
||||
{
|
||||
snd_pcm_hw_params_t *hw_params;
|
||||
snd_pcm_stream_t stream_type;
|
||||
|
@ -473,7 +474,7 @@ gst_alsa_probe_supported_formats (GstObject * obj, snd_pcm_t * handle,
|
|||
/* Try opening IEC958 device to see if we can support that format (playback
|
||||
* only for now but we could add SPDIF capture later) */
|
||||
if (stream_type == SND_PCM_STREAM_PLAYBACK) {
|
||||
snd_pcm_t *pcm = gst_alsa_open_iec958_pcm (obj);
|
||||
snd_pcm_t *pcm = gst_alsa_open_iec958_pcm (obj, device);
|
||||
|
||||
if (G_LIKELY (pcm)) {
|
||||
gst_caps_append (caps, gst_caps_from_string (PASSTHROUGH_CAPS));
|
||||
|
|
|
@ -51,9 +51,10 @@
|
|||
GST_DEBUG_CATEGORY_EXTERN (alsa_debug);
|
||||
#define GST_CAT_DEFAULT alsa_debug
|
||||
|
||||
snd_pcm_t * gst_alsa_open_iec958_pcm (GstObject * obj);
|
||||
snd_pcm_t * gst_alsa_open_iec958_pcm (GstObject * obj, gchar *device);
|
||||
|
||||
GstCaps * gst_alsa_probe_supported_formats (GstObject * obj,
|
||||
gchar * device,
|
||||
snd_pcm_t * handle,
|
||||
const GstCaps * template_caps);
|
||||
|
||||
|
|
|
@ -300,8 +300,8 @@ gst_alsasink_getcaps (GstBaseSink * bsink, GstCaps * filter)
|
|||
g_return_val_if_fail (pad_template != NULL, NULL);
|
||||
|
||||
templ_caps = gst_pad_template_get_caps (pad_template);
|
||||
caps = gst_alsa_probe_supported_formats (GST_OBJECT (sink), sink->handle,
|
||||
templ_caps);
|
||||
caps = gst_alsa_probe_supported_formats (GST_OBJECT (sink), sink->device,
|
||||
sink->handle, templ_caps);
|
||||
gst_caps_unref (templ_caps);
|
||||
|
||||
if (caps) {
|
||||
|
@ -852,9 +852,9 @@ gst_alsasink_prepare (GstAudioSink * asink, GstAudioRingBufferSpec * spec)
|
|||
|
||||
alsa = GST_ALSA_SINK (asink);
|
||||
|
||||
if (spec->type == GST_AUDIO_RING_BUFFER_FORMAT_TYPE_IEC958) {
|
||||
if (alsa->iec958) {
|
||||
snd_pcm_close (alsa->handle);
|
||||
alsa->handle = gst_alsa_open_iec958_pcm (GST_OBJECT (alsa));
|
||||
alsa->handle = gst_alsa_open_iec958_pcm (GST_OBJECT (alsa), alsa->device);
|
||||
if (G_UNLIKELY (!alsa->handle)) {
|
||||
goto no_iec958;
|
||||
}
|
||||
|
|
|
@ -267,8 +267,8 @@ gst_alsasrc_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
|
|||
templ_caps = gst_pad_template_get_caps (pad_template);
|
||||
GST_INFO_OBJECT (src, "template caps %" GST_PTR_FORMAT, templ_caps);
|
||||
|
||||
caps = gst_alsa_probe_supported_formats (GST_OBJECT (src), src->handle,
|
||||
templ_caps);
|
||||
caps = gst_alsa_probe_supported_formats (GST_OBJECT (src),
|
||||
src->device, src->handle, templ_caps);
|
||||
gst_caps_unref (templ_caps);
|
||||
|
||||
if (caps) {
|
||||
|
|
Loading…
Reference in a new issue