]> granicus.if.org Git - handbrake/commitdiff
decsrt: don't combine > 2 lines into 2
authorJohn Stebbins <jstebbins.hb@gmail.com>
Sun, 11 Oct 2015 17:50:51 +0000 (10:50 -0700)
committerJohn Stebbins <jstebbins.hb@gmail.com>
Thu, 15 Oct 2015 19:54:06 +0000 (12:54 -0700)
This was originally done because > 2 lines is not supported in mp4 timed
text.  But this line combining is now performed only when necessary in
muxavformat.

libhb/decsrtsub.c

index 74d153f13a417645957af4187632c33605f3b358..28845677a2725bfeeb092be9f943911bf21c8079 100644 (file)
@@ -475,7 +475,6 @@ static hb_buffer_t *srt_read( hb_work_private_t *pv )
             {
                 long length;
                 char *p, *q;
-                int  line = 1;
                 uint64_t start_time = ( pv->current_entry.start +
                                         pv->subtitle->config.offset ) * 90;
                 uint64_t stop_time = ( pv->current_entry.stop +
@@ -494,7 +493,7 @@ static hb_buffer_t *srt_read( hb_work_private_t *pv )
 
                 for (q = p = pv->current_entry.text; *p != '\0'; p++)
                 {
-                    if (*p == '\n' || *p == '\r')
+                    if (*p == '\r')
                     {
                         if (*(p + 1) == '\n' || *(p + 1) == '\r' ||
                             *(p + 1) == '\0')
@@ -503,18 +502,8 @@ static hb_buffer_t *srt_read( hb_work_private_t *pv )
                             length--;
                             continue;
                         }
-                        else if (line == 1)
-                        {
-                            // replace '\r' with '\n'
-                            *q   = '\n';
-                            line = 2;
-                        }
-                        else
-                        {
-                            // all subtitles on two lines tops
-                            // replace line breaks with spaces
-                            *q = ' ';
-                        }
+                        // replace '\r' with '\n'
+                        *q   = '\n';
                         q++;
                     }
                     else
@@ -552,7 +541,6 @@ static hb_buffer_t *srt_read( hb_work_private_t *pv )
     {
         long length;
         char *p, *q;
-        int  line = 1;
         uint64_t start_time = ( pv->current_entry.start +
                                 pv->subtitle->config.offset ) * 90;
         uint64_t stop_time = ( pv->current_entry.stop +
@@ -569,7 +557,7 @@ static hb_buffer_t *srt_read( hb_work_private_t *pv )
 
         for (q = p = pv->current_entry.text; *p != '\0'; p++)
         {
-            if (*p == '\n' || *p == '\r')
+            if (*p == '\r')
             {
                 if (*(p + 1) == '\n' || *(p + 1) == '\r' || *(p + 1) == '\0')
                 {
@@ -577,18 +565,8 @@ static hb_buffer_t *srt_read( hb_work_private_t *pv )
                     length--;
                     continue;
                 }
-                else if (line == 1)
-                {
-                    // replace '\r' with '\n'
-                    *q   = '\n';
-                    line = 2;
-                }
-                else
-                {
-                    // all subtitles on two lines tops
-                    // replace line breaks with spaces
-                    *q = ' ';
-                }
+                // replace '\r' with '\n'
+                *q   = '\n';
                 q++;
             }
             else