summaryrefslogtreecommitdiffstats
path: root/libhb/scan.c
diff options
context:
space:
mode:
authorjbrjake <[email protected]>2007-08-13 16:14:06 +0000
committerjbrjake <[email protected]>2007-08-13 16:14:06 +0000
commite532199ceccdc03a2a356b44dd5a2ab1cb859408 (patch)
tree911bf910bda26fea58a1e2f09a4d51e18bc42b90 /libhb/scan.c
parentb811ee3c5e1108fbbb21961d4fcad0942b1a609f (diff)
"Same as source" changes. Old behavior: mark all NTSC content as 23.976. New behavior: mark all NTSC content as 29.97, only use 23.976 when scanning shows a title reporting itself as mostly progressive.
Also threw in a bunch of commented out logging messages for diagnostic usage. And notification during encodes when progressive flags go on or off (only works in jam builds until the contrib binary packs get rebuilt). git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@799 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/scan.c')
-rw-r--r--libhb/scan.c42
1 files changed, 36 insertions, 6 deletions
diff --git a/libhb/scan.c b/libhb/scan.c
index 97a437008..cda52e375 100644
--- a/libhb/scan.c
+++ b/libhb/scan.c
@@ -290,6 +290,7 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title )
hb_buffer_t * buf_ps, * buf_es, * buf_raw;
hb_list_t * list_es, * list_raw;
hb_libmpeg2_t * mpeg2;
+ int progressive_count = 0;
buf_ps = hb_buffer_init( HB_DVD_READ_BUFFER_SIZE );
list_es = hb_list_init();
@@ -306,6 +307,8 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title )
FILE * file_preview;
char filename[1024];
+ //hb_log("Seeking to: %f", (float) ( i + 1 ) / 11.0 );
+
if (data->dvd)
{
if( !hb_dvd_seek( data->dvd, (float) ( i + 1 ) / 11.0 ) )
@@ -377,13 +380,40 @@ static int DecodePreviews( hb_scan_t * data, hb_title_t * title )
goto error;
}
- if( !i )
+ /* Get size and rate infos */
+ title->rate = 27000000;
+ int ar;
+ hb_libmpeg2_info( mpeg2, &title->width, &title->height,
+ &title->rate_base, &ar );
+
+ if (title->rate_base == 1126125)
+ {
+ /* Frame FPS is 23.976 (meaning it's progressive), so
+ start keeping track of how many are reporting at
+ that speed. When enough show up that way, we want
+ to make that the overall title FPS.
+ */
+ progressive_count++;
+
+ if (progressive_count < 6)
+ /* Not enough frames are reporting as progressive,
+ which means we should be conservative and use
+ 29.97 as the title's FPS for now.
+ */
+ title->rate_base = 900900;
+ else
+ {
+ /* A majority of the scan frames are progressive. Make that
+ the title's FPS, and announce it once to the log.
+ */
+ if (progressive_count == 6)
+ hb_log("Title's mostly progressive NTSC, setting fps to 23.976");
+ title->rate_base = 1126125;
+ }
+ }
+
+ if( i == 2) // Use the third frame's info, so as to skip opening logos
{
- /* Get size and rate infos */
- title->rate = 27000000;
- int ar;
- hb_libmpeg2_info( mpeg2, &title->width, &title->height,
- &title->rate_base, &ar );
// The aspect ratio may have already been set by parsing the VOB/IFO details on a DVD, however
// if we're working with program/transport streams that data needs to come from within the stream.
if (title->aspect <= 0)