mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
launch: Make it easier to render project
Now providing an output uri is enough to tell that you want to render. It will use project rendering infos when possible, missing a way to specify which info if various are disponnible (we use the first one right now). + Make options more logical now, -l mean --load, and -r means repeat
This commit is contained in:
parent
f7ac18c138
commit
c97b9f7e04
1 changed files with 28 additions and 17 deletions
|
@ -150,7 +150,7 @@ create_timeline (int nbargs, gchar ** argv, gchar * audio, gchar * video)
|
||||||
!(!video || ges_timeline_add_track (timeline, trackv)))
|
!(!video || ges_timeline_add_track (timeline, trackv)))
|
||||||
goto build_failure;
|
goto build_failure;
|
||||||
|
|
||||||
/* Here we've finished initializing our timeline, we're
|
/* Here we've finished initializing our timeline, we're
|
||||||
* ready to start using it... by solely working with the layer !*/
|
* ready to start using it... by solely working with the layer !*/
|
||||||
|
|
||||||
for (i = 0; i < nbargs / 3; i++) {
|
for (i = 0; i < nbargs / 3; i++) {
|
||||||
|
@ -255,8 +255,8 @@ build_failure:
|
||||||
}
|
}
|
||||||
|
|
||||||
static GESPipeline *
|
static GESPipeline *
|
||||||
create_pipeline (gchar * load_path, gchar * save_path, int argc, char **argv,
|
create_pipeline (GESTimeline ** ret_timeline, gchar * load_path,
|
||||||
gchar * audio, gchar * video)
|
gchar * save_path, int argc, char **argv, gchar * audio, gchar * video)
|
||||||
{
|
{
|
||||||
GESPipeline *pipeline = NULL;
|
GESPipeline *pipeline = NULL;
|
||||||
GESTimeline *timeline = NULL;
|
GESTimeline *timeline = NULL;
|
||||||
|
@ -305,6 +305,7 @@ create_pipeline (gchar * load_path, gchar * save_path, int argc, char **argv,
|
||||||
if (!ges_pipeline_add_timeline (pipeline, timeline))
|
if (!ges_pipeline_add_timeline (pipeline, timeline))
|
||||||
goto failure;
|
goto failure;
|
||||||
|
|
||||||
|
*ret_timeline = timeline;
|
||||||
return pipeline;
|
return pipeline;
|
||||||
|
|
||||||
failure:
|
failure:
|
||||||
|
@ -326,8 +327,10 @@ bus_message_cb (GstBus * bus, GstMessage * message, GMainLoop * mainloop)
|
||||||
gchar *dbg_info = NULL;
|
gchar *dbg_info = NULL;
|
||||||
|
|
||||||
gst_message_parse_error (message, &err, &dbg_info);
|
gst_message_parse_error (message, &err, &dbg_info);
|
||||||
g_printerr ("ERROR from element %s: %s\n",
|
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline),
|
||||||
GST_OBJECT_NAME (message->src), err->message);
|
GST_DEBUG_GRAPH_SHOW_ALL, "ges-launch-error");
|
||||||
|
g_printerr ("ERROR from element %s: %s\n", GST_OBJECT_NAME (message->src),
|
||||||
|
err->message);
|
||||||
g_printerr ("Debugging info: %s\n", (dbg_info) ? dbg_info : "none");
|
g_printerr ("Debugging info: %s\n", (dbg_info) ? dbg_info : "none");
|
||||||
g_error_free (err);
|
g_error_free (err);
|
||||||
g_free (dbg_info);
|
g_free (dbg_info);
|
||||||
|
@ -412,7 +415,6 @@ main (int argc, gchar ** argv)
|
||||||
gchar *audio_preset = NULL;
|
gchar *audio_preset = NULL;
|
||||||
gchar *video_preset = NULL;
|
gchar *video_preset = NULL;
|
||||||
gchar *exclude_args = NULL;
|
gchar *exclude_args = NULL;
|
||||||
static gboolean render = FALSE;
|
|
||||||
static gboolean smartrender = FALSE;
|
static gboolean smartrender = FALSE;
|
||||||
static gboolean list_transitions = FALSE;
|
static gboolean list_transitions = FALSE;
|
||||||
static gboolean list_patterns = FALSE;
|
static gboolean list_patterns = FALSE;
|
||||||
|
@ -423,8 +425,6 @@ main (int argc, gchar ** argv)
|
||||||
GOptionEntry options[] = {
|
GOptionEntry options[] = {
|
||||||
{"thumbnail", 'm', 0.0, G_OPTION_ARG_DOUBLE, &thumbinterval,
|
{"thumbnail", 'm', 0.0, G_OPTION_ARG_DOUBLE, &thumbinterval,
|
||||||
"Take thumbnails every n seconds (saved in current directory)", "N"},
|
"Take thumbnails every n seconds (saved in current directory)", "N"},
|
||||||
{"render", 'r', 0, G_OPTION_ARG_NONE, &render,
|
|
||||||
"Render to outputuri", NULL},
|
|
||||||
{"smartrender", 's', 0, G_OPTION_ARG_NONE, &smartrender,
|
{"smartrender", 's', 0, G_OPTION_ARG_NONE, &smartrender,
|
||||||
"Render to outputuri, and avoid decoding/reencoding", NULL},
|
"Render to outputuri, and avoid decoding/reencoding", NULL},
|
||||||
{"outputuri", 'o', 0, G_OPTION_ARG_STRING, &outputuri,
|
{"outputuri", 'o', 0, G_OPTION_ARG_STRING, &outputuri,
|
||||||
|
@ -441,7 +441,7 @@ main (int argc, gchar ** argv)
|
||||||
"Encoding audio profile preset", "<GstPresetName>"},
|
"Encoding audio profile preset", "<GstPresetName>"},
|
||||||
{"vpreset", 0, 0, G_OPTION_ARG_STRING, &video_preset,
|
{"vpreset", 0, 0, G_OPTION_ARG_STRING, &video_preset,
|
||||||
"Encoding video profile preset", "<GstPresetName>"},
|
"Encoding video profile preset", "<GstPresetName>"},
|
||||||
{"repeat", 'l', 0, G_OPTION_ARG_INT, &repeat,
|
{"repeat", 'r', 0, G_OPTION_ARG_INT, &repeat,
|
||||||
"Number of time to repeat timeline", NULL},
|
"Number of time to repeat timeline", NULL},
|
||||||
{"list-transitions", 't', 0, G_OPTION_ARG_NONE, &list_transitions,
|
{"list-transitions", 't', 0, G_OPTION_ARG_NONE, &list_transitions,
|
||||||
"List valid transition types and exit", NULL},
|
"List valid transition types and exit", NULL},
|
||||||
|
@ -449,7 +449,7 @@ main (int argc, gchar ** argv)
|
||||||
"List patterns and exit", NULL},
|
"List patterns and exit", NULL},
|
||||||
{"save", 'z', 0, G_OPTION_ARG_STRING, &save_path,
|
{"save", 'z', 0, G_OPTION_ARG_STRING, &save_path,
|
||||||
"Save project to file before rendering", "<path>"},
|
"Save project to file before rendering", "<path>"},
|
||||||
{"load", 'q', 0, G_OPTION_ARG_STRING, &load_path,
|
{"load", 'l', 0, G_OPTION_ARG_STRING, &load_path,
|
||||||
"Load project from file before rendering", "<path>"},
|
"Load project from file before rendering", "<path>"},
|
||||||
{"verbose", 0, 0, G_OPTION_ARG_NONE, &verbose,
|
{"verbose", 0, 0, G_OPTION_ARG_NONE, &verbose,
|
||||||
"Output status information and property notifications", NULL},
|
"Output status information and property notifications", NULL},
|
||||||
|
@ -460,6 +460,7 @@ main (int argc, gchar ** argv)
|
||||||
GOptionContext *ctx;
|
GOptionContext *ctx;
|
||||||
GMainLoop *mainloop;
|
GMainLoop *mainloop;
|
||||||
GstBus *bus;
|
GstBus *bus;
|
||||||
|
GESTimeline *timeline;
|
||||||
|
|
||||||
setlocale (LC_ALL, "");
|
setlocale (LC_ALL, "");
|
||||||
|
|
||||||
|
@ -505,7 +506,7 @@ main (int argc, gchar ** argv)
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((!load_path && (argc < 4))) || (outputuri && (!render && !smartrender))) {
|
if (((!load_path && (argc < 4)))) {
|
||||||
g_printf ("%s", g_option_context_get_help (ctx, TRUE, NULL));
|
g_printf ("%s", g_option_context_get_help (ctx, TRUE, NULL));
|
||||||
g_option_context_free (ctx);
|
g_option_context_free (ctx);
|
||||||
exit (1);
|
exit (1);
|
||||||
|
@ -520,24 +521,34 @@ main (int argc, gchar ** argv)
|
||||||
video = NULL;
|
video = NULL;
|
||||||
|
|
||||||
/* Create the pipeline */
|
/* Create the pipeline */
|
||||||
pipeline = create_pipeline (load_path, save_path, argc - 1, argv + 1,
|
pipeline =
|
||||||
|
create_pipeline (&timeline, load_path, save_path, argc - 1, argv + 1,
|
||||||
audio, video);
|
audio, video);
|
||||||
if (!pipeline)
|
if (!pipeline)
|
||||||
exit (1);
|
exit (1);
|
||||||
|
|
||||||
/* Setup profile/encoding if needed */
|
/* Setup profile/encoding if needed */
|
||||||
if (render || smartrender) {
|
if (smartrender || outputuri) {
|
||||||
GstEncodingProfile *prof;
|
GstEncodingProfile *prof = NULL;
|
||||||
|
GESProject *proj =
|
||||||
|
GES_PROJECT (ges_extractable_get_asset (GES_EXTRACTABLE (timeline)));
|
||||||
|
|
||||||
prof = make_encoding_profile (audio, video, video_restriction, audio_preset,
|
if (proj) {
|
||||||
video_preset, container);
|
const GList *profiles = ges_project_list_encoding_profiles (proj);
|
||||||
|
|
||||||
|
prof = profiles ? profiles->data : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!prof) {
|
||||||
|
make_encoding_profile (audio, video, video_restriction, audio_preset,
|
||||||
|
video_preset, container);
|
||||||
|
}
|
||||||
|
|
||||||
if (!prof || !ges_pipeline_set_render_settings (pipeline, outputuri, prof)
|
if (!prof || !ges_pipeline_set_render_settings (pipeline, outputuri, prof)
|
||||||
|| !ges_pipeline_set_mode (pipeline,
|
|| !ges_pipeline_set_mode (pipeline,
|
||||||
smartrender ? TIMELINE_MODE_SMART_RENDER : TIMELINE_MODE_RENDER))
|
smartrender ? TIMELINE_MODE_SMART_RENDER : TIMELINE_MODE_RENDER))
|
||||||
exit (1);
|
exit (1);
|
||||||
|
|
||||||
g_free (outputuri);
|
|
||||||
gst_encoding_profile_unref (prof);
|
gst_encoding_profile_unref (prof);
|
||||||
} else {
|
} else {
|
||||||
ges_pipeline_set_mode (pipeline, TIMELINE_MODE_PREVIEW);
|
ges_pipeline_set_mode (pipeline, TIMELINE_MODE_PREVIEW);
|
||||||
|
|
Loading…
Reference in a new issue