}
}
-/* Extract metadata from all the streams and write it to the text widget in the GUI */\r
-static void analyze_streams (CustomData *data) {\r
- gint i;\r
- GstTagList *tags;\r
- gchar *str, *total_str;\r
- guint rate;\r
+/* Extract metadata from all the streams and write it to the text widget in the GUI */
+static void analyze_streams (CustomData *data) {
+ gint i;
+ GstTagList *tags;
+ gchar *str, *total_str;
+ guint rate;
gint n_video, n_audio, n_text;
- GtkTextBuffer *text;\r
+ GtkTextBuffer *text;
/* Clean current contents of the widget */
- text = gtk_text_view_get_buffer (GTK_TEXT_VIEW (data->streams_list));\r
- gtk_text_buffer_set_text (text, "", -1);\r
- \r
- /* Read some properties */\r
- g_object_get (data->playbin2, "n-video", &n_video, NULL);\r
- g_object_get (data->playbin2, "n-audio", &n_audio, NULL);\r
- g_object_get (data->playbin2, "n-text", &n_text, NULL);\r
- \r
- for (i = 0; i < n_video; i++) {\r
- tags = NULL;\r
- /* Retrieve the stream's video tags */\r
- g_signal_emit_by_name (data->playbin2, "get-video-tags", i, &tags);\r
- if (tags) {\r
- total_str = g_strdup_printf ("video stream %d:\n", i);\r
- gtk_text_buffer_insert_at_cursor (text, total_str, -1);\r
- g_free (total_str);\r
- gst_tag_list_get_string (tags, GST_TAG_VIDEO_CODEC, &str);\r
- total_str = g_strdup_printf (" codec: %s\n", str ? str : "unknown");\r
- gtk_text_buffer_insert_at_cursor (text, total_str, -1);\r
- g_free (total_str);\r
- g_free (str);\r
- gst_tag_list_free (tags);\r
- }\r
- }\r
- \r
- for (i = 0; i < n_audio; i++) {\r
- tags = NULL;\r
- /* Retrieve the stream's audio tags */\r
- g_signal_emit_by_name (data->playbin2, "get-audio-tags", i, &tags);\r
- if (tags) {\r
- total_str = g_strdup_printf ("\naudio stream %d:\n", i);\r
- gtk_text_buffer_insert_at_cursor (text, total_str, -1);\r
- g_free (total_str);\r
- if (gst_tag_list_get_string (tags, GST_TAG_AUDIO_CODEC, &str)) {\r
- total_str = g_strdup_printf (" codec: %s\n", str);\r
- gtk_text_buffer_insert_at_cursor (text, total_str, -1);\r
- g_free (total_str);\r
- g_free (str);\r
- }\r
- if (gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &str)) {\r
- total_str = g_strdup_printf (" language: %s\n", str);\r
- gtk_text_buffer_insert_at_cursor (text, total_str, -1);\r
- g_free (total_str);\r
- g_free (str);\r
- }\r
- if (gst_tag_list_get_uint (tags, GST_TAG_BITRATE, &rate)) {\r
- total_str = g_strdup_printf (" bitrate: %d\n", rate);\r
- gtk_text_buffer_insert_at_cursor (text, total_str, -1);\r
- g_free (total_str);\r
- }\r
- gst_tag_list_free (tags);\r
- }\r
- }\r
- \r
- for (i = 0; i < n_text; i++) {\r
- tags = NULL;\r
- /* Retrieve the stream's subtitle tags */\r
- g_signal_emit_by_name (data->playbin2, "get-text-tags", i, &tags);\r
- if (tags) {\r
- total_str = g_strdup_printf ("\nsubtitle stream %d:\n", i);\r
- gtk_text_buffer_insert_at_cursor (text, total_str, -1);\r
- g_free (total_str);\r
- if (gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &str)) {\r
- total_str = g_strdup_printf (" language: %s\n", str);\r
- gtk_text_buffer_insert_at_cursor (text, total_str, -1);\r
- g_free (total_str);\r
- g_free (str);\r
- }\r
- gst_tag_list_free (tags);\r
- }\r
- }\r
-}\r
+ text = gtk_text_view_get_buffer (GTK_TEXT_VIEW (data->streams_list));
+ gtk_text_buffer_set_text (text, "", -1);
+
+ /* Read some properties */
+ g_object_get (data->playbin2, "n-video", &n_video, NULL);
+ g_object_get (data->playbin2, "n-audio", &n_audio, NULL);
+ g_object_get (data->playbin2, "n-text", &n_text, NULL);
+
+ for (i = 0; i < n_video; i++) {
+ tags = NULL;
+ /* Retrieve the stream's video tags */
+ g_signal_emit_by_name (data->playbin2, "get-video-tags", i, &tags);
+ if (tags) {
+ total_str = g_strdup_printf ("video stream %d:\n", i);
+ gtk_text_buffer_insert_at_cursor (text, total_str, -1);
+ g_free (total_str);
+ gst_tag_list_get_string (tags, GST_TAG_VIDEO_CODEC, &str);
+ total_str = g_strdup_printf (" codec: %s\n", str ? str : "unknown");
+ gtk_text_buffer_insert_at_cursor (text, total_str, -1);
+ g_free (total_str);
+ g_free (str);
+ gst_tag_list_free (tags);
+ }
+ }
+
+ for (i = 0; i < n_audio; i++) {
+ tags = NULL;
+ /* Retrieve the stream's audio tags */
+ g_signal_emit_by_name (data->playbin2, "get-audio-tags", i, &tags);
+ if (tags) {
+ total_str = g_strdup_printf ("\naudio stream %d:\n", i);
+ gtk_text_buffer_insert_at_cursor (text, total_str, -1);
+ g_free (total_str);
+ if (gst_tag_list_get_string (tags, GST_TAG_AUDIO_CODEC, &str)) {
+ total_str = g_strdup_printf (" codec: %s\n", str);
+ gtk_text_buffer_insert_at_cursor (text, total_str, -1);
+ g_free (total_str);
+ g_free (str);
+ }
+ if (gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &str)) {
+ total_str = g_strdup_printf (" language: %s\n", str);
+ gtk_text_buffer_insert_at_cursor (text, total_str, -1);
+ g_free (total_str);
+ g_free (str);
+ }
+ if (gst_tag_list_get_uint (tags, GST_TAG_BITRATE, &rate)) {
+ total_str = g_strdup_printf (" bitrate: %d\n", rate);
+ gtk_text_buffer_insert_at_cursor (text, total_str, -1);
+ g_free (total_str);
+ }
+ gst_tag_list_free (tags);
+ }
+ }
+
+ for (i = 0; i < n_text; i++) {
+ tags = NULL;
+ /* Retrieve the stream's subtitle tags */
+ g_signal_emit_by_name (data->playbin2, "get-text-tags", i, &tags);
+ if (tags) {
+ total_str = g_strdup_printf ("\nsubtitle stream %d:\n", i);
+ gtk_text_buffer_insert_at_cursor (text, total_str, -1);
+ g_free (total_str);
+ if (gst_tag_list_get_string (tags, GST_TAG_LANGUAGE_CODE, &str)) {
+ total_str = g_strdup_printf (" language: %s\n", str);
+ gtk_text_buffer_insert_at_cursor (text, total_str, -1);
+ g_free (total_str);
+ g_free (str);
+ }
+ gst_tag_list_free (tags);
+ }
+ }
+}
/* This function is called when an "application" message is posted on the bus.
* Here we retrieve the message posted by the tags_cb callback */