2008-05-05 Sebastian Dröge <slomo@circular-chaos.org>
+ Patch by: Young-Ho Cha <ganadist at chollian dot net>
+
+ * gst/subparse/samiparse.c: (handle_start_sync),
+ (start_sami_element), (end_sami_element), (characters_sami),
+ (sami_context_reset):
+ Only output characters inside the "sync" elements. There could be
+ other elements like "style" that have some content but should
+ not be printed. Fixes bug #467911.
+
+2008-05-05 Sebastian Dröge <slomo@circular-chaos.org>
+
* gst/playback/gstplaybasebin.c: (set_audio_mute),
(set_active_source):
* gst/playback/gstplaybasebin.h:
* and _context_pop_state(). */
htmlParserCtxtPtr htmlctxt; /* html parser context */
gboolean has_result; /* set when ready to push out result */
- gboolean in_title; /* flag to avoid appending the title content
- * to buf */
+ gboolean in_sync; /* flag to avoid appending anything except the
+ * content of the sync elements to buf */
guint64 time1; /* previous start attribute in sync tag */
guint64 time2; /* current start attribute in sync tag */
};
if (!value)
continue;
if (!xmlStrncmp ((const xmlChar *) "start", key, 5)) {
+ /* FIXME: this is not correct. According to[0] the start parameter
+ * specifies the time when the text should be shown and not the time
+ * when the text should be hidden again.
+ * This essentially means that we have to look at the next sync element
+ * before pushing one buffer and push the last buffer with -1
+ * as duration after the body element is closed.
+ * [0] http://msdn.microsoft.com/en-us/library/ms971327.aspx
+ */
sctx->time1 = sctx->time2;
sctx->time2 = atoi ((const char *) value) * GST_MSECOND;
sctx->has_result = TRUE;
{
GstSamiContext *sctx = (GstSamiContext *) ctx;
- if (!xmlStrncmp ((const xmlChar *) "title", name, 5)) {
- sctx->in_title = TRUE;
- } else if (!xmlStrncmp ((const xmlChar *) "sync", name, 4)) {
+ if (!xmlStrncmp ((const xmlChar *) "sync", name, 4)) {
handle_start_sync (sctx, atts);
+ sctx->in_sync = TRUE;
} else if (!xmlStrncmp ((const xmlChar *) "font", name, 4)) {
handle_start_font (sctx, atts);
} else if (!xmlStrncmp ((const xmlChar *) "ruby", name, 4)) {
{
GstSamiContext *sctx = (GstSamiContext *) ctx;
- if (!xmlStrncmp ((const xmlChar *) "title", name, 5)) {
- sctx->in_title = FALSE;
+ if (!xmlStrncmp ((const xmlChar *) "sync", name, 4)) {
+ sctx->in_sync = FALSE;
} else if (!xmlStrncmp ((const xmlChar *) "font", name, 4)) {
sami_context_pop_state (sctx, SPAN_TAG);
} else if (!xmlStrncmp ((const xmlChar *) "ruby", name, 4)) {
GstSamiContext *sctx = (GstSamiContext *) ctx;
gchar *escaped;
- /* skip title */
- if (sctx->in_title)
+ /* Skip everything except content of the sync elements */
+ if (!sctx->in_sync)
return;
escaped = g_markup_escape_text ((const gchar *) ch, len);
g_string_truncate (context->resultbuf, 0);
g_string_truncate (context->state, 0);
context->has_result = FALSE;
- context->in_title = FALSE;
+ context->in_sync = FALSE;
context->time1 = 0;
context->time2 = 0;
}