gst_encoding_profile_set_description (profile, description);
gst_encoding_profile_set_preset_name (profile, preset_name);
}
-
- if (preset && preset_properties) {
- GstElement *element;
-
- if (!g_strcmp0 (type, "container")) {
- element = get_element_for_encoding_profile (profile,
- GST_ELEMENT_FACTORY_TYPE_MUXER);
- } else {
- element = get_element_for_encoding_profile (profile,
- GST_ELEMENT_FACTORY_TYPE_ENCODER);
- }
-
- if (G_UNLIKELY (!element || !GST_IS_PRESET (element))) {
- GST_WARNING_OBJECT (element, "Element is not a GstPreset");
- goto done;
- }
-
- /* If the preset doesn't exist on the system, create it */
- if (!gst_preset_load_preset (GST_PRESET (element), preset)) {
- gst_structure_foreach (preset_properties,
- (GstStructureForeachFunc) set_property_foreach, element);
-
- if (!gst_preset_save_preset (GST_PRESET (element), preset)) {
- GST_WARNING_OBJECT (element, "Could not save preset %s", preset);
- }
- }
-
- done:
- if (element)
- gst_object_unref (element);
+ if (preset_properties) {
+ gst_encoding_profile_set_element_properties (profile,
+ gst_structure_copy (preset_properties));
}
return profile;
{
gchar *tmpc;
GstCaps *tmpcaps;
+ GstStructure *properties;
const gchar *preset, *preset_name, *name, *description;
append_escaped (str,
preset = gst_encoding_profile_get_preset (sprof);
if (preset) {
- GstElement *encoder;
-
append_escaped (str, g_markup_printf_escaped ("preset='%s' ", preset),
depth);
+ }
- encoder = get_element_for_encoding_profile (sprof,
- GST_ELEMENT_FACTORY_TYPE_ENCODER);
- if (encoder) {
- if (GST_IS_PRESET (encoder) &&
- gst_preset_load_preset (GST_PRESET (encoder), preset)) {
-
- gchar *settings =
- _serialize_properties (G_OBJECT (encoder), NULL, NULL);
- append_escaped (str, g_markup_printf_escaped ("preset-properties='%s' ",
- settings), depth);
- g_free (settings);
- }
- gst_object_unref (encoder);
- }
+ properties = gst_encoding_profile_get_element_properties (sprof);
+ if (properties) {
+ gchar *props_str = gst_structure_to_string (properties);
+
+ append_escaped (str,
+ g_markup_printf_escaped ("preset-properties='%s' ", props_str), depth);
+ g_free (props_str);
+ gst_structure_free (properties);
}
preset_name = gst_encoding_profile_get_preset_name (sprof);
GESProject * project, guint depth)
{
GstCaps *profformat;
+ GstStructure *properties;
const gchar *profname, *profdesc, *profpreset, *proftype, *profpresetname;
const GList *tmp;
profname, profdesc, proftype), depth);
if (profpreset) {
- GstElement *element;
-
append_escaped (str, g_markup_printf_escaped ("preset='%s' ",
profpreset), depth);
+ }
- if (GST_IS_ENCODING_CONTAINER_PROFILE (prof)) {
- element = get_element_for_encoding_profile (prof,
- GST_ELEMENT_FACTORY_TYPE_MUXER);
- } else {
- element = get_element_for_encoding_profile (prof,
- GST_ELEMENT_FACTORY_TYPE_ENCODER);
- }
-
- if (element) {
- if (GST_IS_PRESET (element) &&
- gst_preset_load_preset (GST_PRESET (element), profpreset)) {
- gchar *settings =
- _serialize_properties (G_OBJECT (element), NULL, NULL);
- append_escaped (str,
- g_markup_printf_escaped ("preset-properties='%s' ", settings),
- depth);
- g_free (settings);
- }
- gst_object_unref (element);
- }
+ properties = gst_encoding_profile_get_element_properties (prof);
+ if (properties) {
+ gchar *props_str = gst_structure_to_string (properties);
+ append_escaped (str,
+ g_markup_printf_escaped ("preset-properties='%s' ", props_str),
+ depth);
+ g_free (props_str);
+ gst_structure_free (properties);
}
if (profpresetname)