- someone
- Tuesday, February 26th, 2008 at 12:37:01am MST
- Index: libhb/decmpeg2.c
- ===================================================================
- --- libhb/decmpeg2.c (revision 1314)
- +++ libhb/decmpeg2.c (working copy)
- @@ -321,6 +321,13 @@
- *aspect_ratio = m->aspect_ratio;
- }
- +int hb_libmpeg2_clear_aspect_ratio( hb_libmpeg2_t * m )
- +{
- + int ar = m->aspect_ratio;
- + m->aspect_ratio = 0;
- + return ar;
- +}
- +
- /**********************************************************************
- * hb_libmpeg2_close
- **********************************************************************
- Index: libhb/internal.h
- ===================================================================
- --- libhb/internal.h (revision 1314)
- +++ libhb/internal.h (working copy)
- @@ -112,6 +112,7 @@
- void hb_libmpeg2_info( hb_libmpeg2_t * m, int * width,
- int * height, int * rate, int * aspect_ratio );
- void hb_libmpeg2_close( hb_libmpeg2_t ** );
- +int hb_libmpeg2_clear_aspect_ratio( hb_libmpeg2_t * );
- /***********************************************************************
- * mpegdemux.c
- Index: libhb/scan.c
- ===================================================================
- --- libhb/scan.c (revision 1314)
- +++ libhb/scan.c (working copy)
- @@ -281,11 +281,12 @@
- **********************************************************************/
- static int DecodePreviews( hb_scan_t * data, hb_title_t * title )
- {
- - int i, ret;
- + int i, npreviews = 0;
- hb_buffer_t * buf_ps, * buf_es, * buf_raw;
- hb_list_t * list_es, * list_raw;
- hb_libmpeg2_t * mpeg2;
- int progressive_count = 0;
- + int ar16_count = 0, ar4_count = 0;
- buf_ps = hb_buffer_init( HB_DVD_READ_BUFFER_SIZE );
- list_es = hb_list_init();
- @@ -349,6 +350,12 @@
- if( buf_es->id == 0xE0 && !hb_list_count( list_raw ) )
- {
- hb_libmpeg2_decode( mpeg2, buf_es, list_raw );
- + int ar = hb_libmpeg2_clear_aspect_ratio( mpeg2 );
- + if ( ar != 0 )
- + {
- + ( ar == (HB_ASPECT_BASE * 4 / 3) ) ?
- + ++ar4_count : ++ar16_count ;
- + }
- }
- else if( !i )
- {
- @@ -383,6 +390,11 @@
- hb_libmpeg2_info( mpeg2, &title->width, &title->height,
- &title->rate_base, &ar );
- + /* if we found mostly 4:3 previews use that as the aspect ratio otherwise
- + use 16:9 */
- + title->aspect = ar4_count > ar16_count ?
- + HB_ASPECT_BASE * 4 / 3 : HB_ASPECT_BASE * 16 / 9;
- +
- if( title->rate_base == 1126125 )
- {
- /* Frame FPS is 23.976 (meaning it's progressive), so
- @@ -421,12 +433,9 @@
- title->rate_base = 1126125;
- }
- - if( i == 2) // Use the third frame's info, so as to skip opening logos
- + // start from third frame to skip opening logos
- + if( i >= 2)
- {
- - // 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)
- - title->aspect = ar;
- title->crop[0] = title->crop[1] = title->height / 2;
- title->crop[2] = title->crop[3] = title->width / 2;
- }
- @@ -493,6 +502,7 @@
- break;
- }
- }
- + ++npreviews;
- skip_preview:
- while( ( buf_raw = hb_list_item( list_raw, 0 ) ) )
- @@ -507,16 +517,16 @@
- title->crop[2] = EVEN( title->crop[2] );
- title->crop[3] = EVEN( title->crop[3] );
- - hb_log( "scan: %dx%d, %.3f fps, autocrop = %d/%d/%d/%d",
- - title->width, title->height, (float) title->rate /
- + hb_log( "scan: %d previews, %dx%d, %.3f fps, autocrop = %d/%d/%d/%d, aspect %s",
- + npreviews, title->width, title->height, (float) title->rate /
- (float) title->rate_base, title->crop[0], title->crop[1],
- - title->crop[2], title->crop[3] );
- -
- - ret = 1;
- + title->crop[2], title->crop[3],
- + title->aspect == HB_ASPECT_BASE * 16 / 9 ? "16:9" :
- + title->aspect == HB_ASPECT_BASE * 4 / 3 ? "4:3" : "none" );
- goto cleanup;
- error:
- - ret = 0;
- + npreviews = 0;
- cleanup:
- hb_buffer_close( &buf_ps );
- @@ -535,7 +545,7 @@
- if (data->dvd)
- hb_dvd_stop( data->dvd );
- - return ret;
- + return npreviews;
- }
- static void LookForAC3AndDCA( hb_title_t * title, hb_buffer_t * b )
- Index: libhb/common.c
- ===================================================================
- --- libhb/common.c (revision 1314)
- +++ libhb/common.c (working copy)
- @@ -111,6 +111,15 @@
- hb_title_t * title = job->title;
- int i;
- + /* don't do anything unless the title has complete size info */
- + if ( title->height == 0 || title->width == 0 || title->aspect == 0 )
- + {
- + hb_log( "hb_fix_aspect: incomplete info for title %d: "
- + "height = %d, width = %d, aspect = %d",
- + title->height, title->width, title->aspect );
- + return;
- + }
- +
- /* Sanity checks:
- Widths and heights must be multiples of 16 and greater than or
- equal to 16
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.