* gst_encoding_profile_get_preset:
* @profile: a #GstEncodingProfile
*
- * Returns: the name of the #GstElement that implements #GstPreset to
- * be used in the profile.
+ * Returns: the name of the #GstPreset to be used in the profile.
+ * This is the name that has been set when saving the preset.
*/
const gchar *
gst_encoding_profile_get_preset (GstEncodingProfile * profile)
* gst_encoding_profile_get_preset_name:
* @profile: a #GstEncodingProfile
*
- * Returns: the name of the #GstPreset to be used in the profile.
- * This is the name that has been set when saving the preset.
+ * Returns: the name of the #GstPreset factory to be used in the profile.
*/
const gchar *
gst_encoding_profile_get_preset_name (GstEncodingProfile * profile)
*
* Sets the name of the #GstElement that implements the #GstPreset interface
* to use for the profile.
+ * This is the name that has been set when saving the preset.
*/
void
gst_encoding_profile_set_preset (GstEncodingProfile * profile,
* @profile: a #GstEncodingProfile
* @preset_name: The name of the preset to use in this @profile.
*
- * Sets the name of the #GstPreset to be used in the profile.
- * This is the name that has been set when saving the preset.
+ * Sets the name of the #GstPreset's factory to be used in the profile.
*/
void
gst_encoding_profile_set_preset_name (GstEncodingProfile * profile,
" preset name: %s)", GST_OBJECT_NAME (factory), preset, preset_name);
res = gst_element_factory_create (factory, name);
- if (preset) {
- if (g_strcmp0 (gst_object_get_name (GST_OBJECT (factory)), preset) == 0) {
- if (preset_name) {
- if (!gst_preset_load_preset (GST_PRESET (res), preset_name)) {
- GST_WARNING ("Couldn't set preset [%s] on element [%s]",
- preset, GST_OBJECT_NAME (factory));
- gst_object_unref (res);
- res = NULL;
- }
- } else {
- GST_DEBUG ("Using a preset with no preset name, making use of the"
- " proper element without setting any property");
+
+ if (preset && GST_IS_PRESET (res)) {
+ if (preset_name == NULL ||
+ g_strcmp0 (GST_OBJECT_NAME (factory), preset_name) == 0) {
+
+ if (!gst_preset_load_preset (GST_PRESET (res), preset)) {
+ GST_WARNING ("Couldn't set preset [%s] on element [%s]",
+ preset, GST_OBJECT_NAME (factory));
+ gst_object_unref (res);
+ res = NULL;
}
} else {
- gst_object_unref (res);
- res = NULL;
+ GST_DEBUG ("Using a preset with no preset name, making use of the"
+ " proper element without setting any property");
}
+ } else if (preset_name && g_strcmp0 (GST_OBJECT_NAME (factory), preset_name)) {
+ gst_object_unref (res);
+ res = NULL;
}
+ /* Else we keep it */
return res;
}
/* Give a name someone should never use outside of that test */
gst_preset_save_preset (oggmuxpreset, "test_encodebin_preset");
- gst_encoding_profile_set_preset (prof, "oggmux");
- gst_encoding_profile_set_preset_name (prof, "test_encodebin_preset");
+ gst_encoding_profile_set_preset (prof, "test_encodebin_preset");
+ gst_encoding_profile_set_preset_name (prof, "oggmux");
g_object_set (ebin, "profile", prof, NULL);