]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/mpeg.h
#include just the required stdint.h instead of libavutil/common.h.
[ffmpeg] / libavformat / mpeg.h
index 94c703d464751de5b0174baab9c7489d39c70d58..d09b2e81bc6fe1ae65cd960c9655ba6c1f712974 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * MPEG1/2 muxer and demuxer common defines
- * Copyright (c) 2000, 2001, 2002 Fabrice Bellard.
+ * Copyright (c) 2000, 2001, 2002 Fabrice Bellard
  *
  * This file is part of FFmpeg.
  *
@@ -22,6 +22,9 @@
 #ifndef AVFORMAT_MPEG_H
 #define AVFORMAT_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 /* AVFORMAT_MPEG_H */