OSDN Git Service

dvdnav: oops. initialize d->chapter to 0 instead of first chapter
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 13 Jun 2009 18:13:53 +0000 (18:13 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sat, 13 Jun 2009 18:13:53 +0000 (18:13 +0000)
otherwise, we don't get the initial chapter marker event

git-svn-id: svn://localhost/HandBrake/trunk@2528 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/common.h
libhb/dvdnav.c
libhb/hb.h
libhb/work.c

index e6d0566..ccd065c 100644 (file)
@@ -248,7 +248,6 @@ struct hb_job_s
 
     int                     indepth_scan;
     hb_subtitle_config_t    select_subtitle_config;
-    hb_subtitle_t        ** select_subtitle;
     char                  * native_language;
 
     int             angle;              // dvd angle to encode
index 2a161d4..063498c 100644 (file)
@@ -842,7 +842,7 @@ static int hb_dvdnav_start( hb_dvd_t * e, hb_title_t *title, int c )
     }
     d->title = t;
     d->stopped = 0;
-    d->chapter = c;
+    d->chapter = 0;
     return 1;
 }
 
index 080d979..234d4b5 100644 (file)
@@ -79,6 +79,8 @@ typedef struct hb_interjob_s
     int render_dropped;    /* frames droped by telecine */
     int vrate;             /* initial assigned vrate */
     int vrate_base;        /* initial assigned vrate_base */
+
+    hb_subtitle_t *select_subtitle; /* foreign language scan subtitle */
 } hb_interjob_t;
 
 hb_interjob_t * hb_interjob_get( hb_handle_t * ); 
index 7ffb3ab..4f20502 100644 (file)
@@ -382,6 +382,7 @@ static void do_job( hb_job_t * job, int cpu_count )
     hb_title_t    * title;
     int             i, j;
     hb_work_object_t * w;
+    hb_interjob_t * interjob;
 
     hb_audio_t   * audio;
     hb_subtitle_t * subtitle;
@@ -393,6 +394,7 @@ static void do_job( hb_job_t * job, int cpu_count )
     unsigned int subtitle_hit = 0;
 
     title = job->title;
+    interjob = hb_interjob_get( job->h );
 
     if( job->pass == 2 && !job->cfr )
     {
@@ -505,7 +507,8 @@ static void do_job( hb_job_t * job, int cpu_count )
     /*
      * Look for the scanned subtitle in the existing subtitle list
      */
-    if ( !job->indepth_scan && job->select_subtitle && *(job->select_subtitle) )
+    if ( !job->indepth_scan && interjob->select_subtitle &&
+         ( job->pass == 0 || job->pass == 2 ) )
     {
         /*
          * Disable forced subtitles if we didn't find any in the scan
@@ -513,10 +516,10 @@ static void do_job( hb_job_t * job, int cpu_count )
          *
          * select_subtitle implies that we did a scan.
          */
-        if( (*job->select_subtitle)->config.force && 
-            (*job->select_subtitle)->forced_hits == 0 )
+        if( interjob->select_subtitle->config.force && 
+            interjob->select_subtitle->forced_hits == 0 )
         {
-            (*job->select_subtitle)->config.force = 0;
+            interjob->select_subtitle->config.force = 0;
         }
         for( i=0; i < hb_list_count(title->list_subtitle); i++ )
         {
@@ -530,17 +533,16 @@ static void do_job( hb_job_t * job, int cpu_count )
                 *
                 * select_subtitle implies that we did a scan.
                 */
-                if( (*job->select_subtitle)->id == subtitle->id )
+                if( interjob->select_subtitle->id == subtitle->id )
                 {
-                    *subtitle = *(*job->select_subtitle);
-                    free( *job->select_subtitle );
-                    free( job->select_subtitle );
-                    job->select_subtitle = NULL;
+                    *subtitle = *(interjob->select_subtitle);
+                    free( interjob->select_subtitle );
+                    interjob->select_subtitle = NULL;
                 }
             }
         }
 
-        if( job->select_subtitle )
+        if( interjob->select_subtitle )
         {
             /*
              * Its not in the existing list
@@ -549,16 +551,10 @@ static void do_job( hb_job_t * job, int cpu_count )
              * add the subtitle that we found on the first pass for use in this
              * pass.
              */
-            hb_list_add( title->list_subtitle, *job->select_subtitle );
-            free( job->select_subtitle );
-            job->select_subtitle = NULL;
+            hb_list_add( title->list_subtitle, interjob->select_subtitle );
+            interjob->select_subtitle = NULL;
         }
     }
-    else if ( !job->indepth_scan && job->select_subtitle )
-    {
-        free( job->select_subtitle );
-        job->select_subtitle = NULL;
-    }
 
 
     for( i=0; i < hb_list_count(title->list_subtitle); i++ )
@@ -1045,20 +1041,17 @@ cleanup:
         }
     }
 
-    if( job->select_subtitle )
+    if( job->indepth_scan )
     {
-        if( job->indepth_scan )
+        for( i=0; i < hb_list_count( title->list_subtitle ); i++ )
         {
-            for( i=0; i < hb_list_count( title->list_subtitle ); i++ )
+            subtitle =  hb_list_item( title->list_subtitle, i );
+            if( subtitle->id == subtitle_hit )
             {
-                subtitle =  hb_list_item( title->list_subtitle, i );
-                if( subtitle->id == subtitle_hit )
-                {
-                    subtitle->config = job->select_subtitle_config;
-                    hb_list_rem( title->list_subtitle, subtitle );
-                    *job->select_subtitle = subtitle;
-                    break;
-                }
+                subtitle->config = job->select_subtitle_config;
+                hb_list_rem( title->list_subtitle, subtitle );
+                interjob->select_subtitle = subtitle;
+                break;
             }
         }
     }