summaryrefslogtreecommitdiff
path: root/libavformat/mpeg.h
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.h
parentca5323af4b2aa6f499a85687ee027426aca10d7a (diff)
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.h')
-rw-r--r--libavformat/mpeg.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libavformat/mpeg.h b/libavformat/mpeg.h
index 053b1590ea..9283101d10 100644
--- a/libavformat/mpeg.h
+++ b/libavformat/mpeg.h
@@ -57,4 +57,13 @@
static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 };
+/**
+ * Parse MPEG-PES five-byte timestamp
+ */
+static inline int64_t ff_parse_pes_pts(uint8_t *buf) {
+ return (int64_t)(*buf & 0x0e) << 29 |
+ (AV_RB16(buf+1) >> 1) << 15 |
+ AV_RB16(buf+3) >> 1;
+}
+
#endif /* FFMPEG_MPEG_H */