source: roaraudio/roard/emul_simple.c @ 5439:7950543cabbc

Last change on this file since 5439:7950543cabbc was 5381:430b1d26e12d, checked in by phi, 12 years ago

updated copyright years

File size: 1.9 KB
Line 
1//emul_simple.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2012
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
28#ifndef ROAR_WITHOUT_DCOMP_EMUL_SIMPLE
29
30int emul_simple_on_connect  (int client, struct roard_listen * lsock) {
31 struct roar_stream_server * ss;
32 struct roar_stream        *  s;
33 struct roar_client        *  c;
34 int stream;
35
36 if ( clients_get(client, &c) == -1 ) {
37  return -1;
38 }
39
40 if ((stream = streams_new()) == -1 ) {
41  clients_delete(client);
42  return -1;
43 }
44
45 if ( streams_get(stream, &ss) == -1 ) {
46  streams_delete(stream);
47  clients_delete(client);
48  return -1;
49 }
50
51 s = ROAR_STREAM(ss);
52
53 if ( client_stream_add(client, stream) == -1 ) {
54  streams_delete(stream);
55  clients_delete(client);
56  return -1;
57 }
58
59 memcpy(&(s->info), &(lsock->inst.stpl.info), sizeof(struct roar_audio_info));
60
61 ss->codec_orgi = s->info.codec;
62
63 if ( streams_set_dir(stream, lsock->inst.stpl.dir, 1) == -1 ) {
64  clients_delete(client);
65  return -1;
66 }
67
68 if ( client_stream_exec(client, stream) == -1 ) {
69  clients_delete(client);
70  return -1;
71 }
72
73 return 0;
74}
75
76#endif
77
78//ll
Note: See TracBrowser for help on using the repository browser.