/* * Copyright (C) 2003-2007 the GStreamer project * Julien Moutte * Ronald Bultje * Copyright (C) 2005-2008 Tim-Philipp Müller * Copyright (C) 2009 Sebastian Dröge * Copyright © 2009 Christian Persch * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * The Totem project hereby grant permission for non-gpl compatible GStreamer * plugins to be used and distributed together with GStreamer and Totem. This * permission is above and beyond the permissions granted by the GPL license * Totem is covered by. * * Monday 7th February 2005: Christian Schaller: Add exception clause. * See license_change file for details. * */ #include "totem-gst-helpers.h" #include #include void totem_gst_message_print (GstMessage *msg, GstElement *play, const char *filename) { GError *err = NULL; char *dbg = NULL; g_return_if_fail (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ERROR); if (play != NULL) { g_return_if_fail (filename != NULL); GST_DEBUG_BIN_TO_DOT_FILE (GST_BIN_CAST (play), GST_DEBUG_GRAPH_SHOW_ALL ^ GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS, filename); } gst_message_parse_error (msg, &err, &dbg); if (err) { char *uri; g_object_get (play, "uri", &uri, NULL); GST_ERROR ("message = %s", GST_STR_NULL (err->message)); GST_ERROR ("domain = %d (%s)", err->domain, GST_STR_NULL (g_quark_to_string (err->domain))); GST_ERROR ("code = %d", err->code); GST_ERROR ("debug = %s", GST_STR_NULL (dbg)); GST_ERROR ("source = %" GST_PTR_FORMAT, msg->src); GST_ERROR ("uri = %s", GST_STR_NULL (uri)); g_free (uri); g_error_free (err); } g_free (dbg); } static gboolean filter_hw_decoders (GstPluginFeature *feature, gpointer user_data) { GstElementFactory *factory; if (!GST_IS_ELEMENT_FACTORY (feature)) return FALSE; factory = GST_ELEMENT_FACTORY (feature); if (!gst_element_factory_list_is_type (factory, GST_ELEMENT_FACTORY_TYPE_DECODER | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO | GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE)) { return FALSE; } return gst_element_factory_list_is_type (factory, GST_ELEMENT_FACTORY_TYPE_HARDWARE); } void totem_gst_disable_hardware_decoders (void) { GstRegistry *registry; g_autolist(GstPluginFeature) hw_list = NULL; GList *l; registry = gst_registry_get (); hw_list = gst_registry_feature_filter (registry, filter_hw_decoders, FALSE, NULL); for (l = hw_list; l != NULL; l = l->next) { g_debug ("Disabling feature %s", gst_plugin_feature_get_name (l->data)); gst_registry_remove_feature (registry, l->data); } } /* * vim: sw=2 ts=8 cindent noai bs=2 */