ext/annodex/: Add a little extra debug. Make the decoder not return NOT_LINKED, as...
authorJan Schmidt <thaytan@mad.scientist.com>
Tue, 28 Feb 2006 09:21:27 +0000 (09:21 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Tue, 28 Feb 2006 09:21:27 +0000 (09:21 +0000)
Original commit message from CVS:
* ext/annodex/gstcmmldec.c: (gst_cmml_dec_sink_event),
(gst_cmml_dec_new_buffer), (gst_cmml_dec_parse_preamble),
(gst_cmml_dec_parse_head), (gst_cmml_dec_push_clip):
* ext/annodex/gstcmmlparser.c: (gst_cmml_parser_parse_chunk):
Add a little extra debug. Make the decoder not return NOT_LINKED,
as we want to continue decoding all CMML and emitting tags.

ChangeLog
ext/annodex/gstcmmldec.c
ext/annodex/gstcmmlparser.c

index f808731..8f74d23 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-02-28  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * ext/annodex/gstcmmldec.c: (gst_cmml_dec_sink_event),
+       (gst_cmml_dec_new_buffer), (gst_cmml_dec_parse_preamble),
+       (gst_cmml_dec_parse_head), (gst_cmml_dec_push_clip):
+       * ext/annodex/gstcmmlparser.c: (gst_cmml_parser_parse_chunk):
+         Add a little extra debug. Make the decoder not return NOT_LINKED,
+         as we want to continue decoding all CMML and emitting tags.
+
 2006-02-27  Michael Smith  <msmith@fluendo.com>
 
        * ext/annodex/gstskeltag.c:
index a2bb67b..26376f4 100644 (file)
@@ -357,6 +357,8 @@ gst_cmml_dec_sink_event (GstPad * pad, GstEvent * event)
 
       if (dec->flow_return == GST_FLOW_OK)
         dec->flow_return = gst_pad_push (dec->srcpad, buffer);
+      if (dec->flow_return == GST_FLOW_NOT_LINKED)
+        dec->flow_return = GST_FLOW_OK; /* Ignore NOT_LINKED */
 
       break;
     }
@@ -449,6 +451,8 @@ gst_cmml_dec_new_buffer (GstCmmlDec * dec,
     if (data)
       memcpy (GST_BUFFER_DATA (*buffer), data, size);
     GST_BUFFER_TIMESTAMP (*buffer) = dec->timestamp;
+  } else if (res == GST_FLOW_NOT_LINKED) {
+    GST_DEBUG_OBJECT (dec, "alloc function return NOT-LINKED, ignoring");
   } else {
     GST_WARNING_OBJECT (dec, "alloc function returned error %s",
         gst_flow_get_name (res));
@@ -547,15 +551,16 @@ gst_cmml_dec_parse_preamble (GstCmmlDec * dec, guchar * preamble,
   /* push the root element */
   dec->flow_return = gst_cmml_dec_new_buffer (dec,
       encoded_preamble, strlen ((gchar *) encoded_preamble), &buffer);
-  if (dec->flow_return != GST_FLOW_OK)
-    goto done;
+  if (dec->flow_return == GST_FLOW_OK) {
+    dec->flow_return = gst_pad_push (dec->srcpad, buffer);
+  }
 
-  dec->flow_return = gst_pad_push (dec->srcpad, buffer);
+  if (dec->flow_return == GST_FLOW_NOT_LINKED)
+    dec->flow_return = GST_FLOW_OK;     /* Ignore NOT_LINKED */
   if (!GST_FLOW_IS_FATAL (dec->flow_return)) {
     GST_INFO_OBJECT (dec, "preamble parsed");
   }
 
-done:
   g_free (encoded_preamble);
   return;
 }
@@ -598,6 +603,8 @@ gst_cmml_dec_parse_head (GstCmmlDec * dec, GstCmmlTagHead * head)
   g_free (head_str);
   if (dec->flow_return == GST_FLOW_OK)
     dec->flow_return = gst_pad_push (dec->srcpad, buffer);
+  if (dec->flow_return == GST_FLOW_NOT_LINKED)
+    dec->flow_return = GST_FLOW_OK;     /* Ignore NOT_LINKED */
 }
 
 /* send a TAG_MESSAGE event for a clip */
@@ -627,6 +634,8 @@ gst_cmml_dec_push_clip (GstCmmlDec * dec, GstCmmlTagClip * clip)
       clip_str, strlen ((gchar *) clip_str), &buffer);
   if (dec->flow_return == GST_FLOW_OK)
     dec->flow_return = gst_pad_push (dec->srcpad, buffer);
+  if (dec->flow_return == GST_FLOW_NOT_LINKED)
+    dec->flow_return = GST_FLOW_OK;     /* Ignore NOT_LINKED */
 
   g_free (clip_str);
 }
index 1411478..3992daf 100644 (file)
@@ -72,8 +72,7 @@ gst_cmml_parser_new (GstCmmlParserMode mode)
       (startElementNsSAX2Func) gst_cmml_parser_parse_start_element_ns;
   parser->context->sax->endElementNs =
       (endElementNsSAX2Func) gst_cmml_parser_parse_end_element_ns;
-  parser->context->sax->processingInstruction =
-      (processingInstructionSAXFunc)
+  parser->context->sax->processingInstruction = (processingInstructionSAXFunc)
       gst_cmml_parser_parse_processing_instruction;
   parser->preamble_callback = NULL;
   parser->cmml_end_callback = NULL;
@@ -111,6 +110,7 @@ gst_cmml_parser_parse_chunk (GstCmmlParser * parser,
   if (xmlres != XML_ERR_OK) {
     xmlErrorPtr xml_error = xmlCtxtGetLastError (parser->context);
 
+    GST_DEBUG ("Error occurred decoding chunk %s", data);
     g_set_error (err,
         GST_LIBRARY_ERROR, GST_LIBRARY_ERROR_FAILED, xml_error->message);
     return FALSE;