Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 155230 Details for
Bug 240951
rfe: dbus interface to get all connected audio cards
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
dbus support for alsaaudio binding
pyalsaaudio-0.2-dbus.patch (text/plain), 4.53 KB, created by
Andy Shevchenko
on 2007-05-23 11:42:12 UTC
(
hide
)
Description:
dbus support for alsaaudio binding
Filename:
MIME Type:
Creator:
Andy Shevchenko
Created:
2007-05-23 11:42:12 UTC
Size:
4.53 KB
patch
obsolete
>diff -ruN -p pyalsaaudio-0.2.orig/Cards.py pyalsaaudio-0.2/Cards.py >--- pyalsaaudio-0.2.orig/Cards.py 1970-01-01 03:00:00.000000000 +0300 >+++ pyalsaaudio-0.2/Cards.py 2007-05-23 13:41:49.000000000 +0300 >@@ -0,0 +1,75 @@ >+ >+# vim: ts=4 sw=4 et: >+ >+""" >+DBus interface handler. >+""" >+ >+__author__ = "Andy Shevchenko <andy@smile.org.ua>" >+__revision__ = "$Id$" >+ >+import dbus >+ >+DEVICES = {} >+CAPABILITY = 'alsa' >+ >+class HALDevice: >+ """ Special class to store device """ >+ def __init__(self, device): >+ self.__device = device >+ self.__properties = self.__device.GetAllProperties() >+ >+ def has_key(self, key): >+ return self.__properties.has_key(key) >+ >+ def __delitem__(self, key): >+ if self.__properties.has_key(key): >+ del self.__properties[key] >+ >+ def __getitem__(self, key): >+ return self.__properties[key] >+ >+ def get(self, key, result=None): >+ if self.__properties.has_key(key): >+ return self.__properties[key] >+ return result >+ >+ def udi(self): >+ return self.get('info.udi') >+ >+def refresh(): >+ """ Fill devices list by current connected devices """ >+ DEVICES.clear() >+ for udi in hal_manager.FindDeviceByCapability(CAPABILITY): >+ DEVICES[udi] = HALDevice(bus.get_object('org.freedesktop.Hal', udi)) >+ >+def devices(): >+ """ Return all registered devices """ >+ return DEVICES.keys() >+ >+def get(udi, result=None): >+ """ Return HALDevice object by udi """ >+ return DEVICES.get(udi, result) >+ >+def cards(): >+ """ Return list of tuples (card, card_id) >+ where card is a number and card_id is a name of the card """ >+ result = [] >+ for udi in DEVICES.keys(): >+ if DEVICES[udi].get('alsa.type') == 'control': >+ result.append((DEVICES[udi].get('alsa.card'), >+ DEVICES[udi].get('alsa.card_id'))) >+ return result >+ >+def convert(number=0): >+ """ Convert card number to the special name suitable for all >+ alsaaudio classes """ >+ return "hw:%d" % number >+ >+bus = dbus.SystemBus() >+hal_manager = bus.get_object('org.freedesktop.Hal', >+ '/org/freedesktop/Hal/Manager') >+ >+dbus_version = getattr(dbus, 'version', (0,0,0)) >+if dbus_version >= (0,41,0): >+ import dbus.glib >diff -ruN -p pyalsaaudio-0.2.orig/cardstest.py pyalsaaudio-0.2/cardstest.py >--- pyalsaaudio-0.2.orig/cardstest.py 1970-01-01 03:00:00.000000000 +0300 >+++ pyalsaaudio-0.2/cardstest.py 2007-05-23 13:46:24.000000000 +0300 >@@ -0,0 +1,26 @@ >+## cardstest.py >+## >+## Example: >+## python cardstest.py >+ >+# vim: ts=4 sw=4 et: >+ >+""" >+The Cards interface provides the following methods: >+refresh() -- read all connected audio devices via HAL >+cards() -- return tuples with card number and name >+""" >+ >+__author__ = "Andy Shevchenko <andy@smile.org.ua>" >+__revision__ = "$Id$" >+ >+import alsaaudio >+ >+if alsaaudio.dbus_support: >+ alsaaudio.Cards.refresh() >+ >+ for card, card_id in alsaaudio.Cards.cards(): >+ print "%d [%s]" % (card, card_id) >+else: >+ print "DBus isn't supported." >+ >diff -ruN -p pyalsaaudio-0.2.orig/__init__.py pyalsaaudio-0.2/__init__.py >--- pyalsaaudio-0.2.orig/__init__.py 1970-01-01 03:00:00.000000000 +0300 >+++ pyalsaaudio-0.2/__init__.py 2007-05-23 13:43:17.000000000 +0300 >@@ -0,0 +1,26 @@ >+ >+# vim: ts=4 sw=4 et: >+ >+""" >+This modules provides support for the ALSA audio API. >+ >+To control the PCM device, use the PCM class, Mixers >+are controlled using the Mixer class. >+ >+The following functions are also provided: >+mixers() -- Return a list of available mixer names >+ >+The Cards interface provides the following methods: >+refresh() -- read all connected audio devices via HAL >+cards() -- return tuples with card number and name >+""" >+ >+__revision__ = "$Id$" >+ >+from alsaaudio import * >+try: >+ import Cards >+ dbus_support = True >+except: >+ Cards = None >+ dbus_support = False >diff -ruN -p pyalsaaudio-0.2.orig/setup.py pyalsaaudio-0.2/setup.py >--- pyalsaaudio-0.2.orig/setup.py 2005-07-10 00:26:43.000000000 +0300 >+++ pyalsaaudio-0.2/setup.py 2007-05-23 14:02:03.000000000 +0300 >@@ -3,11 +3,13 @@ from distutils.extension import Extensio > > setup( > name = "alsaaudio", >- version = "0.1", >+ version = "0.2.1", > description = "alsa bindings", > author = "Casper Wilstrup", > author_email="cwi@unispeed.com", >- ext_modules=[Extension("alsaaudio",["alsaaudio.c"],libraries=['asound']) >+ packages=['alsaaudio'], >+ package_dir={'alsaaudio': ''}, >+ ext_modules=[Extension("alsaaudio.alsaaudio",["alsaaudio.c"],libraries=['asound']) > ] > ) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 240951
: 155230 |
155231