mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-09 08:55:33 +00:00
Port to gst_print* family
g_print* would print broken string on Windows See also https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/258 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-examples/-/merge_requests/20>
This commit is contained in:
parent
38d6a5873a
commit
61d200a957
8 changed files with 163 additions and 162 deletions
|
@ -56,7 +56,7 @@ static gboolean caps_resolved = FALSE;
|
|||
static void
|
||||
remove_client (Client * client)
|
||||
{
|
||||
g_print ("Removing connection %s\n", client->name);
|
||||
gst_print ("Removing connection %s\n", client->name);
|
||||
|
||||
G_LOCK (clients);
|
||||
clients = g_list_remove (clients, client);
|
||||
|
@ -96,7 +96,7 @@ write_bytes (Client * client, const gchar * data, guint len)
|
|||
|
||||
if (w <= 0) {
|
||||
if (err) {
|
||||
g_print ("Write error %s\n", err->message);
|
||||
gst_print ("Write error %s\n", err->message);
|
||||
g_clear_error (&err);
|
||||
}
|
||||
remove_client (client);
|
||||
|
@ -167,15 +167,15 @@ client_message (Client * client, const gchar * data, guint len)
|
|||
g_source_destroy (client->tosource);
|
||||
g_source_unref (client->tosource);
|
||||
client->tosource = NULL;
|
||||
g_print ("Starting to stream to %s\n", client->name);
|
||||
gst_print ("Starting to stream to %s\n", client->name);
|
||||
g_signal_emit_by_name (multisocketsink, "add", client->socket);
|
||||
}
|
||||
|
||||
if (!started) {
|
||||
g_print ("Starting pipeline\n");
|
||||
gst_print ("Starting pipeline\n");
|
||||
if (gst_element_set_state (pipeline,
|
||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
|
||||
g_print ("Failed to start pipeline\n");
|
||||
gst_print ("Failed to start pipeline\n");
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
started = TRUE;
|
||||
|
@ -204,7 +204,7 @@ client_message (Client * client, const gchar * data, guint len)
|
|||
static gboolean
|
||||
on_timeout (Client * client)
|
||||
{
|
||||
g_print ("Timeout\n");
|
||||
gst_print ("Timeout\n");
|
||||
remove_client (client);
|
||||
|
||||
return FALSE;
|
||||
|
@ -250,14 +250,14 @@ on_read_bytes (GPollableInputStream * stream, Client * client)
|
|||
}
|
||||
|
||||
if (client->current_message->len >= 1024 * 1024) {
|
||||
g_print ("No complete request after 1MB of data\n");
|
||||
gst_print ("No complete request after 1MB of data\n");
|
||||
remove_client (client);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
} else {
|
||||
g_print ("Read error %s\n", err->message);
|
||||
gst_print ("Read error %s\n", err->message);
|
||||
g_clear_error (&err);
|
||||
remove_client (client);
|
||||
return FALSE;
|
||||
|
@ -284,7 +284,7 @@ on_new_connection (GSocketService * service, GSocketConnection * connection,
|
|||
g_free (ip);
|
||||
g_object_unref (addr);
|
||||
|
||||
g_print ("New connection %s\n", client->name);
|
||||
gst_print ("New connection %s\n", client->name);
|
||||
|
||||
client->waiting_200_ok = FALSE;
|
||||
client->http_version = g_strdup ("");
|
||||
|
@ -324,7 +324,7 @@ on_message (GstBus * bus, GstMessage * message, gpointer user_data)
|
|||
GError *err;
|
||||
|
||||
gst_message_parse_error (message, &err, &debug);
|
||||
g_print ("Error %s\n", err->message);
|
||||
gst_print ("Error %s\n", err->message);
|
||||
g_error_free (err);
|
||||
g_free (debug);
|
||||
g_main_loop_quit (loop);
|
||||
|
@ -335,13 +335,13 @@ on_message (GstBus * bus, GstMessage * message, gpointer user_data)
|
|||
GError *err;
|
||||
|
||||
gst_message_parse_warning (message, &err, &debug);
|
||||
g_print ("Warning %s\n", err->message);
|
||||
gst_print ("Warning %s\n", err->message);
|
||||
g_error_free (err);
|
||||
g_free (debug);
|
||||
break;
|
||||
}
|
||||
case GST_MESSAGE_EOS:{
|
||||
g_print ("EOS\n");
|
||||
gst_print ("EOS\n");
|
||||
g_main_loop_quit (loop);
|
||||
}
|
||||
default:
|
||||
|
@ -404,7 +404,7 @@ on_stream_caps_changed (GObject * obj, GParamSpec * pspec, gpointer user_data)
|
|||
} else {
|
||||
content_type = g_strdup_printf ("Content-Type: %s\r\n", mimetype);
|
||||
}
|
||||
g_print ("%s", content_type);
|
||||
gst_print ("%s", content_type);
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
|
@ -443,7 +443,7 @@ main (gint argc, gchar ** argv)
|
|||
gst_init (&argc, &argv);
|
||||
|
||||
if (argc < 4) {
|
||||
g_print ("usage: %s PORT <launch line>\n"
|
||||
gst_print ("usage: %s PORT <launch line>\n"
|
||||
"example: %s 8080 ( videotestsrc ! theoraenc ! oggmux name=stream )\n",
|
||||
argv[0], argv[0]);
|
||||
return -1;
|
||||
|
@ -454,21 +454,21 @@ main (gint argc, gchar ** argv)
|
|||
|
||||
bin = gst_parse_launchv ((const gchar **) argv + 2, &err);
|
||||
if (!bin) {
|
||||
g_print ("invalid pipeline: %s\n", err->message);
|
||||
gst_print ("invalid pipeline: %s\n", err->message);
|
||||
g_clear_error (&err);
|
||||
return -2;
|
||||
}
|
||||
|
||||
stream = gst_bin_get_by_name (GST_BIN (bin), "stream");
|
||||
if (!stream) {
|
||||
g_print ("no element with name \"stream\" found\n");
|
||||
gst_print ("no element with name \"stream\" found\n");
|
||||
gst_object_unref (bin);
|
||||
return -3;
|
||||
}
|
||||
|
||||
srcpad = gst_element_get_static_pad (stream, "src");
|
||||
if (!srcpad) {
|
||||
g_print ("no \"src\" pad in element \"stream\" found\n");
|
||||
gst_print ("no \"src\" pad in element \"stream\" found\n");
|
||||
gst_object_unref (stream);
|
||||
gst_object_unref (bin);
|
||||
return -4;
|
||||
|
@ -514,7 +514,7 @@ main (gint argc, gchar ** argv)
|
|||
GST_STATE_READY) == GST_STATE_CHANGE_FAILURE) {
|
||||
gst_object_unref (pipeline);
|
||||
g_main_loop_unref (loop);
|
||||
g_print ("Failed to set pipeline to ready\n");
|
||||
gst_print ("Failed to set pipeline to ready\n");
|
||||
return -5;
|
||||
}
|
||||
|
||||
|
@ -526,7 +526,7 @@ main (gint argc, gchar ** argv)
|
|||
|
||||
g_socket_service_start (service);
|
||||
|
||||
g_print ("Listening on http://127.0.0.1:%d/\n", port);
|
||||
gst_print ("Listening on http://127.0.0.1:%d/\n", port);
|
||||
|
||||
g_main_loop_run (loop);
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@ static void play_set_relative_volume (GstPlay * play, gdouble volume_step);
|
|||
static void
|
||||
end_of_stream_cb (GstPlayer * player, GstPlay * play)
|
||||
{
|
||||
g_print ("\n");
|
||||
gst_print ("\n");
|
||||
/* and switch to next item in list */
|
||||
if (!play_next (play)) {
|
||||
g_print ("Reached end of play list.\n");
|
||||
gst_print ("Reached end of play list.\n");
|
||||
g_main_loop_quit (play->loop);
|
||||
}
|
||||
}
|
||||
|
@ -70,14 +70,14 @@ end_of_stream_cb (GstPlayer * player, GstPlay * play)
|
|||
static void
|
||||
error_cb (GstPlayer * player, GError * err, GstPlay * play)
|
||||
{
|
||||
g_printerr ("ERROR %s for %s\n", err->message, play->uris[play->cur_idx]);
|
||||
gst_printerr ("ERROR %s for %s\n", err->message, play->uris[play->cur_idx]);
|
||||
|
||||
/* if looping is enabled, then disable it else will keep looping forever */
|
||||
play->repeat = FALSE;
|
||||
|
||||
/* try next item in list then */
|
||||
if (!play_next (play)) {
|
||||
g_print ("Reached end of play list.\n");
|
||||
gst_print ("Reached end of play list.\n");
|
||||
g_main_loop_quit (play->loop);
|
||||
}
|
||||
}
|
||||
|
@ -100,20 +100,20 @@ position_updated_cb (GstPlayer * player, GstClockTime pos, GstPlay * play)
|
|||
pstr[9] = '\0';
|
||||
g_snprintf (dstr, 32, "%" GST_TIME_FORMAT, GST_TIME_ARGS (dur));
|
||||
dstr[9] = '\0';
|
||||
g_print ("%s / %s %s\r", pstr, dstr, status);
|
||||
gst_print ("%s / %s %s\r", pstr, dstr, status);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
state_changed_cb (GstPlayer * player, GstPlayerState state, GstPlay * play)
|
||||
{
|
||||
g_print ("State changed: %s\n", gst_player_state_get_name (state));
|
||||
gst_print ("State changed: %s\n", gst_player_state_get_name (state));
|
||||
}
|
||||
|
||||
static void
|
||||
buffering_cb (GstPlayer * player, gint percent, GstPlay * play)
|
||||
{
|
||||
g_print ("Buffering: %d\n", percent);
|
||||
gst_print ("Buffering: %d\n", percent);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -127,22 +127,22 @@ print_one_tag (const GstTagList * list, const gchar * tag, gpointer user_data)
|
|||
|
||||
val = gst_tag_list_get_value_index (list, tag, i);
|
||||
if (G_VALUE_HOLDS_STRING (val)) {
|
||||
g_print (" %s : %s \n", tag, g_value_get_string (val));
|
||||
gst_print (" %s : %s \n", tag, g_value_get_string (val));
|
||||
} else if (G_VALUE_HOLDS_UINT (val)) {
|
||||
g_print (" %s : %u \n", tag, g_value_get_uint (val));
|
||||
gst_print (" %s : %u \n", tag, g_value_get_uint (val));
|
||||
} else if (G_VALUE_HOLDS_DOUBLE (val)) {
|
||||
g_print (" %s : %g \n", tag, g_value_get_double (val));
|
||||
gst_print (" %s : %g \n", tag, g_value_get_double (val));
|
||||
} else if (G_VALUE_HOLDS_BOOLEAN (val)) {
|
||||
g_print (" %s : %s \n", tag,
|
||||
gst_print (" %s : %s \n", tag,
|
||||
g_value_get_boolean (val) ? "true" : "false");
|
||||
} else if (GST_VALUE_HOLDS_DATE_TIME (val)) {
|
||||
GstDateTime *dt = g_value_get_boxed (val);
|
||||
gchar *dt_str = gst_date_time_to_iso8601_string (dt);
|
||||
|
||||
g_print (" %s : %s \n", tag, dt_str);
|
||||
gst_print (" %s : %s \n", tag, dt_str);
|
||||
g_free (dt_str);
|
||||
} else {
|
||||
g_print (" %s : tag of type '%s' \n", tag, G_VALUE_TYPE_NAME (val));
|
||||
gst_print (" %s : tag of type '%s' \n", tag, G_VALUE_TYPE_NAME (val));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,15 +156,15 @@ print_video_info (GstPlayerVideoInfo * info)
|
|||
if (info == NULL)
|
||||
return;
|
||||
|
||||
g_print (" width : %d\n", gst_player_video_info_get_width (info));
|
||||
g_print (" height : %d\n", gst_player_video_info_get_height (info));
|
||||
g_print (" max_bitrate : %d\n",
|
||||
gst_print (" width : %d\n", gst_player_video_info_get_width (info));
|
||||
gst_print (" height : %d\n", gst_player_video_info_get_height (info));
|
||||
gst_print (" max_bitrate : %d\n",
|
||||
gst_player_video_info_get_max_bitrate (info));
|
||||
g_print (" bitrate : %d\n", gst_player_video_info_get_bitrate (info));
|
||||
gst_print (" bitrate : %d\n", gst_player_video_info_get_bitrate (info));
|
||||
gst_player_video_info_get_framerate (info, &fps_n, &fps_d);
|
||||
g_print (" framerate : %.2f\n", (gdouble) fps_n / fps_d);
|
||||
gst_print (" framerate : %.2f\n", (gdouble) fps_n / fps_d);
|
||||
gst_player_video_info_get_pixel_aspect_ratio (info, &par_n, &par_d);
|
||||
g_print (" pixel-aspect-ratio %u:%u\n", par_n, par_d);
|
||||
gst_print (" pixel-aspect-ratio %u:%u\n", par_n, par_d);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -173,13 +173,13 @@ print_audio_info (GstPlayerAudioInfo * info)
|
|||
if (info == NULL)
|
||||
return;
|
||||
|
||||
g_print (" sample rate : %d\n",
|
||||
gst_print (" sample rate : %d\n",
|
||||
gst_player_audio_info_get_sample_rate (info));
|
||||
g_print (" channels : %d\n", gst_player_audio_info_get_channels (info));
|
||||
g_print (" max_bitrate : %d\n",
|
||||
gst_print (" channels : %d\n", gst_player_audio_info_get_channels (info));
|
||||
gst_print (" max_bitrate : %d\n",
|
||||
gst_player_audio_info_get_max_bitrate (info));
|
||||
g_print (" bitrate : %d\n", gst_player_audio_info_get_bitrate (info));
|
||||
g_print (" language : %s\n", gst_player_audio_info_get_language (info));
|
||||
gst_print (" bitrate : %d\n", gst_player_audio_info_get_bitrate (info));
|
||||
gst_print (" language : %s\n", gst_player_audio_info_get_language (info));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -188,7 +188,7 @@ print_subtitle_info (GstPlayerSubtitleInfo * info)
|
|||
if (info == NULL)
|
||||
return;
|
||||
|
||||
g_print (" language : %s\n", gst_player_subtitle_info_get_language (info));
|
||||
gst_print (" language : %s\n", gst_player_subtitle_info_get_language (info));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -197,31 +197,31 @@ print_all_stream_info (GstPlayerMediaInfo * media_info)
|
|||
guint count = 0;
|
||||
GList *list, *l;
|
||||
|
||||
g_print ("URI : %s\n", gst_player_media_info_get_uri (media_info));
|
||||
g_print ("Duration: %" GST_TIME_FORMAT "\n",
|
||||
gst_print ("URI : %s\n", gst_player_media_info_get_uri (media_info));
|
||||
gst_print ("Duration: %" GST_TIME_FORMAT "\n",
|
||||
GST_TIME_ARGS (gst_player_media_info_get_duration (media_info)));
|
||||
g_print ("Global taglist:\n");
|
||||
gst_print ("Global taglist:\n");
|
||||
if (gst_player_media_info_get_tags (media_info))
|
||||
gst_tag_list_foreach (gst_player_media_info_get_tags (media_info),
|
||||
print_one_tag, NULL);
|
||||
else
|
||||
g_print (" (nil) \n");
|
||||
gst_print (" (nil) \n");
|
||||
|
||||
list = gst_player_media_info_get_stream_list (media_info);
|
||||
if (!list)
|
||||
return;
|
||||
|
||||
g_print ("All Stream information\n");
|
||||
gst_print ("All Stream information\n");
|
||||
for (l = list; l != NULL; l = l->next) {
|
||||
GstTagList *tags = NULL;
|
||||
GstPlayerStreamInfo *stream = (GstPlayerStreamInfo *) l->data;
|
||||
|
||||
g_print (" Stream # %u \n", count++);
|
||||
g_print (" type : %s_%u\n",
|
||||
gst_print (" Stream # %u \n", count++);
|
||||
gst_print (" type : %s_%u\n",
|
||||
gst_player_stream_info_get_stream_type (stream),
|
||||
gst_player_stream_info_get_index (stream));
|
||||
tags = gst_player_stream_info_get_tags (stream);
|
||||
g_print (" taglist : \n");
|
||||
gst_print (" taglist : \n");
|
||||
if (tags) {
|
||||
gst_tag_list_foreach (tags, print_one_tag, NULL);
|
||||
}
|
||||
|
@ -244,11 +244,11 @@ print_all_video_stream (GstPlayerMediaInfo * media_info)
|
|||
if (!list)
|
||||
return;
|
||||
|
||||
g_print ("All video streams\n");
|
||||
gst_print ("All video streams\n");
|
||||
for (l = list; l != NULL; l = l->next) {
|
||||
GstPlayerVideoInfo *info = (GstPlayerVideoInfo *) l->data;
|
||||
GstPlayerStreamInfo *sinfo = (GstPlayerStreamInfo *) info;
|
||||
g_print (" %s_%d #\n", gst_player_stream_info_get_stream_type (sinfo),
|
||||
gst_print (" %s_%d #\n", gst_player_stream_info_get_stream_type (sinfo),
|
||||
gst_player_stream_info_get_index (sinfo));
|
||||
print_video_info (info);
|
||||
}
|
||||
|
@ -263,11 +263,11 @@ print_all_subtitle_stream (GstPlayerMediaInfo * media_info)
|
|||
if (!list)
|
||||
return;
|
||||
|
||||
g_print ("All subtitle streams:\n");
|
||||
gst_print ("All subtitle streams:\n");
|
||||
for (l = list; l != NULL; l = l->next) {
|
||||
GstPlayerSubtitleInfo *info = (GstPlayerSubtitleInfo *) l->data;
|
||||
GstPlayerStreamInfo *sinfo = (GstPlayerStreamInfo *) info;
|
||||
g_print (" %s_%d #\n", gst_player_stream_info_get_stream_type (sinfo),
|
||||
gst_print (" %s_%d #\n", gst_player_stream_info_get_stream_type (sinfo),
|
||||
gst_player_stream_info_get_index (sinfo));
|
||||
print_subtitle_info (info);
|
||||
}
|
||||
|
@ -282,11 +282,11 @@ print_all_audio_stream (GstPlayerMediaInfo * media_info)
|
|||
if (!list)
|
||||
return;
|
||||
|
||||
g_print ("All audio streams: \n");
|
||||
gst_print ("All audio streams: \n");
|
||||
for (l = list; l != NULL; l = l->next) {
|
||||
GstPlayerAudioInfo *info = (GstPlayerAudioInfo *) l->data;
|
||||
GstPlayerStreamInfo *sinfo = (GstPlayerStreamInfo *) info;
|
||||
g_print (" %s_%d #\n", gst_player_stream_info_get_stream_type (sinfo),
|
||||
gst_print (" %s_%d #\n", gst_player_stream_info_get_stream_type (sinfo),
|
||||
gst_player_stream_info_get_index (sinfo));
|
||||
print_audio_info (info);
|
||||
}
|
||||
|
@ -299,15 +299,15 @@ print_current_tracks (GstPlay * play)
|
|||
GstPlayerVideoInfo *video = NULL;
|
||||
GstPlayerSubtitleInfo *subtitle = NULL;
|
||||
|
||||
g_print ("Current video track: \n");
|
||||
gst_print ("Current video track: \n");
|
||||
video = gst_player_get_current_video_track (play->player);
|
||||
print_video_info (video);
|
||||
|
||||
g_print ("Current audio track: \n");
|
||||
gst_print ("Current audio track: \n");
|
||||
audio = gst_player_get_current_audio_track (play->player);
|
||||
print_audio_info (audio);
|
||||
|
||||
g_print ("Current subtitle track: \n");
|
||||
gst_print ("Current subtitle track: \n");
|
||||
subtitle = gst_player_get_current_subtitle_track (play->player);
|
||||
print_subtitle_info (subtitle);
|
||||
|
||||
|
@ -325,11 +325,11 @@ static void
|
|||
print_media_info (GstPlayerMediaInfo * media_info)
|
||||
{
|
||||
print_all_stream_info (media_info);
|
||||
g_print ("\n");
|
||||
gst_print ("\n");
|
||||
print_all_video_stream (media_info);
|
||||
g_print ("\n");
|
||||
gst_print ("\n");
|
||||
print_all_audio_stream (media_info);
|
||||
g_print ("\n");
|
||||
gst_print ("\n");
|
||||
print_all_subtitle_stream (media_info);
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ play_set_relative_volume (GstPlay * play, gdouble volume_step)
|
|||
|
||||
g_object_set (play->player, "volume", volume, NULL);
|
||||
|
||||
g_print ("Volume: %.0f%% \n", volume * 100);
|
||||
gst_print ("Volume: %.0f%% \n", volume * 100);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
|
@ -438,7 +438,7 @@ play_uri (GstPlay * play, const gchar * next_uri)
|
|||
play_reset (play);
|
||||
|
||||
loc = play_uri_get_display_name (play, next_uri);
|
||||
g_print ("Now playing %s\n", loc);
|
||||
gst_print ("Now playing %s\n", loc);
|
||||
g_free (loc);
|
||||
|
||||
g_object_set (play->player, "uri", next_uri, NULL);
|
||||
|
@ -451,7 +451,7 @@ play_next (GstPlay * play)
|
|||
{
|
||||
if ((play->cur_idx + 1) >= play->num_uris) {
|
||||
if (play->repeat) {
|
||||
g_print ("Looping playlist \n");
|
||||
gst_print ("Looping playlist \n");
|
||||
play->cur_idx = -1;
|
||||
} else
|
||||
return FALSE;
|
||||
|
@ -567,7 +567,7 @@ relative_seek (GstPlay * play, gdouble percent)
|
|||
g_object_get (play->player, "position", &pos, "duration", &dur, NULL);
|
||||
|
||||
if (dur <= 0) {
|
||||
g_print ("\nCould not seek.\n");
|
||||
gst_print ("\nCould not seek.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -602,7 +602,7 @@ keyboard_cb (const gchar * key_input, gpointer user_data)
|
|||
break;
|
||||
case '>':
|
||||
if (!play_next (play)) {
|
||||
g_print ("\nReached end of play list.\n");
|
||||
gst_print ("\nReached end of play list.\n");
|
||||
g_main_loop_quit (play->loop);
|
||||
}
|
||||
break;
|
||||
|
@ -671,7 +671,7 @@ main (int argc, char **argv)
|
|||
g_option_context_add_main_entries (ctx, options, NULL);
|
||||
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", GST_STR_NULL (err->message));
|
||||
gst_print ("Error initializing: %s\n", GST_STR_NULL (err->message));
|
||||
g_clear_error (&err);
|
||||
g_option_context_free (ctx);
|
||||
return 1;
|
||||
|
@ -684,8 +684,8 @@ main (int argc, char **argv)
|
|||
gchar *version_str;
|
||||
|
||||
version_str = gst_version_string ();
|
||||
g_print ("%s version %s\n", g_get_prgname (), "1.0");
|
||||
g_print ("%s\n", version_str);
|
||||
gst_print ("%s version %s\n", g_get_prgname (), "1.0");
|
||||
gst_print ("%s\n", version_str);
|
||||
g_free (version_str);
|
||||
|
||||
g_free (playlist_file);
|
||||
|
@ -712,7 +712,7 @@ main (int argc, char **argv)
|
|||
g_strfreev (lines);
|
||||
g_free (playlist_contents);
|
||||
} else {
|
||||
g_printerr ("Could not read playlist: %s\n", err->message);
|
||||
gst_printerr ("Could not read playlist: %s\n", err->message);
|
||||
g_clear_error (&err);
|
||||
}
|
||||
g_free (playlist_file);
|
||||
|
@ -720,10 +720,10 @@ main (int argc, char **argv)
|
|||
}
|
||||
|
||||
if (playlist->len == 0 && (filenames == NULL || *filenames == NULL)) {
|
||||
g_printerr ("Usage: %s FILE1|URI1 [FILE2|URI2] [FILE3|URI3] ...",
|
||||
gst_printerr ("Usage: %s FILE1|URI1 [FILE2|URI2] [FILE3|URI3] ...",
|
||||
"gst-play");
|
||||
g_printerr ("\n\n"),
|
||||
g_printerr ("%s\n\n",
|
||||
gst_printerr ("\n\n"),
|
||||
gst_printerr ("%s\n\n",
|
||||
"You must provide at least one filename or URI to play.");
|
||||
/* No input provided. Free array */
|
||||
g_ptr_array_free (playlist, TRUE);
|
||||
|
@ -757,7 +757,7 @@ main (int argc, char **argv)
|
|||
if (gst_play_kb_set_key_handler (keyboard_cb, play)) {
|
||||
atexit (restore_terminal);
|
||||
} else {
|
||||
g_print ("Interactive keyboard handling in terminal not available.\n");
|
||||
gst_print ("Interactive keyboard handling in terminal not available.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -767,7 +767,7 @@ main (int argc, char **argv)
|
|||
/* clean up */
|
||||
play_free (play);
|
||||
|
||||
g_print ("\n");
|
||||
gst_print ("\n");
|
||||
gst_deinit ();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ load_from_builder (const gchar * filename, gboolean register_sig_handler,
|
|||
|
||||
builder = gtk_builder_new_from_resource (filename);
|
||||
if (builder == NULL) {
|
||||
g_print ("ERROR: failed to load %s \n", filename);
|
||||
gst_print ("ERROR: failed to load %s \n", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1358,7 +1358,7 @@ gtk_widget_apply_css (GtkWidget * widget, const gchar * filename)
|
|||
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
|
||||
bytes = g_resources_lookup_data (filename, 0, &err);
|
||||
if (err) {
|
||||
g_print ("ERROR: failed to apply css %s '%s' \n", filename, err->message);
|
||||
gst_print ("ERROR: failed to apply css %s '%s' \n", filename, err->message);
|
||||
return;
|
||||
}
|
||||
data = g_bytes_get_data (bytes, &data_size);
|
||||
|
@ -1612,12 +1612,12 @@ gtk_play_get_cover_image (GstPlayerMediaInfo * media_info)
|
|||
if ((type != GST_TAG_IMAGE_TYPE_FRONT_COVER) &&
|
||||
(type != GST_TAG_IMAGE_TYPE_UNDEFINED) &&
|
||||
(type != GST_TAG_IMAGE_TYPE_NONE)) {
|
||||
g_print ("unsupport type ... %d \n", type);
|
||||
gst_print ("unsupport type ... %d \n", type);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!gst_buffer_map (buffer, &info, GST_MAP_READ)) {
|
||||
g_print ("failed to map gst buffer \n");
|
||||
gst_print ("failed to map gst buffer \n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1628,7 +1628,7 @@ gtk_play_get_cover_image (GstPlayerMediaInfo * media_info)
|
|||
if (pixbuf) {
|
||||
g_object_ref (pixbuf);
|
||||
} else {
|
||||
g_print ("failed to convert gst buffer to pixbuf %s \n", err->message);
|
||||
gst_print ("failed to convert gst buffer to pixbuf %s \n", err->message);
|
||||
g_error_free (err);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -184,12 +184,12 @@ void MediaInfo::update(GstPlayerMediaInfo *info)
|
|||
if ((type != GST_TAG_IMAGE_TYPE_FRONT_COVER) &&
|
||||
(type != GST_TAG_IMAGE_TYPE_UNDEFINED) &&
|
||||
(type != GST_TAG_IMAGE_TYPE_NONE)) {
|
||||
g_print ("unsupport type ... %d \n", type);
|
||||
gst_print ("unsupport type ... %d \n", type);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gst_buffer_map (buffer, &map_info, GST_MAP_READ)) {
|
||||
g_print ("failed to map gst buffer \n");
|
||||
gst_print ("failed to map gst buffer \n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ static gboolean
|
|||
cleanup_and_quit_loop (const gchar * msg, enum AppState state)
|
||||
{
|
||||
if (msg)
|
||||
g_printerr ("%s\n", msg);
|
||||
gst_printerr ("%s\n", msg);
|
||||
if (state > 0)
|
||||
app_state = state;
|
||||
|
||||
|
@ -153,7 +153,7 @@ on_incoming_decodebin_stream (GstElement * decodebin, GstPad * pad,
|
|||
const gchar *name;
|
||||
|
||||
if (!gst_pad_has_current_caps (pad)) {
|
||||
g_printerr ("Pad '%s' has no caps, can't do anything, ignoring\n",
|
||||
gst_printerr ("Pad '%s' has no caps, can't do anything, ignoring\n",
|
||||
GST_PAD_NAME (pad));
|
||||
return;
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ on_incoming_decodebin_stream (GstElement * decodebin, GstPad * pad,
|
|||
} else if (g_str_has_prefix (name, "audio")) {
|
||||
handle_media_stream (pad, pipe, "audioconvert", "autoaudiosink");
|
||||
} else {
|
||||
g_printerr ("Unknown pad %s, ignoring", GST_PAD_NAME (pad));
|
||||
gst_printerr ("Unknown pad %s, ignoring", GST_PAD_NAME (pad));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ send_room_peer_sdp (GstWebRTCSessionDescription * desc, const gchar * peer_id)
|
|||
g_assert_not_reached ();
|
||||
|
||||
text = gst_sdp_message_as_text (desc->sdp);
|
||||
g_print ("Sending sdp %s to %s:\n%s\n", sdptype, peer_id, text);
|
||||
gst_print ("Sending sdp %s to %s:\n%s\n", sdptype, peer_id, text);
|
||||
|
||||
sdp = json_object_new ();
|
||||
json_object_set_string_member (sdp, "type", sdptype);
|
||||
|
@ -420,12 +420,12 @@ start_pipeline (void)
|
|||
"queue ! " RTP_CAPS_OPUS (96) " ! audiotee. ", &error);
|
||||
|
||||
if (error) {
|
||||
g_printerr ("Failed to parse launch: %s\n", error->message);
|
||||
gst_printerr ("Failed to parse launch: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
goto err;
|
||||
}
|
||||
|
||||
g_print ("Starting pipeline, not transmitting yet\n");
|
||||
gst_print ("Starting pipeline, not transmitting yet\n");
|
||||
ret = gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||
if (ret == GST_STATE_CHANGE_FAILURE)
|
||||
goto err;
|
||||
|
@ -433,7 +433,7 @@ start_pipeline (void)
|
|||
return TRUE;
|
||||
|
||||
err:
|
||||
g_print ("State change failure\n");
|
||||
gst_print ("State change failure\n");
|
||||
if (pipeline)
|
||||
g_clear_object (&pipeline);
|
||||
return FALSE;
|
||||
|
@ -451,7 +451,7 @@ join_room_on_server (void)
|
|||
if (!room_id)
|
||||
return FALSE;
|
||||
|
||||
g_print ("Joining room %s\n", room_id);
|
||||
gst_print ("Joining room %s\n", room_id);
|
||||
app_state = ROOM_JOINING;
|
||||
msg = g_strdup_printf ("ROOM %s", room_id);
|
||||
soup_websocket_connection_send_text (ws_conn, msg);
|
||||
|
@ -468,7 +468,7 @@ register_with_server (void)
|
|||
SOUP_WEBSOCKET_STATE_OPEN)
|
||||
return FALSE;
|
||||
|
||||
g_print ("Registering id %s with server\n", local_id);
|
||||
gst_print ("Registering id %s with server\n", local_id);
|
||||
app_state = SERVER_REGISTERING;
|
||||
|
||||
/* Register with the server with a random integer id. Reply will be received
|
||||
|
@ -497,7 +497,7 @@ do_registration (void)
|
|||
return FALSE;
|
||||
}
|
||||
app_state = SERVER_REGISTERED;
|
||||
g_print ("Registered with server\n");
|
||||
gst_print ("Registered with server\n");
|
||||
/* Ask signalling server that we want to join a room */
|
||||
if (!join_room_on_server ()) {
|
||||
cleanup_and_quit_loop ("ERROR: Failed to join room", ROOM_CALL_ERROR);
|
||||
|
@ -523,7 +523,7 @@ do_join_room (const gchar * text)
|
|||
}
|
||||
|
||||
app_state = ROOM_JOINED;
|
||||
g_print ("Room joined\n");
|
||||
gst_print ("Room joined\n");
|
||||
/* Start recording, but not transmitting */
|
||||
if (!start_pipeline ()) {
|
||||
cleanup_and_quit_loop ("ERROR: Failed to start pipeline", ROOM_CALL_ERROR);
|
||||
|
@ -536,11 +536,11 @@ do_join_room (const gchar * text)
|
|||
/* There are peers in the room already. We need to start negotiation
|
||||
* (exchange SDP and ICE candidates) and transmission of media. */
|
||||
if (len > 1 && strlen (peer_ids[1]) > 0) {
|
||||
g_print ("Found %i peers already in room\n", len - 1);
|
||||
gst_print ("Found %i peers already in room\n", len - 1);
|
||||
app_state = ROOM_CALL_OFFERING;
|
||||
for (ii = 1; ii < len; ii++) {
|
||||
gchar *peer_id = g_strdup (peer_ids[ii]);
|
||||
g_print ("Negotiating with peer %s\n", peer_id);
|
||||
gst_print ("Negotiating with peer %s\n", peer_id);
|
||||
/* This might fail asynchronously */
|
||||
call_peer (peer_id);
|
||||
peers = g_list_prepend (peers, peer_id);
|
||||
|
@ -621,7 +621,7 @@ handle_sdp_offer (const gchar * peer_id, const gchar * text)
|
|||
|
||||
g_assert_cmpint (app_state, ==, ROOM_CALL_ANSWERING);
|
||||
|
||||
g_print ("Received offer:\n%s\n", text);
|
||||
gst_print ("Received offer:\n%s\n", text);
|
||||
|
||||
ret = gst_sdp_message_new (&sdp);
|
||||
g_assert_cmpint (ret, ==, GST_SDP_OK);
|
||||
|
@ -661,7 +661,7 @@ handle_sdp_answer (const gchar * peer_id, const gchar * text)
|
|||
|
||||
g_assert_cmpint (app_state, >=, ROOM_CALL_OFFERING);
|
||||
|
||||
g_print ("Received answer:\n%s\n", text);
|
||||
gst_print ("Received answer:\n%s\n", text);
|
||||
|
||||
ret = gst_sdp_message_new (&sdp);
|
||||
g_assert_cmpint (ret, ==, GST_SDP_OK);
|
||||
|
@ -690,19 +690,20 @@ handle_peer_message (const gchar * peer_id, const gchar * msg)
|
|||
JsonObject *object, *child;
|
||||
JsonParser *parser = json_parser_new ();
|
||||
if (!json_parser_load_from_data (parser, msg, -1, NULL)) {
|
||||
g_printerr ("Unknown message '%s' from '%s', ignoring", msg, peer_id);
|
||||
gst_printerr ("Unknown message '%s' from '%s', ignoring", msg, peer_id);
|
||||
g_object_unref (parser);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
root = json_parser_get_root (parser);
|
||||
if (!JSON_NODE_HOLDS_OBJECT (root)) {
|
||||
g_printerr ("Unknown json message '%s' from '%s', ignoring", msg, peer_id);
|
||||
gst_printerr ("Unknown json message '%s' from '%s', ignoring", msg,
|
||||
peer_id);
|
||||
g_object_unref (parser);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_print ("Message from peer %s: %s\n", peer_id, msg);
|
||||
gst_print ("Message from peer %s: %s\n", peer_id, msg);
|
||||
|
||||
object = json_node_get_object (root);
|
||||
/* Check type of JSON message */
|
||||
|
@ -750,7 +751,7 @@ handle_peer_message (const gchar * peer_id, const gchar * msg)
|
|||
candidate);
|
||||
gst_object_unref (webrtc);
|
||||
} else {
|
||||
g_printerr ("Ignoring unknown JSON message:\n%s\n", msg);
|
||||
gst_printerr ("Ignoring unknown JSON message:\n%s\n", msg);
|
||||
}
|
||||
g_object_unref (parser);
|
||||
return TRUE;
|
||||
|
@ -765,7 +766,7 @@ on_server_message (SoupWebsocketConnection * conn, SoupWebsocketDataType type,
|
|||
|
||||
switch (type) {
|
||||
case SOUP_WEBSOCKET_DATA_BINARY:
|
||||
g_printerr ("Received unknown binary message, ignoring\n");
|
||||
gst_printerr ("Received unknown binary message, ignoring\n");
|
||||
return;
|
||||
case SOUP_WEBSOCKET_DATA_TEXT:{
|
||||
gsize size;
|
||||
|
@ -803,18 +804,18 @@ on_server_message (SoupWebsocketConnection * conn, SoupWebsocketDataType type,
|
|||
peers = g_list_prepend (peers, g_strdup (splitm[1]));
|
||||
peer_id = find_peer_from_list (splitm[1]);
|
||||
g_assert_nonnull (peer_id);
|
||||
g_print ("Peer %s has joined the room\n", peer_id);
|
||||
gst_print ("Peer %s has joined the room\n", peer_id);
|
||||
} else if (g_str_has_prefix (text, "ROOM_PEER_LEFT")) {
|
||||
splitm = g_strsplit (text, " ", 2);
|
||||
peer_id = find_peer_from_list (splitm[1]);
|
||||
g_assert_nonnull (peer_id);
|
||||
peers = g_list_remove (peers, peer_id);
|
||||
g_print ("Peer %s has left the room\n", peer_id);
|
||||
gst_print ("Peer %s has left the room\n", peer_id);
|
||||
remove_peer_from_pipeline (peer_id);
|
||||
g_free ((gchar *) peer_id);
|
||||
/* TODO: cleanup pipeline */
|
||||
} else {
|
||||
g_printerr ("WARNING: Ignoring unknown message %s\n", text);
|
||||
gst_printerr ("WARNING: Ignoring unknown message %s\n", text);
|
||||
}
|
||||
g_strfreev (splitm);
|
||||
} else {
|
||||
|
@ -856,7 +857,7 @@ on_server_connected (SoupSession * session, GAsyncResult * res,
|
|||
g_assert_nonnull (ws_conn);
|
||||
|
||||
app_state = SERVER_CONNECTED;
|
||||
g_print ("Connected to signalling server\n");
|
||||
gst_print ("Connected to signalling server\n");
|
||||
|
||||
g_signal_connect (ws_conn, "closed", G_CALLBACK (on_server_closed), NULL);
|
||||
g_signal_connect (ws_conn, "message", G_CALLBACK (on_server_message), NULL);
|
||||
|
@ -888,7 +889,7 @@ connect_to_websocket_server_async (void)
|
|||
|
||||
message = soup_message_new (SOUP_METHOD_GET, server_url);
|
||||
|
||||
g_print ("Connecting to server...\n");
|
||||
gst_print ("Connecting to server...\n");
|
||||
|
||||
/* Once connected, we will register */
|
||||
soup_session_websocket_connect_async (session, message, NULL, NULL, NULL,
|
||||
|
@ -912,7 +913,7 @@ check_plugins (void)
|
|||
GstPlugin *plugin;
|
||||
plugin = gst_registry_find_plugin (registry, needed[i]);
|
||||
if (!plugin) {
|
||||
g_print ("Required gstreamer plugin '%s' not found\n", needed[i]);
|
||||
gst_print ("Required gstreamer plugin '%s' not found\n", needed[i]);
|
||||
ret = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
@ -931,7 +932,7 @@ main (int argc, char *argv[])
|
|||
g_option_context_add_main_entries (context, entries, NULL);
|
||||
g_option_context_add_group (context, gst_init_get_option_group ());
|
||||
if (!g_option_context_parse (context, &argc, &argv, &error)) {
|
||||
g_printerr ("Error initializing: %s\n", error->message);
|
||||
gst_printerr ("Error initializing: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -939,7 +940,7 @@ main (int argc, char *argv[])
|
|||
return -1;
|
||||
|
||||
if (!room_id) {
|
||||
g_printerr ("--room-id is a required argument\n");
|
||||
gst_printerr ("--room-id is a required argument\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -949,7 +950,7 @@ main (int argc, char *argv[])
|
|||
/* Sanitize by removing whitespace, modifies string in-place */
|
||||
g_strdelimit (local_id, " \t\n\r", '-');
|
||||
|
||||
g_print ("Our local id is %s\n", local_id);
|
||||
gst_print ("Our local id is %s\n", local_id);
|
||||
|
||||
if (!server_url)
|
||||
server_url = g_strdup (default_server_url);
|
||||
|
@ -971,7 +972,7 @@ main (int argc, char *argv[])
|
|||
g_main_loop_run (loop);
|
||||
|
||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
|
||||
g_print ("Pipeline stopped\n");
|
||||
gst_print ("Pipeline stopped\n");
|
||||
|
||||
gst_object_unref (pipeline);
|
||||
g_free (server_url);
|
||||
|
|
|
@ -190,7 +190,7 @@ handle_media_stream (GstPad * pad, GstElement * pipe, const char *convert_name,
|
|||
GstElement *q, *conv, *resample, *sink;
|
||||
GstPadLinkReturn ret;
|
||||
|
||||
g_print ("Trying to handle stream with %s ! %s", convert_name, sink_name);
|
||||
gst_print ("Trying to handle stream with %s ! %s", convert_name, sink_name);
|
||||
|
||||
q = gst_element_factory_make ("queue", NULL);
|
||||
g_assert_nonnull (q);
|
||||
|
@ -232,7 +232,7 @@ on_incoming_decodebin_stream (GstElement * decodebin, GstPad * pad,
|
|||
const gchar *name;
|
||||
|
||||
if (!gst_pad_has_current_caps (pad)) {
|
||||
g_printerr ("Pad '%s' has no caps, can't do anything, ignoring\n",
|
||||
gst_printerr ("Pad '%s' has no caps, can't do anything, ignoring\n",
|
||||
GST_PAD_NAME (pad));
|
||||
return;
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ on_incoming_decodebin_stream (GstElement * decodebin, GstPad * pad,
|
|||
} else if (g_str_has_prefix (name, "audio")) {
|
||||
handle_media_stream (pad, pipe, "audioconvert", "autoaudiosink");
|
||||
} else {
|
||||
g_printerr ("Unknown pad %s, ignoring", GST_PAD_NAME (pad));
|
||||
gst_printerr ("Unknown pad %s, ignoring", GST_PAD_NAME (pad));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ on_offer_created_cb (GstPromise * promise, gpointer user_data)
|
|||
gst_promise_unref (local_desc_promise);
|
||||
|
||||
sdp_string = gst_sdp_message_as_text (offer->sdp);
|
||||
g_print ("Negotiation offer created:\n%s\n", sdp_string);
|
||||
gst_print ("Negotiation offer created:\n%s\n", sdp_string);
|
||||
|
||||
sdp_json = json_object_new ();
|
||||
json_object_set_string_member (sdp_json, "type", "sdp");
|
||||
|
@ -413,7 +413,7 @@ on_negotiation_needed_cb (GstElement * webrtcbin, gpointer user_data)
|
|||
GstPromise *promise;
|
||||
ReceiverEntry *receiver_entry = (ReceiverEntry *) user_data;
|
||||
|
||||
g_print ("Creating negotiation offer\n");
|
||||
gst_print ("Creating negotiation offer\n");
|
||||
|
||||
promise = gst_promise_new_with_change_func (on_offer_created_cb,
|
||||
(gpointer) receiver_entry, NULL);
|
||||
|
@ -525,7 +525,7 @@ soup_websocket_message_cb (G_GNUC_UNUSED SoupWebsocketConnection * connection,
|
|||
}
|
||||
sdp_string = json_object_get_string_member (data_json_object, "sdp");
|
||||
|
||||
g_print ("Received SDP:\n%s\n", sdp_string);
|
||||
gst_print ("Received SDP:\n%s\n", sdp_string);
|
||||
|
||||
ret = gst_sdp_message_new (&sdp);
|
||||
g_assert_cmphex (ret, ==, GST_SDP_OK);
|
||||
|
@ -566,7 +566,7 @@ soup_websocket_message_cb (G_GNUC_UNUSED SoupWebsocketConnection * connection,
|
|||
candidate_string = json_object_get_string_member (data_json_object,
|
||||
"candidate");
|
||||
|
||||
g_print ("Received ICE candidate with mline index %u; candidate: %s\n",
|
||||
gst_print ("Received ICE candidate with mline index %u; candidate: %s\n",
|
||||
mline_index, candidate_string);
|
||||
|
||||
g_signal_emit_by_name (receiver_entry->webrtcbin, "add-ice-candidate",
|
||||
|
@ -592,7 +592,7 @@ soup_websocket_closed_cb (SoupWebsocketConnection * connection,
|
|||
{
|
||||
GHashTable *receiver_entry_table = (GHashTable *) user_data;
|
||||
g_hash_table_remove (receiver_entry_table, connection);
|
||||
g_print ("Closed websocket connection %p\n", (gpointer) connection);
|
||||
gst_print ("Closed websocket connection %p\n", (gpointer) connection);
|
||||
}
|
||||
|
||||
|
||||
|
@ -629,7 +629,7 @@ soup_websocket_handler (G_GNUC_UNUSED SoupServer * server,
|
|||
ReceiverEntry *receiver_entry;
|
||||
GHashTable *receiver_entry_table = (GHashTable *) user_data;
|
||||
|
||||
g_print ("Processing new websocket connection %p", (gpointer) connection);
|
||||
gst_print ("Processing new websocket connection %p", (gpointer) connection);
|
||||
|
||||
g_signal_connect (G_OBJECT (connection), "closed",
|
||||
G_CALLBACK (soup_websocket_closed_cb), (gpointer) receiver_entry_table);
|
||||
|
@ -662,7 +662,7 @@ get_string_from_json_object (JsonObject * object)
|
|||
gboolean
|
||||
exit_sighandler (gpointer user_data)
|
||||
{
|
||||
g_print ("Caught signal, stopping mainloop\n");
|
||||
gst_print ("Caught signal, stopping mainloop\n");
|
||||
GMainLoop *mainloop = (GMainLoop *) user_data;
|
||||
g_main_loop_quit (mainloop);
|
||||
return TRUE;
|
||||
|
@ -699,7 +699,7 @@ main (int argc, char *argv[])
|
|||
soup_server_listen_all (soup_server, SOUP_HTTP_PORT,
|
||||
(SoupServerListenOptions) 0, NULL);
|
||||
|
||||
g_print ("WebRTC page link: http://127.0.0.1:%d/\n", (gint) SOUP_HTTP_PORT);
|
||||
gst_print ("WebRTC page link: http://127.0.0.1:%d/\n", (gint) SOUP_HTTP_PORT);
|
||||
|
||||
g_main_loop_run (mainloop);
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ on_offer_created_cb (GstPromise * promise, gpointer user_data)
|
|||
gst_promise_unref (local_desc_promise);
|
||||
|
||||
sdp_string = gst_sdp_message_as_text (offer->sdp);
|
||||
g_print ("Negotiation offer created:\n%s\n", sdp_string);
|
||||
gst_print ("Negotiation offer created:\n%s\n", sdp_string);
|
||||
|
||||
sdp_json = json_object_new ();
|
||||
json_object_set_string_member (sdp_json, "type", "sdp");
|
||||
|
@ -287,7 +287,7 @@ on_negotiation_needed_cb (GstElement * webrtcbin, gpointer user_data)
|
|||
GstPromise *promise;
|
||||
ReceiverEntry *receiver_entry = (ReceiverEntry *) user_data;
|
||||
|
||||
g_print ("Creating negotiation offer\n");
|
||||
gst_print ("Creating negotiation offer\n");
|
||||
|
||||
promise = gst_promise_new_with_change_func (on_offer_created_cb,
|
||||
(gpointer) receiver_entry, NULL);
|
||||
|
@ -399,7 +399,7 @@ soup_websocket_message_cb (G_GNUC_UNUSED SoupWebsocketConnection * connection,
|
|||
}
|
||||
sdp_string = json_object_get_string_member (data_json_object, "sdp");
|
||||
|
||||
g_print ("Received SDP:\n%s\n", sdp_string);
|
||||
gst_print ("Received SDP:\n%s\n", sdp_string);
|
||||
|
||||
ret = gst_sdp_message_new (&sdp);
|
||||
g_assert_cmphex (ret, ==, GST_SDP_OK);
|
||||
|
@ -440,7 +440,7 @@ soup_websocket_message_cb (G_GNUC_UNUSED SoupWebsocketConnection * connection,
|
|||
candidate_string = json_object_get_string_member (data_json_object,
|
||||
"candidate");
|
||||
|
||||
g_print ("Received ICE candidate with mline index %u; candidate: %s\n",
|
||||
gst_print ("Received ICE candidate with mline index %u; candidate: %s\n",
|
||||
mline_index, candidate_string);
|
||||
|
||||
g_signal_emit_by_name (receiver_entry->webrtcbin, "add-ice-candidate",
|
||||
|
@ -466,7 +466,7 @@ soup_websocket_closed_cb (SoupWebsocketConnection * connection,
|
|||
{
|
||||
GHashTable *receiver_entry_table = (GHashTable *) user_data;
|
||||
g_hash_table_remove (receiver_entry_table, connection);
|
||||
g_print ("Closed websocket connection %p\n", (gpointer) connection);
|
||||
gst_print ("Closed websocket connection %p\n", (gpointer) connection);
|
||||
}
|
||||
|
||||
|
||||
|
@ -503,7 +503,7 @@ soup_websocket_handler (G_GNUC_UNUSED SoupServer * server,
|
|||
ReceiverEntry *receiver_entry;
|
||||
GHashTable *receiver_entry_table = (GHashTable *) user_data;
|
||||
|
||||
g_print ("Processing new websocket connection %p", (gpointer) connection);
|
||||
gst_print ("Processing new websocket connection %p", (gpointer) connection);
|
||||
|
||||
g_signal_connect (G_OBJECT (connection), "closed",
|
||||
G_CALLBACK (soup_websocket_closed_cb), (gpointer) receiver_entry_table);
|
||||
|
@ -536,7 +536,7 @@ get_string_from_json_object (JsonObject * object)
|
|||
gboolean
|
||||
exit_sighandler (gpointer user_data)
|
||||
{
|
||||
g_print ("Caught signal, stopping mainloop\n");
|
||||
gst_print ("Caught signal, stopping mainloop\n");
|
||||
GMainLoop *mainloop = (GMainLoop *) user_data;
|
||||
g_main_loop_quit (mainloop);
|
||||
return TRUE;
|
||||
|
@ -573,7 +573,7 @@ main (int argc, char *argv[])
|
|||
soup_server_listen_all (soup_server, SOUP_HTTP_PORT,
|
||||
(SoupServerListenOptions) 0, NULL);
|
||||
|
||||
g_print ("WebRTC page link: http://127.0.0.1:%d/\n", (gint) SOUP_HTTP_PORT);
|
||||
gst_print ("WebRTC page link: http://127.0.0.1:%d/\n", (gint) SOUP_HTTP_PORT);
|
||||
|
||||
g_main_loop_run (mainloop);
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ static gboolean
|
|||
cleanup_and_quit_loop (const gchar * msg, enum AppState state)
|
||||
{
|
||||
if (msg)
|
||||
g_printerr ("%s\n", msg);
|
||||
gst_printerr ("%s\n", msg);
|
||||
if (state > 0)
|
||||
app_state = state;
|
||||
|
||||
|
@ -114,7 +114,7 @@ handle_media_stream (GstPad * pad, GstElement * pipe, const char *convert_name,
|
|||
GstElement *q, *conv, *resample, *sink;
|
||||
GstPadLinkReturn ret;
|
||||
|
||||
g_print ("Trying to handle stream with %s ! %s", convert_name, sink_name);
|
||||
gst_print ("Trying to handle stream with %s ! %s", convert_name, sink_name);
|
||||
|
||||
q = gst_element_factory_make ("queue", NULL);
|
||||
g_assert_nonnull (q);
|
||||
|
@ -156,7 +156,7 @@ on_incoming_decodebin_stream (GstElement * decodebin, GstPad * pad,
|
|||
const gchar *name;
|
||||
|
||||
if (!gst_pad_has_current_caps (pad)) {
|
||||
g_printerr ("Pad '%s' has no caps, can't do anything, ignoring\n",
|
||||
gst_printerr ("Pad '%s' has no caps, can't do anything, ignoring\n",
|
||||
GST_PAD_NAME (pad));
|
||||
return;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ on_incoming_decodebin_stream (GstElement * decodebin, GstPad * pad,
|
|||
} else if (g_str_has_prefix (name, "audio")) {
|
||||
handle_media_stream (pad, pipe, "audioconvert", "autoaudiosink");
|
||||
} else {
|
||||
g_printerr ("Unknown pad %s, ignoring", GST_PAD_NAME (pad));
|
||||
gst_printerr ("Unknown pad %s, ignoring", GST_PAD_NAME (pad));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,10 +233,10 @@ send_sdp_to_peer (GstWebRTCSessionDescription * desc)
|
|||
sdp = json_object_new ();
|
||||
|
||||
if (desc->type == GST_WEBRTC_SDP_TYPE_OFFER) {
|
||||
g_print ("Sending offer:\n%s\n", text);
|
||||
gst_print ("Sending offer:\n%s\n", text);
|
||||
json_object_set_string_member (sdp, "type", "offer");
|
||||
} else if (desc->type == GST_WEBRTC_SDP_TYPE_ANSWER) {
|
||||
g_print ("Sending answer:\n%s\n", text);
|
||||
gst_print ("Sending answer:\n%s\n", text);
|
||||
json_object_set_string_member (sdp, "type", "answer");
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
|
@ -310,7 +310,7 @@ static void
|
|||
data_channel_on_open (GObject * dc, gpointer user_data)
|
||||
{
|
||||
GBytes *bytes = g_bytes_new ("data", strlen ("data"));
|
||||
g_print ("data channel opened\n");
|
||||
gst_print ("data channel opened\n");
|
||||
g_signal_emit_by_name (dc, "send-string", "Hi! from GStreamer");
|
||||
g_signal_emit_by_name (dc, "send-data", bytes);
|
||||
g_bytes_unref (bytes);
|
||||
|
@ -325,7 +325,7 @@ data_channel_on_close (GObject * dc, gpointer user_data)
|
|||
static void
|
||||
data_channel_on_message_string (GObject * dc, gchar * str, gpointer user_data)
|
||||
{
|
||||
g_print ("Received data channel message: %s\n", str);
|
||||
gst_print ("Received data channel message: %s\n", str);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -368,7 +368,7 @@ on_ice_gathering_state_notify (GstElement * webrtcbin, GParamSpec * pspec,
|
|||
new_state = "complete";
|
||||
break;
|
||||
}
|
||||
g_print ("ICE gathering state changed to %s\n", new_state);
|
||||
gst_print ("ICE gathering state changed to %s\n", new_state);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -386,7 +386,7 @@ start_pipeline (void)
|
|||
"queue ! " RTP_CAPS_OPUS "97 ! sendrecv. ", &error);
|
||||
|
||||
if (error) {
|
||||
g_printerr ("Failed to parse launch: %s\n", error->message);
|
||||
gst_printerr ("Failed to parse launch: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
goto err;
|
||||
}
|
||||
|
@ -411,10 +411,10 @@ start_pipeline (void)
|
|||
g_signal_emit_by_name (webrtc1, "create-data-channel", "channel", NULL,
|
||||
&send_channel);
|
||||
if (send_channel) {
|
||||
g_print ("Created data channel\n");
|
||||
gst_print ("Created data channel\n");
|
||||
connect_data_channel_signals (send_channel);
|
||||
} else {
|
||||
g_print ("Could not create data channel, is usrsctp available?\n");
|
||||
gst_print ("Could not create data channel, is usrsctp available?\n");
|
||||
}
|
||||
|
||||
g_signal_connect (webrtc1, "on-data-channel", G_CALLBACK (on_data_channel),
|
||||
|
@ -425,7 +425,7 @@ start_pipeline (void)
|
|||
/* Lifetime is the same as the pipeline itself */
|
||||
gst_object_unref (webrtc1);
|
||||
|
||||
g_print ("Starting pipeline\n");
|
||||
gst_print ("Starting pipeline\n");
|
||||
ret = gst_element_set_state (GST_ELEMENT (pipe1), GST_STATE_PLAYING);
|
||||
if (ret == GST_STATE_CHANGE_FAILURE)
|
||||
goto err;
|
||||
|
@ -452,7 +452,7 @@ setup_call (void)
|
|||
if (!peer_id)
|
||||
return FALSE;
|
||||
|
||||
g_print ("Setting up signalling server call with %s\n", peer_id);
|
||||
gst_print ("Setting up signalling server call with %s\n", peer_id);
|
||||
app_state = PEER_CONNECTING;
|
||||
msg = g_strdup_printf ("SESSION %s", peer_id);
|
||||
soup_websocket_connection_send_text (ws_conn, msg);
|
||||
|
@ -471,7 +471,7 @@ register_with_server (void)
|
|||
return FALSE;
|
||||
|
||||
our_id = g_random_int_range (10, 10000);
|
||||
g_print ("Registering id %i with server\n", our_id);
|
||||
gst_print ("Registering id %i with server\n", our_id);
|
||||
app_state = SERVER_REGISTERING;
|
||||
|
||||
/* Register with the server with a random integer id. Reply will be received
|
||||
|
@ -550,7 +550,7 @@ on_server_message (SoupWebsocketConnection * conn, SoupWebsocketDataType type,
|
|||
|
||||
switch (type) {
|
||||
case SOUP_WEBSOCKET_DATA_BINARY:
|
||||
g_printerr ("Received unknown binary message, ignoring\n");
|
||||
gst_printerr ("Received unknown binary message, ignoring\n");
|
||||
return;
|
||||
case SOUP_WEBSOCKET_DATA_TEXT:{
|
||||
gsize size;
|
||||
|
@ -571,7 +571,7 @@ on_server_message (SoupWebsocketConnection * conn, SoupWebsocketDataType type,
|
|||
goto out;
|
||||
}
|
||||
app_state = SERVER_REGISTERED;
|
||||
g_print ("Registered with server\n");
|
||||
gst_print ("Registered with server\n");
|
||||
/* Ask signalling server to connect us with a specific peer */
|
||||
if (!setup_call ()) {
|
||||
cleanup_and_quit_loop ("ERROR: Failed to setup call", PEER_CALL_ERROR);
|
||||
|
@ -616,14 +616,14 @@ on_server_message (SoupWebsocketConnection * conn, SoupWebsocketDataType type,
|
|||
JsonObject *object, *child;
|
||||
JsonParser *parser = json_parser_new ();
|
||||
if (!json_parser_load_from_data (parser, text, -1, NULL)) {
|
||||
g_printerr ("Unknown message '%s', ignoring", text);
|
||||
gst_printerr ("Unknown message '%s', ignoring", text);
|
||||
g_object_unref (parser);
|
||||
goto out;
|
||||
}
|
||||
|
||||
root = json_parser_get_root (parser);
|
||||
if (!JSON_NODE_HOLDS_OBJECT (root)) {
|
||||
g_printerr ("Unknown json message '%s', ignoring", text);
|
||||
gst_printerr ("Unknown json message '%s', ignoring", text);
|
||||
g_object_unref (parser);
|
||||
goto out;
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ on_server_message (SoupWebsocketConnection * conn, SoupWebsocketDataType type,
|
|||
g_assert_cmphex (ret, ==, GST_SDP_OK);
|
||||
|
||||
if (g_str_equal (sdptype, "answer")) {
|
||||
g_print ("Received answer:\n%s\n", text);
|
||||
gst_print ("Received answer:\n%s\n", text);
|
||||
answer = gst_webrtc_session_description_new (GST_WEBRTC_SDP_TYPE_ANSWER,
|
||||
sdp);
|
||||
g_assert_nonnull (answer);
|
||||
|
@ -675,7 +675,7 @@ on_server_message (SoupWebsocketConnection * conn, SoupWebsocketDataType type,
|
|||
}
|
||||
app_state = PEER_CALL_STARTED;
|
||||
} else {
|
||||
g_print ("Received offer:\n%s\n", text);
|
||||
gst_print ("Received offer:\n%s\n", text);
|
||||
on_offer_received (sdp);
|
||||
}
|
||||
|
||||
|
@ -691,7 +691,7 @@ on_server_message (SoupWebsocketConnection * conn, SoupWebsocketDataType type,
|
|||
g_signal_emit_by_name (webrtc1, "add-ice-candidate", sdpmlineindex,
|
||||
candidate);
|
||||
} else {
|
||||
g_printerr ("Ignoring unknown JSON message:\n%s\n", text);
|
||||
gst_printerr ("Ignoring unknown JSON message:\n%s\n", text);
|
||||
}
|
||||
g_object_unref (parser);
|
||||
}
|
||||
|
@ -716,7 +716,7 @@ on_server_connected (SoupSession * session, GAsyncResult * res,
|
|||
g_assert_nonnull (ws_conn);
|
||||
|
||||
app_state = SERVER_CONNECTED;
|
||||
g_print ("Connected to signalling server\n");
|
||||
gst_print ("Connected to signalling server\n");
|
||||
|
||||
g_signal_connect (ws_conn, "closed", G_CALLBACK (on_server_closed), NULL);
|
||||
g_signal_connect (ws_conn, "message", G_CALLBACK (on_server_message), NULL);
|
||||
|
@ -748,7 +748,7 @@ connect_to_websocket_server_async (void)
|
|||
|
||||
message = soup_message_new (SOUP_METHOD_GET, server_url);
|
||||
|
||||
g_print ("Connecting to server...\n");
|
||||
gst_print ("Connecting to server...\n");
|
||||
|
||||
/* Once connected, we will register */
|
||||
soup_session_websocket_connect_async (session, message, NULL, NULL, NULL,
|
||||
|
@ -772,7 +772,7 @@ check_plugins (void)
|
|||
for (i = 0; i < g_strv_length ((gchar **) needed); i++) {
|
||||
plugin = gst_registry_find_plugin (registry, needed[i]);
|
||||
if (!plugin) {
|
||||
g_print ("Required gstreamer plugin '%s' not found\n", needed[i]);
|
||||
gst_print ("Required gstreamer plugin '%s' not found\n", needed[i]);
|
||||
ret = FALSE;
|
||||
continue;
|
||||
}
|
||||
|
@ -791,7 +791,7 @@ main (int argc, char *argv[])
|
|||
g_option_context_add_main_entries (context, entries, NULL);
|
||||
g_option_context_add_group (context, gst_init_get_option_group ());
|
||||
if (!g_option_context_parse (context, &argc, &argv, &error)) {
|
||||
g_printerr ("Error initializing: %s\n", error->message);
|
||||
gst_printerr ("Error initializing: %s\n", error->message);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -799,7 +799,7 @@ main (int argc, char *argv[])
|
|||
return -1;
|
||||
|
||||
if (!peer_id) {
|
||||
g_printerr ("--peer-id is a required argument\n");
|
||||
gst_printerr ("--peer-id is a required argument\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -822,7 +822,7 @@ main (int argc, char *argv[])
|
|||
|
||||
if (pipe1) {
|
||||
gst_element_set_state (GST_ELEMENT (pipe1), GST_STATE_NULL);
|
||||
g_print ("Pipeline stopped\n");
|
||||
gst_print ("Pipeline stopped\n");
|
||||
gst_object_unref (pipe1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue