summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libmusepack/mpc_types.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libmusepack/mpc_types.h')
-rw-r--r--lib/rbcodec/codecs/libmusepack/mpc_types.h145
1 files changed, 145 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libmusepack/mpc_types.h b/lib/rbcodec/codecs/libmusepack/mpc_types.h
new file mode 100644
index 0000000000..0e7aa9d2c3
--- /dev/null
+++ b/lib/rbcodec/codecs/libmusepack/mpc_types.h
@@ -0,0 +1,145 @@
1/*
2 Copyright (c) 2005-2009, The Musepack Development Team
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are
7 met:
8
9 * Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11
12 * Redistributions in binary form must reproduce the above
13 copyright notice, this list of conditions and the following
14 disclaimer in the documentation and/or other materials provided
15 with the distribution.
16
17 * Neither the name of the The Musepack Development Team nor the
18 names of its contributors may be used to endorse or promote
19 products derived from this software without specific prior
20 written permission.
21
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33*/
34#ifndef _MPC_TYPES_H_
35#define _MPC_TYPES_H_
36#ifdef WIN32
37#pragma once
38#endif
39
40#include <stdlib.h>
41#include <inttypes.h>
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47#ifdef _MSC_VER
48typedef __int8 mpc_int8_t;
49typedef unsigned __int8 mpc_uint8_t;
50typedef __int16 mpc_int16_t;
51typedef unsigned __int16 mpc_uint16_t;
52typedef __int32 mpc_int32_t;
53typedef unsigned __int32 mpc_uint32_t;
54typedef __int64 mpc_int64_t;
55typedef unsigned __int64 mpc_uint64_t;
56#define mpc_inline __inline
57#else
58typedef signed char mpc_int8_t;
59typedef unsigned char mpc_uint8_t;
60typedef short mpc_int16_t;
61typedef unsigned short mpc_uint16_t;
62typedef int mpc_int32_t;
63typedef unsigned int mpc_uint32_t;
64typedef long long mpc_int64_t;
65typedef unsigned long long mpc_uint64_t;
66#define mpc_inline inline
67#endif
68
69typedef int mpc_int_t;
70typedef unsigned int mpc_uint_t;
71typedef size_t mpc_size_t;
72typedef mpc_uint8_t mpc_bool_t;
73
74// #define LONG_SEEK_TABLE
75#ifdef LONG_SEEK_TABLE // define as needed (mpc_uint32_t supports files up to 512 MB)
76typedef mpc_uint64_t mpc_seek_t;
77#else
78typedef mpc_uint32_t mpc_seek_t;
79#endif
80
81# define mpc_int64_min -9223372036854775808ll
82# define mpc_int64_max 9223372036854775807ll
83
84typedef struct mpc_quantizer {
85 mpc_int16_t L [36];
86 mpc_int16_t R [36];
87} mpc_quantizer;
88
89/// Libmpcdec error codes
90typedef enum mpc_status {
91 // Success.
92 MPC_STATUS_OK = 0,
93 // Generic failure (I/O error or invalid file).
94 MPC_STATUS_FAIL = -1
95} mpc_status;
96
97#define MPC_FIXED_POINT
98#define MPC_FIXED_POINT_SHIFT 16
99
100#ifdef MPC_FIXED_POINT
101# define MPC_FIXED_POINT_FRACTPART 14
102# define MPC_FIXED_POINT_SCALE_SHIFT (MPC_FIXED_POINT_SHIFT + MPC_FIXED_POINT_FRACTPART)
103# define MPC_FIXED_POINT_SCALE (1 << (MPC_FIXED_POINT_SCALE_SHIFT - 1))
104typedef mpc_int32_t MPC_SAMPLE_FORMAT;
105#else
106typedef float MPC_SAMPLE_FORMAT;
107#endif
108
109enum {
110 MPC_FALSE = 0,
111 MPC_TRUE = !MPC_FALSE
112};
113
114//// 'Cdecl' forces the use of standard C/C++ calling convention ///////
115#if defined _WIN32
116# define mpc_cdecl __cdecl
117#elif defined __ZTC__
118# define mpc_cdecl _cdecl
119#elif defined __TURBOC__
120# define mpc_cdecl cdecl
121#else
122# define mpc_cdecl
123#endif
124
125/* DLL building support on win32 hosts */
126#ifndef MPC_API
127# ifdef DLL_EXPORT /* defined by libtool (if required) */
128# define MPC_API __declspec(dllexport)
129# endif
130# ifdef MPC_DLL_IMPORT /* define if linking with this dll */
131# define MPC_API __declspec(dllimport)
132# endif
133# ifndef MPC_API /* static linking or !_WIN32 */
134# if defined(__GNUC__) && (__GNUC__ >= 4)
135# define MPC_API __attribute__ ((visibility("default")))
136# else
137# define MPC_API
138# endif
139# endif
140#endif
141
142#ifdef __cplusplus
143}
144#endif
145#endif