]> granicus.if.org Git - handbrake/commitdiff
Bug fix to r1691: had the offsets for PTS & DTS reversed so we were trying to grab...
authorvan <vanj.hb@gmail.com>
Tue, 16 Sep 2008 21:53:56 +0000 (21:53 +0000)
committervan <vanj.hb@gmail.com>
Tue, 16 Sep 2008 21:53:56 +0000 (21:53 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1705 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/stream.c

index a6a54f6160c34b5bb9781ac3aae01a94715f533e..5294919a23d24bd6865cf91da0e7a5c5ca1f5c39 100755 (executable)
@@ -2209,20 +2209,20 @@ static int hb_ts_stream_decode( hb_stream_t *stream, uint8_t *obuf )
                 {
                     // PES must begin with an mpeg start code & contain
                     // a DTS or PTS.
-                    uint8_t *pes = buf + adapt_len + 4;
+                    const uint8_t *pes = buf + adapt_len + 4;
                     if ( pes[0] != 0x00 || pes[1] != 0x00 || pes[2] != 0x01 ||
                          ( pes[7] >> 6 ) == 0 )
                     {
                         continue;
                     }
                     // if we have a dts use it otherwise use the pts
-                    pes += (pes[7] & 0x40)? 9 : 14;
+                    pes += (pes[7] & 0x40)? 14 : 9;
 
-                    pcr = ( ( (uint64_t)pes[0] >> 1 ) & 7 << 30 ) |
-                          ( (uint64_t)pes[1] << 22 ) |
-                          ( ( (uint64_t)pes[2] >> 1 ) << 15 ) |
-                          ( (uint64_t)pes[3] << 7 ) |
-                          ( (uint64_t)pes[4] >> 1 );
+                    pcr = ( (uint64_t)(pes[0] & 0xe ) << 29 );
+                    pcr |= ( pes[1] << 22 ) |
+                           ( ( pes[2] >> 1 ) << 15 ) |
+                           ( pes[3] << 7 ) |
+                           ( pes[4] >> 1 );
                     stream->ts_nextpcr = pcr;
                 }
             }