source: roaraudio/roard/include/codecfilter.h @ 2503:714b0d78bb4b

Last change on this file since 2503:714b0d78bb4b was 2083:db651f413235, checked in by phi, 15 years ago

added CTLs for setting encoder quality

File size: 5.2 KB
RevLine 
[169]1//codecfilter.h:
2
[668]3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008
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
[169]25#ifndef _CODECFILTER_H_
26#define _CODECFILTER_H_
27
28#include <roaraudio.h>
29
[170]30#define CODECFILTER_USERDATA_T void *
31
[195]32struct roar_stream_server;
[170]33
[612]34#define ROAR_CODECFILTER_NONE  0
35#define ROAR_CODECFILTER_READ  1
36#define ROAR_CODECFILTER_WRITE 2
37
[1238]38
39#define ROAR_CODECFILTER_CTL_NOOP            ROAR_STREAM_CTL_COMP_CF|0x0000 /* noop... */
40#define ROAR_CODECFILTER_CTL_BASE            ROAR_STREAM_CTL_COMP_CF|0x0000 /* Base ops... */
41#define ROAR_CODECFILTER_CTL_META            ROAR_STREAM_CTL_COMP_CF|0x1000 /* Meta data things... */
42
[2083]43#define ROAR_CODECFILTER_CTL_SET             0x0002
44#define ROAR_CODECFILTER_CTL_GET             0x0003
45
[1238]46#define ROAR_CODECFILTER_CTL_UPDATE          0x0001
47
[2083]48#define ROAR_CODECFILTER_CTL_Q               0x0010
49#define ROAR_CODECFILTER_CTL_SET_Q           ROAR_CODECFILTER_CTL_BASE|ROAR_CODECFILTER_CTL_Q|ROAR_CODECFILTER_CTL_SET
50#define ROAR_CODECFILTER_CTL_GET_Q           ROAR_CODECFILTER_CTL_BASE|ROAR_CODECFILTER_CTL_Q|ROAR_CODECFILTER_CTL_GET
51
[1238]52#define ROAR_CODECFILTER_CTL_META_UPDATE     ROAR_CODECFILTER_CTL_META|ROAR_CODECFILTER_CTL_UPDATE
53
54#define ROAR_CODECFILTER_CTL2CMD(x)          ((x) & (~ROAR_STREAM_CTL_COMP_CF))
55
[170]56struct roar_codecfilter {
[176]57 int    codec;
[170]58 char * name;
59 char * desc;
[171]60 char * options;
[612]61 int    flags;
[193]62 int (*open )(CODECFILTER_USERDATA_T * inst, int codec,
[171]63                                             struct roar_stream_server * info,
64                                             struct roar_codecfilter   * filter);
[170]65 int (*close)(CODECFILTER_USERDATA_T   inst);
66 int (*pause)(CODECFILTER_USERDATA_T   inst, int newstate);
67 int (*write)(CODECFILTER_USERDATA_T   inst, char * buf, int len);
68 int (*read )(CODECFILTER_USERDATA_T   inst, char * buf, int len);
69 int (*flush)(CODECFILTER_USERDATA_T   inst);
[1144]70 int (*delay)(CODECFILTER_USERDATA_T   inst, uint_least32_t * delay);
[1223]71 int (*ctl  )(CODECFILTER_USERDATA_T   inst, int cmd, void * data);
[170]72};
73
[172]74
75#include "codecfilter_cmd.h"
[561]76#include "codecfilter_wave.h"
77
78
[204]79#ifdef ROAR_HAVE_LIBVORBISFILE
80#include "codecfilter_vorbis.h"
81#endif
[172]82
[323]83#ifdef ROAR_HAVE_LIBCELT
84#include "codecfilter_celt.h"
85#endif
[172]86
[371]87#ifdef ROAR_HAVE_LIBSPEEX
88#include "codecfilter_speex.h"
89#endif
90
[851]91#ifdef ROAR_HAVE_LIBSNDFILE
92#include "codecfilter_sndfile.h"
93#endif
94
[992]95#ifdef ROAR_HAVE_LIBFISHSOUND
96#include "codecfilter_fishsound.h"
97#endif
98
99//cf alaw/mulaw:
[783]100#include <libroardsp/libroardsp.h>
101
[170]102void print_codecfilterlist (void);
103
104int codecfilter_open (CODECFILTER_USERDATA_T * inst,
105                 int * codecfilter_id, char * codecfilter /* NOTE: this is not part of struct roar_codecfilter's def! */,
[193]106                 int codec, struct roar_stream_server * info);
[170]107int codecfilter_close(CODECFILTER_USERDATA_T   inst, int codecfilter);
108int codecfilter_pause(CODECFILTER_USERDATA_T   inst, int codecfilter, int newstate);
109int codecfilter_write(CODECFILTER_USERDATA_T   inst, int codecfilter, char * buf, int len);
110int codecfilter_read (CODECFILTER_USERDATA_T   inst, int codecfilter, char * buf, int len);
111int codecfilter_flush(CODECFILTER_USERDATA_T   inst, int codecfilter);
[1144]112int codecfilter_delay(CODECFILTER_USERDATA_T   inst, int codecfilter, uint_least32_t * delay);
[1224]113int codecfilter_ctl  (CODECFILTER_USERDATA_T   inst, int codecfilter, int_least32_t cmd, void * data);
[1144]114
115int codecfilter_delay_fulldyn(CODECFILTER_USERDATA_T   inst, uint_least32_t * delay);
116
[170]117
[736]118// codecfilter without a own .h:
119int cf_alaw_open(CODECFILTER_USERDATA_T * inst, int codec,
120                                            struct roar_stream_server * info,
121                                            struct roar_codecfilter   * filter);
122
123int cf_alaw_close(CODECFILTER_USERDATA_T   inst);
124
125int cf_alaw_read(CODECFILTER_USERDATA_T   inst, char * buf, int len);
126int cf_alaw_write(CODECFILTER_USERDATA_T   inst, char * buf, int len);
[1144]127int cf_alaw_delay(CODECFILTER_USERDATA_T   inst, uint_least32_t * delay);
[170]128
[922]129int cf_mulaw_open(CODECFILTER_USERDATA_T * inst, int codec,
130                                            struct roar_stream_server * info,
131                                            struct roar_codecfilter   * filter);
132
133int cf_mulaw_close(CODECFILTER_USERDATA_T   inst);
134
135int cf_mulaw_read(CODECFILTER_USERDATA_T   inst, char * buf, int len);
136int cf_mulaw_write(CODECFILTER_USERDATA_T   inst, char * buf, int len);
[1144]137// cf_mulaw_delay() would be exactly the same as cf_alaw_delay() so it is just used by mulaw, too.
[922]138
[169]139#endif
140
141//ll
Note: See TracBrowser for help on using the repository browser.