source: roaraudio/include/libroardsp/transcode.h @ 5961:06e7fd9e4c25

Last change on this file since 5961:06e7fd9e4c25 was 5961:06e7fd9e4c25, checked in by phi, 10 years ago

Updates of copyright and license headers

File size: 4.6 KB
RevLine 
[2168]1//transcode.h:
2
3/*
[5961]4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009-2014
[2168]5 *
6 *  This file is part of libroar 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 *  libroar 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
[3517]21 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 *  Boston, MA 02110-1301, USA.
[2168]23 *
24 *  NOTE for everyone want's to change something and send patches:
25 *  read README and HACKING! There a addition information on
26 *  the license of this document you need to read before you send
27 *  any patches.
28 *
29 *  NOTE for uses of non-GPL (LGPL,...) software using libesd, libartsc
30 *  or libpulse*:
31 *  The libs libroaresd, libroararts and libroarpulse link this lib
32 *  and are therefore GPL. Because of this it may be illigal to use
33 *  them with any software that uses libesd, libartsc or libpulse*.
34 */
35
[2169]36#ifndef _LIBROARDSP_TRANSCODE_H_
37#define _LIBROARDSP_TRANSCODE_H_
[2168]38
[2169]39#include "libroardsp.h"
[2168]40
[2170]41#define ROAR_XCODER_STAGE_NONE        0
42#define ROAR_XCODER_STAGE_INITED      0
43#define ROAR_XCODER_STAGE_WAIT        1
44#define ROAR_XCODER_STAGE_MAGIC       2
45#define ROAR_XCODER_STAGE_OPENING     3
46#define ROAR_XCODER_STAGE_OPENED      4
47#define ROAR_XCODER_STAGE_CLOSING     5
48#define ROAR_XCODER_STAGE_CLOSED      6
49
50#define ROAR_BIXCODER_FLAGS_NONE      0x0000
51#define ROAR_BIXCODER_FLAGS_ENCODE    0x0001
52#define ROAR_BIXCODER_FLAGS_DECODE    0x0002
53
54struct roar_xcoder;
55
56struct roar_xcoder_entry {
[2175]57 int codec;
[2170]58 int (*init)(struct roar_xcoder * state);
59 int (*uninit)(struct roar_xcoder * state);
60 int (*packet_size)(struct roar_xcoder * state, int samples);
[2171]61 int (*encode)(struct roar_xcoder * state, void * buf, size_t len);
62 int (*decode)(struct roar_xcoder * state, void * buf, size_t len);
[2921]63 int (*proc_header)(struct roar_xcoder * state);
[2170]64};
65
66struct roar_xcoder {
67 void * inst;
68 struct roar_xcoder_entry * entry;
69 struct roar_vio_calls * backend;
[2171]70 int encode;
[2170]71 int flags;
72 int stage;
73 ssize_t packet_len;
74 struct roar_buffer * iobuffer;
75 struct {
76  struct roar_audio_info coded;
77  struct roar_audio_info pcm;
78 } info;
79};
80
81struct roar_bixcoder {
82 struct roar_xcoder encoder, decoder;
83 int flags;
84};
85
86struct roar_transcoder {
87 struct roar_xcoder encoder, decoder;
88};
89
90int roar_xcoder_init(struct roar_xcoder * state, int encoder, struct roar_audio_info * info, struct roar_vio_calls * vio);
91int roar_xcoder_set_backend(struct roar_xcoder * state, struct roar_vio_calls * vio);
92int roar_xcoder_packet_size(struct roar_xcoder * state, int samples);
93int roar_xcoder_close      (struct roar_xcoder * state);
[2921]94int roar_xcoder_proc_header(struct roar_xcoder * state);
[2170]95int roar_xcoder_proc_packet(struct roar_xcoder * state, void * buf, size_t len);
96int roar_xcoder_proc       (struct roar_xcoder * state, void * buf, size_t len);
97
98int roar_bixcoder_init(struct roar_bixcoder * state, struct roar_audio_info * info, struct roar_vio_calls * vio);
99int roar_bixcoder_packet_size (struct roar_bixcoder * state, int samples);
100int roar_bixcoder_close       (struct roar_bixcoder * state);
[2921]101int roar_bixcoder_read_header (struct roar_bixcoder * state);
[2170]102int roar_bixcoder_read_packet (struct roar_bixcoder * state, void * buf, size_t len);
103int roar_bixcoder_read        (struct roar_bixcoder * state, void * buf, size_t len);
[2921]104int roar_bixcoder_write_header(struct roar_bixcoder * state);
[2170]105int roar_bixcoder_write_packet(struct roar_bixcoder * state, void * buf, size_t len);
106int roar_bixcoder_write       (struct roar_bixcoder * state, void * buf, size_t len);
107
[2172]108// dummy functions used by some de/encoders:
109int roar_xcoder_dummy_inituninit(struct roar_xcoder * state);
110int roar_xcoder_dummy_packet_size_any(struct roar_xcoder * state, int samples);
[2922]111int roar_xcoder_dummy_proc_header(struct roar_xcoder * state);
[2172]112
[2179]113// prototypes for some simple xcoders:
114int roar_xcoder_alaw_encode(struct roar_xcoder * state, void * buf, size_t len);
115int roar_xcoder_alaw_decode(struct roar_xcoder * state, void * buf, size_t len);
116
117int roar_xcoder_mulaw_encode(struct roar_xcoder * state, void * buf, size_t len);
118int roar_xcoder_mulaw_decode(struct roar_xcoder * state, void * buf, size_t len);
119
[2168]120#endif
121
122//ll
Note: See TracBrowser for help on using the repository browser.