summaryrefslogtreecommitdiff
path: root/libavformat/mpeg.c
diff options
context:
space:
mode:
authorIvo van Poorten <ivop@euronet.nl>2008-01-07 23:32:57 +0000
committerIvo van Poorten <ivop@euronet.nl>2008-01-07 23:32:57 +0000
commit66e9e302394553fca0ebb6d25bb211cbdb4887f0 (patch)
tree9c2ea98f42e5365a76e2d65729d8dee8a90425f3 /libavformat/mpeg.c
parentca5323af4b2aa6f499a85687ee027426aca10d7a (diff)
downloadffmpeg-66e9e302394553fca0ebb6d25bb211cbdb4887f0.tar.gz
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. Originally committed as revision 11451 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/mpeg.c')
-rw-r--r--libavformat/mpeg.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index 3101c2a30f..d044d07f41 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -120,17 +120,12 @@ static int mpegps_read_header(AVFormatContext *s,
static int64_t get_pts(ByteIOContext *pb, int c)
{
- int64_t pts;
- int val;
-
- 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;
+ uint8_t buf[5];
+
+ 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,