If an image source isn't visible there is no point polling for changes
during the time it's hidden as no one will see them. Should the image
be on unreachable media such as an unavailable network share, this
check would cause the graphics thread to periodically stall trying to
detect changes of a non-visible image source.
If the image is modified while it's hidden, the updated file will now
be loaded as soon as the source is made visible - the update timer
intentionally ticks up while hidden.
Partially fixes some of the behavior described in
https://github.com/obsproject/obs-studio/issues/3007, a full fix
likely requires significant changes to support OS-specific file change
notification APIs.
Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed. Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
Defers the update of the slideshow source until the user has pressed OK
or exited the properties dialog. This ensures images aren't reloaded
every time the user adjusts a setting.
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.
The blend state does not need to (and should not) be changed. This
fixes an issue where if filters are applied to an image source, the
image source will paint incorrectly.
This commit fixes the issue outlined in the following thread:
https://obsproject.com/forum/threads/50045/
When the image source file was replaced by an outside process, it would
only reload when the file's new timestamp was newer than the file's
previous timestamp. This fixes that behavior. Now an image source
will reload any time the file's new timestamp is different than its
previous timestamp.
(Note: This commit also modified text-freetype2)
Prevents issues from being able to update files that may not be using
the current system encoding on windows.
(Note: This commit also modified text-freetype2)
The implementation of get_modified_timestamp() did not check the return
value of stat(), so in case the check fails the values in the stats
structure can be any garbage on the stack and the value of
stats.st_mtime can change on every call. This can trigger a reload of
the image every second, even if the file was not actually modified.
Closesjp9000/obs-studio#520
Images continually loading/unloading every time transitioning occurs
adds a lot of unnecessary transition lag. The user can always change
this value manually and/or use scene collections, so change the default
setting to make it not unload/reload by default feels a bit more safe.
Polls for file changes like the text plugin does. This is an interim
solution; both the text plugin and image source should use a file
monitoring API, preferably implemented through libobs.
Closesjp9000/obs-studio#482
API changed from:
obs_source_info::get_name(void)
obs_output_info::get_name(void)
obs_encoder_info::get_name(void)
obs_service_info::get_name(void)
API changed to:
obs_source_info::get_name(void *type_data)
obs_output_info::get_name(void *type_data)
obs_encoder_info::get_name(void *type_data)
obs_service_info::get_name(void *type_data)
This allows the type data to be used when getting the name of the
object (useful for plugin wrappers primarily).
NOTE: Though a parameter was added, this is backward-compatible with
older plugins due to calling convention. The new parameter will simply
be ignored by older plugins, and the stack (if used) will be cleaned up
by the caller.
If this option is on, the image will unload when the image isn't
displayed anywhere, and then reload it when it's displayed again to
reduce the amount of memory images take up on VRAM at any given time.
If this option is off, then it's always loaded in VRAM regardless of
whether it's displayed or not.
Closes Pull Request #380
(edited by Jim)
Typedef pointers are unsafe. If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data. I admit this was a fundamental mistake that must
be corrected.
All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.
This does not break ABI though, which is pretty nice.
API Removed:
- graphics_t obs_graphics();
Replaced With:
- void obs_enter_graphics();
- void obs_leave_graphics();
Description:
obs_graphics() was somewhat of a pointless function. The only time
that it was ever necessary was to pass it as a parameter to
gs_entercontext() followed by a subsequent gs_leavecontext() call after
that. So, I felt that it made a bit more sense just to implement
obs_enter_graphics() and obs_leave_graphics() functions to do the exact
same thing without having to repeat that code. There's really no need
to ever "hold" the graphics pointer, though I suppose that could change
in the future so having a similar function come back isn't out of the
question.
Still, this at least reduces the amount of unnecessary repeated code for
the time being.
This functionality can now be handled automatically because locale can
now be freed seaparately from obs_module_unload with
obs_module_free_locale, which is called automatically when the module is
being freed.