xml-formatter: De/serialize whether encoding profiles are enabled or not

Reviewers: Mathieu_Du

Differential Revision: http://phabricator.freedesktop.org/D151
This commit is contained in:
Thibault Saunier 2015-05-07 10:52:18 +02:00
parent bb40668ff9
commit 8558a03272
3 changed files with 23 additions and 10 deletions

View file

@ -770,7 +770,7 @@ _create_profile (GESBaseXmlFormatter * self,
const gchar * type, const gchar * parent, const gchar * name, const gchar * type, const gchar * parent, const gchar * name,
const gchar * description, GstCaps * format, const gchar * preset, const gchar * description, GstCaps * format, const gchar * preset,
const gchar * preset_name, gint id, guint presence, GstCaps * restriction, const gchar * preset_name, gint id, guint presence, GstCaps * restriction,
guint pass, gboolean variableframerate) guint pass, gboolean variableframerate, gboolean enabled)
{ {
GstEncodingProfile *profile = NULL; GstEncodingProfile *profile = NULL;
@ -798,6 +798,7 @@ _create_profile (GESBaseXmlFormatter * self,
} }
gst_encoding_profile_set_name (profile, name); 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_description (profile, description);
gst_encoding_profile_set_preset_name (profile, preset_name); 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 * description, GstCaps * format, const gchar * preset,
const gchar * preset_name, guint id, guint presence, GstCaps * restriction, const gchar * preset_name, guint id, guint presence, GstCaps * restriction,
guint pass, gboolean variableframerate, GstStructure * properties, guint pass, gboolean variableframerate, GstStructure * properties,
GError ** error) gboolean enabled, GError ** error)
{ {
const GList *tmp; const GList *tmp;
GstEncodingProfile *profile; GstEncodingProfile *profile;
@ -1223,7 +1224,8 @@ ges_base_xml_formatter_add_encoding_profile (GESBaseXmlFormatter * self,
if (parent == NULL) { if (parent == NULL) {
profile = profile =
_create_profile (self, type, parent, name, description, format, preset, _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); ges_project_add_encoding_profile (GES_FORMATTER (self)->project, profile);
gst_object_unref (profile); gst_object_unref (profile);
@ -1256,7 +1258,7 @@ ges_base_xml_formatter_add_encoding_profile (GESBaseXmlFormatter * self,
profile = profile =
_create_profile (self, type, parent, name, description, format, preset, _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) if (profile == NULL)
goto done; goto done;

View file

@ -236,6 +236,7 @@ G_GNUC_INTERNAL void ges_base_xml_formatter_add_encoding_profile(GESBaseXmlForma
guint pass, guint pass,
gboolean variableframerate, gboolean variableframerate,
GstStructure * properties, GstStructure * properties,
gboolean enabled,
GError ** error); GError ** error);
G_GNUC_INTERNAL void ges_base_xml_formatter_add_track_element (GESBaseXmlFormatter *self, G_GNUC_INTERNAL void ges_base_xml_formatter_add_track_element (GESBaseXmlFormatter *self,
GType effect_type, GType effect_type,

View file

@ -157,7 +157,7 @@ _parse_encoding_profile (GMarkupParseContext * context,
ges_base_xml_formatter_add_encoding_profile (GES_BASE_XML_FORMATTER (self), ges_base_xml_formatter_add_encoding_profile (GES_BASE_XML_FORMATTER (self),
type, NULL, name, description, capsformat, preset, preset_name, 0, 0, type, NULL, name, description, capsformat, preset, preset_name, 0, 0,
NULL, 0, FALSE, NULL, error); NULL, 0, FALSE, NULL, TRUE, error);
} }
static inline void static inline void
@ -165,12 +165,13 @@ _parse_stream_profile (GMarkupParseContext * context,
const gchar * element_name, const gchar ** attribute_names, const gchar * element_name, const gchar ** attribute_names,
const gchar ** attribute_values, GESXmlFormatter * self, GError ** error) const gchar ** attribute_values, GESXmlFormatter * self, GError ** error)
{ {
gboolean variableframerate = FALSE; gboolean variableframerate = FALSE, enabled = TRUE;
guint id = 0, presence = 0, pass = 0; guint id = 0, presence = 0, pass = 0;
GstCaps *format_caps = NULL, *restriction_caps = NULL; GstCaps *format_caps = NULL, *restriction_caps = NULL;
const gchar *parent, *strid, *type, *strpresence, *format = NULL, const gchar *parent, *strid, *type, *strpresence, *format = NULL,
*name = NULL, *description = NULL, *preset, *preset_name = *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 /* 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... :/ */ * 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, "restriction", &restriction,
COLLECT_STR_OPT, "pass", &strpass, COLLECT_STR_OPT, "pass", &strpass,
COLLECT_STR_OPT, "variableframerate", &strvariableframerate, COLLECT_STR_OPT, "variableframerate", &strvariableframerate,
COLLECT_STR_OPT, "enabled", &strenabled,
G_MARKUP_COLLECT_STRING, "parent", &parent, G_MARKUP_COLLECT_INVALID)) G_MARKUP_COLLECT_STRING, "parent", &parent, G_MARKUP_COLLECT_INVALID))
return; return;
@ -213,6 +215,12 @@ _parse_stream_profile (GMarkupParseContext * context,
goto convertion_failed; goto convertion_failed;
} }
if (strenabled) {
enabled = g_ascii_strtoll (strenabled, NULL, 10);
if (errno)
goto convertion_failed;
}
if (format) if (format)
format_caps = gst_caps_from_string (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), ges_base_xml_formatter_add_encoding_profile (GES_BASE_XML_FORMATTER (self),
type, parent, name, description, format_caps, preset, preset_name, id, 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; return;
@ -1273,9 +1282,10 @@ _save_stream_profiles (GString * str, GstEncodingProfile * sprof,
append_escaped (str, append_escaped (str,
g_markup_printf_escaped g_markup_printf_escaped
(" <stream-profile parent='%s' id='%d' type='%s' " (" <stream-profile parent='%s' id='%d' type='%s' "
"presence='%d' ", profilename, id, "presence='%d' enabled='%d' ", profilename, id,
gst_encoding_profile_get_type_nick (sprof), gst_encoding_profile_get_type_nick (sprof),
gst_encoding_profile_get_presence (sprof))); gst_encoding_profile_get_presence (sprof),
gst_encoding_profile_is_enabled (sprof)));
tmpcaps = gst_encoding_profile_get_format (sprof); tmpcaps = gst_encoding_profile_get_format (sprof);
if (tmpcaps) { if (tmpcaps) {