summaryrefslogtreecommitdiff
path: root/apps/codecs/librm/rm.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/librm/rm.h')
-rw-r--r--apps/codecs/librm/rm.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/apps/codecs/librm/rm.h b/apps/codecs/librm/rm.h
new file mode 100644
index 0000000000..bdd03f3db2
--- /dev/null
+++ b/apps/codecs/librm/rm.h
@@ -0,0 +1,83 @@
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 _RM_H
22#define _RM_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 uint8_t *frames[100]; /* Pointers to ordered audio frames in buffer */
31 uint16_t version;
32 uint16_t length;
33 uint32_t timestamp;
34 uint16_t stream_number;
35 uint8_t flags;
36}RMPacket;
37
38typedef struct rm_context
39{
40 /* Demux Context */
41 int old_format;
42 int current_stream;
43 int remaining_len;
44 int audio_stream_num; /*< Stream number for audio packets*/
45 int audio_pkt_cnt; /* Output packet counter*/
46
47 /* Stream Variables */
48 uint32_t data_offset;
49 uint32_t audiotimestamp; /* Audio packet timestamp*/
50 uint16_t sub_packet_cnt; /* Subpacket counter, used while reading */
51 uint16_t sub_packet_size, sub_packet_h, coded_framesize; /* Descrambling parameters from container */
52 uint16_t audio_framesize; /* Audio frame size from container */
53 uint16_t sub_packet_lengths[16]; /* Length of each subpacket */
54
55 /* Codec Context */
56 uint16_t block_align;
57 uint32_t nb_packets;
58 int frame_number;
59 uint32_t extradata_size;
60 uint16_t sample_rate;
61 uint16_t nb_channels;
62 uint32_t bit_rate;
63 uint16_t flags;
64
65 /*cook extradata*/
66 uint32_t cook_version;
67 uint16_t samples_pf_pc; /* samples per frame per channel */
68 uint16_t nb_subbands; /* number of subbands in the frequency domain */
69 /* extra 8 bytes for stereo data */
70 uint32_t unused;
71 uint16_t js_subband_start; /* joint stereo subband start */
72 uint16_t js_vlc_bits;
73
74} RMContext;
75
76int open_wav(char* filename);
77void close_wav(int fd, RMContext *rmctx);
78int real_parse_header(int fd, RMContext *rmctx);
79void rm_get_packet(int fd,RMContext *rmctx, RMPacket *pkt);
80void rm_get_packet_membuf(uint8_t **filebuf,RMContext *rmctx, RMPacket *pkt);
81off_t filesize(int fd);
82void advance_buffer(uint8_t **buf, int val);
83#endif