FS#8961 - Anti-Aliased Fonts.
[kugel-rb/myfork.git] / apps / codecs / librm / rm.h
blobc4a4e3a77ed2732fa36ca8c001507f8dc174b954
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2009 Mohamed Tarek
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.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef _RM_H
22 #define _RM_H
24 #include <stdio.h>
25 #include <inttypes.h>
26 #include "bytestream.h"
28 #define MAX_EXTRADATA_SIZE 16
29 #define DATA_HEADER_SIZE 18
30 #define PACKET_HEADER_SIZE 12
32 enum codecs {
33 CODEC_COOK,
34 CODEC_AAC,
35 CODEC_AC3,
36 CODEC_ATRAC
39 typedef struct rm_packet
41 uint8_t *frames[100]; /* Pointers to ordered audio frames in buffer */
42 uint16_t version;
43 uint16_t length;
44 uint32_t timestamp;
45 uint16_t stream_number;
46 uint8_t flags;
48 #ifdef TEST
49 uint8_t data[30000]; /* Reordered data. No malloc, hence the size */
50 #endif
51 }RMPacket;
53 typedef struct rm_context
55 /* Demux Context */
56 int old_format;
57 int current_stream;
58 int remaining_len;
59 int audio_stream_num; /*< Stream number for audio packets*/
60 int audio_pkt_cnt; /* Output packet counter*/
62 /* Stream Variables */
63 uint32_t data_offset;
64 uint32_t duration;
65 uint32_t audiotimestamp; /* Audio packet timestamp*/
66 uint16_t sub_packet_cnt; /* Subpacket counter, used while reading */
67 uint16_t sub_packet_size, sub_packet_h, coded_framesize; /* Descrambling parameters from container */
68 uint16_t audio_framesize; /* Audio frame size from container */
69 uint16_t sub_packet_lengths[16]; /* Length of each subpacket */
71 /* Codec Context */
72 enum codecs codec_type;
73 uint16_t block_align;
74 uint32_t nb_packets;
75 int frame_number;
76 uint16_t sample_rate;
77 uint16_t nb_channels;
78 uint32_t bit_rate;
79 uint16_t flags;
81 /*codec extradata*/
82 uint32_t extradata_size;
83 uint8_t codec_extradata[MAX_EXTRADATA_SIZE];
85 } RMContext;
87 int real_parse_header(int fd, RMContext *rmctx);
89 /* Get a (sub_packet_h*frames_per_packet) number of audio frames from a memory buffer */
90 int rm_get_packet(uint8_t **src,RMContext *rmctx, RMPacket *pkt);
92 #ifdef TEST
94 int filesize(int fd);
95 void advance_buffer(uint8_t **buf, int val);
97 /* Get a (sub_packet_h*frames_per_packet) number of audio frames from a file descriptor */
98 void rm_get_packet_fd(int fd,RMContext *rmctx, RMPacket *pkt);
100 #endif /* TEST */
102 #endif /* _RM_H */