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:
authorSybren A. Stüvel <sybren@blender.org>2019-09-19 16:26:17 +0300
committerSybren A. Stüvel <sybren@blender.org>2019-09-19 16:26:17 +0300
commit3977854c706ba3312d0adaf915b267da2c7c8f17 (patch)
tree94186bbaaf56e3aa05517bc0d924352343e411a8 /source/blender/imbuf
parent71f2229b0d8241ba153abebcc1e0d0e92e877574 (diff)
Cleanup: rename anim::duration to anim::duration_in_frames
Units should be explicit, and not left to be guessed by the reader. The field is only used in a single C file, so it's a relatively low-risk change.
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/IMB_anim.h2
-rw-r--r--source/blender/imbuf/intern/anim_movie.c31
2 files changed, 17 insertions, 16 deletions
diff --git a/source/blender/imbuf/intern/IMB_anim.h b/source/blender/imbuf/intern/IMB_anim.h
index 065c7e64d07..9ad88f24693 100644
--- a/source/blender/imbuf/intern/IMB_anim.h
+++ b/source/blender/imbuf/intern/IMB_anim.h
@@ -89,7 +89,7 @@ struct anim {
int ib_flags;
int curtype;
int curposition; /* index 0 = 1e, 1 = 2e, enz. */
- int duration;
+ int duration_in_frames;
int frs_sec;
double frs_sec_base;
int x, y;
diff --git a/source/blender/imbuf/intern/anim_movie.c b/source/blender/imbuf/intern/anim_movie.c
index a5fa55479dd..232a9998ebf 100644
--- a/source/blender/imbuf/intern/anim_movie.c
+++ b/source/blender/imbuf/intern/anim_movie.c
@@ -199,7 +199,7 @@ static void free_anim_avi(struct anim *anim)
}
# endif
- anim->duration = 0;
+ anim->duration_in_frames = 0;
}
#endif /* WITH_AVI */
@@ -408,7 +408,7 @@ static int startavi(struct anim *anim)
return -1;
}
- anim->duration = anim->avi->header->TotalFrames;
+ anim->duration_in_frames = anim->avi->header->TotalFrames;
anim->params = NULL;
anim->x = anim->avi->header->Width;
@@ -426,7 +426,7 @@ static int startavi(struct anim *anim)
anim->y,
anim->framesize,
anim->interlacing,
- anim->duration);
+ anim->duration_in_frames);
# endif
return 0;
@@ -570,27 +570,28 @@ static int startffmpeg(struct anim *anim)
}
frame_rate = av_guess_frame_rate(pFormatCtx, video_stream, NULL);
- anim->duration = 0;
+ anim->duration_in_frames = 0;
/* Take from the stream if we can. */
if (video_stream->nb_frames != 0) {
- anim->duration = video_stream->nb_frames;
+ anim->duration_in_frames = video_stream->nb_frames;
/* Sanity check on the detected duration. This is to work around corruption like reported in
* T68091. */
if (frame_rate.den != 0 && pFormatCtx->duration > 0) {
- double stream_sec = anim->duration * av_q2d(frame_rate);
+ double stream_sec = anim->duration_in_frames * av_q2d(frame_rate);
double container_sec = pFormatCtx->duration / (double)AV_TIME_BASE;
if (stream_sec > 4.0 * container_sec) {
/* The stream is significantly longer than the container duration, which is
* suspicious. */
- anim->duration = 0;
+ anim->duration_in_frames = 0;
}
}
}
/* Fall back to the container. */
- if (anim->duration == 0) {
- anim->duration = (int)(pFormatCtx->duration * av_q2d(frame_rate) / AV_TIME_BASE + 0.5f);
+ if (anim->duration_in_frames == 0) {
+ anim->duration_in_frames = (int)(pFormatCtx->duration * av_q2d(frame_rate) / AV_TIME_BASE +
+ 0.5f);
}
frs_num = frame_rate.num;
@@ -1240,7 +1241,7 @@ static void free_anim_ffmpeg(struct anim *anim)
av_free_packet(&anim->next_packet);
}
}
- anim->duration = 0;
+ anim->duration_in_frames = 0;
}
#endif
@@ -1277,7 +1278,7 @@ static ImBuf *anim_getnew(struct anim *anim)
ibuf = IMB_loadiffname(anim->name, anim->ib_flags, anim->colorspace);
if (ibuf) {
BLI_strncpy(anim->first, anim->name, sizeof(anim->first));
- anim->duration = 1;
+ anim->duration_in_frames = 1;
}
break;
case ANIM_MOVIE:
@@ -1315,7 +1316,7 @@ struct ImBuf *IMB_anim_previewframe(struct anim *anim)
ibuf = IMB_anim_absolute(anim, 0, IMB_TC_NONE, IMB_PROXY_NONE);
if (ibuf) {
IMB_freeImBuf(ibuf);
- position = anim->duration / 2;
+ position = anim->duration_in_frames / 2;
ibuf = IMB_anim_absolute(anim, position, IMB_TC_NONE, IMB_PROXY_NONE);
}
return ibuf;
@@ -1351,7 +1352,7 @@ struct ImBuf *IMB_anim_absolute(struct anim *anim,
if (position < 0) {
return (NULL);
}
- if (position >= anim->duration) {
+ if (position >= anim->duration_in_frames) {
return (NULL);
}
}
@@ -1416,12 +1417,12 @@ int IMB_anim_get_duration(struct anim *anim, IMB_Timecode_Type tc)
{
struct anim_index *idx;
if (tc == IMB_TC_NONE) {
- return anim->duration;
+ return anim->duration_in_frames;
}
idx = IMB_anim_open_index(anim, tc);
if (!idx) {
- return anim->duration;
+ return anim->duration_in_frames;
}
return IMB_indexer_get_duration(idx);