+ // since AC3 frames don't line up with MPEG ES frames scan the
+ // frame for an AC3 sync pattern.
+ for ( i = 0; i < len - 16; ++i )
+ {
+ int rate, bitrate, flags;
+ int size = a52_syncinfo( (uint8_t *)buf + i, &flags, &rate, &bitrate );
+ if( size > 0 )
+ {
+ // we have a plausible sync header - see if crc1 checks
+ int crc1size = (size >> 1) + (size >> 3);
+ if ( i + crc1size > len )
+ {
+ // don't have enough data to check crc1
+ break;
+ }
+ if ( av_crc( av_crc_get_table( AV_CRC_16_ANSI ), 0,
+ buf + i + 2, crc1size - 2 ) == 0 )
+ {
+ // crc checks - we've got sync
+ return i;
+ }
+ }
+ }
+ return -1;
+}
+
+static int deca52BSInfo( hb_work_object_t *w, const hb_buffer_t *b,
+ hb_work_info_t *info )
+{