Main Backend class interface
This interface defines the main factory of the backend. The PySide.phonon.Phonon::BackendInterface.createObject() function creates all the objects needed by the frontend.
The objectDescriptionIndexes and objectDescriptionProperties functions return information about available devices, effects and codecs.
An implementation could look like this:
def createObject(self, c, parent, args):
if c == BackendInterface.MediaObjectClass:
return MediaObject(parent)
elif c == BackendInterface.VolumeFaderEffectClass:
return VolumeFaderEffect(parent)
elif c == BackendInterface.AudioOutputClass:
return AudioOutput(parent)
elif c == BackendInterface.AudioDataOutputClass:
return AudioDataOutput(parent)
elif c == BackendInterface.VisualizationClass:
return Visualization(parent)
elif c == BackendInterface.VideoDataOutputClass:
return VideoDataOutput(parent)
elif c == BackendInterface.EffectClass:
return Effect(args[0].toInt(), parent)
elif c == BackendInterface.VideoWidgetClass:
return VideoWidget(parent)
return None
def objectDescriptionIndexes(self, type_):
retval = set()
if type_ == Phonon.AudioOutputDeviceType:
# use AudioDeviceEnumerator to list ALSA and OSS devices
retval.add(10000)
retval.add(10001)
elif type_ == Phonon.AudioCaptureDeviceType:
retval.add(20000)
retval.add(20001)
elif type_ == Phonon.VideoCaptureDeviceType:
retval.add(30000)
retval.add(30001)
elif type_ == Phonon.EffectType:
retval.add(0x7F000001)
return retval
def objectDescriptionProperties(self, type_, index):
ret = {}
if type_ == Phonon.AudioOutputDeviceType:
if index == 10000:
ret["name"] = "internal Soundcard"
elif index == 10001:
ret["name"] = "USB Headset"
ret["available"] = False
elif type_ == Phonon.AudioCaptureDeviceType:
if index == 20000:
ret["name"] = "Soundcard"
ret["description"] = "first description"
elif index == 20001:
ret["name"] = "DV"
ret["description"] = "second description"
elif type_ == Phonon.VideoCaptureDeviceType:
elif index == 30000:
ret["name"] = "USB Webcam"
ret["description"] = "first description"
elif index == 30001:
ret["name"] = "DV"))
ret["description"] = "second description"
elif type_ == Phonon.EffectType:
if index == 0x7F000001:
ret["name"] = "Delay"
ret["description"] = "Simple delay effect with time, feedback and level controls."
return ret
Classes that the PySide.phonon.Phonon::BackendInterface.createObject() function has to handle.
| 常量 | 描述 |
|---|---|
| Phonon.BackendInterface.MediaObjectClass | Request to return a MediaObject 对象。 |
| Phonon.BackendInterface.VolumeFaderEffectClass | Request to return a VolumeFaderEffect 对象。 |
| Phonon.BackendInterface.AudioOutputClass | Request to return an AudioOutput 对象。 |
| Phonon.BackendInterface.AudioDataOutputClass | Request to return an AudioDataOutput 对象。 |
| Phonon.BackendInterface.VisualizationClass | Request to return a Visualization 对象。 |
| Phonon.BackendInterface.VideoDataOutputClass | Request to return a VideoDataOutput 对象。 |
| Phonon.BackendInterface.EffectClass | Request to return a Effect object. Takes an additional int that specifies the effect ID. |
| Phonon.BackendInterface.VideoWidgetClass | Request to return a VideoWidget 对象。 |
| 返回类型: | 字符串列表 |
|---|
Returns all available MIME types.
| 参数: |
|
|---|---|
| 返回类型: |
PySide.QtCore.bool |
Defines a signal connection between the two given nodes.
| 参数: |
|
|---|---|
| 返回类型: |
| 参数: |
|
|---|---|
| 返回类型: |
PySide.QtCore.bool |
Cuts a signal connection between the two given nodes.
| 参数: | arg__1 – |
|---|---|
| 返回类型: | PySide.QtCore.bool |
| 参数: | type – PySide.phonon.Phonon.ObjectDescriptionType |
|---|---|
| 返回类型: |
Returns the unique identifiers for the devices/effects/codecs of the given type .
type see Phonon.ObjectDescriptionType
| 参数: |
|
|---|---|
| 返回类型: |
Given a unique identifier that was returned from objectDescriptionIndexes this function returns a hash mapping property names to values.
The property “name” must always be present. All other properties are optional.
| 特性 | 描述 |
| name | The name of the device/effect/codec/... |
| description | A text explaining what this device/effect/codec/... is/can do |
| icon | An icon name (using the freedesktop naming scheme) or a PySide.QtGui.QIcon for this device/effect/codec/... |
| available | A bool telling whether the device is present or unplugged. |
type see Phonon.ObjectDescriptionType index The unique identifier that is returned from objectDescriptionIndexes
| 参数: | arg__1 – |
|---|---|
| 返回类型: | PySide.QtCore.bool |