matroska: Remove the doctype enum, it's not needed anymore
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 20 May 2010 18:01:58 +0000 (20:01 +0200)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Thu, 20 May 2010 19:49:43 +0000 (21:49 +0200)
gst/matroska/matroska-demux.c
gst/matroska/matroska-ids.c
gst/matroska/matroska-ids.h
gst/matroska/matroska-mux.c

index a311b4a..ec27329 100644 (file)
@@ -2576,11 +2576,8 @@ gst_matroska_demux_parse_header (GstMatroskaDemux * demux)
 
   ret = GST_FLOW_ERROR;
   if (doctype) {
-    GEnumClass *doctype_class;
-    GEnumValue *doctype_value;
-    doctype_class = g_type_class_ref (GST_TYPE_MATROSKA_DOCTYPE);
-    doctype_value = g_enum_get_value_by_nick (doctype_class, doctype);
-    if (doctype_value) {
+    if (g_str_equal (doctype, GST_MATROSKA_DOCTYPE_MATROSKA) ||
+        g_str_equal (doctype, GST_MATROSKA_DOCTYPE_WEBM)) {
       if (version <= 2) {
         GST_INFO_OBJECT (demux, "Input is %s version %d", doctype, version);
         ret = GST_FLOW_OK;
@@ -2593,7 +2590,6 @@ gst_matroska_demux_parse_header (GstMatroskaDemux * demux)
       GST_ELEMENT_ERROR (demux, STREAM, WRONG_TYPE, (NULL),
           ("Input is not a matroska stream (doctype=%s)", doctype));
     }
-    g_type_class_unref (doctype_class);
     g_free (doctype);
   } else {
     GST_ELEMENT_ERROR (demux, STREAM, WRONG_TYPE, (NULL),
index b7153ba..0ee39d3 100644 (file)
 
 #include "matroska-ids.h"
 
-GType
-gst_matroska_doctype_get_type (void)
-{
-  static GType doctype_type = 0;
-
-  static const GEnumValue doctype_types[] = {
-    {GST_MATROSKA_DOCTYPE_MATROSKA, "Matroska", "matroska"},
-    {GST_MATROSKA_DOCTYPE_WEBM, "WebM", "webm"},
-    {0, NULL, NULL}
-  };
-
-  if (!doctype_type) {
-    doctype_type = g_enum_register_static ("GstMatroskaDoctype", doctype_types);
-  }
-  return doctype_type;
-}
-
 gboolean
 gst_matroska_track_init_video_context (GstMatroskaTrackContext ** p_context)
 {
index c6bc433..085bf84 100644 (file)
 #include "ebml-ids.h"
 
 /*
- * EBML DocType. enum.
+ * EBML DocType.
  */
 
-#define GST_MATROSKA_DOCTYPE_MATROSKA              0
-#define GST_MATROSKA_DOCTYPE_WEBM                  1
-
-#define GST_TYPE_MATROSKA_DOCTYPE                  (gst_matroska_doctype_get_type())
-extern GType gst_matroska_doctype_get_type (void);
+#define GST_MATROSKA_DOCTYPE_MATROSKA              "matroska"
+#define GST_MATROSKA_DOCTYPE_WEBM                  "webm"
 
 /*
  * Matroska element IDs. max. 32-bit.
index b4182d5..235d19a 100644 (file)
@@ -340,9 +340,9 @@ gst_matroska_mux_init (GstMatroskaMux * mux, GstMatroskaMuxClass * g_class)
       mux);
 
   mux->ebml_write = gst_ebml_write_new (mux->srcpad);
+  mux->doctype = GST_MATROSKA_DOCTYPE_MATROSKA;
 
   /* property defaults */
-  mux->doctype = "matroska";
   mux->doctype_version = DEFAULT_DOCTYPE_VERSION;
   mux->writing_app = g_strdup (DEFAULT_WRITING_APP);
   mux->min_index_interval = DEFAULT_MIN_INDEX_INTERVAL;
@@ -2880,7 +2880,7 @@ gst_webm_mux_class_init (GstWebMMuxClass * klass)
 static void
 gst_webm_mux_init (GstWebMMux * mux, GstWebMMuxClass * g_class)
 {
-  mux->doctype = "webm";
+  mux->doctype = GST_MATROSKA_DOCTYPE_WEBM;
 }
 
 gboolean