aboutsummaryrefslogtreecommitdiffstats
path: root/cmdutils.h
diff options
context:
space:
mode:
authorAlexander Strange <astrange@ithinksw.com>2010-09-28 02:05:12 +0000
committerAlexander Strange <astrange@ithinksw.com>2010-09-28 02:05:12 +0000
commit7a8bfa5d674922d4413d403b059fe183deb7ddbe (patch)
treeefaf3df8c3aa8f3d7eb47fdfa4828c86b2fcdcf1 /cmdutils.h
parent6d19fd5c26cc2971a9925376f52e57c286d2326b (diff)
downloadffmpeg-7a8bfa5d674922d4413d403b059fe183deb7ddbe.tar.gz
Extract timestamp correction code from ffplay.c to cmdutils.c
Originally committed as revision 25241 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'cmdutils.h')
-rw-r--r--cmdutils.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/cmdutils.h b/cmdutils.h
index 68a29b4033..c2c3c466ad 100644
--- a/cmdutils.h
+++ b/cmdutils.h
@@ -226,4 +226,28 @@ int read_yesno(void);
*/
int read_file(const char *filename, char **bufptr, size_t *size);
+typedef struct {
+ int64_t num_faulty_pts; /// Number of incorrect PTS values so far
+ int64_t num_faulty_dts; /// Number of incorrect DTS values so far
+ int64_t last_pts; /// PTS of the last frame
+ int64_t last_dts; /// DTS of the last frame
+} PtsCorrectionContext;
+
+/**
+ * Resets the state of the PtsCorrectionContext.
+ */
+void init_pts_correction(PtsCorrectionContext *ctx);
+
+/**
+ * Attempts to guess proper monotonic timestamps for decoded video frames
+ * which might have incorrect times. Input timestamps may wrap around, in
+ * which case the output will as well.
+ *
+ * @param pts The pts field of the decoded AVPacket, as passed through
+ * AVCodecContext.reordered_opaque
+ * @param dts The dts field of the decoded AVPacket
+ * @return One of the input values. May be AV_NOPTS_VALUE.
+ */
+int64_t guess_correct_pts(PtsCorrectionContext *ctx, int64_t pts, int64_t dts);
+
#endif /* FFMPEG_CMDUTILS_H */