summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/codecs.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/codecs.h')
-rw-r--r--lib/rbcodec/codecs/codecs.h45
1 files changed, 25 insertions, 20 deletions
diff --git a/lib/rbcodec/codecs/codecs.h b/lib/rbcodec/codecs/codecs.h
index ae4233b7a6..672b1ded53 100644
--- a/lib/rbcodec/codecs/codecs.h
+++ b/lib/rbcodec/codecs/codecs.h
@@ -36,7 +36,7 @@
36#endif 36#endif
37#if (CONFIG_CODEC == SWCODEC) 37#if (CONFIG_CODEC == SWCODEC)
38#ifdef HAVE_RECORDING 38#ifdef HAVE_RECORDING
39#include "pcm_record.h" 39#include "enc_base.h"
40#endif 40#endif
41#include "dsp_core.h" 41#include "dsp_core.h"
42#include "dsp_misc.h" 42#include "dsp_misc.h"
@@ -72,12 +72,12 @@
72#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */ 72#define CODEC_ENC_MAGIC 0x52454E43 /* RENC */
73 73
74/* increase this every time the api struct changes */ 74/* increase this every time the api struct changes */
75#define CODEC_API_VERSION 45 75#define CODEC_API_VERSION 46
76 76
77/* update this to latest version if a change to the api struct breaks 77/* update this to latest version if a change to the api struct breaks
78 backwards compatibility (and please take the opportunity to sort in any 78 backwards compatibility (and please take the opportunity to sort in any
79 new function which are "waiting" at the end of the function table) */ 79 new function which are "waiting" at the end of the function table) */
80#define CODEC_MIN_API_VERSION 45 80#define CODEC_MIN_API_VERSION 46
81 81
82/* reasons for calling codec main entrypoint */ 82/* reasons for calling codec main entrypoint */
83enum codec_entry_call_reason { 83enum codec_entry_call_reason {
@@ -96,6 +96,9 @@ enum codec_command_action {
96 CODEC_ACTION_HALT = -1, 96 CODEC_ACTION_HALT = -1,
97 CODEC_ACTION_NULL = 0, 97 CODEC_ACTION_NULL = 0,
98 CODEC_ACTION_SEEK_TIME = 1, 98 CODEC_ACTION_SEEK_TIME = 1,
99#ifdef HAVE_RECORDING
100 CODEC_ACTION_STREAM_FINISH = 2,
101#endif
99}; 102};
100 103
101/* NOTE: To support backwards compatibility, only add new functions at 104/* NOTE: To support backwards compatibility, only add new functions at
@@ -200,24 +203,18 @@ struct codec_api {
200#endif 203#endif
201 204
202#ifdef HAVE_RECORDING 205#ifdef HAVE_RECORDING
203 void (*enc_get_inputs)(struct enc_inputs *inputs); 206 int (*enc_pcmbuf_read)(void *buf, int count);
204 void (*enc_set_parameters)(struct enc_parameters *params); 207 int (*enc_pcmbuf_advance)(int count);
205 struct enc_chunk_hdr * (*enc_get_chunk)(void); 208 struct enc_chunk_data * (*enc_encbuf_get_buffer)(size_t need);
206 void (*enc_finish_chunk)(void); 209 void (*enc_encbuf_finish_buffer)(void);
207 unsigned char * (*enc_get_pcm_data)(size_t size); 210 ssize_t (*enc_stream_read)(void *buf, size_t count);
208 size_t (*enc_unget_pcm_data)(size_t size); 211 off_t (*enc_stream_lseek)(off_t offset, int whence);
209 212 ssize_t (*enc_stream_write)(const void *buf, size_t count);
210 /* file */
211 int (*open)(const char* pathname, int flags, ...);
212 int (*close)(int fd);
213 ssize_t (*read)(int fd, void* buf, size_t count);
214 off_t (*lseek)(int fd, off_t offset, int whence);
215 ssize_t (*write)(int fd, const void* buf, size_t count);
216 int (*round_value_to_list32)(unsigned long value, 213 int (*round_value_to_list32)(unsigned long value,
217 const unsigned long list[], 214 const unsigned long list[],
218 int count, 215 int count,
219 bool signd); 216 bool signd);
220#endif 217#endif /* HAVE_RECORDING */
221 218
222 /* new stuff at the end, sort into place next time 219 /* new stuff at the end, sort into place next time
223 the API gets incompatible */ 220 the API gets incompatible */
@@ -229,6 +226,7 @@ struct codec_header {
229 enum codec_status(*entry_point)(enum codec_entry_call_reason reason); 226 enum codec_status(*entry_point)(enum codec_entry_call_reason reason);
230 enum codec_status(*run_proc)(void); 227 enum codec_status(*run_proc)(void);
231 struct codec_api **api; 228 struct codec_api **api;
229 void * rec_extension[]; /* extension for encoders */
232}; 230};
233 231
234#ifdef CODEC 232#ifdef CODEC
@@ -249,7 +247,7 @@ extern unsigned char plugin_end_addr[];
249 __attribute__ ((section (".header")))= { \ 247 __attribute__ ((section (".header")))= { \
250 { CODEC_ENC_MAGIC, TARGET_ID, CODEC_API_VERSION, \ 248 { CODEC_ENC_MAGIC, TARGET_ID, CODEC_API_VERSION, \
251 plugin_start_addr, plugin_end_addr }, codec_start, \ 249 plugin_start_addr, plugin_end_addr }, codec_start, \
252 codec_run, &ci }; 250 codec_run, &ci, { enc_callback } };
253 251
254#else /* def SIMULATOR */ 252#else /* def SIMULATOR */
255/* decoders */ 253/* decoders */
@@ -262,7 +260,7 @@ extern unsigned char plugin_end_addr[];
262#define CODEC_ENC_HEADER \ 260#define CODEC_ENC_HEADER \
263 const struct codec_header __header = { \ 261 const struct codec_header __header = { \
264 { CODEC_ENC_MAGIC, TARGET_ID, CODEC_API_VERSION, NULL, NULL }, \ 262 { CODEC_ENC_MAGIC, TARGET_ID, CODEC_API_VERSION, NULL, NULL }, \
265 codec_start, codec_run, &ci }; 263 codec_start, codec_run, &ci, { enc_callback } };
266#endif /* SIMULATOR */ 264#endif /* SIMULATOR */
267#endif /* CODEC */ 265#endif /* CODEC */
268 266
@@ -277,12 +275,19 @@ void *codec_get_buffer_callback(size_t *size);
277int codec_load_buf(int hid, struct codec_api *api); 275int codec_load_buf(int hid, struct codec_api *api);
278int codec_load_file(const char* codec, struct codec_api *api); 276int codec_load_file(const char* codec, struct codec_api *api);
279int codec_run_proc(void); 277int codec_run_proc(void);
280int codec_halt(void);
281int codec_close(void); 278int codec_close(void);
279#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING)
280enc_callback_t codec_get_enc_callback(void);
281#else
282#define codec_get_enc_callback() NULL
283#endif
282 284
283/* defined by the codec */ 285/* defined by the codec */
284enum codec_status codec_start(enum codec_entry_call_reason reason); 286enum codec_status codec_start(enum codec_entry_call_reason reason);
285enum codec_status codec_main(enum codec_entry_call_reason reason); 287enum codec_status codec_main(enum codec_entry_call_reason reason);
286enum codec_status codec_run(void); 288enum codec_status codec_run(void);
289#if CONFIG_CODEC == SWCODEC && defined(HAVE_RECORDING)
290int enc_callback(enum enc_callback_reason reason, void *params);
291#endif
287 292
288#endif /* _CODECS_H_ */ 293#endif /* _CODECS_H_ */