summaryrefslogtreecommitdiff
path: root/apps/codecs/libcook/rm.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libcook/rm.h')
-rw-r--r--apps/codecs/libcook/rm.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/apps/codecs/libcook/rm.h b/apps/codecs/libcook/rm.h
new file mode 100644
index 0000000000..f36145fc19
--- /dev/null
+++ b/apps/codecs/libcook/rm.h
@@ -0,0 +1,78 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 Mohamed Tarek
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _RM2WAV_H
22#define _RM2WAV_H
23
24#include <stdio.h>
25#include <stdint.h>
26
27typedef struct rm_packet
28{
29 uint8_t data[30000]; /* Reordered data. No malloc, hence the size */
30 uint16_t version;
31 uint16_t length;
32 uint32_t timestamp;
33 uint16_t stream_number;
34 uint8_t flags;
35}RMPacket;
36
37typedef struct rm_context
38{
39 /* Demux Context */
40 int old_format;
41 int current_stream;
42 int remaining_len;
43 int audio_stream_num; /*< Stream number for audio packets*/
44 int audio_pkt_cnt; /* Output packet counter*/
45
46 /* Stream Variables */
47 uint32_t audiotimestamp; /* Audio packet timestamp*/
48 uint16_t sub_packet_cnt; /* Subpacket counter, used while reading */
49 uint16_t sub_packet_size, sub_packet_h, coded_framesize; /* Descrambling parameters from container */
50 uint16_t audio_framesize; /* Audio frame size from container */
51 uint16_t sub_packet_lengths[16]; /* Length of each subpacket */
52
53 /* Codec Context */
54 uint16_t block_align;
55 uint32_t nb_packets;
56 int frame_number;
57 uint32_t extradata_size;
58 uint16_t sample_rate;
59 uint16_t nb_channels;
60 uint32_t bit_rate;
61 uint16_t flags;
62
63 /*cook extradata*/
64 uint32_t cook_version;
65 uint16_t samples_pf_pc; /* samples per frame per channel */
66 uint16_t nb_subbands; /* number of subbands in the frequency domain */
67 /* extra 8 bytes for stereo data */
68 uint32_t unused;
69 uint16_t js_subband_start; /* joint stereo subband start */
70 uint16_t js_vlc_bits;
71
72} RMContext;
73
74int open_wav(char* filename);
75void close_wav(int fd, RMContext *rmctx);
76int real_parse_header(int fd, RMContext *rmctx);
77void rm_get_packet(int fd,RMContext *rmctx, RMPacket *pkt);
78#endif