OBS Studio - Free and open source software for live streaming and screen recording
libobs: Deprecate v1 of obs_properties_add_button
With v1 of this function, it's unclear where exactly the data pointer comes from or what it is. In fact, this is not determined by libobs, but the consumer. libobs assumes that the caller of obs_property_button_clicked passes an obs_context_data pointer, and then passes the data pointer of that obs_context_data as the data pointer to the callback. In OBS Studio, this is always the private data of the associated object. However, this assumes that there even is such an object (source/encoder/ etc), even though properties are meant to be free-standing. This is not just philosophical, because with obs_get_source_properties you can actually get an obs_properties_t that isn't associated with any specific source, at which point you have no idea what the data pointer will be. For this reason, obs_properties_add_button v1 needs to go. obs_properties_add_button2 can be used as a drop-in replacement. With v2, it's well-defined that the pointer you're passing as priv is the pointer you get back in the callback as data. If you don't care about it, simply pass NULL/nullptr. Once v1 is removed in the future, obs_property_button_clicked should be replaced with a variant that doesn't take a second argument, as that argument will no longer be used anywhere.
S
Sebastian Beckmann committed
dba426630a2152fe8d4f0dc331447b14b7c7a963
Parent: cb75098
Committed by Ryan Foster <ryan@obsproject.com>
on 5/5/2026, 7:45:04 PM