OSDN Git Service

Removed double EOF for CC's (one from dvd and one from cc), fixed compiler warnings...
authoreddyg <eddyg@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 6 May 2009 22:58:21 +0000 (22:58 +0000)
committereddyg <eddyg@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Wed, 6 May 2009 22:58:21 +0000 (22:58 +0000)
git-svn-id: svn://localhost/HandBrake/trunk@2394 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/deccc608sub.c
libhb/reader.c
libhb/sync.c

index b351be9..18d0e6b 100644 (file)
@@ -1490,10 +1490,10 @@ void write_cc_line_as_transcript (struct eia608_screen *data, struct s_write *wb
         /*
          * Put this subtitle in a hb_buffer_t and shove it into the subtitle fifo
          */
-        buffer = hb_buffer_init( strlen( wb->subline ) + 1 );
+        buffer = hb_buffer_init( length + 1 );
         buffer->start = wb->data608->current_visible_start_ms;
         buffer->stop = get_fts(wb);
-        strcpy( buffer->data, wb->subline );
+        memcpy( buffer->data, wb->subline, length + 1 );
         //hb_log("CC %lld: %s", buffer->stop, wb->subline);
 
         hb_fifo_push( wb->subtitle->fifo_raw, buffer );
@@ -1615,19 +1615,22 @@ int write_cc_buffer_as_srt (struct eia608_screen *data, struct s_write *wb)
                 hb_log ("\r");
                 hb_log ("%s\n",wb->subline);
             }
-            hb_buffer_t *buffer = hb_buffer_init( strlen( wb->subline ) + 1 );
-            buffer->start = ms_start;
-            buffer->stop = ms_end;
-            strcpy( buffer->data, wb->subline );
-
-            hb_fifo_push( wb->subtitle->fifo_raw, buffer );
-
-            //fwrite (wb->subline, 1, length, wb->fh);
-            XMLRPC_APPEND(wb->subline,length);
-            //fwrite (encoded_crlf, 1, encoded_crlf_length,wb->fh);
-            XMLRPC_APPEND(encoded_crlf,encoded_crlf_length);
-            wrote_something=1;
-            // fhb_log (wb->fh,encoded_crlf);
+            if (length > 0)
+            {
+                hb_buffer_t *buffer = hb_buffer_init( length + 1 );
+                buffer->start = ms_start;
+                buffer->stop = ms_end;
+                memcpy( buffer->data, wb->subline, length + 1 );
+                
+                hb_fifo_push( wb->subtitle->fifo_raw, buffer );
+                
+                //fwrite (wb->subline, 1, length, wb->fh);
+                XMLRPC_APPEND(wb->subline,length);
+                //fwrite (encoded_crlf, 1, encoded_crlf_length,wb->fh);
+                XMLRPC_APPEND(encoded_crlf,encoded_crlf_length);
+                wrote_something=1;
+                // fhb_log (wb->fh,encoded_crlf);
+            }
         }
     }
     if (debug_608)
index f7470bf..dd47815 100644 (file)
@@ -460,7 +460,7 @@ static void ReaderFunc( void * _r )
     hb_subtitle_t *subtitle;
     for( n = 0; ( subtitle = hb_list_item( r->job->title->list_subtitle, n ) ); ++n )
     {
-        if ( subtitle->fifo_in )
+        if ( subtitle->fifo_in && subtitle->source == VOBSUB)
             push_buf( r, subtitle->fifo_in, hb_buffer_init(0) );
     }
 
index a0dfd66..67093d1 100644 (file)
@@ -416,17 +416,25 @@ static void SyncVideo( hb_work_object_t * w )
                      *
                      * Bypass the sync fifo altogether.
                      */
-                    if( sub->size == 0 || sub->start < cur->start )
+                    if( sub->size == 0 )
                     {
-                        uint64_t duration;
-                        duration = sub->stop - sub->start;
                         sub = hb_fifo_get( subtitle->fifo_raw );
-                        sub->start = pv->next_start;
-                        sub->stop = sub->start + duration;
                         hb_fifo_push( subtitle->fifo_out, sub );
-                    } else {
                         sub = NULL;
                         break;
+                    } else {
+                        if( sub->start < cur->start )
+                        {
+                            uint64_t duration;
+                            duration = sub->stop - sub->start;
+                            sub = hb_fifo_get( subtitle->fifo_raw );
+                            sub->start = pv->next_start;
+                            sub->stop = sub->start + duration;
+                            hb_fifo_push( subtitle->fifo_out, sub );
+                        } else {
+                            sub = NULL;
+                            break;
+                        }
                     }
                 }
             }