]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/mpeg.h
indent
[ffmpeg] / libavformat / mpeg.h
index 053b1590eaf9e5ca6cb0574c85840cb58e61c900..c1675ee4428440f1ea16311bdca93971b034354a 100644 (file)
@@ -22,6 +22,9 @@
 #ifndef FFMPEG_MPEG_H
 #define FFMPEG_MPEG_H
 
+#include <stdint.h>
+#include "libavutil/intreadwrite.h"
+
 #define PACK_START_CODE             ((unsigned int)0x000001ba)
 #define SYSTEM_HEADER_START_CODE    ((unsigned int)0x000001bb)
 #define SEQUENCE_END_CODE           ((unsigned int)0x000001b7)
 
 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 */