13 audio_init(void *cls
, int bits
, int channels
, int samplerate
)
15 return fopen("audio.pcm", "wb");
19 audio_set_volume(void *cls
, void *session
, float volume
)
21 printf("Setting volume to %f\n", volume
);
25 audio_process(void *cls
, void *session
, const void *buffer
, int buflen
)
29 buflen
-= fwrite(buffer
+orig
-buflen
, 1, buflen
, session
);
34 audio_flush(void *cls
, void *session
)
36 printf("Flushing audio\n");
40 audio_destroy(void *cls
, void *session
)
46 main(int argc
, char *argv
[])
48 const char *name
= "AppleTV";
49 unsigned short raop_port
= 5000;
50 const char hwaddr
[] = { 0x48, 0x5d, 0x60, 0x7c, 0xee, 0x22 };
54 raop_callbacks_t raop_cbs
;
57 raop_cbs
.audio_init
= audio_init
;
58 raop_cbs
.audio_set_volume
= audio_set_volume
;
59 raop_cbs
.audio_process
= audio_process
;
60 raop_cbs
.audio_flush
= audio_flush
;
61 raop_cbs
.audio_destroy
= audio_destroy
;
63 raop
= raop_init_from_keyfile(&raop_cbs
, "airport.key");
64 raop_start(raop
, &raop_port
, hwaddr
, sizeof(hwaddr
), "test");
66 dnssd
= dnssd_init(NULL
);
67 dnssd_register_raop(dnssd
, name
, raop_port
, hwaddr
, sizeof(hwaddr
), 1);
75 dnssd_unregister_raop(dnssd
);