Page MenuHome

anim_movie.diff

File Metadata

Author
Anders Gudmundson (anders_gud)
Created
Nov 13 2013, 3:16 PM

anim_movie.diff

--- source/blender/imbuf/intern/anim_movie.c-bak 2011-01-07 12:57:14.547533566 +0100
+++ source/blender/imbuf/intern/anim_movie.c 2011-01-07 21:18:42.173749647 +0100
@@ -1,4 +1,4 @@
-/**
+/*
* anim.c
*
* $Id: anim_movie.c 33448 2010-12-03 17:05:21Z campbellbarton $
@@ -592,9 +592,23 @@
anim->duration = pFormatCtx->duration * pCodecCtx->frame_rate
/ pCodecCtx->frame_rate_base / AV_TIME_BASE;
#else
- anim->duration = ceil(pFormatCtx->duration
+ /* anim->duration = ceil(pFormatCtx->duration
* av_q2d(pFormatCtx->streams[videoStream]->r_frame_rate)
- / AV_TIME_BASE);
+ / AV_TIME_BASE);*/
+
+ if (pFormatCtx->streams[videoStream]->avg_frame_rate.den &&
+ pFormatCtx->streams[videoStream]->avg_frame_rate.num) {
+ anim->duration = pFormatCtx->duration
+ /* AG mp4 bug * av_q2d(pFormatCtx->streams[videoStream]->r_frame_rate)*/
+ * av_q2d(pFormatCtx->streams[videoStream]->avg_frame_rate)
+ / AV_TIME_BASE;
+ }else{
+ anim->duration = pFormatCtx->duration
+ * av_q2d(pFormatCtx->streams[videoStream]->r_frame_rate)
+ / AV_TIME_BASE;
+ }
+
+ printf("avg_frame_rate:%f r_frame_rate:%f\n", av_q2d(pFormatCtx->streams[videoStream]->avg_frame_rate), av_q2d(pFormatCtx->streams[videoStream]->r_frame_rate));
#endif
anim->params = 0;
@@ -857,13 +871,20 @@
#else
double frame_rate =
av_q2d(anim->pFormatCtx->streams[anim->videoStream]
- ->r_frame_rate);
+ ->avg_frame_rate);
#endif
double pts_time_base = av_q2d(anim->pFormatCtx->streams[anim->videoStream]->time_base);
long long pos;
long long st_time = anim->pFormatCtx->start_time;
int ret;
+ if (frame_rate != frame_rate) {
+ frame_rate =
+ av_q2d(anim->pFormatCtx->streams[anim->videoStream]
+ ->r_frame_rate);
+ }
+
+
if (seek_by_bytes) {
pos = position - anim->preseek;
if (pos < 0) {

Event Timeline