[2685] | 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 |
---|
[2688] | 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 | if ( stream == NULL ) |
---|
| 39 | return -1; |
---|
| 40 | |
---|
| 41 | switch (s->dir) { |
---|
| 42 | case ROAR_DIR_COMPLEX_IN: |
---|
| 43 | case ROAR_DIR_PLAY: |
---|
| 44 | flags = O_RDONLY; |
---|
| 45 | break; |
---|
| 46 | case ROAR_DIR_COMPLEX_OUT: |
---|
| 47 | case ROAR_DIR_MONITOR: |
---|
| 48 | case ROAR_DIR_OUTPUT: |
---|
| 49 | flags = O_WRONLY; |
---|
| 50 | break; |
---|
| 51 | default: |
---|
| 52 | return -1; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | state = RAUMOpenVIO(&(stream->vio), flags); |
---|
| 56 | |
---|
| 57 | if ( state == NULL ) |
---|
| 58 | return -1; |
---|
| 59 | |
---|
| 60 | cont_fw_set_uinst(self, state); |
---|
| 61 | |
---|
| 62 | return 0; |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | int cf_raum_pcb_close (struct cont_fw_parent_inst * self) { |
---|
| 66 | void * state; |
---|
| 67 | |
---|
| 68 | if ( cont_fw_get_uinst(self, &state) == -1 ) |
---|
| 69 | return -1; |
---|
| 70 | |
---|
| 71 | return RAUMClose(state); |
---|
| 72 | } |
---|
[2685] | 73 | |
---|
| 74 | CONT_FW_SETUP_TYPE(cf_raum_setup) { |
---|
[2688] | 75 | self->pcb.open = cf_raum_pcb_open; |
---|
| 76 | self->pcb.close = cf_raum_pcb_close; |
---|
[2685] | 77 | return 0; |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | #endif |
---|
| 81 | |
---|
| 82 | //ll |
---|