Diffstat (limited to 'core/multimedia/opieplayer/libmad/stream.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/libmad/stream.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/multimedia/opieplayer/libmad/stream.c b/core/multimedia/opieplayer/libmad/stream.c index 4374de7..a63d67b 100644 --- a/core/multimedia/opieplayer/libmad/stream.c +++ b/core/multimedia/opieplayer/libmad/stream.c | |||
@@ -1,51 +1,51 @@ | |||
1 | /* | 1 | /* |
2 | * libmad - MPEG audio decoder library | 2 | * libmad - MPEG audio decoder library |
3 | * Copyright (C) 2000-2001 Robert Leslie | 3 | * Copyright (C) 2000-2004 Underbit Technologies, Inc. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | * | 18 | * |
19 | * $Id$ | 19 | * $Id$ |
20 | */ | 20 | */ |
21 | 21 | ||
22 | # ifdef HAVE_CONFIG_H | 22 | # ifdef HAVE_CONFIG_H |
23 | # include "libmad_config.h" | 23 | # include "libmad_config.h" |
24 | # endif | 24 | # endif |
25 | 25 | ||
26 | # include "libmad_global.h" | 26 | # include "libmad_global.h" |
27 | 27 | ||
28 | # include <stdlib.h> | 28 | # include <stdlib.h> |
29 | 29 | ||
30 | # include "bit.h" | 30 | # include "bit.h" |
31 | # include "stream.h" | 31 | # include "stream.h" |
32 | 32 | ||
33 | /* | 33 | /* |
34 | * NAME:stream->init() | 34 | * NAME:stream->init() |
35 | * DESCRIPTION:initialize stream struct | 35 | * DESCRIPTION:initialize stream struct |
36 | */ | 36 | */ |
37 | void mad_stream_init(struct mad_stream *stream) | 37 | void mad_stream_init(struct mad_stream *stream) |
38 | { | 38 | { |
39 | stream->buffer = 0; | 39 | stream->buffer = 0; |
40 | stream->bufend = 0; | 40 | stream->bufend = 0; |
41 | stream->skiplen = 0; | 41 | stream->skiplen = 0; |
42 | 42 | ||
43 | stream->sync = 0; | 43 | stream->sync = 0; |
44 | stream->freerate = 0; | 44 | stream->freerate = 0; |
45 | 45 | ||
46 | stream->this_frame = 0; | 46 | stream->this_frame = 0; |
47 | stream->next_frame = 0; | 47 | stream->next_frame = 0; |
48 | mad_bit_init(&stream->ptr, 0); | 48 | mad_bit_init(&stream->ptr, 0); |
49 | 49 | ||
50 | mad_bit_init(&stream->anc_ptr, 0); | 50 | mad_bit_init(&stream->anc_ptr, 0); |
51 | stream->anc_bitlen = 0; | 51 | stream->anc_bitlen = 0; |
@@ -100,61 +100,62 @@ void mad_stream_skip(struct mad_stream *stream, unsigned long length) | |||
100 | } | 100 | } |
101 | 101 | ||
102 | /* | 102 | /* |
103 | * NAME:stream->sync() | 103 | * NAME:stream->sync() |
104 | * DESCRIPTION:locate the next stream sync word | 104 | * DESCRIPTION:locate the next stream sync word |
105 | */ | 105 | */ |
106 | int mad_stream_sync(struct mad_stream *stream) | 106 | int mad_stream_sync(struct mad_stream *stream) |
107 | { | 107 | { |
108 | register unsigned char const *ptr, *end; | 108 | register unsigned char const *ptr, *end; |
109 | 109 | ||
110 | ptr = mad_bit_nextbyte(&stream->ptr); | 110 | ptr = mad_bit_nextbyte(&stream->ptr); |
111 | end = stream->bufend; | 111 | end = stream->bufend; |
112 | 112 | ||
113 | while (ptr < end - 1 && | 113 | while (ptr < end - 1 && |
114 | !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) | 114 | !(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0)) |
115 | ++ptr; | 115 | ++ptr; |
116 | 116 | ||
117 | if (end - ptr < MAD_BUFFER_GUARD) | 117 | if (end - ptr < MAD_BUFFER_GUARD) |
118 | return -1; | 118 | return -1; |
119 | 119 | ||
120 | mad_bit_init(&stream->ptr, ptr); | 120 | mad_bit_init(&stream->ptr, ptr); |
121 | 121 | ||
122 | return 0; | 122 | return 0; |
123 | } | 123 | } |
124 | 124 | ||
125 | /* | 125 | /* |
126 | * NAME:stream->errorstr() | 126 | * NAME:stream->errorstr() |
127 | * DESCRIPTION:return a string description of the current error condition | 127 | * DESCRIPTION:return a string description of the current error condition |
128 | */ | 128 | */ |
129 | char const *mad_stream_errorstr(struct mad_stream const *stream) | 129 | char const *mad_stream_errorstr(struct mad_stream const *stream) |
130 | { | 130 | { |
131 | switch (stream->error) { | 131 | switch (stream->error) { |
132 | case MAD_ERROR_NONE: return "no error"; | 132 | case MAD_ERROR_NONE: return "no error"; |
133 | 133 | ||
134 | case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)"; | 134 | case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)"; |
135 | case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer"; | 135 | case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer"; |
136 | 136 | ||
137 | case MAD_ERROR_NOMEM: return "not enough memory"; | 137 | case MAD_ERROR_NOMEM: return "not enough memory"; |
138 | 138 | ||
139 | case MAD_ERROR_LOSTSYNC: return "lost synchronization"; | 139 | case MAD_ERROR_LOSTSYNC: return "lost synchronization"; |
140 | case MAD_ERROR_BADLAYER: return "reserved header layer value"; | 140 | case MAD_ERROR_BADLAYER: return "reserved header layer value"; |
141 | case MAD_ERROR_BADBITRATE: return "forbidden bitrate value"; | 141 | case MAD_ERROR_BADBITRATE: return "forbidden bitrate value"; |
142 | case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value"; | 142 | case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value"; |
143 | case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value"; | 143 | case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value"; |
144 | 144 | ||
145 | case MAD_ERROR_BADCRC: return "CRC check failed"; | 145 | case MAD_ERROR_BADCRC: return "CRC check failed"; |
146 | case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value"; | 146 | case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value"; |
147 | case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index"; | 147 | case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index"; |
148 | case MAD_ERROR_BADMODE: return "bad bitrate/mode combination"; | ||
148 | case MAD_ERROR_BADFRAMELEN: return "bad frame length"; | 149 | case MAD_ERROR_BADFRAMELEN: return "bad frame length"; |
149 | case MAD_ERROR_BADBIGVALUES: return "bad big_values count"; | 150 | case MAD_ERROR_BADBIGVALUES: return "bad big_values count"; |
150 | case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type"; | 151 | case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type"; |
151 | case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info"; | 152 | case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info"; |
152 | case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer"; | 153 | case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer"; |
153 | case MAD_ERROR_BADPART3LEN: return "bad audio data length"; | 154 | case MAD_ERROR_BADPART3LEN: return "bad audio data length"; |
154 | case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select"; | 155 | case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select"; |
155 | case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun"; | 156 | case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun"; |
156 | case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS"; | 157 | case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS"; |
157 | } | 158 | } |
158 | 159 | ||
159 | return 0; | 160 | return 0; |
160 | } | 161 | } |