Improve properties API

Improve the properties API so that it can actually respond somewhat to
user input.  Maybe later this might be further improved or replaced with
something script-based.

When creating a property, you can now add a callback to that property
that notifies when the property has been changed in the user interface.
Return true if you want the properties to be refreshed, or false if not.
Though now that I think about it I doubt there would ever be a case
where you would have this callback and *not* refresh the properties.

Regardless, this allows functions to change the values of properties or
settings, or enable/disable/hide other property controls from view
dynamically.
This commit is contained in:
jp9000
2014-04-04 00:30:37 -07:00
parent baa57d4c39
commit 1bca7e0a3e
18 changed files with 466 additions and 174 deletions

View File

@@ -383,7 +383,7 @@ static void rtmp_stream_data(void *data, struct encoder_packet *packet)
static obs_properties_t rtmp_stream_properties(const char *locale)
{
obs_properties_t props = obs_properties_create();
obs_properties_t props = obs_properties_create(locale);
/* TODO: locale */
obs_properties_add_text(props, "path", "Stream URL", OBS_TEXT_DEFAULT);
@@ -392,19 +392,18 @@ static obs_properties_t rtmp_stream_properties(const char *locale)
OBS_TEXT_DEFAULT);
obs_properties_add_text(props, "password", "Password",
OBS_TEXT_PASSWORD);
UNUSED_PARAMETER(locale);
return props;
}
struct obs_output_info rtmp_output_info = {
.id = "rtmp_output",
.flags = OBS_OUTPUT_AV | OBS_OUTPUT_ENCODED | OBS_OUTPUT_SERVICE,
.getname = rtmp_stream_getname,
.create = rtmp_stream_create,
.destroy = rtmp_stream_destroy,
.start = rtmp_stream_start,
.stop = rtmp_stream_stop,
.encoded_data = rtmp_stream_data,
.id = "rtmp_output",
.flags = OBS_OUTPUT_AV |
OBS_OUTPUT_ENCODED,
.getname = rtmp_stream_getname,
.create = rtmp_stream_create,
.destroy = rtmp_stream_destroy,
.start = rtmp_stream_start,
.stop = rtmp_stream_stop,
.encoded_packet = rtmp_stream_data,
.properties = rtmp_stream_properties
};