aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2014-11-23 12:56:02 +0100
committerClément Bœsch <u@pkh.me>2014-11-23 13:13:38 +0100
commit6e411d9cc7ecf266c2ee463f0addb596cbf470a8 (patch)
tree0169dbbca4d38db160777e0355a88bb14ffb18f4
parent8ef46f4a0cd3019b1099de424db28954f2c4ad59 (diff)
downloadffmpeg-6e411d9cc7ecf266c2ee463f0addb596cbf470a8.tar.gz
avcodec/microdvddec: support non persistent italic marker '/'
Inspired from a patch by Michal Wazgird <mplayer@cyryl.net> See https://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/2014-November/072772.html
-rw-r--r--libavcodec/microdvddec.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/libavcodec/microdvddec.c b/libavcodec/microdvddec.c
index b225ab9f7e..96034a042a 100644
--- a/libavcodec/microdvddec.c
+++ b/libavcodec/microdvddec.c
@@ -66,8 +66,24 @@ static void microdvd_set_tag(struct microdvd_tag *tags, struct microdvd_tag tag)
// italic, bold, underline, strike-through
#define MICRODVD_STYLES "ibus"
+/* some samples have lines that start with a / indicating non persistent italic
+ * marker */
+static char *check_for_italic_slash_marker(struct microdvd_tag *tags, char *s)
+{
+ if (*s == '/') {
+ struct microdvd_tag tag = tags[indexof(MICRODVD_TAGS, 'y')];
+ tag.key = 'y';
+ tag.data1 |= 1 << 0 /* 'i' position in MICRODVD_STYLES */;
+ microdvd_set_tag(tags, tag);
+ s++;
+ }
+ return s;
+}
+
static char *microdvd_load_tags(struct microdvd_tag *tags, char *s)
{
+ s = check_for_italic_slash_marker(tags, s);
+
while (*s == '{') {
char *start = s;
char tag_char = *(s + 1);
@@ -178,7 +194,7 @@ static char *microdvd_load_tags(struct microdvd_tag *tags, char *s)
microdvd_set_tag(tags, tag);
s++;
}
- return s;
+ return check_for_italic_slash_marker(tags, s);
}
static void microdvd_open_tags(AVBPrint *new_line, struct microdvd_tag *tags)