mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 04:22:27 +00:00
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:
parent
ba2b4920b6
commit
b3a240126d
2 changed files with 68 additions and 43 deletions
|
@ -343,6 +343,45 @@ ges_pipeline_new (void)
|
||||||
( (GST_IS_ENCODING_AUDIO_PROFILE (profile) && (tracktype) == GES_TRACK_TYPE_AUDIO) || \
|
( (GST_IS_ENCODING_AUDIO_PROFILE (profile) && (tracktype) == GES_TRACK_TYPE_AUDIO) || \
|
||||||
(GST_IS_ENCODING_VIDEO_PROFILE (profile) && (tracktype) == GES_TRACK_TYPE_VIDEO))
|
(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
|
static gboolean
|
||||||
ges_pipeline_update_caps (GESPipeline * self)
|
ges_pipeline_update_caps (GESPipeline * self)
|
||||||
{
|
{
|
||||||
|
@ -361,6 +400,17 @@ ges_pipeline_update_caps (GESPipeline * self)
|
||||||
GESTrack *track = (GESTrack *) ltrack->data;
|
GESTrack *track = (GESTrack *) ltrack->data;
|
||||||
GList *allstreams;
|
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 *)
|
allstreams = (GList *)
|
||||||
gst_encoding_container_profile_get_profiles (
|
gst_encoding_container_profile_get_profiles (
|
||||||
(GstEncodingContainerProfile *) self->priv->profile);
|
(GstEncodingContainerProfile *) self->priv->profile);
|
||||||
|
@ -368,42 +418,14 @@ ges_pipeline_update_caps (GESPipeline * self)
|
||||||
/* Find a matching stream setting */
|
/* Find a matching stream setting */
|
||||||
for (lstream = allstreams; lstream; lstream = lstream->next) {
|
for (lstream = allstreams; lstream; lstream = lstream->next) {
|
||||||
GstEncodingProfile *prof = (GstEncodingProfile *) lstream->data;
|
GstEncodingProfile *prof = (GstEncodingProfile *) lstream->data;
|
||||||
|
if (_track_is_compatible_with_profile (self, track, 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_object_unref (track);
|
gst_object_unref (track);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
if (tracks)
|
if (tracks)
|
||||||
g_list_free (tracks);
|
g_list_free (tracks);
|
||||||
|
|
||||||
|
|
|
@ -592,28 +592,31 @@ static GstEncodingProfile *
|
||||||
_parse_encoding_profile (const gchar * format)
|
_parse_encoding_profile (const gchar * format)
|
||||||
{
|
{
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
GstEncodingProfile *encoding_profile;
|
GstEncodingProfile *encoding_profile = NULL;
|
||||||
gchar **restriction_format, **preset_v;
|
gchar **restriction_format, **preset_v;
|
||||||
|
|
||||||
guint i, presence = 0;
|
guint i = 1, presence = 0;
|
||||||
GstCaps *restrictioncaps = NULL;
|
GstCaps *restrictioncaps = NULL;
|
||||||
gchar **strpresence_v, **strcaps_v = g_strsplit (format, ":", 0);
|
gchar **strpresence_v, **strcaps_v = g_strsplit (format, ":", 0);
|
||||||
|
|
||||||
if (strcaps_v[0] && *strcaps_v[0]) {
|
if (strcaps_v[0] && *strcaps_v[0]) {
|
||||||
caps = gst_caps_from_string (strcaps_v[0]);
|
if (strcaps_v[1] == NULL) {
|
||||||
if (caps == NULL) {
|
/* Only 1 profile which means no container used */
|
||||||
g_printerr ("Could not parse caps %s", strcaps_v[0]);
|
i = 0;
|
||||||
return FALSE;
|
} 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;
|
gchar *strcaps, *strpresence;
|
||||||
char *preset_name = NULL;
|
char *preset_name = NULL;
|
||||||
GstEncodingProfile *profile = NULL;
|
GstEncodingProfile *profile = NULL;
|
||||||
|
|
Loading…
Reference in a new issue