From 61308b44f001a024e6d0a86133ff5adf44a9905a Mon Sep 17 00:00:00 2001 From: gxalpha Date: Wed, 28 Aug 2024 02:23:36 +0200 Subject: [PATCH] libobs: Deprecate obs_get_transition_by_[name|uuid] obs_get_transition_by_name is very problematic because transitions are always private and their names aren't unique. This means that the method iterates over all private sources and then takes the first that both is a transition and matches the name we're looking for. However, this could be from anywhere - it could be a frontend transition, but also a source transition, quick transition, or even one from third-party plugins. This is always never what is intended. As such, this method (which should never have been added in the first place) needs to go. In its place, obs_frontend_get_transitions returns a list of all frontend transitions (which is usually what people are looking for), and alternatively obs_get_source_by_uuid also provides access to private sources. While we're at it, obs_get_transition_by_uuid is basically a wrapper for obs_get_source_by_uuid and not really necessary. UUID's are unique and a source doesn't suddenly change its type, so if you have a transition's UUID you can be pretty sure that when you do obs_get_source_by_uuid, it will still be a transition. --- docs/sphinx/reference-core.rst | 6 ++++++ libobs/obs.h | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/reference-core.rst b/docs/sphinx/reference-core.rst index d6be06d6d416ea..6f0109bf436957 100644 --- a/docs/sphinx/reference-core.rst +++ b/docs/sphinx/reference-core.rst @@ -351,6 +351,9 @@ Libobs Objects Increments the source reference counter, use :c:func:`obs_source_release()` to release it when complete. + .. deprecated:: 31.0 + Use :c:func:`obs_frontend_get_transitions` from the Frontend API or :c:func:`obs_get_source_by_uuid` instead. + --------------------- .. function:: obs_source_t *obs_get_transition_by_uuid(const char *uuid) @@ -362,6 +365,9 @@ Libobs Objects .. versionadded:: 29.1 + .. deprecated:: 31.0 + Use :c:func:`obs_get_source_by_uuid` instead. + --------------------- .. function:: obs_scene_t *obs_get_scene_by_name(const char *name) diff --git a/libobs/obs.h b/libobs/obs.h index 095bccc5ef98e7..a70bb876e9a071 100644 --- a/libobs/obs.h +++ b/libobs/obs.h @@ -699,10 +699,10 @@ EXPORT obs_source_t *obs_get_source_by_name(const char *name); EXPORT obs_source_t *obs_get_source_by_uuid(const char *uuid); /** Get a transition source by its name. */ -EXPORT obs_source_t *obs_get_transition_by_name(const char *name); +OBS_DEPRECATED EXPORT obs_source_t *obs_get_transition_by_name(const char *name); /** Get a transition source by its UUID. */ -EXPORT obs_source_t *obs_get_transition_by_uuid(const char *uuid); +OBS_DEPRECATED EXPORT obs_source_t *obs_get_transition_by_uuid(const char *uuid); /** Gets an output by its name. */ EXPORT obs_output_t *obs_get_output_by_name(const char *name);