source: roaraudio/roard/emul_simple.c @ 3358:7f9d211148e0

Last change on this file since 3358:7f9d211148e0 was 3255:970b81dc7c18, checked in by phi, 14 years ago

got PA simple protocol basicly to work

File size: 1.8 KB
Line 
1//emul_simple.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010
5 *
6 *  This file is part of roard a part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  RoarAudio is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU General Public License for more details.
18 *
19 *  You should have received a copy of the GNU General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 */
24
25#include "roard.h"
26
27int emul_simple_on_connect  (int client, struct roard_listen * lsock) {
28 struct roar_stream_server * ss;
29 struct roar_stream        *  s;
30 struct roar_client        *  c;
31 int stream;
32
33 if ( clients_get(client, &c) == -1 ) {
34  return -1;
35 }
36
37 if ((stream = streams_new()) == -1 ) {
38  clients_delete(client);
39  return -1;
40 }
41
42 if ( streams_get(stream, &ss) == -1 ) {
43  streams_delete(stream);
44  clients_delete(client);
45  return -1;
46 }
47
48 s = ROAR_STREAM(ss);
49
50 if ( client_stream_add(client, stream) == -1 ) {
51  streams_delete(stream);
52  clients_delete(client);
53  return -1;
54 }
55
56 memcpy(&(s->info), &(lsock->inst.stpl.info), sizeof(struct roar_audio_info));
57
58 ss->codec_orgi = s->info.codec;
59
60 if ( streams_set_dir(stream, lsock->inst.stpl.dir, 1) == -1 ) {
61  clients_delete(client);
62  return -1;
63 }
64
65 if ( client_stream_exec(client, stream) == -1 ) {
66  clients_delete(client);
67  return -1;
68 }
69
70 return 0;
71}
72
73//ll
Note: See TracBrowser for help on using the repository browser.