diff options
author | van <[email protected]> | 2008-08-18 06:15:17 +0000 |
---|---|---|
committer | van <[email protected]> | 2008-08-18 06:15:17 +0000 |
commit | 37e3888441e68c1eb77faa9f82a9e6f27f9a64f8 (patch) | |
tree | 35c4e9166230827dfa284952d4039ce07a5f09b0 /libhb/stream.c | |
parent | fb73802e00132d407e9f00dd1a3a9535e651cdc6 (diff) |
- To reliably find audio in 720p or 1080i TS streams we need to search through first 50MB of file looking for the stream rather than first 18MB.
- When we're looking for a PES header for some PID, check both that the TS 'start' bit is set and that the first 3 data bytes are an MPEG start code (the start bit may get set by an error not caught by the CRC).
- Print the substream id when we reject a PID as "not audio" so we'll be able to debug TS streams using non-standard PES encapsulations.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1642 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/stream.c')
-rwxr-xr-x | libhb/stream.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/libhb/stream.c b/libhb/stream.c index 90b7ae37e..930af3072 100755 --- a/libhb/stream.c +++ b/libhb/stream.c @@ -727,7 +727,7 @@ static void skip_to_next_pack( hb_stream_t *src_stream ) */ static const uint8_t *hb_ts_stream_getPEStype(hb_stream_t *stream, uint32_t pid) { - int npack = 100000; // max packets to read + int npack = 300000; // max packets to read while (--npack >= 0) { @@ -766,7 +766,11 @@ static const uint8_t *hb_ts_stream_getPEStype(hb_stream_t *stream, uint32_t pid) udata += buf[4] + 1; break; } - return &buf[udata]; + /* PES hdr has to begin with an mpeg start code */ + if (buf[udata+0] == 0x00 && buf[udata+1] == 0x00 && buf[udata+2] == 0x01) + { + return &buf[udata]; + } } /* didn't find it */ @@ -1185,9 +1189,18 @@ static hb_audio_t *hb_ts_stream_set_audio_id_and_codec(hb_stream_t *stream, } else { - hb_log("transport stream pid 0x%x (type 0x%x) isn't audio", - stream->ts_audio_pids[aud_pid_index], - stream->ts_stream_type[1 + aud_pid_index]); + if ( buf ) + { + hb_log("transport stream pid 0x%x (type 0x%x, substream 0x%x) " + "isn't audio", stream->ts_audio_pids[aud_pid_index], + stream->ts_stream_type[1 + aud_pid_index], buf[3]); + } + else + { + hb_log("transport stream pid 0x%x (type 0x%x) isn't audio", + stream->ts_audio_pids[aud_pid_index], + stream->ts_stream_type[1 + aud_pid_index]); + } } fseeko(stream->file_handle, cur_pos, SEEK_SET); return audio; |