source: roaraudio/roard/container_framework.c @ 2661:82a64623cf1c

Last change on this file since 2661:82a64623cf1c was 2661:82a64623cf1c, checked in by phi, 15 years ago

added container_framework.c with some basic code

File size: 2.2 KB
Line 
1//container_framework.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#define _DECL()  struct cont_fw_child_vio_inst * inst
28#define _CHECK() if ( vio == NULL ) \
29                 return -1
30#define _CINST() if ( (inst = vio->inst) == NULL ) \
31                  return -1
32#define _PREP()  _CHECK(); \
33                 _CINST()
34#define _BASIC() _DECL();  \
35                 _PREP()
36
37ssize_t cont_fw_read    (struct roar_vio_calls * vio, void *buf, size_t count) {
38 _BASIC();
39
40 if ( inst->parent->cb.read != NULL )
41  return inst->parent->cb.read(inst->parent, inst->inst, buf, count);
42
43 return -1;
44}
45
46ssize_t cont_fw_write   (struct roar_vio_calls * vio, void *buf, size_t count) {
47 _BASIC();
48
49 if ( inst->parent->cb.write != NULL )
50  return inst->parent->cb.write(inst->parent, inst->inst, buf, count);
51
52 return -1;
53}
54
55off_t   cont_fw_lseek   (struct roar_vio_calls * vio, off_t offset, int whence);
56int     cont_fw_nonblock(struct roar_vio_calls * vio, int state);
57
58int     cont_fw_sync    (struct roar_vio_calls * vio) {
59 _BASIC();
60
61 if ( inst->parent->cb.flush != NULL )
62  return inst->parent->cb.flush(inst->parent, inst->inst);
63
64 return 0;
65}
66
67int     cont_fw_close   (struct roar_vio_calls * vio) {
68 _DECL();
69 int r = 0;
70
71 _PREP();
72
73 if ( cont_fw_sync(vio) == -1 )
74  r = -1;
75
76 return -1;
77 return  r;
78}
79
80int     cont_fw_ctl     (struct roar_vio_calls * vio, int cmd, void * data);
81
82//ll
Note: See TracBrowser for help on using the repository browser.