pipeline: Add support to rendering without container

+ Simplify the support in ges-launch as we should not require the
profile desc to start with : in that case

https://bugzilla.gnome.org/show_bug.cgi?id=731245
This commit is contained in:
Thibault Saunier 2014-06-05 02:16:01 +02:00
parent ba2b4920b6
commit b3a240126d
2 changed files with 68 additions and 43 deletions

View file

@ -344,31 +344,9 @@ ges_pipeline_new (void)
(GST_IS_ENCODING_VIDEO_PROFILE (profile) && (tracktype) == GES_TRACK_TYPE_VIDEO))
static gboolean
ges_pipeline_update_caps (GESPipeline * self)
_track_is_compatible_with_profile (GESPipeline * self, GESTrack * track,
GstEncodingProfile * prof)
{
GList *ltrack, *tracks, *lstream;
if (!self->priv->profile)
return TRUE;
GST_DEBUG ("Updating track caps");
tracks = ges_timeline_get_tracks (self->priv->timeline);
/* Take each stream of the encoding profile and find a matching
* track to set the caps on */
for (ltrack = tracks; ltrack; ltrack = ltrack->next) {
GESTrack *track = (GESTrack *) ltrack->data;
GList *allstreams;
allstreams = (GList *)
gst_encoding_container_profile_get_profiles (
(GstEncodingContainerProfile *) self->priv->profile);
/* Find a matching stream setting */
for (lstream = allstreams; lstream; lstream = lstream->next) {
GstEncodingProfile *prof = (GstEncodingProfile *) lstream->data;
if (TRACK_COMPATIBLE_PROFILE (track->type, prof)) {
if (self->priv->mode == GES_PIPELINE_MODE_SMART_RENDER) {
GstCaps *ocaps, *rcaps;
@ -397,13 +375,57 @@ ges_pipeline_update_caps (GESPipeline * self)
gst_caps_unref (caps);
}
}
break;
return TRUE;
}
return FALSE;
}
static gboolean
ges_pipeline_update_caps (GESPipeline * self)
{
GList *ltrack, *tracks, *lstream;
if (!self->priv->profile)
return TRUE;
GST_DEBUG ("Updating track caps");
tracks = ges_timeline_get_tracks (self->priv->timeline);
/* Take each stream of the encoding profile and find a matching
* track to set the caps on */
for (ltrack = tracks; ltrack; ltrack = ltrack->next) {
GESTrack *track = (GESTrack *) ltrack->data;
GList *allstreams;
if (!GST_IS_ENCODING_CONTAINER_PROFILE (self->priv->profile)) {
if (_track_is_compatible_with_profile (self, track, self->priv->profile)) {
gst_object_unref (track);
goto done;
} else {
gst_object_unref (track);
continue;
}
}
allstreams = (GList *)
gst_encoding_container_profile_get_profiles (
(GstEncodingContainerProfile *) self->priv->profile);
/* Find a matching stream setting */
for (lstream = allstreams; lstream; lstream = lstream->next) {
GstEncodingProfile *prof = (GstEncodingProfile *) lstream->data;
if (_track_is_compatible_with_profile (self, track, prof))
break;
}
gst_object_unref (track);
}
done:
if (tracks)
g_list_free (tracks);

View file

@ -592,14 +592,18 @@ static GstEncodingProfile *
_parse_encoding_profile (const gchar * format)
{
GstCaps *caps;
GstEncodingProfile *encoding_profile;
GstEncodingProfile *encoding_profile = NULL;
gchar **restriction_format, **preset_v;
guint i, presence = 0;
guint i = 1, presence = 0;
GstCaps *restrictioncaps = NULL;
gchar **strpresence_v, **strcaps_v = g_strsplit (format, ":", 0);
if (strcaps_v[0] && *strcaps_v[0]) {
if (strcaps_v[1] == NULL) {
/* Only 1 profile which means no container used */
i = 0;
} else {
caps = gst_caps_from_string (strcaps_v[0]);
if (caps == NULL) {
g_printerr ("Could not parse caps %s", strcaps_v[0]);
@ -609,11 +613,10 @@ _parse_encoding_profile (const gchar * format)
GST_ENCODING_PROFILE (gst_encoding_container_profile_new
("User profile", "User profile", caps, NULL));
gst_caps_unref (caps);
} else {
encoding_profile = NULL;
}
}
for (i = 1; strcaps_v[i]; i++) {
for (; strcaps_v[i]; i++) {
gchar *strcaps, *strpresence;
char *preset_name = NULL;
GstEncodingProfile *profile = NULL;