Commit | Line | Data |
---|---|---|
8be1424a JVH |
1 | import time |
2 | from struct import * | |
3 | from Shairplay import * | |
4 | ||
5 | hwaddr = pack('BBBBBB', 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB) | |
094e4ad1 JVH |
6 | class 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" | |
8be1424a JVH |
11 | |
12 | shairplay = LoadShairplay(".") | |
094e4ad1 | 13 | callbacks = SampleCallbacks() |
8be1424a | 14 | |
094e4ad1 | 15 | raop = RaopService(shairplay, callbacks) |
8be1424a JVH |
16 | port = raop.start(5000, hwaddr) |
17 | ||
18 | dnssd = DnssdService(shairplay) | |
094e4ad1 | 19 | dnssd.register_raop("RAOP test", port, hwaddr) |
8be1424a JVH |
20 | |
21 | time.sleep(50) | |
22 | ||
23 | dnssd.unregister_raop() | |
24 | raop.stop() | |
094e4ad1 JVH |
25 | |
26 | del dnssd | |
8be1424a JVH |
27 | del raop |
28 |