ges-launcher: slight clean up of _set_rendering_details

Single exit point, ges_printerr, never g_error

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3977>
This commit is contained in:
Mathieu Duponchelle 2023-02-16 17:27:43 +01:00 committed by GStreamer Marge Bot
parent 4c2bd05fdd
commit 47c183cdfd

View file

@ -572,11 +572,13 @@ _set_rendering_details (GESLauncher * self)
gboolean smart_profile = FALSE; gboolean smart_profile = FALSE;
GESPipelineFlags cmode = ges_pipeline_get_mode (self->priv->pipeline); GESPipelineFlags cmode = ges_pipeline_get_mode (self->priv->pipeline);
GESProject *proj; GESProject *proj;
gboolean ret = FALSE;
if (cmode & GES_PIPELINE_MODE_RENDER if (cmode & GES_PIPELINE_MODE_RENDER
|| cmode & GES_PIPELINE_MODE_SMART_RENDER) { || cmode & GES_PIPELINE_MODE_SMART_RENDER) {
GST_INFO_OBJECT (self, "Rendering settings already set"); GST_INFO_OBJECT (self, "Rendering settings already set");
return TRUE; ret = TRUE;
goto done;
} }
proj = proj =
@ -616,8 +618,10 @@ _set_rendering_details (GESLauncher * self)
} }
} else { } else {
prof = parse_encoding_profile (opts->format); prof = parse_encoding_profile (opts->format);
if (!prof) if (!prof) {
g_error ("Invalid format specified: %s", opts->format); ges_printerr ("Invalid format specified: %s", opts->format);
goto done;
}
} }
if (!prof) { if (!prof) {
@ -634,7 +638,7 @@ _set_rendering_details (GESLauncher * self)
if (!prof) { if (!prof) {
ges_printerr ("Could not find any encoding format for %s\n", ges_printerr ("Could not find any encoding format for %s\n",
opts->format); opts->format);
return FALSE; goto done;
} }
if (opts->container_profile) { if (opts->container_profile) {
@ -642,25 +646,25 @@ _set_rendering_details (GESLauncher * self)
GList *tmp; GList *tmp;
if (!(new_prof = parse_encoding_profile (opts->container_profile))) { if (!(new_prof = parse_encoding_profile (opts->container_profile))) {
gst_printerr ("Failed to parse container profile %s", ges_printerr ("Failed to parse container profile %s",
opts->container_profile); opts->container_profile);
gst_object_unref (prof); gst_object_unref (prof);
return FALSE; goto done;
} }
if (!GST_IS_ENCODING_CONTAINER_PROFILE (new_prof)) { if (!GST_IS_ENCODING_CONTAINER_PROFILE (new_prof)) {
gst_printerr ("Top level profile should be container profile"); ges_printerr ("Top level profile should be container profile");
gst_object_unref (prof); gst_object_unref (prof);
gst_object_unref (new_prof); gst_object_unref (new_prof);
return FALSE; goto done;
} }
if (gst_encoding_container_profile_get_profiles if (gst_encoding_container_profile_get_profiles
(GST_ENCODING_CONTAINER_PROFILE (new_prof))) { (GST_ENCODING_CONTAINER_PROFILE (new_prof))) {
gst_printerr ("--container-profile cannot contain children profiles"); ges_printerr ("--container-profile cannot contain children profiles");
gst_object_unref (prof); gst_object_unref (prof);
gst_object_unref (new_prof); gst_object_unref (new_prof);
return FALSE; goto done;
} }
for (tmp = (GList *) for (tmp = (GList *)
@ -700,14 +704,18 @@ _set_rendering_details (GESLauncher * self)
|| !ges_pipeline_set_mode (self->priv->pipeline, || !ges_pipeline_set_mode (self->priv->pipeline,
opts->smartrender ? GES_PIPELINE_MODE_SMART_RENDER : opts->smartrender ? GES_PIPELINE_MODE_SMART_RENDER :
GES_PIPELINE_MODE_RENDER)) { GES_PIPELINE_MODE_RENDER)) {
return FALSE; goto done;
} }
gst_encoding_profile_unref (prof); gst_encoding_profile_unref (prof);
} else { } else {
ges_pipeline_set_mode (self->priv->pipeline, GES_PIPELINE_MODE_PREVIEW); ges_pipeline_set_mode (self->priv->pipeline, GES_PIPELINE_MODE_PREVIEW);
} }
return TRUE;
ret = TRUE;
done:
return ret;
} }
static void static void