Mercurial > audlegacy-plugins
annotate src/musepack/libmpc.h @ 2501:7b284f323ad8
Include cleanups, part #6.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 31 Mar 2008 16:03:22 +0300 |
parents | c1a825ee8cec |
children | bd3a24b39058 |
rev | line source |
---|---|
232 | 1 #ifndef XMMS_MUSEPACK |
2 #define XMMS_MUSEPACK | |
3 | |
1954
6acf1bda788b
Removed some extraneous includes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1950
diff
changeset
|
4 #include "config.h" |
6acf1bda788b
Removed some extraneous includes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1950
diff
changeset
|
5 |
232 | 6 //xmms headers |
7 extern "C" | |
8 { | |
1950
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1438
diff
changeset
|
9 #include <audacious/plugin.h> |
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1438
diff
changeset
|
10 #include <audacious/output.h> |
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1438
diff
changeset
|
11 #include <audacious/util.h> |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1093
diff
changeset
|
12 #include <audacious/i18n.h> |
232 | 13 } |
14 | |
15 //stdlib headers | |
16 #include <string.h> | |
17 #include <stdio.h> | |
18 #include <stdlib.h> | |
19 #include <unistd.h> | |
20 #include <math.h> | |
21 | |
22 //libmpcdec headers | |
23 #undef TRUE | |
24 #undef FALSE | |
25 #include <mpcdec/mpcdec.h> | |
26 | |
27 //GTK+ headers | |
28 #include <glib.h> | |
29 #include <gtk/gtk.h> | |
30 | |
31 //taglib headers | |
32 #include <taglib/tag.h> | |
33 #include <taglib/apetag.h> | |
34 #include <taglib/mpcfile.h> | |
35 | |
36 #ifndef M_LN10 | |
37 #define M_LN10 2.3025850929940456840179914546843642 | |
38 #endif | |
39 | |
40 typedef struct PluginConfig | |
41 { | |
42 gboolean clipPrevention; | |
43 gboolean dynamicBitrate; | |
44 gboolean replaygain; | |
45 gboolean albumGain; | |
46 gboolean isEq; | |
47 }; | |
48 | |
49 typedef struct Widgets | |
50 { | |
51 GtkWidget* aboutBox; | |
52 GtkWidget* configBox; | |
53 GtkWidget* bitrateCheck; | |
54 GtkWidget* clippingCheck; | |
55 GtkWidget* replaygainCheck; | |
56 GtkWidget* albumCheck; | |
57 GtkWidget* infoBox; | |
58 GtkWidget* albumEntry; | |
59 GtkWidget* artistEntry; | |
60 GtkWidget* titleEntry; | |
61 GtkWidget* genreEntry; | |
62 GtkWidget* yearEntry; | |
63 GtkWidget* trackEntry; | |
64 GtkWidget* commentEntry; | |
65 GtkWidget* fileEntry; | |
66 }; | |
67 | |
68 typedef struct MpcDecoder | |
69 { | |
2112 | 70 gchar* isError; |
232 | 71 double offset; |
72 bool isOutput; | |
73 bool isAlive; | |
74 bool isPause; | |
75 }; | |
76 | |
77 typedef struct TrackInfo | |
78 { | |
2112 | 79 gint bitrate; |
80 gchar* display; | |
81 gint length; | |
82 gint sampleFreq; | |
83 gint channels; | |
232 | 84 }; |
85 | |
86 typedef struct MpcInfo | |
87 { | |
2112 | 88 gchar* title; |
89 gchar* artist; | |
90 gchar* album; | |
91 gchar* comment; | |
92 gchar* genre; | |
93 gchar* date; | |
94 unsigned track; | |
95 unsigned year; | |
232 | 96 }; |
97 | |
98 static void mpcOpenPlugin(); | |
99 static void mpcAboutBox(); | |
100 static void mpcConfigBox(); | |
101 static void toggleSwitch(GtkWidget*, gpointer); | |
102 static void saveConfigBox(GtkWidget*, gpointer); | |
260
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
103 static int mpcIsOurFile(char*); |
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
104 static int mpcIsOurFD(char*,VFSFile*); |
567 | 105 static void mpcPlay(InputPlayback *data); |
106 static void mpcStop(InputPlayback *data); | |
107 static void mpcPause(InputPlayback *data, short); | |
108 static void mpcSeek(InputPlayback *data, int); | |
2000
89a445c53318
make musepack compile again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1986
diff
changeset
|
109 //static void mpcSetEq(int, float, float*); |
567 | 110 static int mpcGetTime(InputPlayback *data); |
232 | 111 static void mpcGetSongInfo(char*, char**, int*); |
112 static void freeTags(MpcInfo&); | |
113 static MpcInfo getTags(const char*); | |
114 static void mpcFileInfoBox(char*); | |
1044
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
567
diff
changeset
|
115 static void mpcGtkPrintLabel(GtkWidget*, const char*, ...); |
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
567
diff
changeset
|
116 static GtkWidget* mpcGtkTagLabel(const char*, int, int, int, int, GtkWidget*); |
232 | 117 static GtkWidget* mpcGtkTagEntry(int, int, int, int, int, GtkWidget*); |
118 static GtkWidget* mpcGtkLabel(GtkWidget*); | |
1044
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
567
diff
changeset
|
119 static GtkWidget* mpcGtkButton(const char*, GtkWidget*); |
232 | 120 static void removeTags(GtkWidget*, gpointer); |
121 static void saveTags(GtkWidget*, gpointer); | |
122 static void closeInfoBox(GtkWidget*, gpointer); | |
123 static char* mpcGenerateTitle(const MpcInfo&, char*); | |
124 static void lockAcquire(); | |
125 static void lockRelease(); | |
1986 | 126 static void* decodeStream(InputPlayback*); |
2000
89a445c53318
make musepack compile again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1986
diff
changeset
|
127 static int processBuffer(InputPlayback*, MPC_SAMPLE_FORMAT*, char*, mpc_decoder&); |
89a445c53318
make musepack compile again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1986
diff
changeset
|
128 //static void* endThread(char*, FILE*, bool); |
232 | 129 static bool isAlive(); |
130 static void setAlive(bool); | |
131 static double getOffset(); | |
132 static void setOffset(double); | |
133 static bool isPause(); | |
134 static void setReplaygain(mpc_streaminfo&, mpc_decoder&); | |
1438
dc3e28d3b92a
mpc: convert, wma: fixes
William Pitcock <nenolod@atheme-project.org>
parents:
1304
diff
changeset
|
135 static Tuple * mpcGetSongTuple(char *); |
232 | 136 |
137 #ifdef MPC_FIXED_POINT | |
138 inline static int shiftSigned(MPC_SAMPLE_FORMAT val, int shift) | |
139 { | |
140 if (shift > 0) | |
141 val <<= shift; | |
142 else if (shift < 0) | |
143 val >>= -shift; | |
144 return (int) val; | |
145 } | |
146 #endif | |
147 | |
148 inline static void copyBuffer(MPC_SAMPLE_FORMAT* pInBuf, char* pOutBuf, unsigned pLength) | |
149 { | |
150 unsigned pSize = 16; | |
151 int clipMin = -1 << (pSize - 1); | |
152 int clipMax = (1 << (pSize - 1)) - 1; | |
153 int floatScale = 1 << (pSize - 1); | |
154 for (unsigned n = 0; n < 2 * pLength; n++) | |
155 { | |
156 int val; | |
157 #ifdef MPC_FIXED_POINT | |
158 val = shiftSigned(pInBuf[n], pSize - MPC_FIXED_POINT_SCALE_SHIFT); | |
159 #else | |
160 val = (int) (pInBuf[n] * floatScale); | |
161 #endif | |
162 if (val < clipMin) | |
163 val = clipMin; | |
164 else if (val > clipMax) | |
165 val = clipMax; | |
166 unsigned shift = 0; | |
167 do | |
168 { | |
169 pOutBuf[n * 2 + (shift / 8)] = (unsigned char) ((val >> shift) & 0xFF); | |
170 shift += 8; | |
171 } | |
172 while (shift < pSize); | |
173 } | |
174 } | |
175 | |
176 #endif |