// ---------------------------------------------------------------------------- // Retrieve and process a bus message bool GStreamerImportFileHandle::ProcessBusMessage(bool & success) { bool cont = true; // Default to no errors success = true; // Get the next message GstMessage *msg = gst_bus_timed_pop(mBus, 100 * GST_MSECOND); if (!msg) { // Timed out...not an error return cont; } #if defined(__WXDEBUG__) gchar *objname = NULL; if (msg->src != NULL) { objname = gst_object_get_name(msg->src); } wxLogMessage(wxT("GStreamer: Got %s%s%s"), wxString::FromUTF8(GST_MESSAGE_TYPE_NAME(msg)).c_str(), objname ? wxT(" from ") : wxT(""), objname ? wxString::FromUTF8(objname).c_str() : wxT("")); if (objname != NULL) { g_free(objname); } #endif // Handle based on message type switch (GST_MESSAGE_TYPE(msg)) { // Handle error message from gstreamer case GST_MESSAGE_ERROR: { GError *err = NULL; gchar *debug = NULL; gst_message_parse_error(msg, &err, &debug); if (err) { wxString m; m.Printf(wxT("%s%s%s"), wxString::FromUTF8(err->message).c_str(), debug ? wxT("\n") : wxT(""), debug ? wxString::FromUTF8(debug).c_str() : wxT("")); #if defined(_DEBUG) wxMessageBox(m, wxT("GStreamer Error:")); #else wxLogMessage(wxT("GStreamer Error: %s"), m.c_str()); #endif g_error_free(err); } if (debug) { g_free(debug); } success = false; cont = false; } break; // Handle warning message from gstreamer case GST_MESSAGE_WARNING: { GError *err = NULL; gchar *debug = NULL; gst_message_parse_warning(msg, &err, &debug); if (err) { wxLogMessage(wxT("GStreamer Warning: %s%s%s"), wxString::FromUTF8(err->message).c_str(), debug ? wxT("\n") : wxT(""), debug ? wxString::FromUTF8(debug).c_str() : wxT("")); g_error_free(err); } if (debug) { g_free(debug); } } break; // Handle warning message from gstreamer case GST_MESSAGE_INFO: { GError *err = NULL; gchar *debug = NULL; gst_message_parse_info(msg, &err, &debug); if (err) { wxLogMessage(wxT("GStreamer Info: %s%s%s"), wxString::FromUTF8(err->message).c_str(), debug ? wxT("\n") : wxT(""), debug ? wxString::FromUTF8(debug).c_str() : wxT("")); g_error_free(err); } if (debug) { g_free(debug); } } break; // Handle metadata tags case GST_MESSAGE_TAG: { GstTagList *tags = NULL; // Retrieve tag list from message...just ignore failure gst_message_parse_tag(msg, &tags); if (tags) { // Go process the list OnTag(GST_APP_SINK(GST_MESSAGE_SRC(msg)), tags); // Done with list gst_tag_list_unref(tags); } } break; // Pre-roll is done...will happen for each group // (like with chained OGG files) case GST_MESSAGE_ASYNC_DONE: { // If this is the first async-done message, then tell // caller to end loop, but leave it active so that // gstreamer threads can still queue up. // // We'll receive multiple async-done messages for chained // ogg files, so ignore the message the 2nd and subsequent // occurrences. if (!mAsyncDone) { cont = false; mAsyncDone = true; } } break; // End of the stream (and all sub-streams) case GST_MESSAGE_EOS: { // Terminate loop cont = false; } break; } // Release the message gst_message_unref(msg); return cont; }
void JabberProtocol::OnEndTag(XMLEntity *entity) { OnTag(entity); }