Extract timestamp correction code from ffplay.c to cmdutils.c

Originally committed as revision 25241 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Alexander Strange
2010-09-28 02:05:12 +00:00
parent 6d19fd5c26
commit 7a8bfa5d67
3 changed files with 63 additions and 23 deletions

View File

@ -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 */