Mercurial > audlegacy-plugins
annotate src/musepack/libmpc.cxx @ 2705:0edb12410119
Sanitize pkg.m4.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 13 Jun 2008 08:19:51 +0300 |
parents | e23ce346f239 |
children | 04249b58c738 |
rev | line source |
---|---|
232 | 1 #include "libmpc.h" |
2 | |
3 #define FORCED_THREAD_STACKSIZE 1024 * 1000 | |
4 #define REMOVE_NONEXISTANT_TAG(x) if (!*x) { x = NULL; } | |
5 | |
6 using TagLib::MPC::File; | |
7 using TagLib::Tag; | |
8 using TagLib::String; | |
9 using TagLib::APE::ItemListMap; | |
10 | |
1044
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
659
diff
changeset
|
11 const gchar *mpc_fmts[] = { "mpc", NULL }; |
372
a157306caf03
[svn] - finalize the plugin-side of the extension-assist ABI
nenolod
parents:
368
diff
changeset
|
12 |
232 | 13 InputPlugin MpcPlugin = { |
14 NULL, //File Handle FILE* handle | |
15 NULL, //Filename char* filename | |
1185 | 16 (gchar *)"Musepack Audio Plugin", |
232 | 17 mpcOpenPlugin, //Open Plugin [CALLBACK] |
1621
031e91938009
musepack: C++ at it's worst.
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
18 NULL, //Cleanup [UNUSED] |
232 | 19 mpcAboutBox, //Show About box [CALLBACK] |
20 mpcConfigBox, //Show Configure box [CALLBACK] | |
1621
031e91938009
musepack: C++ at it's worst.
William Pitcock <nenolod@atheme.org>
parents:
1510
diff
changeset
|
21 FALSE, //Enabled/Disabled [BOOLEAN] |
260
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
22 mpcIsOurFile, //Check if it's our file [CALLBACK] |
232 | 23 NULL, //Scan the directory [UNUSED] |
24 mpcPlay, //Play [CALLBACK] | |
25 mpcStop, //Stop [CALLBACK] | |
26 mpcPause, //Pause [CALLBACK] | |
27 mpcSeek, //Seek [CALLBACK] | |
28 NULL, //Set EQ [CALLBACK] | |
29 mpcGetTime, //Get Time [CALLBACK] | |
30 NULL, //Get Volume [UNUSED] | |
31 NULL, //Set Volume [UNUSED] | |
32 NULL, //Obsolete [UNUSED] | |
33 NULL, //Visual plugins add_vis_pcm(int time, AFormat fmt, int nch, int length, void *ptr) | |
34 NULL, //Set Info Settings set_info(char *title, int length, int rate, int freq, int nch) | |
35 NULL, //set Info Text set_info_text(char* text) | |
36 mpcGetSongInfo, //Get Title String callback [CALLBACK] | |
37 mpcFileInfoBox, //Show File Info Box [CALLBACK] | |
38 NULL, //Output Plugin Handle OutputPlugin output | |
254 | 39 mpcGetSongTuple,//Acquire tuple for song [CALLBACK] |
40 mpcIsOurFD, | |
1044
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
659
diff
changeset
|
41 (gchar **)mpc_fmts |
232 | 42 }; |
43 | |
1079 | 44 InputPlugin *mpc_iplist[] = { &MpcPlugin, NULL }; |
45 | |
1395
761e17b23e0c
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
1357
diff
changeset
|
46 DECLARE_PLUGIN(musepack, NULL, NULL, mpc_iplist, NULL, NULL, NULL, NULL,NULL); |
232 | 47 |
48 static PluginConfig pluginConfig = {0}; | |
49 static Widgets widgets = {0}; | |
50 static MpcDecoder mpcDecoder = {0}; | |
51 static TrackInfo track = {0}; | |
52 | |
53 static GThread *threadHandle; | |
54 GStaticMutex threadMutex = G_STATIC_MUTEX_INIT; | |
55 | |
56 /* | |
57 * VFS callback implementation, adapted from mpc_reader.c. | |
58 * This _IS_ very sick, but it works. -nenolod | |
59 */ | |
60 static mpc_int32_t | |
1978 | 61 aud_vfs_fread_impl(void *data, void *ptr, mpc_int32_t size) |
232 | 62 { |
63 mpc_reader_file *d = (mpc_reader_file *) data; | |
64 VFSFile *file = (VFSFile *) d->file; | |
65 | |
1978 | 66 return (mpc_int32_t) aud_vfs_fread(ptr, 1, size, file); |
232 | 67 } |
68 | |
69 static mpc_bool_t | |
1978 | 70 aud_vfs_fseek_impl(void *data, mpc_int32_t offset) |
232 | 71 { |
72 mpc_reader_file *d = (mpc_reader_file *) data; | |
73 VFSFile *file = (VFSFile *) d->file; | |
74 | |
1978 | 75 return d->is_seekable ? aud_vfs_fseek(file, offset, SEEK_SET) == 0 : FALSE; |
232 | 76 } |
77 | |
78 static mpc_int32_t | |
1978 | 79 aud_vfs_ftell_impl(void *data) |
232 | 80 { |
81 mpc_reader_file *d = (mpc_reader_file *) data; | |
82 VFSFile *file = (VFSFile *) d->file; | |
83 | |
1978 | 84 return aud_vfs_ftell(file); |
232 | 85 } |
86 | |
87 static mpc_int32_t | |
1978 | 88 aud_vfs_getsize_impl(void *data) |
232 | 89 { |
90 mpc_reader_file *d = (mpc_reader_file *) data; | |
91 | |
92 return d->file_size; | |
93 } | |
94 | |
95 static mpc_bool_t | |
1978 | 96 aud_vfs_canseek_impl(void *data) |
232 | 97 { |
98 mpc_reader_file *d = (mpc_reader_file *) data; | |
99 | |
100 return d->is_seekable; | |
101 } | |
102 | |
103 /* | |
104 * This sets up an mpc_reader_file object to read from VFS instead of libc. | |
105 * Essentially, we use this instead of the normal constructor. | |
106 * - nenolod | |
107 */ | |
108 void | |
109 mpc_reader_setup_file_vfs(mpc_reader_file *p_reader, VFSFile *input) | |
110 { | |
1978 | 111 p_reader->reader.seek = aud_vfs_fseek_impl; |
112 p_reader->reader.read = aud_vfs_fread_impl; | |
113 p_reader->reader.tell = aud_vfs_ftell_impl; | |
114 p_reader->reader.get_size = aud_vfs_getsize_impl; | |
115 p_reader->reader.canseek = aud_vfs_canseek_impl; | |
232 | 116 p_reader->reader.data = p_reader; |
117 | |
118 p_reader->file = (FILE *) input; // no worries, it gets cast back -nenolod | |
119 p_reader->is_seekable = TRUE; // XXX streams | |
120 | |
1978 | 121 aud_vfs_fseek(input, 0, SEEK_END); |
122 p_reader->file_size = aud_vfs_ftell(input); | |
123 aud_vfs_fseek(input, 0, SEEK_SET); | |
232 | 124 } |
125 | |
126 static void mpcOpenPlugin() | |
127 { | |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2119
diff
changeset
|
128 mcs_handle_t *cfg; |
2113 | 129 cfg = aud_cfg_db_open(); |
130 aud_cfg_db_get_bool(cfg, "musepack", "clipPrevention", &pluginConfig.clipPrevention); | |
131 aud_cfg_db_get_bool(cfg, "musepack", "albumGain", &pluginConfig.albumGain); | |
132 aud_cfg_db_get_bool(cfg, "musepack", "dynamicBitrate", &pluginConfig.dynamicBitrate); | |
133 aud_cfg_db_get_bool(cfg, "musepack", "replaygain", &pluginConfig.replaygain); | |
134 aud_cfg_db_close(cfg); | |
232 | 135 } |
136 | |
137 static void mpcAboutBox() | |
138 { | |
139 GtkWidget* aboutBox = widgets.aboutBox; | |
140 if (aboutBox) | |
141 gdk_window_raise(aboutBox->window); | |
142 else | |
143 { | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
144 char* titleText = g_strdup_printf(_("Musepack Decoder Plugin 1.2")); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
145 const char* contentText = _("Plugin code by\nBenoit Amiaux\nMartin Spuler\nKuniklo\n\nGet latest version at http://musepack.net\n"); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
146 const char* buttonText = _("Nevermind"); |
1677
f6f5603a0954
xmms_show_message() changed to audacious_info_dialog()
Matti Hamalainen <ccr@tnsp.org>
parents:
1676
diff
changeset
|
147 aboutBox = audacious_info_dialog(titleText, contentText, buttonText, FALSE, NULL, NULL); |
232 | 148 widgets.aboutBox = aboutBox; |
149 g_signal_connect(G_OBJECT(aboutBox), "destroy", G_CALLBACK(gtk_widget_destroyed), &widgets.aboutBox); | |
150 } | |
151 } | |
152 | |
153 static void mpcConfigBox() | |
154 { | |
155 GtkWidget* configBox = widgets.configBox; | |
156 if(configBox) | |
157 gdk_window_raise(configBox->window); | |
158 else | |
159 { | |
160 configBox = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
161 gtk_window_set_type_hint(GTK_WINDOW(configBox), GDK_WINDOW_TYPE_HINT_DIALOG); | |
162 widgets.configBox = configBox; | |
163 g_signal_connect(G_OBJECT(configBox), "destroy", G_CALLBACK(gtk_widget_destroyed), &widgets.configBox); | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
164 gtk_window_set_title(GTK_WINDOW(configBox), _("Musepack Decoder Configuration")); |
232 | 165 gtk_window_set_policy(GTK_WINDOW(configBox), FALSE, FALSE, FALSE); |
166 gtk_container_border_width(GTK_CONTAINER(configBox), 10); | |
167 | |
168 GtkWidget* notebook = gtk_notebook_new(); | |
169 GtkWidget* vbox = gtk_vbox_new(FALSE, 10); | |
170 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); | |
171 gtk_container_add(GTK_CONTAINER(configBox), vbox); | |
172 | |
173 //General Settings Tab | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
174 GtkWidget* generalSet = gtk_frame_new(_("General Settings")); |
232 | 175 gtk_container_border_width(GTK_CONTAINER(generalSet), 5); |
176 | |
177 GtkWidget* gSvbox = gtk_vbox_new(FALSE, 10); | |
178 gtk_container_border_width(GTK_CONTAINER(gSvbox), 5); | |
179 gtk_container_add(GTK_CONTAINER(generalSet), gSvbox); | |
180 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
181 GtkWidget* bitrateCheck = gtk_check_button_new_with_label(_("Enable Dynamic Bitrate Display")); |
232 | 182 widgets.bitrateCheck = bitrateCheck; |
183 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bitrateCheck), pluginConfig.dynamicBitrate); | |
184 gtk_box_pack_start(GTK_BOX(gSvbox), bitrateCheck, FALSE, FALSE, 0); | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
185 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), generalSet, gtk_label_new(_("Plugin"))); |
232 | 186 |
187 //ReplayGain Settings Tab | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
188 GtkWidget* replaygainSet = gtk_frame_new(_("ReplayGain Settings")); |
232 | 189 gtk_container_border_width(GTK_CONTAINER(replaygainSet), 5); |
190 | |
191 GtkWidget* rSVbox = gtk_vbox_new(FALSE, 10); | |
192 gtk_container_border_width(GTK_CONTAINER(rSVbox), 5); | |
193 gtk_container_add(GTK_CONTAINER(replaygainSet), rSVbox); | |
194 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
195 GtkWidget* clippingCheck = gtk_check_button_new_with_label(_("Enable Clipping Prevention")); |
232 | 196 widgets.clippingCheck = clippingCheck; |
197 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(clippingCheck), pluginConfig.clipPrevention); | |
198 gtk_box_pack_start(GTK_BOX(rSVbox), clippingCheck, FALSE, FALSE, 0); | |
199 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
200 GtkWidget* replaygainCheck = gtk_check_button_new_with_label(_("Enable ReplayGain")); |
232 | 201 widgets.replaygainCheck = replaygainCheck; |
202 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(replaygainCheck), pluginConfig.replaygain); | |
203 gtk_box_pack_start(GTK_BOX(rSVbox), replaygainCheck, FALSE, FALSE, 0); | |
204 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
205 GtkWidget* replaygainType = gtk_frame_new(_("ReplayGain Type")); |
232 | 206 gtk_box_pack_start(GTK_BOX(rSVbox), replaygainType, FALSE, FALSE, 0); |
207 g_signal_connect(G_OBJECT(replaygainCheck), "toggled", G_CALLBACK(toggleSwitch), replaygainType); | |
208 | |
209 GtkWidget* rgVbox = gtk_vbox_new(FALSE, 5); | |
210 gtk_container_set_border_width(GTK_CONTAINER(rgVbox), 5); | |
211 gtk_container_add(GTK_CONTAINER(replaygainType), rgVbox); | |
212 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
213 GtkWidget* trackCheck = gtk_radio_button_new_with_label(NULL, _("Use Track Gain")); |
232 | 214 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(trackCheck), !pluginConfig.albumGain); |
215 gtk_box_pack_start(GTK_BOX(rgVbox), trackCheck, FALSE, FALSE, 0); | |
216 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
217 GtkWidget* albumCheck = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(trackCheck)), _("Use Album Gain")); |
232 | 218 widgets.albumCheck = albumCheck; |
219 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(albumCheck), pluginConfig.albumGain); | |
220 gtk_box_pack_start(GTK_BOX(rgVbox), albumCheck, FALSE, FALSE, 0); | |
221 gtk_widget_set_sensitive(replaygainType, pluginConfig.replaygain); | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
222 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), replaygainSet, gtk_label_new(_("ReplayGain"))); |
232 | 223 |
224 //Buttons | |
225 GtkWidget* buttonBox = gtk_hbutton_box_new(); | |
226 gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_END); | |
227 gtk_button_box_set_spacing(GTK_BUTTON_BOX(buttonBox), 5); | |
228 gtk_box_pack_start(GTK_BOX(vbox), buttonBox, FALSE, FALSE, 0); | |
229 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
230 GtkWidget* okButton = gtk_button_new_with_label(_("Ok")); |
232 | 231 g_signal_connect(G_OBJECT(okButton), "clicked", G_CALLBACK(saveConfigBox), NULL); |
232 GTK_WIDGET_SET_FLAGS(okButton, GTK_CAN_DEFAULT); | |
233 gtk_box_pack_start(GTK_BOX(buttonBox), okButton, TRUE, TRUE, 0); | |
234 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
235 GtkWidget* cancelButton = gtk_button_new_with_label(_("Cancel")); |
232 | 236 g_signal_connect_swapped(G_OBJECT(cancelButton), "clicked", G_CALLBACK(gtk_widget_destroy), GTK_OBJECT(widgets.configBox)); |
237 GTK_WIDGET_SET_FLAGS(cancelButton, GTK_CAN_DEFAULT); | |
238 gtk_widget_grab_default(cancelButton); | |
239 gtk_box_pack_start(GTK_BOX(buttonBox), cancelButton, TRUE, TRUE, 0); | |
240 | |
241 gtk_widget_show_all(configBox); | |
242 } | |
243 } | |
244 | |
245 static void toggleSwitch(GtkWidget* p_Widget, gpointer p_Data) | |
246 { | |
247 gtk_widget_set_sensitive(GTK_WIDGET(p_Data), gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(p_Widget))); | |
248 } | |
249 | |
250 static void saveConfigBox(GtkWidget* p_Widget, gpointer p_Data) | |
251 { | |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2119
diff
changeset
|
252 mcs_handle_t* cfg; |
232 | 253 GtkToggleButton* tb; |
254 | |
255 tb = GTK_TOGGLE_BUTTON(widgets.replaygainCheck); | |
256 pluginConfig.replaygain = gtk_toggle_button_get_active(tb); | |
257 tb = GTK_TOGGLE_BUTTON(widgets.clippingCheck); | |
258 pluginConfig.clipPrevention = gtk_toggle_button_get_active(tb); | |
259 tb = GTK_TOGGLE_BUTTON(widgets.bitrateCheck); | |
260 pluginConfig.dynamicBitrate = gtk_toggle_button_get_active(tb); | |
261 tb = GTK_TOGGLE_BUTTON(widgets.albumCheck); | |
262 pluginConfig.albumGain = gtk_toggle_button_get_active(tb); | |
263 | |
2113 | 264 cfg = aud_cfg_db_open(); |
232 | 265 |
2113 | 266 aud_cfg_db_set_bool(cfg, "musepack", "clipPrevention", pluginConfig.clipPrevention); |
267 aud_cfg_db_set_bool(cfg, "musepack", "albumGain", pluginConfig.albumGain); | |
268 aud_cfg_db_set_bool(cfg, "musepack", "dynamicBitrate", pluginConfig.dynamicBitrate); | |
269 aud_cfg_db_set_bool(cfg, "musepack", "replaygain", pluginConfig.replaygain); | |
232 | 270 |
2113 | 271 aud_cfg_db_close(cfg); |
232 | 272 |
273 gtk_widget_destroy (widgets.configBox); | |
274 } | |
275 | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
276 static gint mpcIsOurFile(gchar* p_Filename) |
260
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
277 { |
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
278 VFSFile *file; |
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
279 gchar magic[3]; |
1978 | 280 if ((file = aud_vfs_fopen(p_Filename, "rb"))) { |
281 aud_vfs_fread(magic, 1, 3, file); | |
260
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
282 if (!memcmp(magic, "MP+", 3)) { |
1978 | 283 aud_vfs_fclose(file); |
260
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
284 return 1; |
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
285 } |
1978 | 286 aud_vfs_fclose(file); |
260
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
287 } |
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
288 return 0; |
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
289 } |
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
290 |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
291 static gint mpcIsOurFD(gchar* p_Filename, VFSFile* file) |
232 | 292 { |
254 | 293 gchar magic[3]; |
1978 | 294 aud_vfs_fread(magic, 1, 3, file); |
260
4f7b72c88319
[svn] So input.c wants to have the old-style function available...
chainsaw
parents:
254
diff
changeset
|
295 if (!memcmp(magic, "MP+", 3)) |
254 | 296 return 1; |
297 return 0; | |
232 | 298 } |
299 | |
567 | 300 static void mpcPlay(InputPlayback *data) |
232 | 301 { |
302 mpcDecoder.offset = -1; | |
303 mpcDecoder.isAlive = true; | |
304 mpcDecoder.isOutput = false; | |
305 mpcDecoder.isPause = false; | |
1357
cf46ed0ee590
musepack: new threading model
William Pitcock <nenolod@atheme-project.org>
parents:
1304
diff
changeset
|
306 threadHandle = g_thread_self(); |
1447
195b5657303e
updated input plugins to use set_pb_ready to signal to the core that they're ready for playback
Giacomo Lozito <james@develia.org>
parents:
1438
diff
changeset
|
307 data->set_pb_ready(data); |
1986 | 308 decodeStream(data); |
232 | 309 } |
310 | |
567 | 311 static void mpcStop(InputPlayback *data) |
232 | 312 { |
313 setAlive(false); | |
314 if (threadHandle) | |
315 { | |
316 g_thread_join(threadHandle); | |
317 if (mpcDecoder.isOutput) | |
318 { | |
567 | 319 data->output->buffer_free(); |
320 data->output->close_audio(); | |
232 | 321 mpcDecoder.isOutput = false; |
322 } | |
323 } | |
324 } | |
325 | |
567 | 326 static void mpcPause(InputPlayback *data, short p_Pause) |
232 | 327 { |
328 lockAcquire(); | |
329 mpcDecoder.isPause = p_Pause; | |
567 | 330 data->output->pause(p_Pause); |
232 | 331 lockRelease(); |
332 } | |
333 | |
567 | 334 static void mpcSeek(InputPlayback *data, int p_Offset) |
232 | 335 { |
336 lockAcquire(); | |
337 mpcDecoder.offset = static_cast<double> (p_Offset); | |
567 | 338 data->output->flush(1000 * p_Offset); |
232 | 339 lockRelease(); |
340 } | |
341 | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
342 static gint mpcGetTime(InputPlayback *data) |
232 | 343 { |
344 if(!isAlive()) | |
345 return -1; | |
567 | 346 return data->output->output_time(); |
232 | 347 } |
348 | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
349 static Tuple *mpcGetSongTuple(gchar* p_Filename) |
232 | 350 { |
1978 | 351 VFSFile *input = aud_vfs_fopen(p_Filename, "rb"); |
1438
dc3e28d3b92a
mpc: convert, wma: fixes
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
352 Tuple *tuple = NULL; |
232 | 353 |
354 if(input) | |
355 { | |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1704
diff
changeset
|
356 tuple = aud_tuple_new_from_filename(p_Filename); |
232 | 357 |
358 MpcInfo tags = getTags(p_Filename); | |
359 | |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1704
diff
changeset
|
360 aud_tuple_associate_string(tuple, FIELD_DATE, NULL, tags.date); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1704
diff
changeset
|
361 aud_tuple_associate_string(tuple, FIELD_TITLE, NULL, tags.title); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1704
diff
changeset
|
362 aud_tuple_associate_string(tuple, FIELD_ARTIST, NULL, tags.artist); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1704
diff
changeset
|
363 aud_tuple_associate_string(tuple, FIELD_ALBUM, NULL, tags.album); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1704
diff
changeset
|
364 aud_tuple_associate_int(tuple, FIELD_TRACK_NUMBER, NULL, tags.track); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1704
diff
changeset
|
365 aud_tuple_associate_int(tuple, FIELD_YEAR, NULL, tags.year); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1704
diff
changeset
|
366 aud_tuple_associate_string(tuple, FIELD_GENRE, NULL, tags.genre); |
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1704
diff
changeset
|
367 aud_tuple_associate_string(tuple, FIELD_COMMENT, NULL, tags.comment); |
1438
dc3e28d3b92a
mpc: convert, wma: fixes
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
368 |
232 | 369 freeTags(tags); |
370 | |
371 mpc_streaminfo info; | |
372 mpc_reader_file reader; | |
373 mpc_reader_setup_file_vfs(&reader, input); | |
374 mpc_streaminfo_read(&info, &reader.reader); | |
375 | |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1704
diff
changeset
|
376 aud_tuple_associate_int(tuple, FIELD_LENGTH, NULL, static_cast<int> (1000 * mpc_streaminfo_get_length(&info))); |
1478
dd05a74648a7
Improve ${codec} and ${quality} tuples.
William Pitcock <nenolod@atheme-project.org>
parents:
1477
diff
changeset
|
377 |
dd05a74648a7
Improve ${codec} and ${quality} tuples.
William Pitcock <nenolod@atheme-project.org>
parents:
1477
diff
changeset
|
378 gchar *scratch = g_strdup_printf("Musepack v%d (encoder %s)", info.stream_version, info.encoder); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1704
diff
changeset
|
379 aud_tuple_associate_string(tuple, FIELD_CODEC, NULL, scratch); |
1478
dd05a74648a7
Improve ${codec} and ${quality} tuples.
William Pitcock <nenolod@atheme-project.org>
parents:
1477
diff
changeset
|
380 g_free(scratch); |
dd05a74648a7
Improve ${codec} and ${quality} tuples.
William Pitcock <nenolod@atheme-project.org>
parents:
1477
diff
changeset
|
381 |
dd05a74648a7
Improve ${codec} and ${quality} tuples.
William Pitcock <nenolod@atheme-project.org>
parents:
1477
diff
changeset
|
382 scratch = g_strdup_printf("lossy (%s)", info.profile_name); |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1704
diff
changeset
|
383 aud_tuple_associate_string(tuple, FIELD_QUALITY, NULL, scratch); |
1478
dd05a74648a7
Improve ${codec} and ${quality} tuples.
William Pitcock <nenolod@atheme-project.org>
parents:
1477
diff
changeset
|
384 g_free(scratch); |
dd05a74648a7
Improve ${codec} and ${quality} tuples.
William Pitcock <nenolod@atheme-project.org>
parents:
1477
diff
changeset
|
385 |
1978 | 386 aud_vfs_fclose(input); |
232 | 387 } |
388 else | |
389 { | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
390 gchar* temp = g_strdup_printf("[xmms-musepack] mpcGetSongInfo is unable to open %s\n", p_Filename); |
232 | 391 perror(temp); |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
392 g_free(temp); |
232 | 393 } |
394 | |
395 return tuple; | |
396 } | |
397 | |
398 static void mpcGetSongInfo(char* p_Filename, char** p_Title, int* p_Length) | |
399 { | |
1978 | 400 VFSFile *input = aud_vfs_fopen(p_Filename, "rb"); |
232 | 401 if(input) |
402 { | |
403 MpcInfo tags = getTags(p_Filename); | |
404 *p_Title = mpcGenerateTitle(tags, p_Filename); | |
405 freeTags(tags); | |
406 mpc_streaminfo info; | |
407 mpc_reader_file reader; | |
408 mpc_reader_setup_file_vfs(&reader, input); | |
409 mpc_streaminfo_read(&info, &reader.reader); | |
410 *p_Length = static_cast<int> (1000 * mpc_streaminfo_get_length(&info)); | |
1978 | 411 aud_vfs_fclose(input); |
232 | 412 } |
413 else | |
414 { | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
415 gchar* temp = g_strdup_printf("[xmms-musepack] mpcGetSongInfo is unable to open %s\n", p_Filename); |
232 | 416 perror(temp); |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
417 g_free(temp); |
232 | 418 } |
419 } | |
420 | |
421 static void freeTags(MpcInfo& tags) | |
422 { | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
423 g_free(tags.title); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
424 g_free(tags.artist); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
425 g_free(tags.album); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
426 g_free(tags.comment); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
427 g_free(tags.genre); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
428 g_free(tags.date); |
232 | 429 } |
430 | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
431 static MpcInfo getTags(const gchar* p_Filename) |
232 | 432 { |
1477
04311d687e94
fix musepack tag retrieval
William Pitcock <nenolod@atheme-project.org>
parents:
1473
diff
changeset
|
433 gchar *pRealFilename = g_filename_from_uri(p_Filename, NULL, NULL); |
04311d687e94
fix musepack tag retrieval
William Pitcock <nenolod@atheme-project.org>
parents:
1473
diff
changeset
|
434 File oFile(pRealFilename ? pRealFilename : p_Filename, false); |
04311d687e94
fix musepack tag retrieval
William Pitcock <nenolod@atheme-project.org>
parents:
1473
diff
changeset
|
435 g_free(pRealFilename); |
232 | 436 Tag* poTag = oFile.tag(); |
437 MpcInfo tags = {0}; | |
438 tags.title = g_strdup(poTag->title().toCString(true)); | |
439 REMOVE_NONEXISTANT_TAG(tags.title); | |
440 tags.artist = g_strdup(poTag->artist().toCString(true)); | |
441 REMOVE_NONEXISTANT_TAG(tags.artist); | |
442 tags.album = g_strdup(poTag->album().toCString(true)); | |
443 REMOVE_NONEXISTANT_TAG(tags.album); | |
444 tags.genre = g_strdup(poTag->genre().toCString(true)); | |
445 REMOVE_NONEXISTANT_TAG(tags.genre); | |
446 tags.comment = g_strdup(poTag->comment().toCString(true)); | |
447 REMOVE_NONEXISTANT_TAG(tags.comment); | |
448 tags.year = poTag->year(); | |
449 tags.track = poTag->track(); | |
659
d1a03def0021
[svn] - disable broken APETag support for now, can cause crashes
nenolod
parents:
567
diff
changeset
|
450 #if 0 |
232 | 451 TagLib::APE::Tag* ape = oFile.APETag(false); |
452 if(ape) | |
453 { | |
454 ItemListMap map = ape->itemListMap(); | |
455 if(map.contains("YEAR")) | |
456 { | |
457 tags.date = g_strdup(map["YEAR"].toString().toCString(true)); | |
458 } | |
459 else | |
460 { | |
461 tags.date = g_strdup_printf("%d", tags.year); | |
462 } | |
463 } | |
659
d1a03def0021
[svn] - disable broken APETag support for now, can cause crashes
nenolod
parents:
567
diff
changeset
|
464 #endif |
232 | 465 return tags; |
466 } | |
467 | |
468 static void mpcFileInfoBox(char* p_Filename) | |
469 { | |
470 GtkWidget* infoBox = widgets.infoBox; | |
471 | |
472 if(infoBox) | |
473 gdk_window_raise(infoBox->window); | |
474 else | |
475 { | |
476 infoBox = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
477 gtk_window_set_type_hint(GTK_WINDOW(infoBox), GDK_WINDOW_TYPE_HINT_DIALOG); | |
478 widgets.infoBox = infoBox; | |
479 gtk_window_set_policy(GTK_WINDOW(infoBox), FALSE, FALSE, FALSE); | |
480 g_signal_connect(G_OBJECT(infoBox), "destroy", G_CALLBACK(closeInfoBox), NULL); | |
481 gtk_container_set_border_width(GTK_CONTAINER(infoBox), 10); | |
482 | |
483 GtkWidget* iVbox = gtk_vbox_new(FALSE, 10); | |
484 gtk_container_add(GTK_CONTAINER(infoBox), iVbox); | |
485 | |
486 GtkWidget* filenameHbox = gtk_hbox_new(FALSE, 5); | |
487 gtk_box_pack_start(GTK_BOX(iVbox), filenameHbox, FALSE, TRUE, 0); | |
488 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
489 GtkWidget* fileLabel = gtk_label_new(_("Filename:")); |
232 | 490 gtk_box_pack_start(GTK_BOX(filenameHbox), fileLabel, FALSE, TRUE, 0); |
491 | |
492 GtkWidget* fileEntry = gtk_entry_new(); | |
493 widgets.fileEntry = fileEntry; | |
494 gtk_editable_set_editable(GTK_EDITABLE(fileEntry), FALSE); | |
495 gtk_box_pack_start(GTK_BOX(filenameHbox), fileEntry, TRUE, TRUE, 0); | |
496 | |
497 GtkWidget* iHbox = gtk_hbox_new(FALSE, 10); | |
498 gtk_box_pack_start(GTK_BOX(iVbox), iHbox, FALSE, TRUE, 0); | |
499 | |
500 GtkWidget* leftBox = gtk_vbox_new(FALSE, 10); | |
501 gtk_box_pack_start(GTK_BOX(iHbox), leftBox, FALSE, FALSE, 0); | |
502 | |
503 //Tag labels | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
504 GtkWidget* tagFrame = gtk_frame_new(_("Musepack Tag")); |
232 | 505 gtk_box_pack_start(GTK_BOX(leftBox), tagFrame, FALSE, FALSE, 0); |
506 gtk_widget_set_sensitive(tagFrame, TRUE); | |
507 | |
508 GtkWidget* iTable = gtk_table_new(5, 5, FALSE); | |
509 gtk_container_set_border_width(GTK_CONTAINER(iTable), 5); | |
510 gtk_container_add(GTK_CONTAINER(tagFrame), iTable); | |
511 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
512 mpcGtkTagLabel(_("Title:"), 0, 1, 0, 1, iTable); |
232 | 513 GtkWidget* titleEntry = mpcGtkTagEntry(1, 4, 0, 1, 0, iTable); |
514 widgets.titleEntry = titleEntry; | |
515 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
516 mpcGtkTagLabel(_("Artist:"), 0, 1, 1, 2, iTable); |
232 | 517 GtkWidget* artistEntry = mpcGtkTagEntry(1, 4, 1, 2, 0, iTable); |
518 widgets.artistEntry = artistEntry; | |
519 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
520 mpcGtkTagLabel(_("Album:"), 0, 1, 2, 3, iTable); |
232 | 521 GtkWidget* albumEntry = mpcGtkTagEntry(1, 4, 2, 3, 0, iTable); |
522 widgets.albumEntry = albumEntry; | |
523 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
524 mpcGtkTagLabel(_("Comment:"), 0, 1, 3, 4, iTable); |
232 | 525 GtkWidget* commentEntry = mpcGtkTagEntry(1, 4, 3, 4, 0, iTable); |
526 widgets.commentEntry = commentEntry; | |
527 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
528 mpcGtkTagLabel(_("Year:"), 0, 1, 4, 5, iTable); |
232 | 529 GtkWidget* yearEntry = mpcGtkTagEntry(1, 2, 4, 5, 4, iTable); |
530 widgets.yearEntry = yearEntry; | |
531 gtk_widget_set_usize(yearEntry, 4, -1); | |
532 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
533 mpcGtkTagLabel(_("Track:"), 2, 3, 4, 5, iTable); |
232 | 534 GtkWidget* trackEntry = mpcGtkTagEntry(3, 4, 4, 5, 4, iTable); |
535 widgets.trackEntry = trackEntry; | |
536 gtk_widget_set_usize(trackEntry, 3, -1); | |
537 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
538 mpcGtkTagLabel(_("Genre:"), 0, 1, 5, 6, iTable); |
232 | 539 GtkWidget* genreEntry = mpcGtkTagEntry(1, 4, 5, 6, 0, iTable); |
540 widgets.genreEntry = genreEntry; | |
541 gtk_widget_set_usize(genreEntry, 20, -1); | |
542 | |
543 //Buttons | |
544 GtkWidget* buttonBox = gtk_hbutton_box_new(); | |
545 gtk_button_box_set_layout(GTK_BUTTON_BOX(buttonBox), GTK_BUTTONBOX_END); | |
546 gtk_button_box_set_spacing(GTK_BUTTON_BOX(buttonBox), 5); | |
547 gtk_box_pack_start(GTK_BOX(leftBox), buttonBox, FALSE, FALSE, 0); | |
548 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
549 GtkWidget* saveButton = mpcGtkButton(_("Save"), buttonBox); |
232 | 550 g_signal_connect(G_OBJECT(saveButton), "clicked", G_CALLBACK(saveTags), NULL); |
551 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
552 GtkWidget* removeButton = mpcGtkButton(_("Remove Tag"), buttonBox); |
232 | 553 g_signal_connect_swapped(G_OBJECT(removeButton), "clicked", G_CALLBACK(removeTags), NULL); |
554 | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
555 GtkWidget* cancelButton = mpcGtkButton(_("Cancel"), buttonBox); |
232 | 556 g_signal_connect_swapped(G_OBJECT(cancelButton), "clicked", G_CALLBACK(closeInfoBox), NULL); |
557 gtk_widget_grab_default(cancelButton); | |
558 | |
559 //File information | |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
560 GtkWidget* infoFrame = gtk_frame_new(_("Musepack Info")); |
232 | 561 gtk_box_pack_start(GTK_BOX(iHbox), infoFrame, FALSE, FALSE, 0); |
562 | |
563 GtkWidget* infoVbox = gtk_vbox_new(FALSE, 5); | |
564 gtk_container_add(GTK_CONTAINER(infoFrame), infoVbox); | |
565 gtk_container_set_border_width(GTK_CONTAINER(infoVbox), 10); | |
566 gtk_box_set_spacing(GTK_BOX(infoVbox), 0); | |
567 | |
568 GtkWidget* streamLabel = mpcGtkLabel(infoVbox); | |
569 GtkWidget* encoderLabel = mpcGtkLabel(infoVbox); | |
570 GtkWidget* profileLabel = mpcGtkLabel(infoVbox); | |
571 GtkWidget* bitrateLabel = mpcGtkLabel(infoVbox); | |
572 GtkWidget* rateLabel = mpcGtkLabel(infoVbox); | |
573 GtkWidget* channelsLabel = mpcGtkLabel(infoVbox); | |
574 GtkWidget* lengthLabel = mpcGtkLabel(infoVbox); | |
575 GtkWidget* fileSizeLabel = mpcGtkLabel(infoVbox); | |
576 GtkWidget* trackPeakLabel = mpcGtkLabel(infoVbox); | |
577 GtkWidget* trackGainLabel = mpcGtkLabel(infoVbox); | |
578 GtkWidget* albumPeakLabel = mpcGtkLabel(infoVbox); | |
579 GtkWidget* albumGainLabel = mpcGtkLabel(infoVbox); | |
580 | |
1978 | 581 VFSFile *input = aud_vfs_fopen(p_Filename, "rb"); |
232 | 582 if(input) |
583 { | |
584 mpc_streaminfo info; | |
585 mpc_reader_file reader; | |
586 mpc_reader_setup_file_vfs(&reader, input); | |
587 mpc_streaminfo_read(&info, &reader.reader); | |
588 | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
589 gint time = static_cast<int> (mpc_streaminfo_get_length(&info)); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
590 gint minutes = time / 60; |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
591 gint seconds = time % 60; |
232 | 592 |
1304
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
593 mpcGtkPrintLabel(streamLabel, _("Streamversion %d"), info.stream_version); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
594 mpcGtkPrintLabel(encoderLabel, _("Encoder: %s"), info.encoder); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
595 mpcGtkPrintLabel(profileLabel, _("Profile: %s"), info.profile_name); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
596 mpcGtkPrintLabel(bitrateLabel, _("Average bitrate: %6.1f kbps"), info.average_bitrate * 1.e-3); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
597 mpcGtkPrintLabel(rateLabel, _("Samplerate: %d Hz"), info.sample_freq); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
598 mpcGtkPrintLabel(channelsLabel, _("Channels: %d"), info.channels); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
599 mpcGtkPrintLabel(lengthLabel, _("Length: %d:\%.2d"), minutes, seconds); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
600 mpcGtkPrintLabel(fileSizeLabel, _("File size: %d Bytes"), info.total_file_length); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
601 mpcGtkPrintLabel(trackPeakLabel, _("Track Peak: %5u"), info.peak_title); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
602 mpcGtkPrintLabel(trackGainLabel, _("Track Gain: %-+2.2f dB"), 0.01 * info.gain_title); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
603 mpcGtkPrintLabel(albumPeakLabel, _("Album Peak: %5u"), info.peak_album); |
f34112ab9101
As usual, "i18n" modifications.
Stany HENRY <StrassBoy@gmail.com>
parents:
1185
diff
changeset
|
604 mpcGtkPrintLabel(albumGainLabel, _("Album Gain: %-+5.2f dB"), 0.01 * info.gain_album); |
232 | 605 |
606 MpcInfo tags = getTags(p_Filename); | |
607 gtk_entry_set_text(GTK_ENTRY(titleEntry), tags.title); | |
608 gtk_entry_set_text(GTK_ENTRY(artistEntry), tags.artist); | |
609 gtk_entry_set_text(GTK_ENTRY(albumEntry), tags.album); | |
610 gtk_entry_set_text(GTK_ENTRY(commentEntry), tags.comment); | |
611 gtk_entry_set_text(GTK_ENTRY(genreEntry), tags.genre); | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
612 gchar* entry = g_strdup_printf ("%d", tags.track); |
232 | 613 gtk_entry_set_text(GTK_ENTRY(trackEntry), entry); |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
614 g_free(entry); |
232 | 615 entry = g_strdup_printf ("%d", tags.year); |
616 gtk_entry_set_text(GTK_ENTRY(yearEntry), entry); | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
617 g_free(entry); |
232 | 618 entry = g_filename_display_name(p_Filename); |
619 gtk_entry_set_text(GTK_ENTRY(fileEntry), entry); | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
620 g_free(entry); |
232 | 621 freeTags(tags); |
1978 | 622 aud_vfs_fclose(input); |
232 | 623 } |
624 else | |
625 { | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
626 gchar* temp = g_strdup_printf("[xmms-musepack] mpcFileInfoBox is unable to read tags from %s", p_Filename); |
232 | 627 perror(temp); |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
628 g_free(temp); |
232 | 629 } |
630 | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
631 gchar* name = g_filename_display_basename(p_Filename); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
632 gchar* text = g_strdup_printf(_("File Info - %s"), name); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
633 g_free(name); |
232 | 634 gtk_window_set_title(GTK_WINDOW(infoBox), text); |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
635 g_free(text); |
232 | 636 |
637 gtk_widget_show_all(infoBox); | |
638 } | |
639 } | |
640 | |
1044
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
659
diff
changeset
|
641 static void mpcGtkPrintLabel(GtkWidget* widget, const char* format,...) |
232 | 642 { |
643 va_list args; | |
644 | |
645 va_start(args, format); | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
646 gchar* temp = g_strdup_vprintf(format, args); |
232 | 647 va_end(args); |
648 | |
649 gtk_label_set_text(GTK_LABEL(widget), temp); | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
650 g_free(temp); |
232 | 651 } |
652 | |
1044
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
659
diff
changeset
|
653 static GtkWidget* mpcGtkTagLabel(const char* p_Text, int a, int b, int c, int d, GtkWidget* p_Box) |
232 | 654 { |
655 GtkWidget* label = gtk_label_new(p_Text); | |
656 gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); | |
657 gtk_table_attach(GTK_TABLE(p_Box), label, a, b, c, d, GTK_FILL, GTK_FILL, 5, 5); | |
658 return label; | |
659 } | |
660 | |
661 static GtkWidget* mpcGtkTagEntry(int a, int b, int c, int d, int p_Size, GtkWidget* p_Box) | |
662 { | |
663 GtkWidget* entry; | |
664 if(p_Size == 0) | |
665 entry = gtk_entry_new(); | |
666 else | |
667 entry = gtk_entry_new_with_max_length(p_Size); | |
668 gtk_table_attach(GTK_TABLE(p_Box), entry, a, b, c, d, | |
669 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | GTK_SHRINK), | |
670 (GtkAttachOptions) (GTK_FILL | GTK_EXPAND | GTK_SHRINK), 0, 5); | |
671 return entry; | |
672 } | |
673 | |
674 static GtkWidget* mpcGtkLabel(GtkWidget* p_Box) | |
675 { | |
676 GtkWidget* label = gtk_label_new(""); | |
677 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
678 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); | |
679 gtk_box_pack_start(GTK_BOX(p_Box), label, FALSE, FALSE, 0); | |
680 return label; | |
681 } | |
682 | |
1044
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
659
diff
changeset
|
683 static GtkWidget* mpcGtkButton(const char* p_Text, GtkWidget* p_Box) |
232 | 684 { |
685 GtkWidget* button = gtk_button_new_with_label(p_Text); | |
686 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); | |
687 gtk_box_pack_start(GTK_BOX(p_Box), button, TRUE, TRUE, 0); | |
688 return button; | |
689 } | |
690 | |
691 static void removeTags(GtkWidget * w, gpointer data) | |
692 { | |
693 File oFile(gtk_entry_get_text(GTK_ENTRY(widgets.fileEntry))); | |
694 oFile.remove(); | |
695 oFile.save(); | |
696 closeInfoBox(NULL, NULL); | |
697 } | |
698 | |
699 static void saveTags(GtkWidget* w, gpointer data) | |
700 { | |
701 File oFile(gtk_entry_get_text(GTK_ENTRY(widgets.fileEntry))); | |
702 Tag* poTag = oFile.tag(); | |
703 | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
704 gchar* cAlbum = g_strdup(gtk_entry_get_text(GTK_ENTRY(widgets.albumEntry))); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
705 gchar* cArtist = g_strdup(gtk_entry_get_text(GTK_ENTRY(widgets.artistEntry))); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
706 gchar* cTitle = g_strdup(gtk_entry_get_text(GTK_ENTRY(widgets.titleEntry))); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
707 gchar* cGenre = g_strdup(gtk_entry_get_text(GTK_ENTRY(widgets.genreEntry))); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
708 gchar* cComment = g_strdup(gtk_entry_get_text(GTK_ENTRY(widgets.commentEntry))); |
232 | 709 |
710 const String album = String(cAlbum, TagLib::String::UTF8); | |
711 const String artist = String(cArtist, TagLib::String::UTF8); | |
712 const String title = String(cTitle, TagLib::String::UTF8); | |
713 const String genre = String(cGenre, TagLib::String::UTF8); | |
714 const String comment = String(cComment, TagLib::String::UTF8); | |
715 | |
716 poTag->setAlbum(album); | |
717 poTag->setArtist(artist); | |
718 poTag->setTitle(title); | |
719 poTag->setGenre(genre); | |
720 poTag->setComment(comment); | |
721 poTag->setYear(atoi(gtk_entry_get_text(GTK_ENTRY(widgets.yearEntry)))); | |
722 poTag->setTrack(atoi(gtk_entry_get_text(GTK_ENTRY(widgets.trackEntry)))); | |
723 | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
724 g_free(cAlbum); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
725 g_free(cArtist); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
726 g_free(cTitle); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
727 g_free(cGenre); |
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
728 g_free(cComment); |
232 | 729 |
730 oFile.save(); | |
731 closeInfoBox(NULL, NULL); | |
732 } | |
733 | |
734 static void closeInfoBox(GtkWidget* w, gpointer data) | |
735 { | |
736 gtk_widget_destroy(widgets.infoBox); | |
737 widgets.infoBox = NULL; | |
738 } | |
739 | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
740 static char* mpcGenerateTitle(const MpcInfo& p_Tags, gchar* p_Filename) |
232 | 741 { |
1438
dc3e28d3b92a
mpc: convert, wma: fixes
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
742 Tuple* tuple = mpcGetSongTuple(p_Filename); |
dc3e28d3b92a
mpc: convert, wma: fixes
William Pitcock <nenolod@atheme-project.org>
parents:
1395
diff
changeset
|
743 |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
744 gchar* title = aud_tuple_formatter_make_title_string(tuple, aud_get_gentitle_format()); |
232 | 745 |
1976
5fa26178eaef
s/tuple_/aud_tuple_/g
William Pitcock <nenolod@atheme.org>
parents:
1704
diff
changeset
|
746 aud_tuple_free((void *) tuple); |
232 | 747 return title; |
748 } | |
749 | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
750 static void* endThread(gchar* p_FileName, VFSFile * p_FileHandle, bool release) |
232 | 751 { |
752 if(release) | |
753 lockRelease(); | |
754 if(mpcDecoder.isError) | |
755 { | |
756 perror(mpcDecoder.isError); | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
757 g_free(mpcDecoder.isError); |
232 | 758 mpcDecoder.isError = NULL; |
759 } | |
760 setAlive(false); | |
761 if(p_FileHandle) | |
1978 | 762 aud_vfs_fclose(p_FileHandle); |
232 | 763 if(track.display) |
764 { | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
765 g_free(track.display); |
232 | 766 track.display = NULL; |
767 } | |
768 return 0; | |
769 } | |
770 | |
1986 | 771 static void* decodeStream(InputPlayback *data) |
232 | 772 { |
773 lockAcquire(); | |
2119
5fea114ca11e
Use a #define for config ID.
Matti Hamalainen <ccr@tnsp.org>
parents:
2116
diff
changeset
|
774 gchar* filename = data->filename; |
1978 | 775 VFSFile *input = aud_vfs_fopen(filename, "rb"); |
232 | 776 if (!input) |
777 { | |
778 mpcDecoder.isError = g_strdup_printf("[xmms-musepack] decodeStream is unable to open %s", filename); | |
779 return endThread(filename, input, true); | |
780 } | |
781 | |
782 mpc_reader_file reader; | |
783 mpc_reader_setup_file_vfs(&reader, input); | |
784 | |
785 mpc_streaminfo info; | |
786 if (mpc_streaminfo_read(&info, &reader.reader) != ERROR_CODE_OK) | |
787 { | |
788 mpcDecoder.isError = g_strdup_printf("[xmms-musepack] decodeStream is unable to read %s", filename); | |
789 return endThread(filename, input, true); | |
790 } | |
791 | |
792 MpcInfo tags = getTags(filename); | |
793 track.display = mpcGenerateTitle(tags, filename); | |
794 track.length = static_cast<int> (1000 * mpc_streaminfo_get_length(&info)); | |
795 track.bitrate = static_cast<int> (info.average_bitrate); | |
796 track.sampleFreq = info.sample_freq; | |
797 track.channels = info.channels; | |
798 freeTags(tags); | |
799 | |
1986 | 800 data->set_params(data, track.display, track.length, track.bitrate, track.sampleFreq, track.channels); |
232 | 801 |
802 mpc_decoder decoder; | |
803 mpc_decoder_setup(&decoder, &reader.reader); | |
804 if (!mpc_decoder_initialize(&decoder, &info)) | |
805 { | |
806 mpcDecoder.isError = g_strdup_printf("[xmms-musepack] decodeStream is unable to initialize decoder on %s", filename); | |
807 return endThread(filename, input, true); | |
808 } | |
809 | |
810 setReplaygain(info, decoder); | |
811 | |
812 MPC_SAMPLE_FORMAT sampleBuffer[MPC_DECODER_BUFFER_LENGTH]; | |
813 char xmmsBuffer[MPC_DECODER_BUFFER_LENGTH * 4]; | |
814 | |
815 if (!MpcPlugin.output->open_audio(FMT_S16_LE, track.sampleFreq, track.channels)) | |
816 { | |
817 mpcDecoder.isError = g_strdup_printf("[xmms-musepack] decodeStream is unable to open an audio output"); | |
818 return endThread(filename, input, true); | |
819 } | |
820 else | |
821 { | |
822 mpcDecoder.isOutput = true; | |
823 } | |
824 | |
825 lockRelease(); | |
826 | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
827 gint counter = 2 * track.sampleFreq / 3; |
232 | 828 while (isAlive()) |
829 { | |
830 if (getOffset() != -1) | |
831 { | |
832 mpc_decoder_seek_seconds(&decoder, mpcDecoder.offset); | |
833 setOffset(-1); | |
834 } | |
835 | |
836 lockAcquire(); | |
837 short iPlaying = MpcPlugin.output->buffer_playing()? 1 : 0; | |
2111
ac599b9b0490
Use GLib types; Also g_free() MUST be used when memory is allocated via any
Matti Hamalainen <ccr@tnsp.org>
parents:
2055
diff
changeset
|
838 gint iFree = MpcPlugin.output->buffer_free(); |
232 | 839 if (!mpcDecoder.isPause && iFree >= ((1152 * 4) << iPlaying)) |
840 { | |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1986
diff
changeset
|
841 unsigned status = processBuffer(data, sampleBuffer, xmmsBuffer, decoder); |
232 | 842 if (status == (unsigned) (-1)) |
843 { | |
844 mpcDecoder.isError = g_strdup_printf("[xmms-musepack] error from internal decoder on %s", filename); | |
845 return endThread(filename, input, true); | |
846 } | |
847 if (status == 0 && iPlaying == 0) | |
848 return endThread(filename, input, true); | |
849 | |
850 lockRelease(); | |
851 | |
852 if(pluginConfig.dynamicBitrate) | |
853 { | |
854 counter -= status; | |
855 if(counter < 0) | |
856 { | |
1986 | 857 data->set_params(data, track.display, track.length, track.bitrate, track.sampleFreq, track.channels); |
232 | 858 counter = 2 * track.sampleFreq / 3; |
859 } | |
860 } | |
861 } | |
862 else | |
863 { | |
864 lockRelease(); | |
1676
aee4ebea943a
xmms_usleep() was removed, use g_usleep()
Matti Hamalainen <ccr@tnsp.org>
parents:
1621
diff
changeset
|
865 g_usleep(10000); |
232 | 866 } |
867 } | |
868 return endThread(filename, input, false); | |
869 } | |
870 | |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1986
diff
changeset
|
871 static int processBuffer(InputPlayback *playback, |
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1986
diff
changeset
|
872 MPC_SAMPLE_FORMAT* sampleBuffer, char* xmmsBuffer, mpc_decoder& decoder) |
232 | 873 { |
874 mpc_uint32_t vbrAcc = 0; | |
875 mpc_uint32_t vbrUpd = 0; | |
876 | |
877 unsigned status = mpc_decoder_decode(&decoder, sampleBuffer, &vbrAcc, &vbrUpd); | |
878 copyBuffer(sampleBuffer, xmmsBuffer, status); | |
879 | |
880 if (pluginConfig.dynamicBitrate) | |
881 { | |
882 track.bitrate = static_cast<int> (vbrUpd * track.sampleFreq / 1152); | |
883 } | |
884 | |
1998
8f3188746b64
chase last changeset in aud
William Pitcock <nenolod@atheme.org>
parents:
1986
diff
changeset
|
885 playback->pass_audio(playback, FMT_S16_LE, track.channels, status * 4, xmmsBuffer, NULL); |
232 | 886 return status; |
887 } | |
888 | |
889 static void setReplaygain(mpc_streaminfo& info, mpc_decoder& decoder) | |
890 { | |
891 if(!pluginConfig.replaygain && !pluginConfig.clipPrevention) | |
892 return; | |
893 | |
894 int peak = pluginConfig.albumGain ? info.peak_album : info.peak_title; | |
895 double gain = pluginConfig.albumGain ? info.gain_album : info.gain_title; | |
896 | |
897 if(!peak) | |
898 peak = 32767; | |
899 if(!gain) | |
900 gain = 1.; | |
901 | |
902 double clip = 32767. / peak; | |
903 gain = exp((M_LN10 / 2000.) * gain); | |
904 | |
905 if(pluginConfig.clipPrevention && !pluginConfig.replaygain) | |
906 gain = clip; | |
907 else if(pluginConfig.replaygain && pluginConfig.clipPrevention) | |
908 if(clip < gain) | |
909 gain = clip; | |
910 | |
911 mpc_decoder_scale_output(&decoder, gain); | |
912 } | |
913 | |
914 inline static void lockAcquire() | |
915 { | |
916 g_static_mutex_lock(&threadMutex); | |
917 } | |
918 | |
919 inline static void lockRelease() | |
920 { | |
921 g_static_mutex_unlock(&threadMutex); | |
922 } | |
923 | |
924 inline static bool isAlive() | |
925 { | |
926 lockAcquire(); | |
927 bool isAlive = mpcDecoder.isAlive; | |
928 lockRelease(); | |
929 return isAlive; | |
930 } | |
931 | |
932 inline static bool isPause() | |
933 { | |
934 lockAcquire(); | |
935 bool isPause = mpcDecoder.isPause; | |
936 lockRelease(); | |
937 return isPause; | |
938 } | |
939 | |
940 inline static void setAlive(bool isAlive) | |
941 { | |
942 lockAcquire(); | |
943 mpcDecoder.isAlive = isAlive; | |
944 lockRelease(); | |
945 } | |
946 | |
947 inline static double getOffset() | |
948 { | |
949 lockAcquire(); | |
950 double offset = mpcDecoder.offset; | |
951 lockRelease(); | |
952 return offset; | |
953 } | |
954 | |
955 inline static void setOffset(double offset) | |
956 { | |
957 lockAcquire(); | |
958 mpcDecoder.offset = offset; | |
959 lockRelease(); | |
960 } |