From 8558a0327210c1f861af20aa089db5a56126d23c Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Thu, 7 May 2015 10:52:18 +0200 Subject: [PATCH] xml-formatter: De/serialize whether encoding profiles are enabled or not Reviewers: Mathieu_Du Differential Revision: http://phabricator.freedesktop.org/D151 --- ges/ges-base-xml-formatter.c | 10 ++++++---- ges/ges-internal.h | 1 + ges/ges-xml-formatter.c | 22 ++++++++++++++++------ 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/ges/ges-base-xml-formatter.c b/ges/ges-base-xml-formatter.c index 6599e87dd9..ac80c317c8 100644 --- a/ges/ges-base-xml-formatter.c +++ b/ges/ges-base-xml-formatter.c @@ -770,7 +770,7 @@ _create_profile (GESBaseXmlFormatter * self, const gchar * type, const gchar * parent, const gchar * name, const gchar * description, GstCaps * format, const gchar * preset, const gchar * preset_name, gint id, guint presence, GstCaps * restriction, - guint pass, gboolean variableframerate) + guint pass, gboolean variableframerate, gboolean enabled) { GstEncodingProfile *profile = NULL; @@ -798,6 +798,7 @@ _create_profile (GESBaseXmlFormatter * self, } gst_encoding_profile_set_name (profile, name); + gst_encoding_profile_set_enabled (profile, enabled); gst_encoding_profile_set_description (profile, description); gst_encoding_profile_set_preset_name (profile, preset_name); @@ -1210,7 +1211,7 @@ ges_base_xml_formatter_add_encoding_profile (GESBaseXmlFormatter * self, const gchar * description, GstCaps * format, const gchar * preset, const gchar * preset_name, guint id, guint presence, GstCaps * restriction, guint pass, gboolean variableframerate, GstStructure * properties, - GError ** error) + gboolean enabled, GError ** error) { const GList *tmp; GstEncodingProfile *profile; @@ -1223,7 +1224,8 @@ ges_base_xml_formatter_add_encoding_profile (GESBaseXmlFormatter * self, if (parent == NULL) { profile = _create_profile (self, type, parent, name, description, format, preset, - preset_name, id, presence, restriction, pass, variableframerate); + preset_name, id, presence, restriction, pass, variableframerate, + enabled); ges_project_add_encoding_profile (GES_FORMATTER (self)->project, profile); gst_object_unref (profile); @@ -1256,7 +1258,7 @@ ges_base_xml_formatter_add_encoding_profile (GESBaseXmlFormatter * self, profile = _create_profile (self, type, parent, name, description, format, preset, - preset_name, id, presence, restriction, pass, variableframerate); + preset_name, id, presence, restriction, pass, variableframerate, enabled); if (profile == NULL) goto done; diff --git a/ges/ges-internal.h b/ges/ges-internal.h index 5c2b6bb4c1..159c2b7bc7 100644 --- a/ges/ges-internal.h +++ b/ges/ges-internal.h @@ -236,6 +236,7 @@ G_GNUC_INTERNAL void ges_base_xml_formatter_add_encoding_profile(GESBaseXmlForma guint pass, gboolean variableframerate, GstStructure * properties, + gboolean enabled, GError ** error); G_GNUC_INTERNAL void ges_base_xml_formatter_add_track_element (GESBaseXmlFormatter *self, GType effect_type, diff --git a/ges/ges-xml-formatter.c b/ges/ges-xml-formatter.c index fe7ac49f2a..89d51738a5 100644 --- a/ges/ges-xml-formatter.c +++ b/ges/ges-xml-formatter.c @@ -157,7 +157,7 @@ _parse_encoding_profile (GMarkupParseContext * context, ges_base_xml_formatter_add_encoding_profile (GES_BASE_XML_FORMATTER (self), type, NULL, name, description, capsformat, preset, preset_name, 0, 0, - NULL, 0, FALSE, NULL, error); + NULL, 0, FALSE, NULL, TRUE, error); } static inline void @@ -165,12 +165,13 @@ _parse_stream_profile (GMarkupParseContext * context, const gchar * element_name, const gchar ** attribute_names, const gchar ** attribute_values, GESXmlFormatter * self, GError ** error) { - gboolean variableframerate = FALSE; + gboolean variableframerate = FALSE, enabled = TRUE; guint id = 0, presence = 0, pass = 0; GstCaps *format_caps = NULL, *restriction_caps = NULL; const gchar *parent, *strid, *type, *strpresence, *format = NULL, *name = NULL, *description = NULL, *preset, *preset_name = - NULL, *restriction = NULL, *strpass = NULL, *strvariableframerate = NULL; + NULL, *restriction = NULL, *strpass = NULL, *strvariableframerate = NULL, + *strenabled = NULL; /* FIXME Looks like there is a bug in that function, if we put the parent * at the beginning it set %NULL and not the real value... :/ */ @@ -187,6 +188,7 @@ _parse_stream_profile (GMarkupParseContext * context, COLLECT_STR_OPT, "restriction", &restriction, COLLECT_STR_OPT, "pass", &strpass, COLLECT_STR_OPT, "variableframerate", &strvariableframerate, + COLLECT_STR_OPT, "enabled", &strenabled, G_MARKUP_COLLECT_STRING, "parent", &parent, G_MARKUP_COLLECT_INVALID)) return; @@ -213,6 +215,12 @@ _parse_stream_profile (GMarkupParseContext * context, goto convertion_failed; } + if (strenabled) { + enabled = g_ascii_strtoll (strenabled, NULL, 10); + if (errno) + goto convertion_failed; + } + if (format) format_caps = gst_caps_from_string (format); @@ -221,7 +229,8 @@ _parse_stream_profile (GMarkupParseContext * context, ges_base_xml_formatter_add_encoding_profile (GES_BASE_XML_FORMATTER (self), type, parent, name, description, format_caps, preset, preset_name, id, - presence, restriction_caps, pass, variableframerate, NULL, error); + presence, restriction_caps, pass, variableframerate, NULL, enabled, + error); return; @@ -1273,9 +1282,10 @@ _save_stream_profiles (GString * str, GstEncodingProfile * sprof, append_escaped (str, g_markup_printf_escaped ("