Rework last change, so that we build subparse, but just disable the sami parse functi...
authorStefan Kost <ensonic@users.sourceforge.net>
Wed, 3 Sep 2008 10:12:04 +0000 (10:12 +0000)
committerStefan Kost <ensonic@users.sourceforge.net>
Wed, 3 Sep 2008 10:12:04 +0000 (10:12 +0000)
Original commit message from CVS:
* configure.ac:
* gst/subparse/Makefile.am:
* gst/subparse/gstsubparse.c:
* gst/subparse/samiparse.c:
* tests/check/elements/subparse.c:
Rework last change, so that we build subparse, but just disable the
sami parse functionality, if we're configured to not use xml. In the
tests only the sami test is disabled now.

ChangeLog
configure.ac
gst/subparse/Makefile.am
gst/subparse/gstsubparse.c
gst/subparse/samiparse.c
tests/check/elements/subparse.c

index 7b9d0dd..65705c3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-09-03  Stefan Kost  <ensonic@users.sf.net>
+
+       * configure.ac:
+       * gst/subparse/Makefile.am:
+       * gst/subparse/gstsubparse.c:
+       * gst/subparse/samiparse.c:
+       * tests/check/elements/subparse.c:
+         Rework last change, so that we build subparse, but just disable the
+         sami parse functionality, if we're configured to not use xml. In the
+         tests only the sami test is disabled now.
+
 2008-09-02  Stefan Kost  <ensonic@users.sf.net>
 
        * configure.ac:
index 11e7f96..2493d4a 100644 (file)
@@ -307,9 +307,7 @@ AG_GST_CHECK_PLUGIN(volume)
 dnl check for gstreamer core features (subsystems)
 GST_CONFIGPATH=`$PKG_CONFIG --variable=includedir gstreamer-0.10`"/gst/gstconfig.h"
 AG_GST_PARSE_SUBSYSTEM_DISABLES($GST_CONFIGPATH)
-if test $GST_DISABLE_XML = "1"; then
-  AG_GST_DISABLE_PLUGIN(subparse)
-fi
+AM_CONDITIONAL(USE_XML, test $GST_DISABLE_XML != "1")
 
 dnl disable plug-ins that require libxml2's HTML support if it is not available
 if test "x$HAVE_LIBXML_HTML" != "xyes"; then
index 0093548..18e091a 100644 (file)
@@ -1,12 +1,17 @@
 plugin_LTLIBRARIES = libgstsubparse.la
 
+if USE_XML
+SAMIPARSE_SOURCES = samiparse.c samiparse.h
+else
+SAMIPARSE_SOURCES = 
+endif
+
 libgstsubparse_la_SOURCES = \
        gstssaparse.c \
        gstssaparse.h \
        gstsubparse.c \
        gstsubparse.h \
-       samiparse.c \
-       samiparse.h \
+       $(SAMIPARSE_SOURCES) \
        tmplayerparse.c \
        tmplayerparse.h \
        mpl2parse.c \
index 87a7c9c..6dc25bc 100644 (file)
@@ -146,7 +146,9 @@ gst_sub_parse_dispose (GObject * object)
     g_string_free (subparse->textbuf, TRUE);
     subparse->textbuf = NULL;
   }
+#ifndef GST_DISABLE_XML
   sami_context_deinit (&subparse->state);
+#endif
 
   GST_CALL_PARENT (G_OBJECT_CLASS, dispose, (object));
 }
@@ -882,9 +884,11 @@ parser_state_dispose (ParserState * state)
     g_string_free (state->buf, TRUE);
     state->buf = NULL;
   }
+#ifndef GST_DISABLE_XML
   if (state->user_data) {
     sami_context_reset (state);
   }
