mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-06 07:28:53 +00:00
osxaudiosink: Move device caps probing to get_caps()
This should be preferred to running the probe at device open time. https://bugzilla.gnome.org/show_bug.cgi?id=740987
This commit is contained in:
parent
945aaa0a35
commit
5c2f041286
1 changed files with 16 additions and 10 deletions
|
@ -132,6 +132,7 @@ static void gst_osx_audio_sink_osxelement_init (gpointer g_iface,
|
||||||
gpointer iface_data);
|
gpointer iface_data);
|
||||||
static gboolean gst_osx_audio_sink_select_device (GstElement * sink,
|
static gboolean gst_osx_audio_sink_select_device (GstElement * sink,
|
||||||
GstOsxAudioRingBuffer * ringbuffer);
|
GstOsxAudioRingBuffer * ringbuffer);
|
||||||
|
static void gst_osx_audio_sink_probe_caps (GstOsxAudioSink * sink);
|
||||||
static void gst_osx_audio_sink_set_volume (GstOsxAudioSink * sink);
|
static void gst_osx_audio_sink_set_volume (GstOsxAudioSink * sink);
|
||||||
|
|
||||||
static OSStatus gst_osx_audio_sink_io_proc (GstOsxAudioRingBuffer * buf,
|
static OSStatus gst_osx_audio_sink_io_proc (GstOsxAudioRingBuffer * buf,
|
||||||
|
@ -308,8 +309,18 @@ static GstCaps *
|
||||||
gst_osx_audio_sink_getcaps (GstBaseSink * base, GstCaps * filter)
|
gst_osx_audio_sink_getcaps (GstBaseSink * base, GstCaps * filter)
|
||||||
{
|
{
|
||||||
GstOsxAudioSink *sink = GST_OSX_AUDIO_SINK (base);
|
GstOsxAudioSink *sink = GST_OSX_AUDIO_SINK (base);
|
||||||
|
GstAudioRingBuffer *buf = GST_AUDIO_BASE_SINK (sink)->ringbuffer;
|
||||||
gchar *caps_string = NULL;
|
gchar *caps_string = NULL;
|
||||||
|
|
||||||
|
if (buf) {
|
||||||
|
GST_OBJECT_LOCK (buf);
|
||||||
|
if (buf->open && !sink->cached_caps) {
|
||||||
|
/* Device is open, let's probe its caps */
|
||||||
|
gst_osx_audio_sink_probe_caps (sink);
|
||||||
|
}
|
||||||
|
GST_OBJECT_UNLOCK (buf);
|
||||||
|
}
|
||||||
|
|
||||||
if (sink->cached_caps) {
|
if (sink->cached_caps) {
|
||||||
caps_string = gst_caps_to_string (sink->cached_caps);
|
caps_string = gst_caps_to_string (sink->cached_caps);
|
||||||
GST_DEBUG_OBJECT (sink, "using cached caps: %s", caps_string);
|
GST_DEBUG_OBJECT (sink, "using cached caps: %s", caps_string);
|
||||||
|
@ -448,8 +459,6 @@ gst_osx_audio_sink_create_ringbuffer (GstAudioBaseSink * sink)
|
||||||
GST_OSX_AUDIO_ELEMENT_GET_INTERFACE (osxsink);
|
GST_OSX_AUDIO_ELEMENT_GET_INTERFACE (osxsink);
|
||||||
ringbuffer->core_audio->is_src = FALSE;
|
ringbuffer->core_audio->is_src = FALSE;
|
||||||
|
|
||||||
gst_osx_audio_sink_set_volume (osxsink);
|
|
||||||
|
|
||||||
return GST_AUDIO_RING_BUFFER (ringbuffer);
|
return GST_AUDIO_RING_BUFFER (ringbuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,8 +529,8 @@ gst_osx_audio_sink_set_volume (GstOsxAudioSink * sink)
|
||||||
gst_core_audio_set_volume (osxbuf->core_audio, sink->volume);
|
gst_core_audio_set_volume (osxbuf->core_audio, sink->volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
gst_osx_audio_sink_allowed_caps (GstOsxAudioSink * osxsink)
|
gst_osx_audio_sink_probe_caps (GstOsxAudioSink * osxsink)
|
||||||
{
|
{
|
||||||
gint i, channels;
|
gint i, channels;
|
||||||
gboolean spdif_allowed;
|
gboolean spdif_allowed;
|
||||||
|
@ -638,8 +647,6 @@ gst_osx_audio_sink_allowed_caps (GstOsxAudioSink * osxsink)
|
||||||
|
|
||||||
osxsink->cached_caps = caps;
|
osxsink->cached_caps = caps;
|
||||||
osxsink->channels = channels;
|
osxsink->channels = channels;
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -647,14 +654,13 @@ gst_osx_audio_sink_select_device (GstElement * sink,
|
||||||
GstOsxAudioRingBuffer * ringbuffer)
|
GstOsxAudioRingBuffer * ringbuffer)
|
||||||
{
|
{
|
||||||
GstOsxAudioSink *osxsink = GST_OSX_AUDIO_SINK (sink);
|
GstOsxAudioSink *osxsink = GST_OSX_AUDIO_SINK (sink);
|
||||||
gboolean res = FALSE;
|
|
||||||
|
|
||||||
if (!gst_core_audio_select_device (&osxsink->device_id, TRUE))
|
if (!gst_core_audio_select_device (&osxsink->device_id, TRUE))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
res = gst_osx_audio_sink_allowed_caps (osxsink);
|
|
||||||
|
|
||||||
ringbuffer->core_audio->device_id = osxsink->device_id;
|
ringbuffer->core_audio->device_id = osxsink->device_id;
|
||||||
|
|
||||||
return res;
|
gst_osx_audio_sink_set_volume (osxsink);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue