static gboolean bus_callback (GstBus * bus, GstMessage * message, gpointer data) { switch (GST_MESSAGE_TYPE (message)) { case GST_MESSAGE_WARNING:{ GError *err; gchar *debug; gst_message_parse_warning (message, &err, &debug); g_print ("Warning: %s\n", err->message); g_error_free (err); g_free (debug); break; } case GST_MESSAGE_ERROR:{ GError *err; gchar *debug = NULL; gst_message_parse_error (message, &err, &debug); g_print ("Error: %s : %s\n", err->message, debug); g_error_free (err); g_free (debug); gtk_main_quit (); break; } case GST_MESSAGE_TAG:{ GstTagList *tags; GValue v = { 0, }; g_print ("Got tags\n"); gst_message_parse_tag (message, &tags); if (gst_tag_list_copy_value (&v, tags, "mxf-structure")) { const GstStructure *s; GtkTreeIter iter; s = gst_value_get_structure (&v); gtk_tree_store_append (treestore, &iter, NULL); insert_structure (s, &iter); gtk_widget_show_all (window); g_value_unset (&v); } gst_tag_list_unref (tags); break; } default: break; } return TRUE; }
static void on_message (GstBus * bus, GstMessage * message, gpointer data) { switch (GST_MESSAGE_TYPE (message)) { case GST_MESSAGE_WARNING: case GST_MESSAGE_ERROR: g_error ("Got error"); gtk_main_quit (); break; case GST_MESSAGE_TAG:{ GstTagList *tags; GValue v = { 0, }; g_print ("Got tags\n"); gst_message_parse_tag (message, &tags); if (gst_tag_list_copy_value (&v, tags, "mxf-structure")) { const GstStructure *s; GtkTreeIter iter; s = gst_value_get_structure (&v); gtk_tree_store_append (treestore, &iter, NULL); insert_structure (s, &iter); gtk_widget_show_all (window); g_value_unset (&v); } gst_tag_list_free (tags); break; } default: break; } }