Mercurial > audlegacy-plugins
annotate src/musepack/libmpc.h @ 2138:76f9a4168708
Fix linking with libaudid3tag
Linking with libaudid3tag from /usr/lib/audacious, add rpath (affected to tta,
shnplug and madplug plugins)
| author | Vitaly Lipatov <lav@etersoft.ru> |
|---|---|
| date | Sat, 27 Oct 2007 19:34:46 -0500 |
| parents | c1a825ee8cec |
| children | 7b284f323ad8 |
| 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> |
|
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1438
diff
changeset
|
12 #include <audacious/configdb.h> |
|
2ebeb7816c5e
Change from "" to <>-style includes. With thanks to ccr for the correct sed voodoo.
chainsaw@localhost
parents:
1438
diff
changeset
|
13 #include <audacious/main.h> |
|
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1093
diff
changeset
|
14 #include <audacious/i18n.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 { | |
| 2112 | 72 gchar* isError; |
| 232 | 73 double offset; |
| 74 bool isOutput; | |
| 75 bool isAlive; | |
| 76 bool isPause; | |
| 77 }; | |
| 78 | |
| 79 typedef struct TrackInfo | |
| 80 { | |
| 2112 | 81 gint bitrate; |
| 82 gchar* display; | |
| 83 gint length; | |
| 84 gint sampleFreq; | |
| 85 gint channels; | |
| 232 | 86 }; |
| 87 | |
| 88 typedef struct MpcInfo | |
| 89 { | |
| 2112 | 90 gchar* title; |
| 91 gchar* artist; | |
| 92 gchar* album; | |
| 93 gchar* comment; | |
| 94 gchar* genre; | |
| 95 gchar* date; | |
| 96 unsigned track; | |
| 97 unsigned year; | |
| 232 | 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); | |
|
2000
89a445c53318
make musepack compile again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1986
diff
changeset
|
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(); | |
| 1986 | 128 static void* decodeStream(InputPlayback*); |
|
2000
89a445c53318
make musepack compile again.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
1986
diff
changeset
|
129 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
|
130 //static void* endThread(char*, FILE*, bool); |
| 232 | 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&); | |
|
1438
dc3e28d3b92a
mpc: convert, wma: fixes
William Pitcock <nenolod@atheme-project.org>
parents:
1304
diff
changeset
|
137 static Tuple * mpcGetSongTuple(char *); |
| 232 | 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 |
