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