Web lists-archives.com

Re: [MPlayer-dev-eng] [PATCH] Fix MicroDVD color tag




On Mon, Nov 24, 2014 at 4:21 PM, Reimar Döffinger <Reimar.Doeffinger@xxxxxx>
wrote:

> On 23.11.2014, at 11:51, Michal Wazgird <mplayer@xxxxxxxxx> wrote:
> > On Sat, Nov 22, 2014 at 6:04 PM, compn <tempn@xxxxxxxxx> wrote:
> >
> >> On Sat, 22 Nov 2014 15:53:14 +0100
> >> Michal Wazgird <mplayer@xxxxxxxxx> wrote:
> >>
> >>> This is my first patch submission, so sorry for any misbehaviour :)
> >>
> >> you forgot to attach it! :)
> >>
> >
> > Sorry :)
> > This time with attachment. And to proper mail :)
>
> Thanks, but I prefer the way this was applied in FFmpeg, which just skips
> any and all $ and # at the start.
> You patch would break any subtitles that do not start with a $.
>

Fixed. Now skips all $ and #.



> I don't mind if you want it to warn about subtitles that do not match the
> specification, but I'd like us to accept them anyway.
>

I'm not sure what you mean here. Do you want me to display a warning
message everytime a non-spec tag is being parsed? Something like this?:

mp_msg(MSGT_SUBREADER,MSGL_V,"SUB: Parsed non-spec MicroDVD tag: %s\n",
tag);


I have also fixed one more bug with tags closing. The color tag was never
closed.


BR
Michal.
Index: sub/subassconvert.c
===================================================================
--- sub/subassconvert.c	(wersja 37328)
+++ sub/subassconvert.c	(kopia robocza)
@@ -340,10 +340,12 @@
             tag.key = tag_char;
             break;
 
-        /* Color */
+        /* Color: {c:$bbggrr} and {c:$#bbggrr}*/
         case 'C':
             tag.persistent = MICRODVD_PERSISTENT_ON;
         case 'c':
+            while(*s == '$' || *s == '#')
+                ++s;
             tag.data1 = strtol(s, &s, 16) & 0x00ffffff;
             if (*s != '}')
                 break;
@@ -470,7 +472,7 @@
 {
     int i, sidx;
 
-    for (i = sizeof(MICRODVD_TAGS) - 2; i; i--) {
+    for (i = sizeof(MICRODVD_TAGS) - 2; i>=0; i--) {
         if (tags[i].persistent != MICRODVD_PERSISTENT_OFF)
             continue;
         switch (tags[i].key) {
@@ -514,6 +516,15 @@
     };
     struct microdvd_tag tags[sizeof(MICRODVD_TAGS) - 1] = {{0}};
 
+    /* '/' at beginning of line is often used to indicate italic text */
+    if(*line == '/') {
+        struct microdvd_tag tag = {0};
+        tag.key = 'y';
+        tag.data1 = 1;
+        microdvd_set_tag(tags, tag);
+        ++line;
+    }
+    
     while (*line) {
         line = microdvd_load_tags(tags, line);
         microdvd_open_tags(&new_line, tags);
@@ -525,6 +536,14 @@
             microdvd_close_no_persistent_tags(&new_line, tags);
             append_text(&new_line, "\\N");
             line++;
+            
+            if(*line == '/') {
+                struct microdvd_tag tag = {0};
+                tag.key = 'y';
+                tag.data1 = 1;
+                microdvd_set_tag(tags, tag);
+                ++line;
+            }
         }
     }
     new_line.buf[new_line.len] = 0;
_______________________________________________
MPlayer-dev-eng mailing list
MPlayer-dev-eng@xxxxxxxxxxxx
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-dev-eng