From 801cab604dc6b82d57c798d4017c26a0a3e6b850 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Mon, 14 Jun 2010 13:27:01 +0200 Subject: [PATCH] ffmpegcolorspace: Use Quarks for structure name/field checking --- gst/ffmpegcolorspace/gstffmpegcolorspace.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/gst/ffmpegcolorspace/gstffmpegcolorspace.c b/gst/ffmpegcolorspace/gstffmpegcolorspace.c index 58d044d535..b3c2cf93c0 100644 --- a/gst/ffmpegcolorspace/gstffmpegcolorspace.c +++ b/gst/ffmpegcolorspace/gstffmpegcolorspace.c @@ -54,6 +54,10 @@ static GstFlowReturn gst_ffmpegcsp_transform (GstBaseTransform * btrans, static GstPadTemplate *sinktempl, *srctempl; +static GQuark _QRAWRGB; /* "video/x-raw-rgb" */ +static GQuark _QRAWYUV; /* "video/x-raw-yuv" */ +static GQuark _QALPHAMASK; /* "alpha_mask" */ + /* copies the given caps */ static GstCaps * gst_ffmpegcsp_caps_remove_format_info (GstCaps * caps) @@ -86,13 +90,13 @@ gst_ffmpegcsp_caps_remove_format_info (GstCaps * caps) static gboolean gst_ffmpegcsp_structure_is_alpha (GstStructure * s) { - const gchar *name; + GQuark name; - name = gst_structure_get_name (s); + name = gst_structure_get_name_id (s); - if (g_str_equal (name, "video/x-raw-rgb")) { - return gst_structure_has_field (s, "alpha_mask"); - } else if (g_str_equal (name, "video/x-raw-yuv")) { + if (name == _QRAWRGB) { + return gst_structure_id_has_field (s, _QALPHAMASK); + } else if (name == _QRAWYUV) { guint32 fourcc; if (!gst_structure_get_fourcc (s, "format", &fourcc)) @@ -305,6 +309,10 @@ gst_ffmpegcsp_base_init (gpointer klass) "FFMPEG Colorspace converter", "Filter/Converter/Video", "Converts video from one colorspace to another", "GStreamer maintainers "); + + _QRAWRGB = g_quark_from_string ("video/x-raw-rgb"); + _QRAWYUV = g_quark_from_string ("video/x-raw-yuv"); + _QALPHAMASK = g_quark_from_string ("alpha_mask"); } static void