Reverts much of PR #11906 in favor of a different way to detect whether
or not the output capabilities must be reset.
The new approach will contain false positives for which the workaround
is not needed but it won't have negative side effects.
To support upgrades from older versions move_to_xdg was reintroduced for
FreeBSD. This has now been available since release 31.0, so users have
likely upgraded across this version and it is no longer needed.
This reverts commit 39b91d8875.
When a new device is selected, a best-possible frame rate is chosen
for the initial configuration of the device. This has to be set in the
source settings, as those are the "source of truth" for the properties
and the device configuration.
The object has to be created explicitly first before setting the
frame rate value. The source then has to be updated explicitly as well
to ensure that the change will be picked up by the next iteration
of the render thread to "tick" the source and thus make it configure
a capture session with the fallback framerate set.
QT_TO_UTF8 returns a const char * that, in general, shouldn't be stored.
This is because QT_TO_UTF8(str) expands to str.toUtf8().constData():
toUtf8() returns a QByteArray, and constData() the pointer to its data
which is only valid until the QByteArray goes out of scope, which is
immediately after the call.
The original code that is changed here only works because in all of the
situations, the object that is stored to is actually a std::string that
gets constructed implicitly, so the constData() pointer is valid long
enough for the std::string constructor to copy the data.
The issue is that any "... = QT_TO_UTF8" code *looks* unsafe, and may
lead new or unfamiliar contributors to assume that they can also use it,
only to do "const char *... = QT_TO_UTF8(...)" which is dangerous.
Additionally, it introduces an unnecessary round of implicit conversions
and copies when QString.toStdString() already exists and copies into the
string buffer directly.
The strings (broadcast.id, stream.[id|name]) are stored as QString,
converted to const char * by QT_TO_UTF8 in OBSYoutubeActions, implicitly
converted back to QString because the OBSYoutubeActions::ok takes
const QString &, only to be converted back to const char * by QT_TO_UTF8
in OBSBasic_YouTube and immediately implicitly turned into
const std::strings, only to have .c_str() called on those to get their
const char * again which is needed for libobs. This is insane.
Let's just pass const std::string & and be happy.
RemoteTextThread and WhatsNewInfoThread explicitly convert their results
into QString, but many consumers need std::string, converting them
back. Let's just use std::string directly and only convert to QString
where actually needed.
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.
v1 of obs_properties_add_button will be deprecated soon.
Also fixes UNUSED_PARAMETER calls in the callbacks for parameters that
are not actually unused, and moves the other ones to the top (as in most
of the rest of the project).
While it is canonical to use the backspace key as an alternative to the
dedicated "delete" key (which is omitted on many smaller-sized Apple
keyboards), the delete key is still available on full-size Apple
keyboards and obviously third-party keyboards.
This change adds the delete key as an alternative to the backspace key
to allow removal of scene items from the scene list in the UI.
When an Audio Output Capture source (AOC) like 'Desktop Audio' has
monitoring_type == OBS_MONITORING_TYPE_MONITOR_ONLY, deduplication
should not be triggered. this is an edge case which may not cover a
reasonable use case, but for the sake of completeness, we deal with it.
Signed-off-by: pkv <pkv@obsproject.com>