diff mpeg.c @ 2906:e5dfe3c96f3b libavformat

Move parsing of MPEG-PES timestamp to mpeg.h (as an inline function) so it can easily be reused by other demuxers for formats that encapsulate MPEG-PES.
author ivo
date Mon, 07 Jan 2008 23:32:57 +0000
parents 8fa014a92350
children f5de41d943e2
line wrap: on
line diff
--- a/mpeg.c	Mon Jan 07 00:03:19 2008 +0000
+++ b/mpeg.c	Mon Jan 07 23:32:57 2008 +0000
@@ -120,17 +120,12 @@
 
 static int64_t get_pts(ByteIOContext *pb, int c)
 {
-    int64_t pts;
-    int val;
+    uint8_t buf[5];
 
-    if (c < 0)
-        c = get_byte(pb);
-    pts = (int64_t)(c & 0x0e) << 29;
-    val = get_be16(pb);
-    pts |= (int64_t)(val >> 1) << 15;
-    val = get_be16(pb);
-    pts |= (int64_t)(val >> 1);
-    return pts;
+    buf[0] = c<0 ? get_byte(pb) : c;
+    get_buffer(pb, buf+1, 4);
+
+    return ff_parse_pes_pts(buf);
 }
 
 static int find_next_start_code(ByteIOContext *pb, int *size_ptr,