summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/libmad/stream.c
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/libmad/stream.c') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/libmad/stream.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/core/multimedia/opieplayer/libmad/stream.c b/core/multimedia/opieplayer/libmad/stream.c
index dea7b8e..4374de7 100644
--- a/core/multimedia/opieplayer/libmad/stream.c
+++ b/core/multimedia/opieplayer/libmad/stream.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * mad - MPEG audio decoder 2 * libmad - MPEG audio decoder library
3 * Copyright (C) 2000-2001 Robert Leslie 3 * Copyright (C) 2000-2001 Robert Leslie
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.
@@ -51,13 +51,13 @@ void mad_stream_init(struct mad_stream *stream)
51 stream->anc_bitlen = 0; 51 stream->anc_bitlen = 0;
52 52
53 stream->main_data = 0; 53 stream->main_data = 0;
54 stream->md_len = 0; 54 stream->md_len = 0;
55 55
56 stream->options = 0; 56 stream->options = 0;
57 stream->error = 0; 57 stream->error = MAD_ERROR_NONE;
58} 58}
59 59
60/* 60/*
61 * NAME:stream->finish() 61 * NAME:stream->finish()
62 * DESCRIPTION:deallocate any dynamic memory associated with stream 62 * DESCRIPTION:deallocate any dynamic memory associated with stream
63 */ 63 */
@@ -118,6 +118,43 @@ int mad_stream_sync(struct mad_stream *stream)
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
125/*
126 * NAME:stream->errorstr()
127 * DESCRIPTION:return a string description of the current error condition
128 */
129char const *mad_stream_errorstr(struct mad_stream const *stream)
130{
131 switch (stream->error) {
132 case MAD_ERROR_NONE: return "no error";
133
134 case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)";
135 case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer";
136
137 case MAD_ERROR_NOMEM: return "not enough memory";
138
139 case MAD_ERROR_LOSTSYNC: return "lost synchronization";
140 case MAD_ERROR_BADLAYER: return "reserved header layer value";
141 case MAD_ERROR_BADBITRATE: return "forbidden bitrate value";
142 case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value";
143 case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value";
144
145 case MAD_ERROR_BADCRC: return "CRC check failed";
146 case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value";
147 case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index";
148 case MAD_ERROR_BADFRAMELEN: return "bad frame length";
149 case MAD_ERROR_BADBIGVALUES: return "bad big_values count";
150 case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type";
151 case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info";
152 case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer";
153 case MAD_ERROR_BADPART3LEN: return "bad audio data length";
154 case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select";
155 case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun";
156 case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS";
157 }
158
159 return 0;
160}