Mercurial > audlegacy-plugins
annotate src/musepack/libmpc.h @ 1171:cbe5598f5de4 trunk
[svn] - keep old passwords if user doesn't change them in configuration
author | desowin |
---|---|
date | Fri, 08 Jun 2007 04:37:56 -0700 |
parents | 6a258916b7e4 |
children | f34112ab9101 |
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" | |
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 { | |
70 char* isError; | |
71 double offset; | |
72 bool isOutput; | |
73 bool isAlive; | |
74 bool isPause; | |
75 }; | |
76 | |
77 typedef struct TrackInfo | |
78 { | |
79 int bitrate; | |
80 char* display; | |
81 int length; | |
82 int sampleFreq; | |
83 int channels; | |
84 }; | |
85 | |
86 typedef struct MpcInfo | |
87 { | |
88 char* title; | |
89 char* artist; | |
90 char* album; | |
91 char* comment; | |
92 char* genre; | |
93 char* date; | |
94 unsigned track; | |
95 unsigned year; | |
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); | |
232 | 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(); | |
126 static void* decodeStream(void*); | |
127 static int processBuffer(MPC_SAMPLE_FORMAT*, char*, mpc_decoder&); | |
128 static void* endThread(char*, FILE*, bool); | |
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&); | |
135 static TitleInput* mpcGetSongTuple(char *); | |
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 |