a pastebin project

someone

  1. Index: libhb/decmpeg2.c
  2. ===================================================================
  3. --- libhb/decmpeg2.c    (revision 1314)
  4. +++ libhb/decmpeg2.c    (working copy)
  5. @@ -321,6 +321,13 @@
  6.      *aspect_ratio = m->aspect_ratio;
  7.  }
  8.  
  9. +int hb_libmpeg2_clear_aspect_ratio( hb_libmpeg2_t * m )
  10. +{
  11. +    int ar = m->aspect_ratio;
  12. +    m->aspect_ratio = 0;
  13. +    return ar;
  14. +}
  15. +
  16.  /**********************************************************************
  17.   * hb_libmpeg2_close
  18.   **********************************************************************
  19. Index: libhb/internal.h
  20. ===================================================================
  21. --- libhb/internal.h    (revision 1314)
  22. +++ libhb/internal.h    (working copy)
  23. @@ -112,6 +112,7 @@
  24.  void             hb_libmpeg2_info( hb_libmpeg2_t * m, int * width,
  25.                                      int * height, int * rate, int * aspect_ratio );
  26.  void             hb_libmpeg2_close( hb_libmpeg2_t ** );
  27. +int              hb_libmpeg2_clear_aspect_ratio( hb_libmpeg2_t * );
  28.  
  29.  /***********************************************************************
  30.   * mpegdemux.c
  31. Index: libhb/scan.c
  32. ===================================================================
  33. --- libhb/scan.c        (revision 1314)
  34. +++ libhb/scan.c        (working copy)
  35. @@ -281,11 +281,12 @@
  36.   **********************************************************************/
  37.  static int DecodePreviews( hb_scan_t * data, hb_title_t * title )
  38.  {
  39. -    int             i, ret;
  40. +    int             i, npreviews = 0;
  41.      hb_buffer_t   * buf_ps, * buf_es, * buf_raw;
  42.      hb_list_t     * list_es, * list_raw;
  43.      hb_libmpeg2_t * mpeg2;
  44.      int progressive_count = 0;
  45. +    int ar16_count = 0, ar4_count = 0;
  46.  
  47.      buf_ps   = hb_buffer_init( HB_DVD_READ_BUFFER_SIZE );
  48.      list_es  = hb_list_init();
  49. @@ -349,6 +350,12 @@
  50.                  if( buf_es->id == 0xE0 && !hb_list_count( list_raw ) )
  51.                  {
  52.                      hb_libmpeg2_decode( mpeg2, buf_es, list_raw );
  53. +                    int ar = hb_libmpeg2_clear_aspect_ratio( mpeg2 );
  54. +                    if ( ar != 0 )
  55. +                    {
  56. +                        ( ar == (HB_ASPECT_BASE * 4 / 3) ) ?
  57. +                            ++ar4_count : ++ar16_count ;
  58. +                    }
  59.                  }
  60.                  else if( !i )
  61.                  {
  62. @@ -383,6 +390,11 @@
  63.          hb_libmpeg2_info( mpeg2, &title->width, &title->height,
  64.                            &title->rate_base, &ar );
  65.  
  66. +        /* if we found mostly 4:3 previews use that as the aspect ratio otherwise
  67. +           use 16:9 */
  68. +        title->aspect = ar4_count > ar16_count ?
  69. +                            HB_ASPECT_BASE * 4 / 3 : HB_ASPECT_BASE * 16 / 9;
  70. +
  71.          if( title->rate_base == 1126125 )
  72.          {
  73.              /* Frame FPS is 23.976 (meaning it's progressive), so
  74. @@ -421,12 +433,9 @@
  75.              title->rate_base = 1126125;
  76.          }
  77.  
  78. -        if( i == 2) // Use the third frame's info, so as to skip opening logos
  79. +        // start from third frame to skip opening logos
  80. +        if( i >= 2)
  81.          {
  82. -            // The aspect ratio may have already been set by parsing the VOB/IFO details on a DVD, however
  83. -            // if we're working with program/transport streams that data needs to come from within the stream.
  84. -            if (title->aspect <= 0)
  85. -              title->aspect = ar;
  86.              title->crop[0] = title->crop[1] = title->height / 2;
  87.              title->crop[2] = title->crop[3] = title->width / 2;
  88.          }
  89. @@ -493,6 +502,7 @@
  90.                      break;
  91.                  }
  92.          }
  93. +        ++npreviews;
  94.  
  95.  skip_preview:
  96.          while( ( buf_raw = hb_list_item( list_raw, 0 ) ) )
  97. @@ -507,16 +517,16 @@
  98.      title->crop[2] = EVEN( title->crop[2] );
  99.      title->crop[3] = EVEN( title->crop[3] );
  100.  
  101. -    hb_log( "scan: %dx%d, %.3f fps, autocrop = %d/%d/%d/%d",
  102. -            title->width, title->height, (float) title->rate /
  103. +    hb_log( "scan: %d previews, %dx%d, %.3f fps, autocrop = %d/%d/%d/%d, aspect %s",
  104. +            npreviews, title->width, title->height, (float) title->rate /
  105.              (float) title->rate_base, title->crop[0], title->crop[1],
  106. -            title->crop[2], title->crop[3] );
  107. -
  108. -    ret = 1;
  109. +            title->crop[2], title->crop[3],
  110. +            title->aspect == HB_ASPECT_BASE * 16 / 9 ? "16:9" :
  111. +                title->aspect == HB_ASPECT_BASE * 4 / 3 ? "4:3" : "none" );
  112.      goto cleanup;
  113.  
  114.  error:
  115. -    ret = 0;
  116. +    npreviews = 0;
  117.  
  118.  cleanup:
  119.      hb_buffer_close( &buf_ps );
  120. @@ -535,7 +545,7 @@
  121.      if (data->dvd)
  122.        hb_dvd_stop( data->dvd );
  123.  
  124. -    return ret;
  125. +    return npreviews;
  126.  }
  127.  
  128.  static void LookForAC3AndDCA( hb_title_t * title, hb_buffer_t * b )
  129. Index: libhb/common.c
  130. ===================================================================
  131. --- libhb/common.c      (revision 1314)
  132. +++ libhb/common.c      (working copy)
  133. @@ -111,6 +111,15 @@
  134.      hb_title_t * title = job->title;
  135.      int          i;
  136.  
  137. +    /* don't do anything unless the title has complete size info */
  138. +    if ( title->height == 0 || title->width == 0 || title->aspect == 0 )
  139. +    {
  140. +        hb_log( "hb_fix_aspect: incomplete info for title %d: "
  141. +                "height = %d, width = %d, aspect = %d",
  142. +                title->height, title->width, title->aspect );
  143. +        return;
  144. +    }
  145. +
  146.      /* Sanity checks:
  147.         Widths and heights must be multiples of 16 and greater than or
  148.         equal to 16

advertising

Create a Paste

Please enter your new post below (or upload a file instead):





Please note that information posted here will not expire by default. If you 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.

fantasy-obligation
fantasy-obligation