From 8bbf66a57f382f642e20e8d2a0ea6ec6f6147da8 Mon Sep 17 00:00:00 2001 From: Young-Ho Cha Date: Mon, 12 Jun 2006 12:44:38 +0000 Subject: [PATCH] gst/subparse/samiparse.c: Honour font face tags in SAMI subtitles (#344503). Original commit message from CVS: Patch by: Young-Ho Cha * gst/subparse/samiparse.c: (sami_context_pop_state), (handle_start_font), (end_sami_element): Honour font face tags in SAMI subtitles (#344503). --- ChangeLog | 8 ++++++++ gst/subparse/samiparse.c | 16 ++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9cfd9836ab..651994ed3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-06-12 Tim-Philipp Müller + + Patch by: Young-Ho Cha + + * gst/subparse/samiparse.c: (sami_context_pop_state), + (handle_start_font), (end_sami_element): + Honour font face tags in SAMI subtitles (#344503). + 2006-06-11 Stefan Kost * po/POTFILES.in: diff --git a/gst/subparse/samiparse.c b/gst/subparse/samiparse.c index f432f426b3..fbe79b974f 100644 --- a/gst/subparse/samiparse.c +++ b/gst/subparse/samiparse.c @@ -25,7 +25,7 @@ #include #define ITALIC_TAG 'i' -#define COLOR_TAG 'c' +#define SPAN_TAG 's' #define RUBY_TAG 'r' #define RT_TAG 't' #define CLEAR_TAG '0' @@ -79,7 +79,7 @@ sami_context_pop_state (GstSamiContext * sctx, char state) g_string_append (str, ""); break; } - case COLOR_TAG: /* */ + case SPAN_TAG: /* */ { g_string_append (str, ""); break; @@ -146,8 +146,9 @@ handle_start_font (GstSamiContext * sctx, const xmlChar ** atts) { int i; - sami_context_pop_state (sctx, COLOR_TAG); + sami_context_pop_state (sctx, SPAN_TAG); if (atts != NULL) { + g_string_append (sctx->buf, "buf, "", sharp, + g_string_append_printf (sctx->buf, " foreground=\"%s%s\"", sharp, value); - sami_context_push_state (sctx, COLOR_TAG); + } else if (!xmlStrncmp ((const xmlChar *) "face", key, 4)) { + g_string_append_printf (sctx->buf, " font_family=\"%s\"", value); } } + g_string_append_c (sctx->buf, '>'); + sami_context_push_state (sctx, SPAN_TAG); } } @@ -224,7 +228,7 @@ end_sami_element (void *ctx, const xmlChar * name) if (!xmlStrncmp ((const xmlChar *) "title", name, 5)) { sctx->in_title = FALSE; } else if (!xmlStrncmp ((const xmlChar *) "font", name, 4)) { - sami_context_pop_state (sctx, COLOR_TAG); + sami_context_pop_state (sctx, SPAN_TAG); } else if (!xmlStrncmp ((const xmlChar *) "ruby", name, 4)) { sami_context_pop_state (sctx, RUBY_TAG); } else if (!xmlStrncmp ((const xmlChar *) "i", name, 1)) {