decodebin2: Use static caps for the default raw caps and put them into a separate...
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 3 Nov 2009 10:48:40 +0000 (11:48 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 3 Nov 2009 12:03:23 +0000 (13:03 +0100)
This way we can use the same default raw caps everywhere.

gst/playback/Makefile.am
gst/playback/gstdecodebin2.c
gst/playback/gstrawcaps.h [new file with mode: 0644]

index e075f83..0647a72 100644 (file)
@@ -58,7 +58,8 @@ noinst_HEADERS = \
        gstinputselector.h \
        gstplay-enum.h \
        gstscreenshot.h \
-       gststreamselector.h
+       gststreamselector.h \
+       gstrawcaps.h
 
 noinst_PROGRAMS = test decodetest test2 test3 test4 test5 test6 test7
 
index 405ddbc..49f3703 100644 (file)
@@ -90,6 +90,7 @@
 #include "gstplay-marshal.h"
 #include "gstplay-enum.h"
 #include "gstfactorylists.h"
+#include "gstrawcaps.h"
 
 /* generic templates */
 static GstStaticPadTemplate decoder_bin_sink_template =
@@ -251,6 +252,8 @@ GST_ELEMENT_DETAILS ("Decoder Bin",
     "Edward Hervey <edward.hervey@collabora.co.uk>, "
     "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
 
+static GstStaticCaps default_raw_caps = GST_STATIC_CAPS (DEFAULT_RAW_CAPS);
+
 static void do_async_start (GstDecodeBin * dbin);
 static void do_async_done (GstDecodeBin * dbin);
 
@@ -847,10 +850,7 @@ gst_decode_bin_init (GstDecodeBin * decode_bin)
   decode_bin->blocked_pads = NULL;
 
   decode_bin->encoding = g_strdup (DEFAULT_SUBTITLE_ENCODING);
-  decode_bin->caps =
-      gst_caps_from_string ("video/x-raw-yuv;video/x-raw-rgb;video/x-raw-gray;"
-      "audio/x-raw-int;audio/x-raw-float;" "text/plain;text/x-pango-markup;"
-      "video/x-dvd-subpicture; subpicture/x-pgs");
+  decode_bin->caps = gst_static_caps_get (&default_raw_caps);
   decode_bin->use_buffering = DEFAULT_USE_BUFFERING;
   decode_bin->low_percent = DEFAULT_LOW_PERCENT;
   decode_bin->high_percent = DEFAULT_HIGH_PERCENT;
diff --git a/gst/playback/gstrawcaps.h b/gst/playback/gstrawcaps.h
new file mode 100644 (file)
index 0000000..0297e33
--- /dev/null
@@ -0,0 +1,42 @@
+/* GStreamer
+ * Copyright (C) <2009> Sebastian Dröge <sebastian.droege@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __GST_RAW_CAPS_H__
+#define __GST_RAW_CAPS_H__
+
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+#define DEFAULT_RAW_CAPS \
+    "video/x-raw-yuv; " \
+    "video/x-raw-rgb; " \
+    "video/x-raw-gray; " \
+    "audio/x-raw-int; " \
+    "audio/x-raw-float; " \
+    "text/plain; " \
+    "text/x-pango-markup; " \
+    "video/x-dvd-subpicture; " \
+    "subpicture/x-pgs"
+
+G_END_DECLS
+
+#endif /* __GST_RAW_CAPS__ */
+