mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
osxaudiosink: Fix up caps querying a bit
This should make caps queries correct in PAUSED and higher as well. https://bugzilla.gnome.org/show_bug.cgi?id=740987
This commit is contained in:
parent
f967f0742f
commit
2d0391c6e1
1 changed files with 30 additions and 16 deletions
|
@ -349,33 +349,47 @@ gst_osx_audio_sink_stop (GstBaseSink * base)
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
gst_osx_audio_sink_getcaps (GstBaseSink * base, GstCaps * filter)
|
gst_osx_audio_sink_getcaps (GstBaseSink * sink, GstCaps * filter)
|
||||||
{
|
{
|
||||||
GstOsxAudioSink *sink = GST_OSX_AUDIO_SINK (base);
|
GstElementClass *gstelement_class;
|
||||||
GstAudioRingBuffer *buf = GST_AUDIO_BASE_SINK (sink)->ringbuffer;
|
GstOsxAudioSink *osxsink;
|
||||||
gchar *caps_string = NULL;
|
GstAudioRingBuffer *buf;
|
||||||
|
GstCaps *ret = NULL;
|
||||||
|
|
||||||
|
gstelement_class = GST_ELEMENT_GET_CLASS (sink);
|
||||||
|
osxsink = GST_OSX_AUDIO_SINK (sink);
|
||||||
|
buf = GST_AUDIO_BASE_SINK (sink)->ringbuffer;
|
||||||
|
|
||||||
if (buf) {
|
if (buf) {
|
||||||
GST_OBJECT_LOCK (buf);
|
GST_OBJECT_LOCK (buf);
|
||||||
if (buf->open && !sink->cached_caps) {
|
|
||||||
/* Device is open, let's probe its caps */
|
if (buf->acquired) {
|
||||||
gst_osx_audio_sink_probe_caps (sink);
|
/* Caps are fixed, use what we have */
|
||||||
|
ret = gst_pad_get_current_caps (GST_BASE_SINK_PAD (sink));
|
||||||
|
if (!ret) {
|
||||||
|
GST_OBJECT_UNLOCK (buf);
|
||||||
|
g_return_val_if_reached (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (buf->open && !osxsink->cached_caps) {
|
||||||
|
/* Device is open, let's probe its caps */
|
||||||
|
gst_osx_audio_sink_probe_caps (osxsink);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ret && osxsink->cached_caps)
|
||||||
|
ret = gst_caps_ref (osxsink->cached_caps);
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (buf);
|
GST_OBJECT_UNLOCK (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sink->cached_caps) {
|
if (ret && filter) {
|
||||||
caps_string = gst_caps_to_string (sink->cached_caps);
|
GstCaps *tmp;
|
||||||
GST_DEBUG_OBJECT (sink, "using cached caps: %s", caps_string);
|
tmp = gst_caps_intersect_full (ret, filter, GST_CAPS_INTERSECT_FIRST);
|
||||||
g_free (caps_string);
|
gst_caps_unref (ret);
|
||||||
if (filter)
|
ret = tmp;
|
||||||
return gst_caps_intersect_full (sink->cached_caps, filter,
|
|
||||||
GST_CAPS_INTERSECT_FIRST);
|
|
||||||
return gst_caps_ref (sink->cached_caps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (sink, "using template caps");
|
return ret;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
Loading…
Reference in a new issue