| 527 | } |
| 528 | |
| 529 | static int hb_stream_check_for_ts(const uint8_t *buf) |
| 530 | { |
| 531 | // transport streams should have a sync byte every 188 bytes. |
| 532 | // search the first 8KB of buf looking for at least 8 consecutive |
| 533 | // correctly located sync patterns. |
| 534 | int offset = 0; |
| 535 | int count = 16; |
| 536 | |
| 537 | for ( offset = 0; offset < 8*1024-count*188; ++offset ) |
| 538 | { |
| 539 | if ( have_ts_sync( &buf[offset], 188, count) ) |
| 540 | return 188 | (offset << 8); |
| 541 | if ( have_ts_sync( &buf[offset], 192, count) ) |
| 542 | return 192 | (offset << 8); |
| 543 | if ( have_ts_sync( &buf[offset], 204, count) ) |
| 544 | return 204 | (offset << 8); |
| 545 | if ( have_ts_sync( &buf[offset], 208, count) ) |
| 546 | return 208 | (offset << 8); |
| 547 | } |
| 548 | return 0; |
| 549 | } |
| 550 | |
| 551 | static int hb_stream_check_for_ps(hb_stream_t *stream) |
| 552 | { |
no test coverage detected