1 | //codecfilter_raum.c: |
---|
2 | |
---|
3 | /* |
---|
4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009 |
---|
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 | |
---|
27 | #ifdef ROAR_HAVE_LIBRAUM |
---|
28 | #include <raum.h> |
---|
29 | |
---|
30 | int cf_raum_pcb_open (struct cont_fw_parent_inst * self, |
---|
31 | int codec, |
---|
32 | struct roar_stream_server * stream, |
---|
33 | struct roar_codecfilter * filter) { |
---|
34 | struct roar_stream * s = ROAR_STREAM(stream); |
---|
35 | RAUMState * state; |
---|
36 | int flags = 0; |
---|
37 | |
---|
38 | ROAR_DBG("cf_raum_pcb_open(*) = ?"); |
---|
39 | |
---|
40 | if ( stream == NULL ) |
---|
41 | return -1; |
---|
42 | |
---|
43 | switch (s->dir) { |
---|
44 | case ROAR_DIR_COMPLEX_IN: |
---|
45 | case ROAR_DIR_PLAY: |
---|
46 | flags = O_RDONLY; |
---|
47 | break; |
---|
48 | case ROAR_DIR_COMPLEX_OUT: |
---|
49 | case ROAR_DIR_MONITOR: |
---|
50 | case ROAR_DIR_OUTPUT: |
---|
51 | flags = O_WRONLY; |
---|
52 | break; |
---|
53 | default: |
---|
54 | return -1; |
---|
55 | } |
---|
56 | |
---|
57 | state = RAUMOpenVIO(&(stream->vio), flags); |
---|
58 | |
---|
59 | if ( state == NULL ) |
---|
60 | return -1; |
---|
61 | |
---|
62 | cont_fw_set_uinst(self, state); |
---|
63 | |
---|
64 | ROAR_DBG("cf_raum_pcb_open(*) = -1"); |
---|
65 | return 0; |
---|
66 | } |
---|
67 | |
---|
68 | int cf_raum_pcb_close (struct cont_fw_parent_inst * self) { |
---|
69 | void * state; |
---|
70 | |
---|
71 | ROAR_DBG("cf_raum_pcb_close(*) = ?"); |
---|
72 | |
---|
73 | if ( cont_fw_get_uinst(self, &state) == -1 ) |
---|
74 | return -1; |
---|
75 | |
---|
76 | ROAR_DBG("cf_raum_pcb_close(*) = ?"); |
---|
77 | return RAUMClose(state); |
---|
78 | } |
---|
79 | |
---|
80 | CONT_FW_SETUP_TYPE(cf_raum_setup) { |
---|
81 | ROAR_DBG("cf_raum_setup(*) = ?"); |
---|
82 | |
---|
83 | self->pcb.open = cf_raum_pcb_open; |
---|
84 | self->pcb.close = cf_raum_pcb_close; |
---|
85 | |
---|
86 | ROAR_DBG("cf_raum_setup(*) = 0"); |
---|
87 | return 0; |
---|
88 | } |
---|
89 | |
---|
90 | #endif |
---|
91 | |
---|
92 | //ll |
---|