[gst-cvs] gst-plugins-bad: frei0r: Use static caps instead of converting strings to caps all the time

Sebastian Dröge slomo at kemper.freedesktop.org
Tue Sep 28 07:21:16 PDT 2010


Module: gst-plugins-bad
Branch: master
Commit: 4e43e8bc677f52c5a6e88c4861f4d5e448fe60f8
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=4e43e8bc677f52c5a6e88c4861f4d5e448fe60f8

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Tue Sep 28 16:20:50 2010 +0200

frei0r: Use static caps instead of converting strings to caps all the time

---

 gst/frei0r/gstfrei0r.c |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/gst/frei0r/gstfrei0r.c b/gst/frei0r/gstfrei0r.c
index 6b8c008..c7a9c71 100644
--- a/gst/frei0r/gstfrei0r.c
+++ b/gst/frei0r/gstfrei0r.c
@@ -32,23 +32,27 @@
 GST_DEBUG_CATEGORY (frei0r_debug);
 #define GST_CAT_DEFAULT frei0r_debug
 
+static GstStaticCaps bgra8888_caps = GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRA);
+static GstStaticCaps rgba8888_caps = GST_STATIC_CAPS (GST_VIDEO_CAPS_RGBA);
+static GstStaticCaps packed32_caps = GST_STATIC_CAPS (GST_VIDEO_CAPS_BGRA " ; "
+    GST_VIDEO_CAPS_RGBA " ; "
+    GST_VIDEO_CAPS_ABGR " ; "
+    GST_VIDEO_CAPS_ARGB " ; "
+    GST_VIDEO_CAPS_BGRx " ; "
+    GST_VIDEO_CAPS_RGBx " ; "
+    GST_VIDEO_CAPS_xBGR " ; "
+    GST_VIDEO_CAPS_xRGB " ; " GST_VIDEO_CAPS_YUV ("AYUV"));
+
 GstCaps *
 gst_frei0r_caps_from_color_model (gint color_model)
 {
   switch (color_model) {
     case F0R_COLOR_MODEL_BGRA8888:
-      return gst_caps_from_string (GST_VIDEO_CAPS_BGRA);
+      return gst_static_caps_get (&bgra8888_caps);
     case F0R_COLOR_MODEL_RGBA8888:
-      return gst_caps_from_string (GST_VIDEO_CAPS_RGBA);
+      return gst_static_caps_get (&rgba8888_caps);
     case F0R_COLOR_MODEL_PACKED32:
-      return gst_caps_from_string (GST_VIDEO_CAPS_BGRA " ; "
-          GST_VIDEO_CAPS_RGBA " ; "
-          GST_VIDEO_CAPS_ABGR " ; "
-          GST_VIDEO_CAPS_ARGB " ; "
-          GST_VIDEO_CAPS_BGRx " ; "
-          GST_VIDEO_CAPS_RGBx " ; "
-          GST_VIDEO_CAPS_xBGR " ; "
-          GST_VIDEO_CAPS_xRGB " ; " GST_VIDEO_CAPS_YUV ("AYUV"));
+      return gst_static_caps_get (&packed32_caps);
     default:
       break;
   }





More information about the Gstreamer-commits mailing list