summaryrefslogtreecommitdiff
path: root/examples/mixer.py
blob: e9cb4327d9f6cc9d45ba69c2ec2d9a73f889b2bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4

import sys

import gst
import gst.interfaces

pipeline = "alsasrc"
if sys.argv[1:]:
    pipeline = " ".join(sys.argv[1:])
a = gst.element_factory_make(pipeline)
print dir(a)

res = a.set_state(gst.STATE_PAUSED)
if res != gst.STATE_CHANGE_SUCCESS:
    print "Could not set pipeline %s to PAUSED" % pipeline

print "Inputs:"
for t in a.list_tracks():
    if t.flags & gst.interfaces.MIXER_TRACK_INPUT:
        sys.stdout.write(t.label)
    sys.stdout.write(': %d - %d' % (t.min_volume, t.max_volume))
    volumes = a.get_volume(t)
    sys.stdout.write(': %r' % (volumes, ))
    if t.props.num_channels > 0:
        a.set_volume(t, volumes=volumes)
    if t.flags & gst.interfaces.MIXER_TRACK_RECORD:
        sys.stdout.write(' (selected)')
    sys.stdout.write('\n')