summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvan <[email protected]>2009-06-02 03:34:20 +0000
committervan <[email protected]>2009-06-02 03:34:20 +0000
commit18853a69850ce65763286d049551c4fc14b8ac5b (patch)
treec97b6f9f80f8d31830bbea295e8de59c2cd8e643
parent46308d7cde4104ef71355d42a82f173cb088f841 (diff)
Fix for New Zealand TV not following the mpeg2 standard
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2466 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/stream.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libhb/stream.c b/libhb/stream.c
index 1e49d76f5..c98f901db 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -1986,7 +1986,13 @@ static int decode_PAT(const uint8_t *buf, hb_stream_t *stream)
static void hb_ts_stream_find_pids(hb_stream_t *stream)
{
- // align to first packet
+ // To be different from every other broadcaster in the world, New Zealand TV
+ // changes PMTs (and thus video & audio PIDs) when 'programs' change. Since
+ // we may have the tail of the previous program at the beginning of this
+ // file, take our PMT from the middle of the file.
+ fseeko(stream->file_handle, 0, SEEK_END);
+ uint64_t fsize = ftello(stream->file_handle);
+ fseeko(stream->file_handle, fsize >> 1, SEEK_SET);
align_to_next_packet(stream);
// Read the Transport Stream Packets (188 bytes each) looking at first for PID 0 (the PAT PID), then decode that