changeset 1667:a20d8757d598 libavformat

simplify pts/dts reading
author michael
date Wed, 17 Jan 2007 10:55:01 +0000
parents 682ea2701149
children b609473bf4bb
files mpeg.c
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mpeg.c	Wed Jan 17 10:45:59 2007 +0000
+++ b/mpeg.c	Wed Jan 17 10:55:01 2007 +0000
@@ -1502,13 +1502,13 @@
         c = get_byte(&s->pb);
         len -= 2;
     }
-    if ((c & 0xf0) == 0x20) {
+    if ((c & 0xe0) == 0x20) {
         dts = pts = get_pts(&s->pb, c);
         len -= 4;
-    } else if ((c & 0xf0) == 0x30) {
-        pts = get_pts(&s->pb, c);
-        dts = get_pts(&s->pb, -1);
-        len -= 9;
+        if (c & 0x10){
+            dts = get_pts(&s->pb, -1);
+            len -= 5;
+        }
     } else if ((c & 0xc0) == 0x80) {
         /* mpeg 2 PES */
 #if 0 /* some streams have this field set for no apparent reason */
@@ -1522,15 +1522,15 @@
         len -= 2;
         if (header_len > len)
             goto error_redo;
-        if ((flags & 0xc0) == 0x80) {
+        if (flags & 0x80) {
             dts = pts = get_pts(&s->pb, -1);
             header_len -= 5;
             len -= 5;
-        } if ((flags & 0xc0) == 0xc0) {
-            pts = get_pts(&s->pb, -1);
-            dts = get_pts(&s->pb, -1);
-            header_len -= 10;
-            len -= 10;
+            if (flags & 0x40) {
+                dts = get_pts(&s->pb, -1);
+                header_len -= 5;
+                len -= 5;
+            }
         }
         len -= header_len;
         while (header_len > 0) {