diff options
Diffstat (limited to 'apps/codecs/libcook/rm2wav.h')
-rw-r--r-- | apps/codecs/libcook/rm2wav.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/apps/codecs/libcook/rm2wav.h b/apps/codecs/libcook/rm2wav.h new file mode 100644 index 0000000000..09b20c7fa6 --- /dev/null +++ b/apps/codecs/libcook/rm2wav.h | |||
@@ -0,0 +1,74 @@ | |||
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 | #include <stdio.h> | ||
22 | #include <stdint.h> | ||
23 | |||
24 | typedef struct rm_packet | ||
25 | { | ||
26 | uint8_t data[30000]; /* Reordered data. No malloc, hence the size */ | ||
27 | uint16_t version; | ||
28 | uint16_t length; | ||
29 | uint32_t timestamp; | ||
30 | uint16_t stream_number; | ||
31 | uint8_t flags; | ||
32 | }RMPacket; | ||
33 | |||
34 | typedef struct rm_context | ||
35 | { | ||
36 | /* Demux Context */ | ||
37 | int old_format; | ||
38 | int current_stream; | ||
39 | int remaining_len; | ||
40 | int audio_stream_num; /*< Stream number for audio packets*/ | ||
41 | int audio_pkt_cnt; /* Output packet counter*/ | ||
42 | |||
43 | /* Stream Variables */ | ||
44 | uint32_t audiotimestamp; /* Audio packet timestamp*/ | ||
45 | uint16_t sub_packet_cnt; /* Subpacket counter, used while reading */ | ||
46 | uint16_t sub_packet_size, sub_packet_h, coded_framesize; /* Descrambling parameters from container */ | ||
47 | uint16_t audio_framesize; /* Audio frame size from container */ | ||
48 | uint16_t sub_packet_lengths[16]; /* Length of each subpacket */ | ||
49 | |||
50 | /* Codec Context */ | ||
51 | uint16_t block_align; | ||
52 | uint32_t nb_packets; | ||
53 | int frame_number; | ||
54 | uint32_t extradata_size; | ||
55 | uint16_t sample_rate; | ||
56 | uint16_t nb_channels; | ||
57 | uint32_t bit_rate; | ||
58 | uint16_t flags; | ||
59 | |||
60 | /*cook extradata*/ | ||
61 | uint32_t cook_version; | ||
62 | uint16_t samples_pf_pc; /* samples per frame per channel */ | ||
63 | uint16_t nb_subbands; /* number of subbands in the frequency domain */ | ||
64 | /* extra 8 bytes for stereo data */ | ||
65 | uint32_t unused; | ||
66 | uint16_t js_subband_start; /* joint stereo subband start */ | ||
67 | uint16_t js_vlc_bits; | ||
68 | |||
69 | } RMContext; | ||
70 | |||
71 | int open_wav(char* filename); | ||
72 | void close_wav(int fd, RMContext *rmctx); | ||
73 | int real_parse_header(int fd, RMContext *rmctx); | ||
74 | void rm_get_packet(int fd,RMContext *rmctx, RMPacket *pkt); | ||