summaryrefslogtreecommitdiff
path: root/apps/codecs/libmusepack/streaminfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libmusepack/streaminfo.c')
-rw-r--r--apps/codecs/libmusepack/streaminfo.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/apps/codecs/libmusepack/streaminfo.c b/apps/codecs/libmusepack/streaminfo.c
index 8ec2234b4f..5475c6f0f6 100644
--- a/apps/codecs/libmusepack/streaminfo.c
+++ b/apps/codecs/libmusepack/streaminfo.c
@@ -35,7 +35,6 @@
35/// \file streaminfo.c 35/// \file streaminfo.c
36/// Implementation of streaminfo reading functions. 36/// Implementation of streaminfo reading functions.
37 37
38#include <string.h>
39#include "musepack.h" 38#include "musepack.h"
40#include "internal.h" 39#include "internal.h"
41 40
@@ -59,16 +58,6 @@ mpc_streaminfo_init(mpc_streaminfo * si)
59 memset(si, 0, sizeof(mpc_streaminfo)); 58 memset(si, 0, sizeof(mpc_streaminfo));
60} 59}
61 60
62// read information from SV8 header
63// not yet implemented
64static mpc_int32_t
65streaminfo_read_header_sv8(mpc_streaminfo * si, mpc_reader * fp)
66{
67 (void)si;
68 (void)fp;
69 return 0;
70}
71
72/// Reads streaminfo from SV7 header. 61/// Reads streaminfo from SV7 header.
73static mpc_int32_t 62static mpc_int32_t
74streaminfo_read_header_sv7(mpc_streaminfo * si, mpc_uint32_t HeaderData[8]) 63streaminfo_read_header_sv7(mpc_streaminfo * si, mpc_uint32_t HeaderData[8])
@@ -143,6 +132,7 @@ streaminfo_read_header_sv7(mpc_streaminfo * si, mpc_uint32_t HeaderData[8])
143} 132}
144 133
145// read information from SV4-SV6 header 134// read information from SV4-SV6 header
135#ifdef MPC_SUPPORT_SV456
146static mpc_int32_t 136static mpc_int32_t
147streaminfo_read_header_sv6(mpc_streaminfo * si, mpc_uint32_t HeaderData[8]) 137streaminfo_read_header_sv6(mpc_streaminfo * si, mpc_uint32_t HeaderData[8])
148{ 138{
@@ -199,7 +189,7 @@ streaminfo_read_header_sv6(mpc_streaminfo * si, mpc_uint32_t HeaderData[8])
199 189
200 return ERROR_CODE_OK; 190 return ERROR_CODE_OK;
201} 191}
202 192#endif
203// reads file header and tags 193// reads file header and tags
204mpc_int32_t 194mpc_int32_t
205mpc_streaminfo_read(mpc_streaminfo * si, mpc_reader * r) 195mpc_streaminfo_read(mpc_streaminfo * si, mpc_reader * r)
@@ -228,23 +218,27 @@ mpc_streaminfo_read(mpc_streaminfo * si, mpc_reader * r)
228#ifndef MPC_LITTLE_ENDIAN 218#ifndef MPC_LITTLE_ENDIAN
229 mpc_uint32_t ptr; 219 mpc_uint32_t ptr;
230 for (ptr = 0; ptr < 8; ptr++) { 220 for (ptr = 0; ptr < 8; ptr++) {
231 HeaderData[ptr] = swap32(HeaderData[ptr]); 221 HeaderData[ptr] = mpc_swap32(HeaderData[ptr]);
232 } 222 }
233#endif 223#endif
234 si->stream_version = HeaderData[0] >> 24; 224 si->stream_version = HeaderData[0] >> 24;
235 225
236 // stream version 8 226 // stream version 8
237 if ((si->stream_version & 15) >= 8) { 227 if ((si->stream_version & 15) >= 8) {
238 Error = streaminfo_read_header_sv8(si, r); 228 return ERROR_CODE_INVALIDSV;
239 } 229 }
240 // stream version 7 230 // stream version 7
241 else if ((si->stream_version & 15) == 7) { 231 else if ((si->stream_version & 15) == 7) {
242 Error = streaminfo_read_header_sv7(si, HeaderData); 232 Error = streaminfo_read_header_sv7(si, HeaderData);
233 if (Error != ERROR_CODE_OK) return Error;
243 } 234 }
244 } 235 } else {
245 else { 236#ifdef MPC_SUPPORT_SV456
246 // stream version 4-6 237 // stream version 4-6
247 Error = streaminfo_read_header_sv6(si, HeaderData); 238 Error = streaminfo_read_header_sv6(si, HeaderData);
239#else
240 return ERROR_CODE_INVALIDSV;
241#endif
248 } 242 }
249 243
250 // estimation, exact value needs too much time 244 // estimation, exact value needs too much time
@@ -259,7 +253,7 @@ mpc_streaminfo_read(mpc_streaminfo * si, mpc_reader * r)
259 si->average_bitrate = 0; 253 si->average_bitrate = 0;
260 } 254 }
261 255
262 return Error; 256 return ERROR_CODE_OK;
263} 257}
264 258
265double 259double