static gboolean handle_message (GstBus * bus, GstMessage * message, gpointer data) { GstElement *bin = GST_ELEMENT_CAST (data); switch (message->type) { case GST_MESSAGE_EOS: g_message ("got EOS"); g_main_loop_quit (loop); break; case GST_MESSAGE_WARNING: case GST_MESSAGE_ERROR: { GError *gerror; gchar *debug; if (message->type == GST_MESSAGE_ERROR) gst_message_parse_error (message, &gerror, &debug); else gst_message_parse_warning (message, &gerror, &debug); gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); g_error_free (gerror); g_free (debug); g_main_loop_quit (loop); break; } case GST_MESSAGE_ASYNC_DONE: g_timeout_add (40, (GSourceFunc) do_step, bin); break; default: break; } return TRUE; }
static gboolean bus_handler (GstBus * bus, GstMessage * message, gpointer data) { GMainLoop *loop = (GMainLoop *) data; switch (message->type) { case GST_MESSAGE_EOS: g_main_loop_quit (loop); break; case GST_MESSAGE_WARNING: case GST_MESSAGE_ERROR:{ GError *gerror; gchar *debug; if (message->type == GST_MESSAGE_WARNING) gst_message_parse_warning (message, &gerror, &debug); else gst_message_parse_error (message, &gerror, &debug); gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); gst_message_unref (message); g_error_free (gerror); g_free (debug); g_main_loop_quit (loop); break; } default: break; } return TRUE; }
/* Receive messages from the pipeline message bus and handle them: */ static gboolean PsychMovieBusCallback(GstBus *bus, GstMessage *msg, gpointer dataptr) { PsychMovieWriterRecordType* dev = (PsychMovieWriterRecordType*) dataptr; switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_EOS: if (PsychPrefStateGet_Verbosity() > 4) printf("PTB-DEBUG: Moviewriter bus: Message EOS received.\n"); dev->eos = TRUE; break; case GST_MESSAGE_WARNING: { gchar *debug; GError *error; gst_message_parse_warning(msg, &error, &debug); if (PsychPrefStateGet_Verbosity() > 3) { printf("PTB-WARNING: GStreamer movie writing engine reports this warning:\n" " Warning from element %s: %s\n", GST_OBJECT_NAME(msg->src), error->message); printf(" Additional debug info: %s.\n", (debug) ? debug : "None"); } g_free(debug); g_error_free(error); break; } case GST_MESSAGE_ERROR: { gchar *debug; GError *error; gst_message_parse_error(msg, &error, &debug); if (PsychPrefStateGet_Verbosity() > 0) { printf("PTB-ERROR: GStreamer movie writing engine reports this error:\n" " Error from element %s: %s\n", GST_OBJECT_NAME(msg->src), error->message); printf(" Additional debug info: %s.\n\n", (debug) ? debug : "None"); // Special tips for the challenged: if (strstr(error->message, "property") || (debug && strstr(debug, "property"))) { // Bailed due to unsupported x264enc parameter "speed-preset". Can be solved by upgrading // GStreamer or the OS or the VideoCodec= override: printf("PTB-TIP: The reason this failed is because your GStreamer codec installation is too outdated.\n"); printf("PTB-TIP: Either upgrade your GStreamer (plugin) installation to a more recent version,\n"); printf("PTB-TIP: or upgrade your operating system (e.g., Ubuntu 10.10 'Maverick Meercat' and later are fine).\n"); printf("PTB-TIP: A recent GStreamer installation is required to use all features and get optimal performance.\n"); printf("PTB-TIP: As a workaround, you can manually specify all codec settings, leaving out the unsupported\n"); printf("PTB-TIP: option. See 'help VideoRecording' on how to do that.\n\n"); } } g_free(debug); g_error_free(error); break; } default: break; } return TRUE; }
static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data) { GstElement *play = (GstElement *)data; gboolean res = gst_pipeline_get_auto_flush_bus((GstPipeline *)play); GError *err = NULL; switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_ERROR: gst_message_parse_error(msg, &err, NULL); g_warning("Play sound error!! (%s, %d)", __FILE__, __LINE__); g_error_free(err); case GST_MESSAGE_EOS: gst_element_set_state(play, GST_STATE_NULL); gst_object_unref(GST_OBJECT(play)); break; case GST_MESSAGE_WARNING: gst_message_parse_warning(msg, &err, NULL); g_warning("Play sound error!! (%s, %d)", __FILE__, __LINE__); g_error_free(err); break; default: break; } return TRUE; }
static void _test_reverse_negotiation_message (GstBus * bus, GstMessage * message, GMainLoop * loop) { GError *err = NULL; gchar *debug; switch (GST_MESSAGE_TYPE (message)) { case GST_MESSAGE_ERROR: gst_message_parse_error (message, &err, &debug); gst_object_default_error (GST_MESSAGE_SRC (message), err, debug); g_error_free (err); g_free (debug); g_assert_not_reached (); break; case GST_MESSAGE_WARNING: gst_message_parse_warning (message, &err, &debug); gst_object_default_error (GST_MESSAGE_SRC (message), err, debug); g_error_free (err); g_free (debug); g_assert_not_reached (); break; case GST_MESSAGE_EOS: g_main_loop_quit (loop); break; default: break; } }
static gboolean bus_call (GstBus *bus, GstMessage *msg, gpointer data) { GstElement *play = data; GError *err = NULL; switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_ERROR: gst_message_parse_error(msg, &err, NULL); purple_debug_error("gstreamer", "%s\n", err->message); g_error_free(err); /* fall-through and clean up */ case GST_MESSAGE_EOS: gst_element_set_state(play, GST_STATE_NULL); gst_object_unref(GST_OBJECT(play)); return FALSE; break; case GST_MESSAGE_WARNING: gst_message_parse_warning(msg, &err, NULL); purple_debug_warning("gstreamer", "%s\n", err->message); g_error_free(err); break; default: break; } return TRUE; }
static void end_stream_cb(GstBus* bus, GstMessage* message, GstElement* pipeline) { GError *error = NULL; gchar *details; switch (GST_MESSAGE_TYPE (message)) { case GST_MESSAGE_ERROR: gst_message_parse_error (message, &error, &details); g_print("Error %s\n", error->message); g_print("Details %s\n", details); /* fallthrough */ case GST_MESSAGE_EOS: g_print("End of stream\n"); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref(pipeline); gtk_main_quit(); break; case GST_MESSAGE_WARNING: gst_message_parse_warning (message, &error, &details); g_print("Warning %s\n", error->message); g_print("Details %s\n", details); break; default: break; } }
static gboolean on_message (GstBus * bus, GstMessage * message, gpointer user_data) { GMainLoop *loop = (GMainLoop *) user_data; switch (GST_MESSAGE_TYPE (message)) { case GST_MESSAGE_ERROR:{ GError *err = NULL; gchar *debug; gst_message_parse_error (message, &err, &debug); g_critical ("Got ERROR: %s (%s)", err->message, GST_STR_NULL (debug)); g_main_loop_quit (loop); break; } case GST_MESSAGE_WARNING:{ GError *err = NULL; gchar *debug; gst_message_parse_warning (message, &err, &debug); g_warning ("Got WARNING: %s (%s)", err->message, GST_STR_NULL (debug)); g_main_loop_quit (loop); break; } case GST_MESSAGE_EOS: g_main_loop_quit (loop); break; default: break; } return TRUE; }
static void handle_message (GstBus * bus, GstMessage * message, gpointer data) { switch (message->type) { case GST_MESSAGE_EOS: g_message ("got EOS"); g_main_loop_quit (loop); break; case GST_MESSAGE_WARNING: case GST_MESSAGE_ERROR: { GError *gerror; gchar *debug; if (message->type == GST_MESSAGE_ERROR) gst_message_parse_error (message, &gerror, &debug); else gst_message_parse_warning (message, &gerror, &debug); gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); g_error_free (gerror); g_free (debug); if (message->type == GST_MESSAGE_ERROR) g_main_loop_quit (loop); break; } default: break; } }
static GstBusSyncReply gst_uri_downloader_bus_handler (GstBus * bus, GstMessage * message, gpointer data) { GstUriDownloader *downloader = (GstUriDownloader *) (data); if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR) { GError *err = NULL; gchar *dbg_info = NULL; gchar *new_error = NULL; gst_message_parse_error (message, &err, &dbg_info); GST_WARNING_OBJECT (downloader, "Received error: %s from %s, the download will be cancelled", err->message, GST_OBJECT_NAME (message->src)); GST_DEBUG ("Debugging info: %s\n", (dbg_info) ? dbg_info : "none"); if (dbg_info) new_error = g_strdup_printf ("%s: %s\n", err->message, dbg_info); if (new_error) { g_free (err->message); err->message = new_error; } if (!downloader->priv->err) downloader->priv->err = err; else g_error_free (err); g_free (dbg_info); /* remove the sync handler to avoid duplicated messages */ gst_bus_set_sync_handler (downloader->priv->bus, NULL, NULL, NULL); /* stop the download */ GST_OBJECT_LOCK (downloader); if (downloader->priv->download != NULL) { GST_DEBUG_OBJECT (downloader, "Stopping download"); g_object_unref (downloader->priv->download); downloader->priv->download = NULL; downloader->priv->cancelled = TRUE; g_cond_signal (&downloader->priv->cond); } GST_OBJECT_UNLOCK (downloader); } else if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_WARNING) { GError *err = NULL; gchar *dbg_info = NULL; gst_message_parse_warning (message, &err, &dbg_info); GST_WARNING_OBJECT (downloader, "Received warning: %s from %s", GST_OBJECT_NAME (message->src), err->message); GST_DEBUG ("Debugging info: %s\n", (dbg_info) ? dbg_info : "none"); g_error_free (err); g_free (dbg_info); } gst_message_unref (message); return GST_BUS_DROP; }
gboolean AudioFileReader::handleMessage(GstMessage* message) { GUniqueOutPtr<GError> error; GUniqueOutPtr<gchar> debug; switch (GST_MESSAGE_TYPE(message)) { case GST_MESSAGE_EOS: g_main_loop_quit(m_loop.get()); break; case GST_MESSAGE_WARNING: gst_message_parse_warning(message, &error.outPtr(), &debug.outPtr()); g_warning("Warning: %d, %s. Debug output: %s", error->code, error->message, debug.get()); break; case GST_MESSAGE_ERROR: gst_message_parse_error(message, &error.outPtr(), &debug.outPtr()); g_warning("Error: %d, %s. Debug output: %s", error->code, error->message, debug.get()); m_errorOccurred = true; gst_element_set_state(m_pipeline, GST_STATE_NULL); g_main_loop_quit(m_loop.get()); break; default: break; } return TRUE; }
static void message_received (GstBus * bus, GstMessage * message, GstPipeline * bin) { GST_INFO ("bus message from \"%" GST_PTR_FORMAT "\": %" GST_PTR_FORMAT, GST_MESSAGE_SRC (message), message); switch (message->type) { case GST_MESSAGE_EOS: g_main_loop_quit (main_loop); break; case GST_MESSAGE_WARNING:{ GError *gerror; gchar *debug; gst_message_parse_warning (message, &gerror, &debug); gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); g_error_free (gerror); g_free (debug); break; } case GST_MESSAGE_ERROR:{ GError *gerror; gchar *debug; gst_message_parse_error (message, &gerror, &debug); gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); g_error_free (gerror); g_free (debug); g_main_loop_quit (main_loop); break; } default: break; } }
/* FIXME: Copy from owr/orw.c without any error handling whatsoever */ static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer user_data) { gboolean ret, is_warning = FALSE; GstStateChangeReturn change_status; gchar *message_type, *debug; GError *error; GstPipeline *pipeline = user_data; g_return_val_if_fail(GST_IS_BUS(bus), TRUE); (void)user_data; switch (GST_MESSAGE_TYPE(msg)) { case GST_MESSAGE_LATENCY: ret = gst_bin_recalculate_latency(GST_BIN(pipeline)); g_warn_if_fail(ret); break; case GST_MESSAGE_CLOCK_LOST: change_status = gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PAUSED); g_warn_if_fail(change_status != GST_STATE_CHANGE_FAILURE); change_status = gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING); g_warn_if_fail(change_status != GST_STATE_CHANGE_FAILURE); break; case GST_MESSAGE_EOS: g_print("End of stream\n"); break; case GST_MESSAGE_WARNING: is_warning = TRUE; case GST_MESSAGE_ERROR: if (is_warning) { message_type = "Warning"; gst_message_parse_warning(msg, &error, &debug); } else { message_type = "Error"; gst_message_parse_error(msg, &error, &debug); } g_printerr("==== %s message start ====\n", message_type); g_printerr("%s in element %s.\n", message_type, GST_OBJECT_NAME(msg->src)); g_printerr("%s: %s\n", message_type, error->message); g_printerr("Debugging info: %s\n", (debug) ? debug : "none"); g_printerr("==== %s message stop ====\n", message_type); /*GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "pipeline.dot");*/ g_error_free(error); g_free(debug); break; default: break; } return TRUE; }
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 gboolean bus_handler (GstBus * bus, GstMessage * message, gpointer data) { GMainLoop *loop = (GMainLoop *) data; switch (message->type) { case GST_MESSAGE_EOS: g_main_loop_quit (loop); break; case GST_MESSAGE_WARNING: case GST_MESSAGE_ERROR:{ GError *gerror; gchar *debug; if (message->type == GST_MESSAGE_WARNING) gst_message_parse_warning (message, &gerror, &debug); else gst_message_parse_error (message, &gerror, &debug); gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); gst_message_unref (message); g_error_free (gerror); g_free (debug); g_main_loop_quit (loop); break; } case GST_MESSAGE_TAG: { GstTagList *tag_list; gchar *fpr, *p; gst_message_parse_tag (message, &tag_list); fail_unless (gst_tag_list_get_string (tag_list, "ofa-fingerprint", &fpr)); p = fpr; while (*p) { fail_unless (g_ascii_isalnum (*p) || *p == '=' || *p == '+' || *p == '/'); p++; } g_free (fpr); gst_tag_list_unref (tag_list); found_fingerprint = TRUE; g_main_loop_quit (loop); break; } default: break; } return TRUE; }
QString WarningMessage::debugMessage() const { gchar *debug; GError *e; //Passing a NULL pointer for the GError is not supported gst_message_parse_warning(object<GstMessage>(), &e, &debug); if (e) { g_error_free (e); } return QGlib::Private::stringFromGCharPtr(debug); }
static bool default_msg_handler( decoder_t *p_dec, GstMessage *p_msg ) { bool err = false; switch( GST_MESSAGE_TYPE( p_msg ) ){ case GST_MESSAGE_ERROR: { gchar *psz_debug; GError *p_error; gst_message_parse_error( p_msg, &p_error, &psz_debug ); g_free( psz_debug ); msg_Err( p_dec, "Error from %s: %s", GST_ELEMENT_NAME( GST_MESSAGE_SRC( p_msg ) ), p_error->message ); g_error_free( p_error ); err = true; } break; case GST_MESSAGE_WARNING: { gchar *psz_debug; GError *p_error; gst_message_parse_warning( p_msg, &p_error, &psz_debug ); g_free( psz_debug ); msg_Warn( p_dec, "Warning from %s: %s", GST_ELEMENT_NAME( GST_MESSAGE_SRC( p_msg ) ), p_error->message ); g_error_free( p_error ); } break; case GST_MESSAGE_INFO: { gchar *psz_debug; GError *p_error; gst_message_parse_info( p_msg, &p_error, &psz_debug ); g_free( psz_debug ); msg_Info( p_dec, "Info from %s: %s", GST_ELEMENT_NAME( GST_MESSAGE_SRC( p_msg ) ), p_error->message ); g_error_free( p_error ); } break; default: break; } return err; }
static VALUE warning_parse(VALUE self) { VALUE result; GError *error; gchar *debug; gst_message_parse_warning(SELF(self), &error, &debug); result = rb_ary_new3(2, GERROR2RVAL(error), CSTR2RVAL_FREE(debug)); return result; }
/** * GST bus signal watch callback */ void Pipeline::end_stream_cb(GstBus* /*bus*/, GstMessage* message, gpointer user_data) { Pipeline *context = static_cast<Pipeline*>(user_data); bool is_verbose = context->owner_->get_configuration()->get_verbose(); if (is_verbose) std::cout << "Pipeline::" << __FUNCTION__ << "(" << message << ")" << std::endl; bool stop_it = true; if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_ERROR) { gchar *debug = NULL; GError *err = NULL; gst_message_parse_error(message, &err, &debug); g_printerr("GStreamer ERROR from element %s: %s\n", GST_OBJECT_NAME(message->src), err->message); show_unlinked_pads(GST_BIN(context->pipeline_)); //if (message->src == GST_OBJECT(context->videosrc_)) //{ // g_print("The error message comes from %s. Not stopping the pipeline.\n", GST_OBJECT_NAME(message->src)); // stop_it = false; //} g_error_free(err); if (debug) { g_print("Error message Debug details: %s\n", debug); g_free(debug); } } else if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_EOS) { std::cout << "EOS: End of stream" << std::endl; } else if (GST_MESSAGE_TYPE(message) == GST_MESSAGE_WARNING) { gchar *debug = NULL; GError *err = NULL; gst_message_parse_warning(message, &err, &debug); g_print("Warning: %s\n", err->message); g_error_free(err); if (debug) { g_print("Debug details: %s\n", debug); g_free(debug); } stop_it = false; } if (stop_it) { g_print("The stream ended. Let's quit.\n"); //gst_element_set_state(pipeline, GST_STATE_NULL); //gst_object_unref(pipeline); //FIXME: causes a segfault // context->owner_->quit(); } }
static gboolean capture_bus_cb (GstBus * bus, GstMessage * message, gpointer data) { GMainLoop *loop = (GMainLoop *) data; const GstStructure *st; switch (GST_MESSAGE_TYPE (message)) { case GST_MESSAGE_ERROR:{ GError *err = NULL; gchar *debug = NULL; gst_message_parse_error (message, &err, &debug); GST_WARNING ("ERROR: %s [%s]", err->message, debug); g_error_free (err); g_free (debug); /* Write debug graph to file */ GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (camera), GST_DEBUG_GRAPH_SHOW_ALL, "camerabin.error"); fail_if (TRUE, "error while capturing"); g_main_loop_quit (loop); break; } case GST_MESSAGE_WARNING:{ GError *err = NULL; gchar *debug = NULL; gst_message_parse_warning (message, &err, &debug); GST_WARNING ("WARNING: %s [%s]", err->message, debug); g_error_free (err); g_free (debug); /* Write debug graph to file */ GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (camera), GST_DEBUG_GRAPH_SHOW_ALL, "camerabin.warning"); break; } case GST_MESSAGE_EOS: GST_DEBUG ("eos"); g_main_loop_quit (loop); break; default: st = gst_message_get_structure (message); if (st && gst_structure_has_name (st, "image-captured")) { gboolean ready = FALSE; GST_INFO ("image captured"); g_object_get (camera, "ready-for-capture", &ready, NULL); fail_if (!ready, "not ready for capture"); } break; } return TRUE; }
static void warning_cb (GstBus * bus, GstMessage * msg, gpointer foo) { GError *err = NULL; gchar *dbg = NULL; gst_message_parse_warning (msg, &err, &dbg); g_printerr ("WARNING: %s (%s)\n", err->message, (dbg) ? dbg : "no details"); g_error_free (err); g_free (dbg); }
static void bus_callback(GstBus *bus, GstMessage *message, void *appdata) {_STT(); oexEcho( "bus_callback()" ); gchar *message_str; const gchar *message_name; GError *error; /* Report errors to the console */ if(GST_MESSAGE_TYPE(message) == GST_MESSAGE_ERROR) { gst_message_parse_error(message, &error, &message_str); g_error("GST error: %s\n", message_str); g_free(error); g_free(message_str); } /* Report warnings to the console */ if(GST_MESSAGE_TYPE(message) == GST_MESSAGE_WARNING) { gst_message_parse_warning(message, &error, &message_str); g_warning("GST warning: %s\n", message_str); g_free(error); g_free(message_str); } /* See if the message type is GST_MESSAGE_APPLICATION which means * thet the message is sent by the client code (this program) and * not by gstreamer. */ if(GST_MESSAGE_TYPE(message) == GST_MESSAGE_APPLICATION) { /* Get name of the message's structure */ message_name = gst_structure_get_name(gst_message_get_structure(message)); /* The hildon banner must be shown in here, because the bus callback is * called in the main thread and calling GUI-functions in gstreamer threads * usually leads to problems with X-server */ /* "photo-taken" message means that the photo was succefully taken * and saved and message is shown to user */ if(!strcmp(message_name, "photo-taken")) { } /* "photo-failed" means that the photo couldn't be captured or saved */ if(!strcmp(message_name, "photo-failed")) { } } }
static gboolean bus_callback(GstBus *bus, GstMessage *message, gpointer *ptr) { gst_app_t *app = (gst_app_t*)ptr; switch(GST_MESSAGE_TYPE(message)){ case GST_MESSAGE_ERROR:{ gchar *debug; GError *err; gst_message_parse_error(message, &err, &debug); g_print("Error %s\n", err->message); g_error_free(err); g_free(debug); g_main_loop_quit(app->loop); } break; case GST_MESSAGE_WARNING:{ gchar *debug; GError *err; gchar *name; gst_message_parse_warning(message, &err, &debug); g_print("Warning %s\nDebug %s\n", err->message, debug); name = (gchar *)GST_MESSAGE_SRC_NAME(message); g_print("Name of src %s\n", name ? name : "nil"); g_error_free(err); g_free(debug); } break; case GST_MESSAGE_EOS: g_print("End of stream\n"); g_main_loop_quit(app->loop); break; case GST_MESSAGE_STATE_CHANGED: break; default: // g_print("got message %s\n", \ gst_message_type_get_name (GST_MESSAGE_TYPE (message))); break; } return TRUE; }
gboolean VideoReceiver::busCall(GstBus *, GstMessage *message, gpointer data) { VideoReceiver *vr = static_cast<VideoReceiver *>(data); GError *error = NULL; gchar *debug = NULL; switch (GST_MESSAGE_TYPE(message)) { case GST_MESSAGE_ERROR: gst_message_parse_error(message, &error, &debug); qWarning("Error: %s", error->message); g_error_free(error); g_free(debug); break; case GST_MESSAGE_EOS: // end-of-stream // g_main_loop_quit(loop); qWarning("%s: Warning: EOS", __FUNCTION__); break; case GST_MESSAGE_WARNING: gst_message_parse_warning(message, &error, &debug); if (error != NULL) { qWarning("Warning: %s", error->message); g_error_free(error); } if (debug != NULL) { qDebug("Debug: %s", debug); g_free(debug); } break; case GST_MESSAGE_ELEMENT: if (gst_structure_has_name(message->structure, "prepare-xwindow-id") && vr->xid != 0) { qDebug("%s - prepare-xwindow-id", __FUNCTION__); gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(GST_MESSAGE_SRC(message)), vr->xid); } break; default: // Unhandled message //qWarning("Unhandled message type: %d", GST_MESSAGE_TYPE(message)); break; } return true; }
static gboolean slave_bus_msg (GstBus * bus, GstMessage * msg, gpointer data) { GstPipeline *pipeline = data; switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_ERROR:{ GError *err; gchar *dbg; gst_message_parse_error (msg, &err, &dbg); g_printerr ("SLAVE: ERROR: %s\n", err->message); if (dbg != NULL) g_printerr ("SLAVE: ERROR debug information: %s\n", dbg); g_error_free (err); g_free (dbg); GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "ipc.slave.error"); break; } case GST_MESSAGE_WARNING:{ GError *err; gchar *dbg; gst_message_parse_warning (msg, &err, &dbg); g_printerr ("SLAVE: WARNING: %s\n", err->message); if (dbg != NULL) g_printerr ("SLAVE: WARNING debug information: %s\n", dbg); g_error_free (err); g_free (dbg); GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "ipc.slave.warning"); break; } case GST_MESSAGE_ASYNC_START: GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline), GST_DEBUG_GRAPH_SHOW_VERBOSE, "ipc.slave.async-start"); break; case GST_MESSAGE_ASYNC_DONE: GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "ipc.slave.async-done"); break; default: break; } return TRUE; }
void SourceObject::HandleWarningMsg (GstMessage *msg) { GError *gerror = nullptr; gchar *debug = nullptr; gst_message_parse_warning (msg, &gerror, &debug); const auto& msgStr = QString::fromUtf8 (gerror->message); const auto& debugStr = QString::fromUtf8 (debug); const auto code = gerror->code; const auto domain = gerror->domain; g_error_free (gerror); g_free (debug); qDebug () << Q_FUNC_INFO << code << domain << msgStr << debugStr; }
/* Event loop to listen to events posted on the GstBus from the pipeline. Exits * on EOS or ERROR events */ static void event_loop (GstElement * pipe) { GstBus *bus; GstMessage *message = NULL; gboolean running = TRUE; bus = gst_element_get_bus (GST_ELEMENT (pipe)); while (running) { message = gst_bus_poll (bus, GST_MESSAGE_ANY, -1); g_assert (message != NULL); switch (message->type) { case GST_MESSAGE_EOS: running = FALSE; break; case GST_MESSAGE_WARNING:{ GError *gerror; gchar *debug; gst_message_parse_warning (message, &gerror, &debug); gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); g_error_free (gerror); g_free (debug); break; } case GST_MESSAGE_ERROR:{ GError *gerror; gchar *debug; gst_message_parse_error (message, &gerror, &debug); gst_object_default_error (GST_MESSAGE_SRC (message), gerror, debug); g_error_free (gerror); g_free (debug); running = FALSE; break; } default: break; } gst_message_unref (message); } gst_object_unref (bus); }
std::string GetLogMessage(GstMessage * msg) { std::string ret; gchar * debug(0); GError * error(0); switch (msg->type) { case GST_MESSAGE_INFO: { gst_message_parse_info(msg, &error, &debug); break; } case GST_MESSAGE_WARNING: { gst_message_parse_warning(msg, &error, &debug); break; } case GST_MESSAGE_ERROR: { gst_message_parse_error(msg, &error, &debug); break; } default: { ret = "This message is not of type info, warning or error. "; break; } } if (error) { ret += std::string(error->message) + ". "; } if (debug) { ret += "Debug string: " + std::string(debug) + ". "; } g_free(debug); g_error_free(error); return ret; }
static void bus_callback(GstBus *bus, GstMessage *message) { gchar *message_str; const gchar *message_name; GError *error; if(GST_MESSAGE_TYPE(message) == GST_MESSAGE_ERROR) { gst_message_parse_error(message, &error, &message_str); g_error("GST error: %s\n", message_str); g_free(error); g_free(message_str); } if(GST_MESSAGE_TYPE(message) == GST_MESSAGE_WARNING) { gst_message_parse_warning(message, &error, &message_str); g_warning("GST warning: %s\n", message_str); g_free(error); g_free(message_str); } if(GST_MESSAGE_TYPE(message) == GST_MESSAGE_APPLICATION) { message_name = gst_structure_get_name(gst_message_get_structure(message)); if(!strcmp(message_name, "photo-taken")) { hildon_banner_show_information( GTK_WIDGET(cappdata->window), NULL, "Photo Taken"); } if(!strcmp(message_name, "photo-failed")) { hildon_banner_show_information( GTK_WIDGET(cappdata->window), "gtk-dialog-error", "Saving Photo Failed"); } } }
gboolean tf_call_channel_bus_message (TfCallChannel *channel, GstMessage *message) { GError *error = NULL; gchar *debug; struct CallConference *cc; guint i; cc = find_call_conference_by_conference (channel, GST_MESSAGE_SRC (message)); if (!cc) return FALSE; switch (GST_MESSAGE_TYPE (message)) { case GST_MESSAGE_WARNING: gst_message_parse_warning (message, &error, &debug); g_warning ("session: %s (%s)", error->message, debug); g_error_free (error); g_free (debug); return TRUE; case GST_MESSAGE_ERROR: gst_message_parse_error (message, &error, &debug); g_warning ("session ERROR: %s (%s)", error->message, debug); tf_call_channel_error (channel); g_error_free (error); g_free (debug); return TRUE; default: break; } for (i = 0; i < channel->contents->len; i++) if (tf_call_content_bus_message (g_ptr_array_index (channel->contents, i), message)) return TRUE; return FALSE; }