Sync with gst-launch, as g_print* will print broken string on Windows.
See also
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/258
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-editing-services/-/merge_requests/245>
if (argc < 3) {
- g_print ("Usage: %s <output uri> <list of files>\n", argv[0]);
+ gst_print ("Usage: %s <output uri> <list of files>\n", argv[0]);
return -1;
}
{
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_ERROR:
- g_print ("ERROR\n");
+ gst_print ("ERROR\n");
g_main_loop_quit (mainloop);
break;
case GST_MESSAGE_EOS:
- g_print ("Done\n");
+ gst_print ("Done\n");
g_main_loop_quit (mainloop);
break;
default:
GST_INFO ("layer clip removed cb %p %p %p", layer, clip, app);
if (!find_row_for_object (GTK_LIST_STORE (app->model), &iter, clip)) {
- g_print ("clip deleted but we don't own it");
+ gst_print ("clip deleted but we don't own it");
return;
}
app->n_objects--;
{
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_ERROR:
- g_printerr ("ERROR\n");
+ gst_printerr ("ERROR\n");
g_main_loop_quit (mainloop);
break;
case GST_MESSAGE_EOS:
- g_printerr ("Done\n");
+ gst_printerr ("Done\n");
g_main_loop_quit (mainloop);
break;
default:
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_ERROR:
- g_print ("ERROR\n");
+ gst_print ("ERROR\n");
break;
case GST_MESSAGE_EOS:
gst_element_set_state (GST_ELEMENT (app->pipeline), GST_STATE_READY);
{
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_ERROR:
- g_printerr ("Got error message on the bus\n");
+ gst_printerr ("Got error message on the bus\n");
g_main_loop_quit (mainloop);
break;
case GST_MESSAGE_EOS:
- g_print ("Done\n");
+ gst_print ("Done\n");
g_main_loop_quit (mainloop);
break;
default:
GstClockTime start = 0;
if (argc < 2) {
- g_print ("Usage: %s <list of files>\n", argv[0]);
+ gst_print ("Usage: %s <list of files>\n", argv[0]);
return -1;
}
clip = GES_CLIP (ges_uri_clip_new (uri));
if (!clip) {
- g_printerr ("Could not create clip for file: %s\n", argv[i]);
+ gst_printerr ("Could not create clip for file: %s\n", argv[i]);
g_free (uri);
goto err;
}
g_option_context_add_group (ctx, gst_init_get_option_group ());
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
- g_print ("Error initializing %s\n", err->message);
+ gst_print ("Error initializing %s\n", err->message);
g_option_context_free (ctx);
g_clear_error (&err);
exit (1);
}
if (filepattern == NULL) {
- g_print ("%s", g_option_context_get_help (ctx, TRUE, NULL));
+ gst_print ("%s", g_option_context_get_help (ctx, TRUE, NULL));
exit (0);
}
g_option_context_free (ctx);
g_option_context_add_group (ctx, gst_init_get_option_group ());
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
- g_print ("Error initializing %s\n", err->message);
+ gst_print ("Error initializing %s\n", err->message);
g_option_context_free (ctx);
g_clear_error (&err);
exit (1);
}
if (argc > 1) {
- g_print ("%s", g_option_context_get_help (ctx, TRUE, NULL));
+ gst_print ("%s", g_option_context_get_help (ctx, TRUE, NULL));
exit (0);
}
GESTimeline *timeline;
if (argc == 1) {
- g_printerr ("Usage: play_timeline_with_one_clip file:///clip/uri\n");
+ gst_printerr ("Usage: play_timeline_with_one_clip file:///clip/uri\n");
return 1;
}
GESClip *clip = GES_CLIP (ges_uri_clip_new (argv[1]));
if (clip == NULL) {
- g_printerr ("%s can not be used, make sure it is a supported media file",
+ gst_printerr
+ ("%s can not be used, make sure it is a supported media file",
argv[1]);
return 1;
g_option_context_add_group (ctx, gst_init_get_option_group ());
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
- g_print ("Error initializing %s\n", err->message);
+ gst_print ("Error initializing %s\n", err->message);
g_option_context_free (ctx);
g_clear_error (&err);
exit (1);
}
if (argc == 1) {
- g_print ("%s", g_option_context_get_help (ctx, TRUE, NULL));
+ gst_print ("%s", g_option_context_get_help (ctx, TRUE, NULL));
exit (0);
}
g_option_context_free (ctx);
guint i;
if (argc < 2) {
- g_print ("Usage: %s <list of audio files>\n", argv[0]);
+ gst_print ("Usage: %s <list of audio files>\n", argv[0]);
return -1;
}
if (!ges_timeline_add_track (timeline, tracka))
return -1;
- /* 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 ! */
for (i = 1; i < argc; i++, offset += GST_SECOND) {
guint i;
if (argc < 2) {
- g_print ("Usage: %s <list of audio files>\n", argv[0]);
+ gst_print ("Usage: %s <list of audio files>\n", argv[0]);
return -1;
}
if (!ges_timeline_add_track (timeline, tracka))
return -1;
- /* 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 ! */
for (i = 1; i < argc; i++) {
GstEncodingProfile *make_encoding_profile (gchar * audio, gchar * container);
/* This example will take a series of files and create a audio-only timeline
- * containing the first second of each file and render it to the output uri
+ * containing the first second of each file and render it to the output uri
* using ogg/vorbis */
/* make_encoding_profile
g_option_context_add_group (ctx, gst_init_get_option_group ());
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
- g_printerr ("Error initializing: %s\n", err->message);
+ gst_printerr ("Error initializing: %s\n", err->message);
g_option_context_free (ctx);
g_clear_error (&err);
return -1;
g_option_context_free (ctx);
if (argc < 3) {
- g_print ("Usage: %s <output uri> <list of audio files>\n", argv[0]);
+ gst_print ("Usage: %s <output uri> <list of audio files>\n", argv[0]);
return -1;
}
if (!ges_timeline_add_track (timeline, tracka))
return -1;
- /* 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 ! */
for (i = 2; i < argc; i++) {
} else if (g_file_test (argv[1], G_FILE_TEST_EXISTS)) {
output_uri = gst_filename_to_uri (argv[1], NULL);
} else {
- g_printerr ("Unrecognised command line argument '%s'.\n"
+ gst_printerr ("Unrecognised command line argument '%s'.\n"
"Please pass an URI or file as argument!\n", argv[1]);
return -1;
}
g_option_context_add_group (ctx, gst_init_get_option_group ());
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
- g_print ("Error initializing %s\n", err->message);
+ gst_print ("Error initializing %s\n", err->message);
g_option_context_free (ctx);
g_clear_error (&err);
exit (1);
}
if (argc > 1) {
- g_print ("%s", g_option_context_get_help (ctx, TRUE, NULL));
+ gst_print ("%s", g_option_context_get_help (ctx, TRUE, NULL));
exit (0);
}
{
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_ERROR:
- g_print ("ERROR\n");
+ gst_print ("ERROR\n");
g_main_loop_quit (mainloop);
break;
case GST_MESSAGE_EOS:
if (repeat > 0) {
- g_print ("Looping again\n");
+ gst_print ("Looping again\n");
/* No need to change state before */
gst_element_seek_simple (GST_ELEMENT (pipeline), GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH, 0);
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
repeat -= 1;
} else {
- g_print ("Done\n");
+ gst_print ("Done\n");
g_main_loop_quit (mainloop);
}
break;
g_option_context_add_group (ctx, gst_init_get_option_group ());
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
- g_print ("Error initializing: %s\n", err->message);
+ gst_print ("Error initializing: %s\n", err->message);
g_option_context_free (ctx);
g_clear_error (&err);
exit (1);
/* Play the pipeline */
mainloop = g_main_loop_new (NULL, FALSE);
- g_print ("thumbnailing every 1 seconds\n");
+ gst_print ("thumbnailing every 1 seconds\n");
g_timeout_add (1000, thumbnail_cb, pipeline);
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
if (gst_element_set_state (GST_ELEMENT (pipeline),
GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
- g_print ("Failed to start the encoding\n");
+ gst_print ("Failed to start the encoding\n");
return 1;
}
g_main_loop_run (mainloop);
g_object_get (nleobj, "start", &start, "duration", &duration,
"priority", &priority, "name", &name, NULL);
- g_print ("nleobject for %s: %f %f %d\n", name,
+ gst_print ("nleobject for %s: %f %f %d\n", name,
((gfloat) start) / GST_SECOND,
((gfloat) duration) / GST_SECOND, priority);
g_timeout_add_seconds (1, (GSourceFunc) print_transition_data, srcb);
if (tduration != 0) {
- g_print ("creating transition at %" GST_TIME_FORMAT " of %f duration (%"
+ gst_print ("creating transition at %" GST_TIME_FORMAT " of %f duration (%"
GST_TIME_FORMAT ")\n", GST_TIME_ARGS (tstart), tdur,
GST_TIME_ARGS (tduration));
if (!(tr = ges_transition_clip_new_for_nick (nick)))
g_option_context_add_group (ctx, gst_init_get_option_group ());
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
- g_print ("Error initializing %s\n", err->message);
+ gst_print ("Error initializing %s\n", err->message);
g_option_context_free (ctx);
g_clear_error (&err);
exit (1);
}
if (argc < 4) {
- g_print ("%s", g_option_context_get_help (ctx, TRUE, NULL));
+ gst_print ("%s", g_option_context_get_help (ctx, TRUE, NULL));
exit (0);
}
*
* // Print some infos about the formatter GESAsset
* for (tmp = formatter_assets; tmp; tmp = tmp->next) {
- * g_print ("Name of the formatter: %s, file extension it produces: %s",
+ * gst_print ("Name of the formatter: %s, file extension it produces: %s",
* ges_meta_container_get_string (
* GES_META_CONTAINER (tmp->data), GES_META_FORMATTER_NAME),
* ges_meta_container_get_string (
*
* asset = ges_asset_request_finish (res, &error);
* if (asset) {
- * g_print ("The file: %s is usable as a GESUriClip",
+ * gst_print ("The file: %s is usable as a GESUriClip",
* ges_asset_get_id (asset));
* } else {
- * g_print ("The file: %s is *not* usable as a GESUriClip because: %s",
+ * gst_print ("The file: %s is *not* usable as a GESUriClip because: %s",
* ges_asset_get_id (source), error->message);
* }
*
print_node (GNode * node, gpointer unused_data)
{
if (G_NODE_IS_ROOT (node)) {
- g_print ("Timeline: %p\n", node->data);
+ gst_print ("Timeline: %p\n", node->data);
return FALSE;
}
- g_print ("%*c- %" GES_FORMAT " - layer %" G_GINT32_FORMAT "\n",
+ gst_print ("%*c- %" GES_FORMAT " - layer %" G_GINT32_FORMAT "\n",
2 * g_node_depth (node), ' ', GES_ARGS (node->data),
ges_timeline_element_get_layer_priority (node->data));
*
* filesource_asset = ges_uri_clip_asset_finish (res, &error);
* if (filesource_asset) {
- * g_print ("The file: %s is usable as a FileSource, it is%s an image and lasts %" GST_TIME_FORMAT,
+ * gst_print ("The file: %s is usable as a FileSource, it is%s an image and lasts %" GST_TIME_FORMAT,
* ges_asset_get_id (GES_ASSET (filesource_asset))
* ges_uri_clip_asset_is_image (filesource_asset) ? "" : " not",
* GST_TIME_ARGS (ges_uri_clip_asset_get_duration (filesource_asset));
* } else {
- * g_print ("The file: %s is *not* usable as a FileSource because: %s",
+ * gst_print ("The file: %s is *not* usable as a FileSource because: %s",
* ges_asset_get_id (source), error->message);
* }
*
const gchar * arg, gpointer data, GError ** err)
{
if (g_strcmp0 (s_opt, "--ges-version") == 0) {
- g_print ("GStreamer Editing Services version %s\n", PACKAGE_VERSION);
+ gst_print ("GStreamer Editing Services version %s\n", PACKAGE_VERSION);
exit (0);
} else if (g_strcmp0 (s_opt, "--ges-sample-paths") == 0) {
ges_add_missing_uri_relocation_uri (arg, FALSE);
ges_layer_add_asset (layer, asset, i * 1000, 0,
1000, GES_TRACK_TYPE_UNKNOWN);
end = gst_util_get_timestamp ();
- g_print ("%" GST_TIME_FORMAT " - adding %d clip to the timeline\n",
+ gst_print ("%" GST_TIME_FORMAT " - adding %d clip to the timeline\n",
GST_TIME_ARGS (end - start), i);
start_ripple = gst_util_get_timestamp ();
min_rippling_time = MIN (min_rippling_time, end - start);
}
end_ripple = gst_util_get_timestamp ();
- g_print ("%" GST_TIME_FORMAT " - rippling %d times, max: %"
+ gst_print ("%" GST_TIME_FORMAT " - rippling %d times, max: %"
GST_TIME_FORMAT " min: %" GST_TIME_FORMAT "\n",
GST_TIME_ARGS (end_ripple - start_ripple), i - 1,
GST_TIME_ARGS (max_rippling_time), GST_TIME_ARGS (min_rippling_time));
min_rippling_time = MIN (min_rippling_time, end - start);
}
end_ripple = gst_util_get_timestamp ();
- g_print ("%" GST_TIME_FORMAT " - rippling %d times, max: %"
+ gst_print ("%" GST_TIME_FORMAT " - rippling %d times, max: %"
GST_TIME_FORMAT " min: %" GST_TIME_FORMAT " (with auto-transition on)\n",
GST_TIME_ARGS (end_ripple - start_ripple), i - 1,
GST_TIME_ARGS (max_rippling_time), GST_TIME_ARGS (min_rippling_time));
start = gst_util_get_timestamp ();
gst_object_unref (timeline);
end = gst_util_get_timestamp ();
- g_print ("%" GST_TIME_FORMAT " - freeing the timeline\n",
+ gst_print ("%" GST_TIME_FORMAT " - freeing the timeline\n",
GST_TIME_ARGS (end - start));
return 0;
{
GList *layer, *clip, *clips, *group;
- g_printerr
+ gst_printerr
("\n\n=========================== GESTimeline: %p ==================\n",
timeline);
for (layer = timeline->layers; layer; layer = layer->next) {
clips = ges_layer_get_clips (layer->data);
- g_printerr ("layer %04d: ", ges_layer_get_priority (layer->data));
+ gst_printerr ("layer %04d: ", ges_layer_get_priority (layer->data));
for (clip = clips; clip; clip = clip->next) {
- g_printerr ("{ %s [ %" G_GUINT64_FORMAT "(%" G_GUINT64_FORMAT ") %"
+ gst_printerr ("{ %s [ %" G_GUINT64_FORMAT "(%" G_GUINT64_FORMAT ") %"
G_GUINT64_FORMAT "] } ", GES_TIMELINE_ELEMENT_NAME (clip->data),
GES_TIMELINE_ELEMENT_START (clip->data),
GES_TIMELINE_ELEMENT_INPOINT (clip->data),
GES_TIMELINE_ELEMENT_END (clip->data));
}
if (layer->next)
- g_printerr ("\n--------------------------------------------------\n");
+ gst_printerr ("\n--------------------------------------------------\n");
g_list_free_full (clips, gst_object_unref);
}
if (ges_timeline_get_groups (timeline)) {
- g_printerr ("\n--------------------------------------------------\n");
- g_printerr ("\nGROUPS:");
- g_printerr ("\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
+ gst_printerr ("\n--------------------------------------------------\n");
+ gst_printerr ("\nGROUPS:");
+ gst_printerr ("\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
}
for (group = ges_timeline_get_groups (timeline); group; group = group->next) {
- g_printerr ("%" GES_FORMAT ": ", GES_ARGS (group->data));
+ gst_printerr ("%" GES_FORMAT ": ", GES_ARGS (group->data));
for (clip = GES_CONTAINER_CHILDREN (group->data); clip; clip = clip->next)
- g_printerr ("[ %s ]", GES_TIMELINE_ELEMENT_NAME (clip->data));
+ gst_printerr ("[ %s ]", GES_TIMELINE_ELEMENT_NAME (clip->data));
}
- g_printerr
+ gst_printerr
("\n=====================================================================\n");
}
return FALSE;
}
- g_print ("\nEncoding details:\n");
- g_print ("================\n");
+ gst_print ("\nEncoding details:\n");
+ gst_print ("================\n");
- g_print (" -> Output file: %s\n", opts->outputuri);
- g_print (" -> Profile:%s\n",
+ gst_print (" -> Output file: %s\n", opts->outputuri);
+ gst_print (" -> Profile:%s\n",
smart_profile ?
" (selected from input files format for efficient smart rendering" :
"");
describe_encoding_profile (prof);
- g_print ("\n");
+ gst_print ("\n");
ges_project_add_encoding_profile (proj, prof);
}
if (opts->disable_mixing || opts->smartrender)
ges_track_set_mixing (track, FALSE);
if (!opts->disable_mixing && opts->smartrender && !printed_mixing_disabled) {
- g_print ("**Mixing is disabled for smart rendering to work**\n");
+ gst_print ("**Mixing is disabled for smart rendering to work**\n");
printed_mixing_disabled = TRUE;
}
}
g_application_quit (G_APPLICATION (self));
}
- g_print ("\nSaving project to %s\n", uri);
+ gst_print ("\nSaving project to %s\n", uri);
ges_project_save (project, timeline, uri, NULL, TRUE, &error);
g_free (uri);
static gboolean
intr_handler (GESLauncher * self)
{
- g_print ("interrupt received.\n");
+ gst_print ("interrupt received.\n");
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (self->priv->pipeline),
GST_DEBUG_GRAPH_SHOW_ALL, "ges-launch.interrupted");
/* Timeline creation */
if (opts->load_path) {
- g_printf ("Loading project from : %s\n", opts->load_path);
+ gst_print ("Loading project from : %s\n", opts->load_path);
if (!(uri = ensure_uri (opts->load_path))) {
g_error ("couldn't create uri for '%s'", opts->load_path);
if (!opts->load_path && !opts->scenario && !opts->testfile
&& !opts->list_transitions && (argc <= 1)) {
- g_printf ("%s", g_option_context_get_help (ctx, TRUE, NULL));
+ gst_print ("%s", g_option_context_get_help (ctx, TRUE, NULL));
g_option_context_free (ctx);
*exit_status = 1;
goto done;
gst_element_query_duration (GST_ELEMENT (pipeline), GST_FORMAT_TIME,
&duration);
- g_print ("<position: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT
+ gst_print ("<position: %" GST_TIME_FORMAT " duration: %" GST_TIME_FORMAT
"/>\r", GST_TIME_ARGS (position), GST_TIME_ARGS (duration));
}
guint i;
for (i = 0; i < enum_class->n_values; i++) {
- g_printf ("%s\n", enum_class->values[i].value_nick);
+ gst_print ("%s\n", enum_class->values[i].value_nick);
}
g_type_class_unref (enum_class);
g_string_append (str, clear);
if (err)
- g_printerr ("%s", str->str);
+ gst_printerr ("%s", str->str);
else
- g_print ("%s", str->str);
+ gst_print ("%s", str->str);
g_string_free (str, TRUE);
}
capsdesc = gst_caps_to_string (format);
if (GST_IS_ENCODING_CONTAINER_PROFILE (profile)) {
- g_print ("%s> %s %s: %s%s%s%s\n", prefix,
+ gst_print ("%s> %s %s: %s%s%s%s\n", prefix,
get_type_icon (profile),
capsdesc, name ? name : "",
desc ? " (" : "", desc ? desc : "", desc ? ")" : "");
} else {
- g_print ("%s%s %s%s%s%s%s%s", prefix, get_type_icon (profile),
+ gst_print ("%s%s %s%s%s%s%s%s", prefix, get_type_icon (profile),
name ? name : capsdesc, desc ? ": " : "", desc ? desc : "",
name ? " (" : "", name ? capsdesc : "", name ? ")" : "");
GstVideoInfo info;
if (gst_video_info_from_caps (&info, caps)) {
- g_print (" (%dx%d", info.width, info.height);
+ gst_print (" (%dx%d", info.width, info.height);
if (info.fps_n)
- g_print ("@%d/%dfps", info.fps_n, info.fps_d);
- g_print (")");
+ gst_print ("@%d/%dfps", info.fps_n, info.fps_d);
+ gst_print (")");
}
gst_caps_unref (caps);
}
GstAudioInfo info;
if (gst_caps_is_fixed (caps) && gst_audio_info_from_caps (&info, caps))
- g_print (" (%d channels @ %dhz)", info.channels, info.rate);
+ gst_print (" (%d channels @ %dhz)", info.channels, info.rate);
gst_caps_unref (caps);
}
}
- g_print ("\n");
+ gst_print ("\n");
}
gst_caps_unref (format);
return;
uri = ges_command_line_formatter_get_timeline_uri (timeline);
- g_print ("\nTimeline description: `%s`\n", &uri[5]);
+ gst_print ("\nTimeline description: `%s`\n", &uri[5]);
g_free (uri);
- g_print ("====================\n\n");
+ gst_print ("====================\n\n");
for (layer = timeline->layers; layer; layer = layer->next) {
clips = ges_layer_get_clips (layer->data);
if (!clips)
continue;
- g_printerr (" layer %d: \n", ges_layer_get_priority (layer->data));
- g_printerr (" --------\n");
+ gst_printerr (" layer %d: \n", ges_layer_get_priority (layer->data));
+ gst_printerr (" --------\n");
for (clip = clips; clip; clip = clip->next) {
gchar *name;
} else {
name = g_strdup (GES_TIMELINE_ELEMENT_NAME (clip->data));
}
- g_print (" - %s\n start=%" GST_TIME_FORMAT,
+ gst_print (" - %s\n start=%" GST_TIME_FORMAT,
name, GST_TIME_ARGS (GES_TIMELINE_ELEMENT_START (clip->data)));
g_free (name);
if (GES_TIMELINE_ELEMENT_INPOINT (clip->data))
- g_print (" inpoint=%" GST_TIME_FORMAT,
+ gst_print (" inpoint=%" GST_TIME_FORMAT,
GST_TIME_ARGS (GES_TIMELINE_ELEMENT_INPOINT (clip->data)));
- g_print (" duration=%" GST_TIME_FORMAT "\n",
+ gst_print (" duration=%" GST_TIME_FORMAT "\n",
GST_TIME_ARGS (GES_TIMELINE_ELEMENT_END (clip->data)));
}
if (layer->next)
- g_printerr ("\n");
+ gst_printerr ("\n");
g_list_free_full (clips, gst_object_unref);
}
- g_print ("\n");
+ gst_print ("\n");
}