Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/ffmpeg/ffmpeg_compat.h')
-rw-r--r--intern/ffmpeg/ffmpeg_compat.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/intern/ffmpeg/ffmpeg_compat.h b/intern/ffmpeg/ffmpeg_compat.h
index 0c22cf82688..ce4bfc7d5e2 100644
--- a/intern/ffmpeg/ffmpeg_compat.h
+++ b/intern/ffmpeg/ffmpeg_compat.h
@@ -113,22 +113,23 @@ void av_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
}
FFMPEG_INLINE
-int64_t av_get_pts_from_frame(AVFormatContext *avctx, AVFrame *picture)
+int64_t timestamp_from_pts_or_dts(int64_t pts, int64_t dts)
{
- int64_t pts;
- pts = picture->pts;
-
- if (pts == AV_NOPTS_VALUE) {
- pts = picture->pkt_dts;
- }
+ /* Some videos do not have any pts values, use dts instead in those cases if
+ * possible. Usually when this happens dts can act as pts because as all frames
+ * should then be presented in their decoded in order. IE pts == dts. */
if (pts == AV_NOPTS_VALUE) {
- pts = 0;
+ return dts;
}
-
- (void)avctx;
return pts;
}
+FFMPEG_INLINE
+int64_t av_get_pts_from_frame(AVFrame *picture)
+{
+ return timestamp_from_pts_or_dts(picture->pts, picture->pkt_dts);
+}
+
/* -------------------------------------------------------------------- */
/** \name Deinterlace code block
*