From kde-commits Tue Apr 22 13:58:18 2008 From: Matthias Kretz Date: Tue, 22 Apr 2008 13:58:18 +0000 To: kde-commits Subject: kdereview/phonon/gstreamer Message-Id: <1208872698.442309.11959.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=120887271228349 SVN commit 799841 by mkretz: try all possible devices to determine whether a sink is useful M +9 -3 devicemanager.cpp --- trunk/kdereview/phonon/gstreamer/devicemanager.cpp #799840:799841 @@ -127,9 +127,15 @@ if (gst_element_set_state(element, GST_STATE_READY) == GST_STATE_CHANGE_SUCCESS) return true; - // FIXME: if the above failed that might only mean that some property first has to be - // set/changed before it will go the READY. E.g. the alsasink only probes the "default" device. - // If that fails for some reason it doesn't indicate a fatal error + const QList &list = GstHelper::extractProperties(element, "device"); + foreach (const QByteArray &gstId, list) { + GstHelper::setProperty(element, "device", gstId); + if (gst_element_set_state(element, GST_STATE_READY) == GST_STATE_CHANGE_SUCCESS) { + return true; + } + } + // FIXME: the above can still fail for a valid alsasink because list only contains entries of + // the form "hw:X,Y". Would be better to use "default:X" or "dmix:X,Y" gst_element_set_state(element, GST_STATE_NULL); return false;