OSDN Git Service

Applied and committed saintdev's patch to fix multi-track audio. Only in the CLI...
[handbrake-jp/handbrake-jp-git.git] / libhb / scan.c
index f60392c..5d817c7 100644 (file)
@@ -177,13 +177,29 @@ static void ScanFunc( void * _data )
         /* Autocrop by default. Gnark gnark */
         memcpy( job->crop, title->crop, 4 * sizeof( int ) );
 
+        if( title->aspect == 16 )
+        {
+            hb_reduce( &job->pixel_aspect_width, &job->pixel_aspect_height,
+                       16 * title->height, 9 * title->width );
+        }
+        else
+        {
+            hb_reduce( &job->pixel_aspect_width, &job->pixel_aspect_height,
+                       4 * title->height, 3 * title->width );
+        }
+
         job->width = title->width - job->crop[2] - job->crop[3];
+//        job->height = title->height - job->crop[0] - job->crop[1];
         hb_fix_aspect( job, HB_KEEP_WIDTH );
         if( job->height > title->height - job->crop[0] - job->crop[1] )
         {
             job->height = title->height - job->crop[0] - job->crop[1];
             hb_fix_aspect( job, HB_KEEP_HEIGHT );
         }
+
+    hb_log( "scan: title (%d) job->width:%d, job->height:%d",
+            i,job->width, job->height );
+
         job->keep_ratio = 1;
 
         job->vcodec     = HB_VCODEC_FFMPEG;
@@ -239,13 +255,16 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title )
         FILE * file_preview;
         char   filename[1024];
 
-        hb_dvd_seek( data->dvd, (float) ( i + 1 ) / 11.0 );
+        if( !hb_dvd_seek( data->dvd, (float) ( i + 1 ) / 11.0 ) )
+        {
+            goto error;
+        }
 
         hb_log( "scan: preview %d", i + 1 );
 
         mpeg2 = hb_libmpeg2_init();
 
-        for( j = 0; j < 10240; j++ )
+        for( j = 0; j < 10240 ; j++ )
         {
             if( !hb_dvd_read( data->dvd, buf_ps ) )
             {
@@ -465,9 +484,20 @@ static void LookForAC3( hb_title_t * title, hb_buffer_t * b )
                     audio->channels = 5;
                     break;
             }
+
+                       if (flags & A52_LFE) {
+                               audio->lfechannels = 1;
+                       } else {
+                               audio->lfechannels = 0;
+                       }
+                       
+                       /* store the AC3 tags for future reference
+                       This enables us to find out if we had a stereo or Dolby source later on */
+                       audio->config.a52.ac3flags = flags;
+
             /* XXX */
             sprintf( audio->lang + strlen( audio->lang ),
-                     " (%d ch)", audio->channels );
+                     " (%d.%d ch)", audio->channels, audio->lfechannels );
             break;
         }
     }