mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
encodebin: Add a way to enable/disabled a GstEncodingProfile
Summary: So that the user can easily use the same encoding profile to render with/without audio/video stream. API: gst_encoding_profile_is_disabled gst_encoding_pofile_set_enabled https://bugzilla.gnome.org/show_bug.cgi?id=749056
This commit is contained in:
parent
22302db7fc
commit
dcfb8a83a5
4 changed files with 49 additions and 2 deletions
|
@ -2185,12 +2185,14 @@ gst_encoding_profile_get_restriction
|
|||
gst_encoding_profile_get_file_extension
|
||||
gst_encoding_profile_set_name
|
||||
gst_encoding_profile_set_description
|
||||
gst_encoding_profile_set_enabled
|
||||
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
|
||||
gst_encoding_profile_is_enabled
|
||||
gst_encoding_profile_get_input_caps
|
||||
gst_encoding_profile_get_type_nick
|
||||
<SUBSECTION container>
|
||||
|
|
|
@ -189,6 +189,7 @@ struct _GstEncodingProfile
|
|||
guint presence;
|
||||
GstCaps *restriction;
|
||||
gboolean allow_dynamic_output;
|
||||
gboolean enabled;
|
||||
};
|
||||
|
||||
struct _GstEncodingProfileClass
|
||||
|
@ -400,6 +401,20 @@ gst_encoding_profile_get_presence (GstEncodingProfile * profile)
|
|||
return profile->presence;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_encoding_profile_get_enabled:
|
||||
* @profile: a #GstEncodingProfile
|
||||
*
|
||||
* Returns: Whther @profile is enabled or not
|
||||
*/
|
||||
gboolean
|
||||
gst_encoding_profile_is_enabled (GstEncodingProfile * profile)
|
||||
{
|
||||
g_return_val_if_fail (GST_IS_ENCODING_PROFILE (profile), FALSE);
|
||||
|
||||
return profile->enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_encoding_profile_get_restriction:
|
||||
* @profile: a #GstEncodingProfile
|
||||
|
@ -542,6 +557,22 @@ gst_encoding_profile_set_presence (GstEncodingProfile * profile, guint presence)
|
|||
profile->presence = presence;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_encoding_profile_set_enabled:
|
||||
* @profile: a #GstEncodingProfile
|
||||
* @enabled: %FALSE to disable #profile, %TRUE to enable it
|
||||
*
|
||||
* Set whether the profile should be used or not.
|
||||
*/
|
||||
void
|
||||
gst_encoding_profile_set_enabled (GstEncodingProfile * profile,
|
||||
gboolean enabled)
|
||||
{
|
||||
g_return_if_fail (GST_IS_ENCODING_PROFILE (profile));
|
||||
|
||||
profile->enabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_encoding_profile_set_restriction:
|
||||
* @profile: a #GstEncodingProfile
|
||||
|
@ -868,6 +899,7 @@ common_creation (GType objtype, GstCaps * format, const gchar * preset,
|
|||
prof->presence = presence;
|
||||
prof->preset_name = NULL;
|
||||
prof->allow_dynamic_output = TRUE;
|
||||
prof->enabled = TRUE;
|
||||
|
||||
return prof;
|
||||
}
|
||||
|
|
|
@ -152,6 +152,9 @@ GstEncodingProfile * gst_encoding_profile_find (const gchar *targetname,
|
|||
const gchar *profilename,
|
||||
const gchar *category);
|
||||
|
||||
gboolean gst_encoding_profile_is_enabled (GstEncodingProfile *profile);
|
||||
void gst_encoding_profile_set_enabled (GstEncodingProfile *profile,
|
||||
gboolean enabled);
|
||||
/* GstEncodingContainerProfile API */
|
||||
gboolean gst_encoding_container_profile_add_profile (GstEncodingContainerProfile *container,
|
||||
GstEncodingProfile *profile);
|
||||
|
|
|
@ -659,8 +659,15 @@ next_unused_stream_profile (GstEncodeBin * ebin, GType ptype,
|
|||
|
||||
if (profilename && !strcmp (name, profilename)) {
|
||||
guint presence = gst_encoding_profile_get_presence (sprof);
|
||||
|
||||
GST_DEBUG ("Found profile matching the requested name");
|
||||
|
||||
if (!gst_encoding_profile_is_enabled (sprof)) {
|
||||
GST_INFO_OBJECT (ebin, "%p is disabled, not using it", sprof);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (presence == 0
|
||||
|| presence > stream_profile_used_count (ebin, sprof))
|
||||
return sprof;
|
||||
|
@ -686,7 +693,9 @@ next_unused_stream_profile (GstEncodeBin * ebin, GType ptype,
|
|||
if (G_TYPE_FROM_INSTANCE (sprof) == ptype) {
|
||||
guint presence = gst_encoding_profile_get_presence (sprof);
|
||||
GST_DEBUG ("Found a stream profile with the same type");
|
||||
if (presence == 0
|
||||
if (!gst_encoding_profile_is_enabled (sprof)) {
|
||||
GST_INFO_OBJECT (ebin, "%p is disabled, not using it", sprof);
|
||||
} else if (presence == 0
|
||||
|| (presence > stream_profile_used_count (ebin, sprof)))
|
||||
return sprof;
|
||||
} else if (caps && ptype == G_TYPE_NONE) {
|
||||
|
@ -1873,7 +1882,8 @@ create_elements_and_pads (GstEncodeBin * ebin)
|
|||
GST_DEBUG ("Trying stream profile with presence %d",
|
||||
gst_encoding_profile_get_presence (sprof));
|
||||
|
||||
if (gst_encoding_profile_get_presence (sprof) != 0) {
|
||||
if (gst_encoding_profile_get_presence (sprof) != 0 &&
|
||||
gst_encoding_profile_is_enabled (sprof)) {
|
||||
if (G_UNLIKELY (_create_stream_group (ebin, sprof, NULL, NULL) == NULL))
|
||||
goto stream_error;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue