]> granicus.if.org Git - handbrake/commitdiff
fix title index issue in batch scanning
authorjstebbins <jstebbins.hb@gmail.com>
Wed, 25 Nov 2009 21:54:06 +0000 (21:54 +0000)
committerjstebbins <jstebbins.hb@gmail.com>
Wed, 25 Nov 2009 21:54:06 +0000 (21:54 +0000)
title index was assigned as the nth file in the directory, but files
that are not video would cause title indexes to be skipped in job.list_title
this would mess up the progress bar.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2982 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/batch.c
libhb/scan.c

index f627df5556e5499399ad1a0ba81ef39556292628..28c40ca48c1eb8f277edbd2d8fd06a244cf46932 100644 (file)
@@ -87,10 +87,10 @@ hb_title_t * hb_batch_title_scan( hb_batch_t * d, int t )
     char         * filename;
     hb_stream_t  * stream;
 
-    if ( t < 1 )
+    if ( t < 0 )
         return NULL;
 
-    filename = hb_list_item( d->list_file, t-1 );
+    filename = hb_list_item( d->list_file, t );
     if ( filename == NULL )
         return NULL;
 
@@ -99,7 +99,6 @@ hb_title_t * hb_batch_title_scan( hb_batch_t * d, int t )
         return NULL;
 
     title = hb_stream_title_scan( stream );
-    title->index = t;
     hb_stream_close( &stream );
 
     return title;
index ea15fc512eb32230d8faf293bc943c9319cce7f8..66afb2a210dd214750d4b68c2dd9f34ee7be4610 100644 (file)
@@ -97,14 +97,17 @@ static void ScanFunc( void * _data )
     }
     else if ( ( data->batch = hb_batch_init( data->path ) ) )
     {
+        int j = 1;
+
         /* Scan all titles */
         for( i = 0; i < hb_batch_title_count( data->batch ); i++ )
         {
             hb_title_t * title;
 
-            title = hb_batch_title_scan( data->batch, i + 1 );
+            title = hb_batch_title_scan( data->batch, i );
             if ( title != NULL )
             {
+                title->index = j++;
                 hb_list_add( data->list_title, title );
             }
         }