summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <thibault.saunier@collabora.com>2012-12-05 15:21:43 -0300
committerThibault Saunier <thibault.saunier@collabora.com>2012-12-05 17:36:21 -0300
commit6a7f6889397206d23f5af8ba689045c727e94b39 (patch)
treed101c98f129fdabc8b12ab98cb267e83787130a9
parent26d72a73f515a4a658208a3a8db41f3d07f29633 (diff)
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
-rw-r--r--docs/libs/gst-plugins-base-libs-sections.txt2
-rw-r--r--gst-libs/gst/pbutils/encoding-profile.c42
-rw-r--r--gst-libs/gst/pbutils/encoding-profile.h3
3 files changed, 43 insertions, 4 deletions
diff --git a/docs/libs/gst-plugins-base-libs-sections.txt b/docs/libs/gst-plugins-base-libs-sections.txt
index c2d46328e..e9065db38 100644
--- a/docs/libs/gst-plugins-base-libs-sections.txt
+++ b/docs/libs/gst-plugins-base-libs-sections.txt
@@ -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
diff --git a/gst-libs/gst/pbutils/encoding-profile.c b/gst-libs/gst/pbutils/encoding-profile.c
index e9de7916c..b2221df4b 100644
--- a/gst-libs/gst/pbutils/encoding-profile.c
+++ b/gst-libs/gst/pbutils/encoding-profile.c
@@ -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)
@@ -269,6 +271,19 @@ 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.
+ */
+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,
@@ -363,6 +379,23 @@ gst_encoding_profile_set_preset (GstEncodingProfile * profile,
}
/**
+ * 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
* @presence: the number of time the profile can be used
@@ -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;
}
diff --git a/gst-libs/gst/pbutils/encoding-profile.h b/gst-libs/gst/pbutils/encoding-profile.h
index 56addc81e..22342f01e 100644
--- a/gst-libs/gst/pbutils/encoding-profile.h
+++ b/gst-libs/gst/pbutils/encoding-profile.h
@@ -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);