Update the python bindings to work with current version
[deb_shairplay.git] / src / test / test.py
... / ...
CommitLineData
1import time
2from struct import *
3from Shairplay import *
4
5hwaddr = pack('BBBBBB', 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB)
6class SampleCallbacks(RaopCallbacks):
7 def audio_init(self, bits, channels, samplerate):
8 print "Initializing " + str(bits) + " " + str(channels) + " " + str(samplerate)
9 def audio_process(self, session, buffer):
10 print "Processing " + str(len(buffer)) + " bytes of audio"
11
12shairplay = LoadShairplay(".")
13callbacks = SampleCallbacks()
14
15raop = RaopService(shairplay, callbacks)
16port = raop.start(5000, hwaddr)
17
18dnssd = DnssdService(shairplay)
19dnssd.register_raop("RAOP test", port, hwaddr)
20
21time.sleep(50)
22
23dnssd.unregister_raop()
24raop.stop()
25
26del dnssd
27del raop
28