From 7a83664099198db4d36b2a22d05af754b87ab23c Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 11 Dec 2008 15:49:12 +0000 Subject: [PATCH] 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 tag. In order to fix that bad behaviour, we trigger the flushing of remaining data on both and . Fixes #557365 --- ChangeLog | 10 ++++++++++ gst/subparse/samiparse.c | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index edaa965419..ee9ef4d5e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-12-11 Edward Hervey + + * 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 tag. + In order to fix that bad behaviour, we trigger the flushing of + remaining data on both and . + Fixes #557365 + 2008-12-11 Sebastian Dröge Patch by: Guillaume Emont diff --git a/gst/subparse/samiparse.c b/gst/subparse/samiparse.c index dbf069d2e3..e8ea72afcb 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: /* */ @@ -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) {