source: roaraudio/roard/emul_simple.c @ 3517:1a3218a3fc5b

Last change on this file since 3517:1a3218a3fc5b was 3517:1a3218a3fc5b, checked in by phi, 14 years ago

updated license headers, FSF moved office

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, 51 Franklin Street, Fifth Floor,
22 *  Boston, MA 02110-1301, USA.
23 *
24 */
25
26#include "roard.h"
27
28int emul_simple_on_connect  (int client, struct roard_listen * lsock) {
29 struct roar_stream_server * ss;
30 struct roar_stream        *  s;
31 struct roar_client        *  c;
32 int stream;
33
34 if ( clients_get(client, &c) == -1 ) {
35  return -1;
36 }
37
38 if ((stream = streams_new()) == -1 ) {
39  clients_delete(client);
40  return -1;
41 }
42
43 if ( streams_get(stream, &ss) == -1 ) {
44  streams_delete(stream);
45  clients_delete(client);
46  return -1;
47 }
48
49 s = ROAR_STREAM(ss);
50
51 if ( client_stream_add(client, stream) == -1 ) {
52  streams_delete(stream);
53  clients_delete(client);
54  return -1;
55 }
56
57 memcpy(&(s->info), &(lsock->inst.stpl.info), sizeof(struct roar_audio_info));
58
59 ss->codec_orgi = s->info.codec;
60
61 if ( streams_set_dir(stream, lsock->inst.stpl.dir, 1) == -1 ) {
62  clients_delete(client);
63  return -1;
64 }
65
66 if ( client_stream_exec(client, stream) == -1 ) {
67  clients_delete(client);
68  return -1;
69 }
70
71 return 0;
72}
73
74//ll
Note: See TracBrowser for help on using the repository browser.