[Tomas Herfert] support for pulseaudio for audio calls.

This commit is contained in:
Yann Leboulanger 2011-03-27 18:47:02 +02:00
parent 2a7feb827c
commit 3d65d05487
1 changed files with 32 additions and 23 deletions

View File

@ -28,22 +28,25 @@ class DeviceManager(object):
def detect_element(self, name, text, pipe='%s'):
try:
element = gst.element_factory_make(name, '%spresencetest' % name)
if isinstance(element, gst.interfaces.PropertyProbe):
element.set_state(gst.STATE_READY)
element.probe_property_name('device')
devices = element.probe_get_values_name('device')
if devices:
self.devices[text % _(' Default device')] = pipe % name
for device in devices:
element.set_state(gst.STATE_NULL)
element.set_property('device', device)
element.set_state(gst.STATE_READY)
device_name = element.get_property('device-name')
self.devices[text % device_name] = pipe % '%s device=%s' % (name, device)
element.set_state(gst.STATE_NULL)
else:
self.devices[text] = pipe % name
if gst.element_factory_find(name):
element = gst.element_factory_make(name,
'%spresencetest' % name)
if isinstance(element, gst.interfaces.PropertyProbe):
element.set_state(gst.STATE_READY)
element.probe_property_name('device')
devices = element.probe_get_values_name('device')
if devices:
self.devices[text % _(' Default device')] = pipe % name
for device in devices:
element.set_state(gst.STATE_NULL)
element.set_property('device', device)
element.set_state(gst.STATE_READY)
device_name = element.get_property('device-name')
self.devices[text % device_name] = pipe % \
'%s device=%s' % (name, device)
element.set_state(gst.STATE_NULL)
else:
self.devices[text] = pipe % name
except ImportError:
pass
except gst.ElementNotFoundError:
@ -55,13 +58,16 @@ class AudioInputManager(DeviceManager):
self.devices = {}
# Test src
self.detect_element('audiotestsrc', _('Audio test'),
'%s is-live=true name=gajim_vol')
'%s is-live=true name=gajim_vol')
# Auto src
self.detect_element('autoaudiosrc', _('Autodetect'),
'%s ! volume name=gajim_vol')
'%s ! volume name=gajim_vol')
# Alsa src
self.detect_element('alsasrc', _('ALSA: %s'),
'%s ! volume name=gajim_vol')
'%s ! volume name=gajim_vol')
# Pulseaudio src
self.detect_element('pulsesrc', _('Pulse: %s'),
'%s ! volume name=gajim_vol')
class AudioOutputManager(DeviceManager):
@ -72,8 +78,9 @@ class AudioOutputManager(DeviceManager):
# Auto sink
self.detect_element('autoaudiosink', _('Autodetect'))
# Alsa sink
self.detect_element('alsasink', _('ALSA: %s'),
'%s sync=false')
self.detect_element('alsasink', _('ALSA: %s'), '%s sync=false')
# Pulseaudio sink
self.detect_element('pulsesink', _('Pulse: %s'), '%s sync=false')
class VideoInputManager(DeviceManager):
@ -81,7 +88,7 @@ class VideoInputManager(DeviceManager):
self.devices = {}
# Test src
self.detect_element('videotestsrc', _('Video test'),
'%s is-live=true ! video/x-raw-yuv,framerate=10/1')
'%s is-live=true ! video/x-raw-yuv,framerate=10/1')
# Auto src
self.detect_element('autovideosrc', _('Autodetect'))
# V4L2 src
@ -97,7 +104,9 @@ class VideoOutputManager(DeviceManager):
# Fake video output
self.detect_element('fakesink', _('Fake audio output'))
# Auto sink
self.detect_element('xvimagesink', _('X Window System (X11/XShm/Xv): %s'))
self.detect_element('xvimagesink',
_('X Window System (X11/XShm/Xv): %s'))
# ximagesink
self.detect_element('ximagesink', _('X Window System (without Xv)'))
self.detect_element('autovideosink', _('Autodetect'))