gst-plugins-base: discoverer: make is_subtitle_caps thread-safe

Tim Müller tpm at kemper.freedesktop.org
Sat Jan 7 12:17:56 PST 2012


Module: gst-plugins-base
Branch: master
Commit: 1031fedaf01097b32ea8945c5476a850e3e8d028
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=1031fedaf01097b32ea8945c5476a850e3e8d028

Author: Tim-Philipp Müller <tim.muller at collabora.co.uk>
Date:   Sat Jan  7 19:39:42 2012 +0000

discoverer: make is_subtitle_caps thread-safe

---

 gst-libs/gst/pbutils/gstdiscoverer.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/gst-libs/gst/pbutils/gstdiscoverer.c b/gst-libs/gst/pbutils/gstdiscoverer.c
index 6af71dc..581739e 100644
--- a/gst-libs/gst/pbutils/gstdiscoverer.c
+++ b/gst-libs/gst/pbutils/gstdiscoverer.c
@@ -438,19 +438,22 @@ _event_probe (GstPad * pad, GstEvent * event, PrivateStream * ps)
   return TRUE;
 }
 
+static GstStaticCaps subtitle_caps = GST_STATIC_CAPS ("text/plain; "
+    "text/x-pango-markup; subpicture/x-pgs; subpicture/x-dvb; "
+    "application/x-subtitle-unknown; application/x-ssa; application/x-ass; "
+    "subtitle/x-kate; application/x-kate; video/x-dvd-subpicture");
+
 static gboolean
 is_subtitle_caps (const GstCaps * caps)
 {
-  static GstCaps *subs_caps = NULL;
+  GstCaps *subs_caps;
+  gboolean ret;
 
-  if (!subs_caps) {
-    subs_caps = gst_caps_from_string ("text/plain; text/x-pango-markup; "
-        "subpicture/x-pgs; subpicture/x-dvb; application/x-subtitle-unknown; "
-        "application/x-ssa; application/x-ass; subtitle/x-kate; "
-        "application/x-kate; video/x-dvd-subpicture; ");
-  }
+  subs_caps = gst_static_caps_get (&subtitle_caps);
+  ret = gst_caps_can_intersect (caps, subs_caps);
+  gst_caps_unref (subs_caps);
 
-  return gst_caps_can_intersect (caps, subs_caps);
+  return ret;
 }
 
 static void



More information about the gstreamer-commits mailing list