summaryrefslogtreecommitdiff
path: root/cmdutils.h
diff options
context:
space:
mode:
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 */