source: roaraudio/roard/caps.c @ 5012:b263759832f1

Last change on this file since 5012:b263759832f1 was 4708:c9d40761088a, checked in by phi, 13 years ago

updated copyright statements

File size: 2.3 KB
Line 
1//caps.c:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010-2011
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
28static uint32_t _g_caps_standards[] = {
29 // message formats:
30 ROAR_STD_MAKE(ROAR_STDV_ROARAUDIO,  0, 0), // v. 0
31
32 // command sets:
33 ROAR_STD_MAKE(ROAR_STDV_ROARAUDIO,  4, 0), // basic commands
34
35 // well known numbers:
36 ROAR_STD_MAKE(ROAR_STDV_ROARAUDIO, 12, 0), // codecs
37
38 // transports:
39#ifdef ROAR_HAVE_UNIX
40 ROAR_STD_MAKE(ROAR_STDV_ROARAUDIO, 23, 0), // UNIX
41#endif
42#ifdef ROAR_HAVE_LIBDNET
43 ROAR_STD_MAKE(ROAR_STDV_ROARAUDIO, 24, 0), // DECnet
44#endif
45#ifdef ROAR_HAVE_IPV4
46 ROAR_STD_MAKE(ROAR_STDV_ROARAUDIO, 25, 0), // TCP
47#endif
48
49 0xFFFFFFFF // terminater
50};
51
52struct roar_stds g_caps_stds = {
53 .stds_len = (sizeof(_g_caps_standards)/sizeof(*_g_caps_standards)) - 1,
54 .stds     = _g_caps_standards
55};
56
57char * stds_string (void) {
58 size_t len = g_caps_stds.stds_len * 14;
59 char * ret = roar_mm_malloc(len);
60 size_t off = 0;
61 size_t i;
62 int snpret;
63 uint32_t cap;
64 int version;
65
66 if ( ret == NULL )
67  return NULL;
68
69 for (i = 0; i < g_caps_stds.stds_len; i++) {
70  cap = g_caps_stds.stds[i];
71  version = ROAR_STD_VERSION(cap);
72  if ( version == 0 ) {
73   snpret = snprintf(ret+off, len-off, "%i-%i,", ROAR_STD_VENDOR(cap), ROAR_STD_STD(cap));
74  } else {
75   snpret = snprintf(ret+off, len-off, "%i-%i-%i,", ROAR_STD_VENDOR(cap), ROAR_STD_STD(cap), version);
76  }
77  if ( snpret > 0 ) {
78   off += snpret;
79  } else {
80   roar_mm_free(ret);
81   return NULL;
82  }
83 }
84
85 ret[off-1] = 0;
86
87 return ret;
88}
89
90//ll
Note: See TracBrowser for help on using the repository browser.