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

This commit is contained in:
Sebastian Dröge 2010-09-28 16:20:50 +02:00
parent 498620d16c
commit 4e43e8bc67

View file

@ -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;
}