From 4e43e8bc677f52c5a6e88c4861f4d5e448fe60f8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 28 Sep 2010 16:20:50 +0200 Subject: [PATCH] frei0r: Use static caps instead of converting strings to caps all the time --- gst/frei0r/gstfrei0r.c | 24 ++++++++++++++---------- 1 file 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; } -- 2.7.4