+#endif
 }
 
 /*
@@ -931,11 +935,13 @@ gst_sub_parse_data_format_autodetect (gchar * match_str)
     GST_LOG ("MPSub (time based) format detected");
     return GST_SUB_PARSE_FORMAT_MPSUB;
   }
+#ifndef GST_DISABLE_XML
   if (strstr (match_str, "<SAMI>") != NULL ||
       strstr (match_str, "<sami>") != NULL) {
     GST_LOG ("SAMI (time based) format detected");
     return GST_SUB_PARSE_FORMAT_SAMI;
   }
+#endif
   /* we're boldly assuming the first subtitle appears within the first hour */
   if (sscanf (match_str, "0:%02u:%02u:", &n1, &n2) == 2 ||
       sscanf (match_str, "0:%02u:%02u=", &n1, &n2) == 2 ||
@@ -986,10 +992,12 @@ gst_sub_parse_format_autodetect (GstSubParse * self)
     case GST_SUB_PARSE_FORMAT_MPSUB:
       self->parse_line = parse_mpsub;
       return gst_caps_new_simple ("text/plain", NULL);
+#ifndef GST_DISABLE_XML
     case GST_SUB_PARSE_FORMAT_SAMI:
       self->parse_line = parse_sami;
       sami_context_init (&self->state);
       return gst_caps_new_simple ("text/x-pango-markup", NULL);
+#endif
     case GST_SUB_PARSE_FORMAT_TMPLAYER:
       self->parse_line = parse_tmplayer;
       self->state.max_duration = 5 * GST_SECOND;
@@ -1027,7 +1035,9 @@ feed_textbuf (GstSubParse * self, GstBuffer * buf)
     /* flush the parser state */
     parser_state_init (&self->state);
     g_string_truncate (self->textbuf, 0);
+#ifndef GST_DISABLE_XML
     sami_context_reset (&self->state);
+#endif
     /* we could set a flag to make sure that the next buffer we push out also
      * has the DISCONT flag set, but there's no point really given that it's
      * subtitles which are discontinuous by nature. */
@@ -1272,15 +1282,19 @@ gst_sub_parse_change_state (GstElement * element, GstStateChange transition)
  * also, give different  subtitle formats really different types */
 static GstStaticCaps mpl2_caps =
 GST_STATIC_CAPS ("application/x-subtitle-mpl2");
+#define SUB_CAPS (gst_static_caps_get (&sub_caps))
+
 static GstStaticCaps tmp_caps =
 GST_STATIC_CAPS ("application/x-subtitle-tmplayer");
-static GstStaticCaps smi_caps = GST_STATIC_CAPS ("application/x-subtitle-sami");
+#define TMP_CAPS (gst_static_caps_get (&tmp_caps))
+
 static GstStaticCaps sub_caps = GST_STATIC_CAPS ("application/x-subtitle");
+#define MPL2_CAPS (gst_static_caps_get (&mpl2_caps))
 
-#define SUB_CAPS (gst_static_caps_get (&sub_caps))
+#ifndef GST_DISABLE_XML
+static GstStaticCaps smi_caps = GST_STATIC_CAPS ("application/x-subtitle-sami");
 #define SAMI_CAPS (gst_static_caps_get (&smi_caps))
-#define TMP_CAPS (gst_static_caps_get (&tmp_caps))
-#define MPL2_CAPS (gst_static_caps_get (&mpl2_caps))
+#endif
 
 static void
 gst_subparse_type_find (GstTypeFind * tf, gpointer private)
@@ -1311,10 +1325,12 @@ gst_subparse_type_find (GstTypeFind * tf, gpointer private)
       GST_DEBUG ("MPSub format detected");
       caps = SUB_CAPS;
       break;
+#ifndef GST_DISABLE_XML
     case GST_SUB_PARSE_FORMAT_SAMI:
       GST_DEBUG ("SAMI (time-based) format detected");
       caps = SAMI_CAPS;
       break;
+#endif
     case GST_SUB_PARSE_FORMAT_TMPLAYER:
       GST_DEBUG ("TMPlayer (time based) format detected");
       caps = TMP_CAPS;
index 1cceeaa..dbf069d 100644 (file)
@@ -19,8 +19,6 @@
 
 #include "samiparse.h"
 
-/* FIXME: use Makefile stuff */
-#ifndef GST_DISABLE_XML
 #include <libxml/HTMLparser.h>
 #include <string.h>
 
@@ -466,32 +464,3 @@ parse_sami (ParserState * state, const gchar * line)
   }
   return NULL;
 }
-
-#else /* GST_DISABLE_XML */
-
-gchar *
-parse_sami (ParserState * state, const gchar * line)
-{
-  /* our template caps should not include sami in this case */
-  g_assert_not_reached ();
-}
-
-void
-sami_context_init (ParserState * state)
-{
-  return;
-}
-
-void
-sami_context_deinit (ParserState * state)
-{
-  return;
-}
-
-void
-sami_context_reset (ParserState * state)
-{
-  return;
-}
-
-#endif /* GST_DISABLE_XML */
index c5127b7..8cb02f4 100644 (file)
@@ -583,6 +583,7 @@ GST_START_TEST (test_subviewer2)
 
 GST_END_TEST;
 
+#ifndef GST_DISABLE_XML
 GST_START_TEST (test_sami)
 {
   SubParseInputChunk sami_input[] = {
@@ -618,6 +619,7 @@ GST_START_TEST (test_sami)
 }
 
 GST_END_TEST;
+#endif
 
 /* TODO:
  *  - add/modify tests so that lines aren't dogfed to the parsers in complete
@@ -646,7 +648,9 @@ subparse_suite (void)
   tcase_add_test (tc_chain, test_mpl2);
   tcase_add_test (tc_chain, test_subviewer);
   tcase_add_test (tc_chain, test_subviewer2);
+#ifndef GST_DISABLE_XML
   tcase_add_test (tc_chain, test_sami);
+#endif
   return s;
 }