OSDN Git Service

Fix for New Zealand TV not following the mpeg2 standard
authorvan <van@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 2 Jun 2009 03:34:20 +0000 (03:34 +0000)
committervan <van@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 2 Jun 2009 03:34:20 +0000 (03:34 +0000)
git-svn-id: svn://localhost/HandBrake/trunk@2466 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/stream.c

index 1e49d76..c98f901 100644 (file)
@@ -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