From 7a83664099198db4d36b2a22d05af754b87ab23c Mon Sep 17 00:00:00 2001 From: Edward Hervey <bilboed@bilboed.com> Date: Thu, 11 Dec 2008 15:49:12 +0000 Subject: gst/subparse/samiparse.c: Some versions of libxml seem to be very picky as to strict formatting of the input and neve... Original commit message from CVS: * gst/subparse/samiparse.c: (sami_context_push_state), (sami_context_pop_state), (start_sami_element), (end_sami_element): Some versions of libxml seem to be very picky as to strict formatting of the input and never 'close' the final </body> tag. In order to fix that bad behaviour, we trigger the flushing of remaining data on both </body> and </sami>. Fixes #557365 --- diff --git a/gst/subparse/samiparse.c b/gst/subparse/samiparse.c index dbf069d..e8ea72a 100644 --- a/gst/subparse/samiparse.c +++ b/gst/subparse/samiparse.c @@ -60,6 +60,7 @@ has_tag (GString * str, const gchar tag) static void sami_context_push_state (GstSamiContext * sctx, char state) { + GST_LOG ("state %c", state); g_string_append_c (sctx->state, state); } @@ -70,6 +71,7 @@ sami_context_pop_state (GstSamiContext * sctx, char state) GString *context_state = sctx->state; int i; + GST_LOG ("state %c", state); for (i = context_state->len - 1; i >= 0; i--) { switch (context_state->str[i]) { case ITALIC_TAG: /* <i> */ @@ -211,6 +213,8 @@ start_sami_element (void *ctx, const xmlChar * name, const xmlChar ** atts) { GstSamiContext *sctx = (GstSamiContext *) ctx; + GST_LOG ("name:%s", name); + if (!xmlStrncmp ((const xmlChar *) "sync", name, 4)) { handle_start_sync (sctx, atts); sctx->in_sync = TRUE; @@ -239,9 +243,12 @@ end_sami_element (void *ctx, const xmlChar * name) { GstSamiContext *sctx = (GstSamiContext *) ctx; + GST_LOG ("name:%s", name); + if (!xmlStrncmp ((const xmlChar *) "sync", name, 4)) { sctx->in_sync = FALSE; - } else if (!xmlStrncmp ((const xmlChar *) "body", name, 4)) { + } else if ((!xmlStrncmp ((const xmlChar *) "body", name, 4)) || + (!xmlStrncmp ((const xmlChar *) "sami", name, 4))) { /* We will usually have one buffer left when the body is closed * as we need the next sync to actually send it */ if (sctx->buf->len != 0) { -- cgit v0.8.2