gst/subparse/samiparse.c: Honour font face tags in SAMI subtitles (#344503).

Original commit message from CVS:
Patch by: Young-Ho Cha  <ganadist at chollian net>
* gst/subparse/samiparse.c: (sami_context_pop_state),
(handle_start_font), (end_sami_element):
Honour font face tags in SAMI subtitles (#344503).
This commit is contained in:
Young-Ho Cha 2006-06-12 12:44:38 +00:00 committed by Tim-Philipp Müller
parent 189fd3d76d
commit 8bbf66a57f
2 changed files with 18 additions and 6 deletions

View file

@ -1,3 +1,11 @@
2006-06-12 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Young-Ho Cha <ganadist at chollian net>
* 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 <ensonic@users.sf.net>
* po/POTFILES.in:

View file

@ -25,7 +25,7 @@
#include <string.h>
#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, "</i>");
break;
}
case COLOR_TAG: /* <span foreground= > */
case SPAN_TAG: /* <span foreground= > */
{
g_string_append (str, "</span>");
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, "<span");
for (i = 0; (atts[i] != NULL); i += 2) {
const xmlChar *key, *value;
@ -179,11 +180,14 @@ handle_start_font (GstSamiContext * sctx, const xmlChar ** atts)
if (!xmlStrncmp ((const xmlChar *) "silver", value, 6)) {
value = (const xmlChar *) "#c0c0c0";
}
g_string_append_printf (sctx->buf, "<span foreground=\"%s%s\">", 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)) {