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

@ -343,6 +343,45 @@ ges_pipeline_new (void)
( (GST_IS_ENCODING_AUDIO_PROFILE (profile) && (tracktype) == GES_TRACK_TYPE_AUDIO) || \
(GST_IS_ENCODING_VIDEO_PROFILE (profile) && (tracktype) == GES_TRACK_TYPE_VIDEO))
static gboolean
_track_is_compatible_with_profile (GESPipeline * self, GESTrack * track,
GstEncodingProfile * prof)
{
if (TRACK_COMPATIBLE_PROFILE (track->type, prof)) {
if (self->priv->mode == GES_PIPELINE_MODE_SMART_RENDER) {
GstCaps *ocaps, *rcaps;
GST_DEBUG ("Smart Render mode, setting input caps");
ocaps = gst_encoding_profile_get_input_caps (prof);
ocaps = gst_caps_make_writable (ocaps);
if (track->type == GES_TRACK_TYPE_AUDIO)
rcaps = gst_caps_new_empty_simple ("audio/x-raw");
else
rcaps = gst_caps_new_empty_simple ("video/x-raw");
gst_caps_append (ocaps, rcaps);
ges_track_set_caps (track, ocaps);
gst_caps_unref (ocaps);
} else {
GstCaps *caps = NULL;
/* Raw preview or rendering mode */
if (track->type == GES_TRACK_TYPE_VIDEO)
caps = gst_caps_new_empty_simple ("video/x-raw");
else if (track->type == GES_TRACK_TYPE_AUDIO)
caps = gst_caps_new_empty_simple ("audio/x-raw");
if (caps) {
ges_track_set_caps (track, caps);
gst_caps_unref (caps);
}
}
return TRUE;
}
return FALSE;
}
static gboolean
ges_pipeline_update_caps (GESPipeline * self)
{
@ -361,6 +400,17 @@ ges_pipeline_update_caps (GESPipeline * self)
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);
@ -368,42 +418,14 @@ ges_pipeline_update_caps (GESPipeline * self)
/* 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;
GST_DEBUG ("Smart Render mode, setting input caps");
ocaps = gst_encoding_profile_get_input_caps (prof);
ocaps = gst_caps_make_writable (ocaps);
if (track->type == GES_TRACK_TYPE_AUDIO)
rcaps = gst_caps_new_empty_simple ("audio/x-raw");
else
rcaps = gst_caps_new_empty_simple ("video/x-raw");
gst_caps_append (ocaps, rcaps);
ges_track_set_caps (track, ocaps);
gst_caps_unref (ocaps);
} else {
GstCaps *caps = NULL;
/* Raw preview or rendering mode */
if (track->type == GES_TRACK_TYPE_VIDEO)
caps = gst_caps_new_empty_simple ("video/x-raw");
else if (track->type == GES_TRACK_TYPE_AUDIO)
caps = gst_caps_new_empty_simple ("audio/x-raw");
if (caps) {
ges_track_set_caps (track, caps);
gst_caps_unref (caps);
}
}
if (_track_is_compatible_with_profile (self, track, prof))
break;
}
}
gst_object_unref (track);
}
done:
if (tracks)
g_list_free (tracks);

View file

@ -592,28 +592,31 @@ 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]) {
caps = gst_caps_from_string (strcaps_v[0]);
if (caps == NULL) {
g_printerr ("Could not parse caps %s", strcaps_v[0]);
return FALSE;
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]);
return FALSE;
}
encoding_profile =
GST_ENCODING_PROFILE (gst_encoding_container_profile_new
("User profile", "User profile", caps, NULL));
gst_caps_unref (caps);
}
encoding_profile =
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;