image-source: Move file modification check before animation processing

The code to process GIF animations contains a return statement that
skiped the file modification check, if the source is not in an active
scene. Like that images in the preview scene of studio mode would never
update, when they get modified on disk.

Also reloading the image, if an animation file has been modified before
processing the old animation that will be replaced later anyway, seems
like a better way to do it.
This commit is contained in:
Christoph Hohmann 2017-03-12 18:41:34 +01:00
parent a8106115d9
commit 35d6787fe5

View File

@ -162,6 +162,17 @@ static void image_source_tick(void *data, float seconds)
struct image_source *context = data;
uint64_t frame_time = obs_get_video_frame_time();
context->update_time_elapsed += seconds;
if (context->update_time_elapsed >= 1.0f) {
time_t t = get_modified_timestamp(context->file);
context->update_time_elapsed = 0.0f;
if (context->file_timestamp != t) {
image_source_load(context);
}
}
if (obs_source_active(context->source)) {
if (!context->active) {
if (context->image.is_animated_gif)
@ -199,17 +210,6 @@ static void image_source_tick(void *data, float seconds)
}
context->last_time = frame_time;
context->update_time_elapsed += seconds;
if (context->update_time_elapsed >= 1.0f) {
time_t t = get_modified_timestamp(context->file);
context->update_time_elapsed = 0.0f;
if (context->file_timestamp != t) {
image_source_load(context);
}
}
}