encoding-profile: Let the user decide what preset name to use

It was possible to decide only what #GstElement implementing #GstPreset
to use during the encoding, we can now let the user select a specific preset previously
saved using #gst_preset_save_preset specifying the name chosen when it was saved
in the gst_encoding_profile_set_preset_name.

Actually loading a preset with %NULL as a name would have always failed, so
in the current state of the API that feature is unusable

API:
  gst_encoding_profile_set_preset_name
  gst_encoding_profile_get_preset_name
This commit is contained in:
Thibault Saunier 2012-12-05 15:21:43 -03:00
parent 26d72a73f5
commit 6a7f688939
3 changed files with 43 additions and 4 deletions

View file

@ -1851,12 +1851,14 @@ gst_encoding_profile_get_name
gst_encoding_profile_get_description
gst_encoding_profile_get_format
gst_encoding_profile_get_preset
gst_encoding_profile_get_preset_name
gst_encoding_profile_get_presence
gst_encoding_profile_get_restriction
gst_encoding_profile_set_name
gst_encoding_profile_set_description
gst_encoding_profile_set_format
gst_encoding_profile_set_preset
gst_encoding_profile_set_preset_name
gst_encoding_profile_set_restriction
gst_encoding_profile_set_presence
gst_encoding_profile_is_equal

View file

@ -102,7 +102,7 @@
* gchar *category = (gchar *) tmpc->data;
*
* ... and we can list all targets within that category ...
*
*
* targets = gst_encoding_target_list_all (category);
*
* ... and show a list to our users ...
@ -138,6 +138,7 @@ struct _GstEncodingProfile
gchar *description;
GstCaps *format;
gchar *preset;
gchar *preset_name;
guint presence;
GstCaps *restriction;
};
@ -260,7 +261,8 @@ gst_encoding_profile_get_format (GstEncodingProfile * profile)
* gst_encoding_profile_get_preset:
* @profile: a #GstEncodingProfile
*
* Returns: the name of the #GstPreset to be used in the profile.
* Returns: the name of the #GstElement that implements #GstPreset to
* be used in the profile.
*/
const gchar *
gst_encoding_profile_get_preset (GstEncodingProfile * profile)
@ -268,6 +270,19 @@ gst_encoding_profile_get_preset (GstEncodingProfile * profile)
return profile->preset;
}
/**
* 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.
*/
const gchar *
gst_encoding_profile_get_preset_name (GstEncodingProfile * profile)
{
return profile->preset_name;
}
/**
* gst_encoding_profile_get_presence:
* @profile: a #GstEncodingProfile
@ -351,7 +366,8 @@ gst_encoding_profile_set_format (GstEncodingProfile * profile, GstCaps * format)
* @profile: a #GstEncodingProfile
* @preset: the element preset to use
*
* Sets the preset to use for the profile.
* Sets the name of the #GstElement that implements the #GstPreset interface
* to use for the profile.
*/
void
gst_encoding_profile_set_preset (GstEncodingProfile * profile,
@ -362,6 +378,23 @@ gst_encoding_profile_set_preset (GstEncodingProfile * profile,
profile->preset = g_strdup (preset);
}
/**
* gst_encoding_profile_get_preset_name:
* @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.
*/
void
gst_encoding_profile_set_preset_name (GstEncodingProfile * profile,
const gchar * preset_name)
{
if (profile->preset_name)
g_free (profile->preset_name);
profile->preset_name = g_strdup (preset_name);
}
/**
* gst_encoding_profile_set_presence:
* @profile: a #GstEncodingProfile
@ -651,7 +684,7 @@ gst_encoding_container_profile_contains_profile (GstEncodingContainerProfile *
* @profile: (transfer full): the #GstEncodingProfile to add.
*
* Add a #GstEncodingProfile to the list of profiles handled by @container.
*
*
* No copy of @profile will be made, if you wish to use it elsewhere after this
* method you should increment its reference count.
*
@ -697,6 +730,7 @@ common_creation (GType objtype, GstCaps * format, const gchar * preset,
if (restriction)
prof->restriction = gst_caps_ref (restriction);
prof->presence = presence;
prof->preset_name = NULL;
return prof;
}

View file

@ -126,11 +126,14 @@ GstCaps * gst_encoding_profile_get_format (GstEncodingProfile *pro
void gst_encoding_profile_set_format (GstEncodingProfile *profile,
GstCaps *format);
const gchar * gst_encoding_profile_get_preset (GstEncodingProfile *profile);
const gchar * gst_encoding_profile_get_preset_name (GstEncodingProfile *profile);
void gst_encoding_profile_set_preset (GstEncodingProfile *profile,
const gchar *preset);
guint gst_encoding_profile_get_presence (GstEncodingProfile *profile);
void gst_encoding_profile_set_presence (GstEncodingProfile *profile,
guint presence);
void gst_encoding_profile_set_preset_name (GstEncodingProfile * profile,
const gchar * preset_name);
GstCaps * gst_encoding_profile_get_restriction (GstEncodingProfile *profile);
void gst_encoding_profile_set_restriction (GstEncodingProfile *profile,
GstCaps *restriction);