Mercurial > audlegacy-plugins
annotate src/filewriter/mp3.c @ 1946:7ee1bc4d5f5b
Remove useless #includes, use <>
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 02 Oct 2007 00:49:51 +0300 |
parents | d158ce84fda7 |
children | 5fa26178eaef |
rev | line source |
---|---|
984 | 1 /* FileWriter-Plugin |
2 * (C) copyright 2007 merging of Disk Writer and Out-Lame by Michael Färber | |
3 * | |
4 * Original Out-Lame-Plugin: | |
5 * (C) copyright 2002 Lars Siebold <khandha5@gmx.net> | |
6 * (C) copyright 2006-2007 porting to audacious by Yoshiki Yazawa <yaz@cc.rim.or.jp> | |
7 * | |
8 * This program is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
21 */ | |
22 | |
23 #include "plugins.h" | |
24 | |
1197
616928ec054d
Add #ifdef FILEWRITER_MP3 to filewriter/mp3.c
Jonathan Schleifer <js@h3c.de>
parents:
1044
diff
changeset
|
25 #ifdef FILEWRITER_MP3 |
616928ec054d
Add #ifdef FILEWRITER_MP3 to filewriter/mp3.c
Jonathan Schleifer <js@h3c.de>
parents:
1044
diff
changeset
|
26 |
984 | 27 #include <lame/lame.h> |
28 #define ENCBUFFER_SIZE 35000 | |
29 | |
30 static void mp3_init(void); | |
31 static void mp3_configure(void); | |
32 static gint mp3_open(void); | |
33 static void mp3_write(void *ptr, gint length); | |
34 static void mp3_close(void); | |
35 static gint mp3_free(void); | |
36 static gint mp3_playing(void); | |
37 static gint mp3_get_written_time(void); | |
38 | |
39 FileWriter mp3_plugin = | |
40 { | |
41 mp3_init, | |
42 mp3_configure, | |
43 mp3_open, | |
44 mp3_write, | |
45 mp3_close, | |
46 mp3_free, | |
47 mp3_playing, | |
48 mp3_get_written_time | |
49 }; | |
50 | |
51 static GtkWidget *configure_win = NULL; | |
52 static GtkWidget *configure_bbox, *configure_ok, *configure_cancel; | |
53 static GtkWidget *alg_quality_spin; | |
54 static GtkWidget *alg_quality_hbox; | |
55 static GtkObject *alg_quality_adj; | |
56 static GtkWidget *vbox, *notebook; | |
57 static GtkWidget *quality_vbox, *quality_hbox1, *alg_quality_frame; | |
58 static GtkWidget *enc_quality_frame, *enc_quality_label1, *enc_quality_label2; | |
59 static GtkWidget *enc_radio1, *enc_radio2, *bitrate_option_menu, *bitrate_menu, | |
60 *bitrate_menu_item; | |
61 static GtkWidget *compression_spin; | |
62 static GtkObject *compression_adj; | |
63 static GtkWidget *mode_hbox, *mode_option_menu, *mode_menu, *mode_frame, | |
64 *mode_menu_item, *ms_mode_toggle; | |
65 static GtkWidget *samplerate_hbox, *samplerate_option_menu, *samplerate_menu, | |
66 *samplerate_label, *samplerate_frame, *samplerate_menu_item; | |
67 static GtkWidget *misc_frame, *misc_vbox, *enforce_iso_toggle, | |
68 *error_protection_toggle; | |
69 static GtkTooltips *quality_tips, *vbr_tips, *tags_tips; | |
70 static GtkWidget *vbr_vbox, *vbr_toggle, *vbr_options_vbox, *vbr_type_frame, | |
71 *vbr_type_hbox, *vbr_type_radio1, *vbr_type_radio2; | |
72 static GtkWidget *abr_frame, *abr_option_menu, *abr_menu, *abr_menu_item, | |
73 *abr_hbox, *abr_label; | |
74 static GtkWidget *vbr_frame, *vbr_options_vbox2; | |
75 static GtkWidget *vbr_options_hbox1, *vbr_min_option_menu, *vbr_min_menu, | |
76 *vbr_min_menu_item, *vbr_min_label; | |
77 static GtkWidget *vbr_options_hbox2, *vbr_max_option_menu, *vbr_max_menu, | |
78 *vbr_max_menu_item, *vbr_max_label, *enforce_min_toggle; | |
79 static GtkWidget *vbr_options_hbox3, *vbr_quality_spin, *vbr_quality_label; | |
80 static GtkObject *vbr_quality_adj; | |
81 static GtkWidget *xing_header_toggle; | |
82 static GtkWidget *tags_vbox, *tags_frames_frame, *tags_frames_hbox, | |
83 *tags_copyright_toggle, *tags_original_toggle; | |
84 static GtkWidget *tags_id3_frame, *tags_id3_vbox, *tags_id3_hbox, | |
85 *tags_force_id3v2_toggle, *tags_only_v1_toggle, *tags_only_v2_toggle; | |
86 | |
87 static GtkWidget *enc_quality_vbox, *hbox1, *hbox2; | |
88 | |
89 static guint64 olen = 0; | |
90 static int inside; | |
91 | |
92 static gint vbr_on = 0; | |
93 static gint vbr_type = 0; | |
94 static gint vbr_min_val = 32; | |
95 static gint vbr_max_val = 320; | |
96 static gint enforce_min_val = 0; | |
97 static gint vbr_quality_val = 4; | |
98 static gint abr_val = 128; | |
99 static gint toggle_xing_val = 1; | |
100 static gint mark_original_val = 1; | |
101 static gint mark_copyright_val = 0; | |
102 static gint force_v2_val = 0; | |
103 static gint only_v1_val = 0; | |
104 static gint only_v2_val = 0; | |
105 static gint algo_quality_val = 5; | |
106 static gint out_samplerate_val = 0; | |
107 static gint bitrate_val = 128; | |
108 static gfloat compression_val = 11; | |
109 static gint enc_toggle_val = 0; | |
110 static gint audio_mode_val = 4; | |
111 static gint auto_ms_val = 0; | |
112 static gint enforce_iso_val = 0; | |
113 static gint error_protect_val = 0; | |
114 | |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
115 static gint available_samplerates[] = |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
116 { 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000 } ; |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
117 |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
118 static gint available_bitrates[] = |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
119 { 8, 16, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } ; |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
120 |
984 | 121 typedef struct { |
122 gchar *track_name; | |
123 gchar *album_name; | |
124 gchar *performer; | |
125 gchar *genre; | |
126 gchar *year; | |
127 gchar *track_number; | |
128 } lameid3_t; | |
129 | |
130 static lameid3_t lameid3; | |
131 | |
132 static lame_global_flags *gfp; | |
133 static int encout; | |
134 static unsigned char encbuffer[ENCBUFFER_SIZE]; | |
135 | |
136 static void free_lameid3(lameid3_t *p) | |
137 { | |
138 g_free(p->track_name); | |
139 g_free(p->album_name); | |
140 g_free(p->performer); | |
141 g_free(p->genre); | |
142 g_free(p->year); | |
143 g_free(p->track_number); | |
144 | |
145 p->track_name = NULL; | |
146 p->album_name = NULL; | |
147 p->performer = NULL; | |
148 p->genre = NULL; | |
149 p->year = NULL; | |
150 p->track_number = NULL; | |
151 | |
152 }; | |
153 | |
154 static void lame_debugf(const char *format, va_list ap) | |
155 { | |
156 (void) vfprintf(stdout, format, ap); | |
157 } | |
158 | |
159 | |
160 | |
161 static void mp3_init(void) | |
162 { | |
163 ConfigDb *db = bmp_cfg_db_open(); | |
164 bmp_cfg_db_get_int(db, "filewriter_mp3", "vbr_on", &vbr_on); | |
165 bmp_cfg_db_get_int(db, "filewriter_mp3", "vbr_type", &vbr_type); | |
166 bmp_cfg_db_get_int(db, "filewriter_mp3", "vbr_min_val", &vbr_min_val); | |
167 bmp_cfg_db_get_int(db, "filewriter_mp3", "vbr_max_val", &vbr_max_val); | |
168 bmp_cfg_db_get_int(db, "filewriter_mp3", "enforce_min_val", | |
169 &enforce_min_val); | |
170 bmp_cfg_db_get_int(db, "filewriter_mp3", "vbr_quality_val", | |
171 &vbr_quality_val); | |
172 bmp_cfg_db_get_int(db, "filewriter_mp3", "abr_val", &abr_val); | |
173 bmp_cfg_db_get_int(db, "filewriter_mp3", "toggle_xing_val", | |
174 &toggle_xing_val); | |
175 bmp_cfg_db_get_int(db, "filewriter_mp3", "mark_original_val", | |
176 &mark_original_val); | |
177 bmp_cfg_db_get_int(db, "filewriter_mp3", "mark_copyright_val", | |
178 &mark_copyright_val); | |
179 bmp_cfg_db_get_int(db, "filewriter_mp3", "force_v2_val", &force_v2_val); | |
180 bmp_cfg_db_get_int(db, "filewriter_mp3", "only_v1_val", &only_v1_val); | |
181 bmp_cfg_db_get_int(db, "filewriter_mp3", "only_v2_val", &only_v2_val); | |
182 bmp_cfg_db_get_int(db, "filewriter_mp3", "algo_quality_val", | |
183 &algo_quality_val); | |
184 bmp_cfg_db_get_int(db, "filewriter_mp3", "out_samplerate_val", | |
185 &out_samplerate_val); | |
186 bmp_cfg_db_get_int(db, "filewriter_mp3", "bitrate_val", &bitrate_val); | |
187 bmp_cfg_db_get_float(db, "filewriter_mp3", "compression_val", | |
188 &compression_val); | |
189 bmp_cfg_db_get_int(db, "filewriter_mp3", "enc_toggle_val", &enc_toggle_val); | |
190 bmp_cfg_db_get_int(db, "filewriter_mp3", "audio_mode_val", &audio_mode_val); | |
191 bmp_cfg_db_get_int(db, "filewriter_mp3", "auto_ms_val", &auto_ms_val); | |
192 bmp_cfg_db_get_int(db, "filewriter_mp3", "enforce_iso_val", | |
193 &enforce_iso_val); | |
194 bmp_cfg_db_get_int(db, "filewriter_mp3", "error_protect_val", | |
195 &error_protect_val); | |
196 bmp_cfg_db_close(db); | |
197 } | |
198 | |
199 static gint mp3_open(void) | |
200 { | |
201 if ((gfp = lame_init()) == (void *)-1) | |
202 return 0; | |
203 | |
204 /* setup id3 data */ | |
205 id3tag_init(gfp); | |
206 | |
207 if (tuple) { | |
208 /* XXX write UTF-8 even though libmp3lame does id3v2.3. --yaz */ | |
209 #ifdef DEBUG | |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1525
diff
changeset
|
210 g_print("track_name = %s\n", tuple_get_string(tuple, FIELD_TITLE, NULL)); |
984 | 211 #endif |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1525
diff
changeset
|
212 lameid3.track_name = g_strdup(tuple_get_string(tuple, FIELD_TITLE, NULL)); |
984 | 213 id3tag_set_title(gfp, lameid3.track_name); |
214 | |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1525
diff
changeset
|
215 lameid3.performer = g_strdup(tuple_get_string(tuple, FIELD_ARTIST, NULL)); |
984 | 216 id3tag_set_artist(gfp, lameid3.performer); |
217 | |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1525
diff
changeset
|
218 lameid3.album_name = g_strdup(tuple_get_string(tuple, FIELD_ALBUM, NULL)); |
984 | 219 id3tag_set_album(gfp, lameid3.album_name); |
220 | |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1525
diff
changeset
|
221 lameid3.genre = g_strdup(tuple_get_string(tuple, FIELD_GENRE, NULL)); |
984 | 222 id3tag_set_genre(gfp, lameid3.genre); |
223 | |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1525
diff
changeset
|
224 lameid3.year = g_strdup_printf("%d", tuple_get_int(tuple, FIELD_YEAR, NULL)); |
984 | 225 id3tag_set_year(gfp, lameid3.year); |
226 | |
1687
d158ce84fda7
Modified for Tuplez/plugin API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
1525
diff
changeset
|
227 lameid3.track_number = g_strdup_printf("%d", tuple_get_int(tuple, FIELD_TRACK_NUMBER, NULL)); |
984 | 228 id3tag_set_track(gfp, lameid3.track_number); |
229 | |
230 // id3tag_write_v1(gfp); | |
231 id3tag_add_v2(gfp); | |
232 } | |
233 | |
234 /* input stream description */ | |
235 | |
236 lame_set_in_samplerate(gfp, input.frequency); | |
237 lame_set_num_channels(gfp, input.channels); | |
238 /* Maybe implement this? */ | |
239 /* lame_set_scale(lame_global_flags *, float); */ | |
240 lame_set_out_samplerate(gfp, out_samplerate_val); | |
241 | |
242 /* general control parameters */ | |
243 | |
244 lame_set_bWriteVbrTag(gfp, toggle_xing_val); | |
245 lame_set_quality(gfp, algo_quality_val); | |
246 if (audio_mode_val != 4) { | |
247 #ifdef DEBUG | |
248 printf("set mode to %d\n", audio_mode_val); | |
249 #endif | |
250 lame_set_mode(gfp, audio_mode_val); | |
251 } | |
252 if(auto_ms_val) | |
253 lame_set_mode_automs(gfp, auto_ms_val); // this forces to use joint stereo!! --yaz. | |
254 | |
255 lame_set_errorf(gfp, lame_debugf); | |
256 lame_set_debugf(gfp, lame_debugf); | |
257 lame_set_msgf(gfp, lame_debugf); | |
258 | |
259 if (enc_toggle_val == 0 && vbr_on == 0) | |
260 lame_set_brate(gfp, bitrate_val); | |
261 else if (vbr_on == 0) | |
262 lame_set_compression_ratio(gfp, compression_val); | |
263 | |
264 /* frame params */ | |
265 | |
266 lame_set_copyright(gfp, mark_copyright_val); | |
267 lame_set_original(gfp, mark_original_val); | |
268 lame_set_error_protection(gfp, error_protect_val); | |
269 lame_set_strict_ISO(gfp, enforce_iso_val); | |
270 | |
271 if (vbr_on != 0) { | |
272 if (vbr_type == 0) | |
273 lame_set_VBR(gfp, 2); | |
274 else | |
275 lame_set_VBR(gfp, 3); | |
276 lame_set_VBR_q(gfp, vbr_quality_val); | |
277 lame_set_VBR_mean_bitrate_kbps(gfp, abr_val); | |
278 lame_set_VBR_min_bitrate_kbps(gfp, vbr_min_val); | |
279 lame_set_VBR_max_bitrate_kbps(gfp, vbr_max_val); | |
280 lame_set_VBR_hard_min(gfp, enforce_min_val); | |
281 } | |
282 | |
283 if (lame_init_params(gfp) == -1) | |
284 return 0; | |
285 | |
286 return 1; | |
287 } | |
288 | |
289 static void mp3_write(void *ptr, gint length) | |
290 { | |
291 if (input.channels == 1) { | |
292 encout = | |
293 lame_encode_buffer(gfp, ptr, ptr, length / 2, encbuffer, | |
294 ENCBUFFER_SIZE); | |
295 } | |
296 else { | |
297 encout = | |
298 lame_encode_buffer_interleaved(gfp, ptr, length / 4, encbuffer, | |
299 ENCBUFFER_SIZE); | |
300 } | |
301 | |
302 vfs_fwrite(encbuffer, 1, encout, output_file); | |
303 written += encout; | |
304 olen += length; | |
305 } | |
306 | |
307 static void mp3_close(void) | |
308 { | |
309 if (output_file) | |
310 { | |
311 encout = lame_encode_flush_nogap(gfp, encbuffer, ENCBUFFER_SIZE); | |
312 vfs_fwrite(encbuffer, 1, encout, output_file); | |
313 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
314 // lame_mp3_tags_fid(gfp, output_file); // will erase id3v2 tag?? |
984 | 315 |
316 lame_close(gfp); | |
317 | |
318 free_lameid3(&lameid3); | |
319 | |
320 olen = 0; | |
321 } | |
322 } | |
323 | |
324 static gint mp3_free(void) | |
325 { | |
326 return ENCBUFFER_SIZE - encout; | |
327 } | |
328 | |
329 static gint mp3_playing(void) | |
330 { | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
331 #ifdef DEBUG |
984 | 332 printf("lame: buffer_playing = %d\n", encout ? 1 : 0); |
333 #endif | |
334 return encout ? 1 : 0; | |
335 } | |
336 | |
337 static gint mp3_get_written_time(void) | |
338 { | |
339 gint time; | |
340 if (input.frequency && input.channels) { | |
341 time = (gint) ((olen * 1000) / (input.frequency * 2 * input.channels)); | |
342 return time + offset; | |
343 } | |
344 | |
345 return 0; | |
346 } | |
347 | |
348 /*****************/ | |
349 /* Configuration */ | |
350 /*****************/ | |
351 | |
352 /* Various Singal-Fuctions */ | |
353 | |
354 static void algo_qual(GtkAdjustment * adjustment, gpointer user_data) | |
355 { | |
356 | |
357 algo_quality_val = | |
358 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON | |
359 (alg_quality_spin)); | |
360 | |
361 } | |
362 | |
363 static void samplerate_activate(GtkMenuItem * menuitem, gpointer user_data) | |
364 { | |
365 | |
366 out_samplerate_val = GPOINTER_TO_INT(user_data); | |
367 | |
368 } | |
369 | |
370 static void bitrate_activate(GtkMenuItem * menuitem, gpointer user_data) | |
371 { | |
372 | |
373 bitrate_val = GPOINTER_TO_INT(user_data); | |
374 | |
375 } | |
376 | |
377 static void compression_change(GtkAdjustment * adjustment, | |
378 gpointer user_data) | |
379 { | |
380 | |
381 compression_val = | |
382 gtk_spin_button_get_value_as_float(GTK_SPIN_BUTTON | |
383 (compression_spin)); | |
384 | |
385 } | |
386 | |
387 static void encoding_toggle(GtkToggleButton * togglebutton, | |
388 gpointer user_data) | |
389 { | |
390 | |
391 enc_toggle_val = GPOINTER_TO_INT(user_data); | |
392 | |
393 } | |
394 | |
395 static void mode_activate(GtkMenuItem * menuitem, gpointer user_data) | |
396 { | |
397 | |
398 audio_mode_val = GPOINTER_TO_INT(user_data); | |
399 | |
400 } | |
401 | |
402 static void toggle_auto_ms(GtkToggleButton * togglebutton, | |
403 gpointer user_data) | |
404 { | |
405 | |
406 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ms_mode_toggle)) == | |
407 TRUE) | |
408 auto_ms_val = 1; | |
409 else | |
410 auto_ms_val = 0; | |
411 | |
412 } | |
413 | |
414 static void toggle_enforce_iso(GtkToggleButton * togglebutton, | |
415 gpointer user_data) | |
416 { | |
417 | |
418 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enforce_iso_toggle)) | |
419 == TRUE) | |
420 enforce_iso_val = 1; | |
421 else | |
422 enforce_iso_val = 0; | |
423 | |
424 } | |
425 | |
426 static void toggle_error_protect(GtkToggleButton * togglebutton, | |
427 gpointer user_data) | |
428 { | |
429 | |
430 if (gtk_toggle_button_get_active | |
431 (GTK_TOGGLE_BUTTON(error_protection_toggle)) == TRUE) | |
432 error_protect_val = 1; | |
433 else | |
434 error_protect_val = 0; | |
435 | |
436 } | |
437 | |
438 static void toggle_vbr(GtkToggleButton * togglebutton, gpointer user_data) | |
439 { | |
440 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vbr_toggle)) == | |
441 TRUE) { | |
442 gtk_widget_set_sensitive(vbr_options_vbox, TRUE); | |
443 gtk_widget_set_sensitive(enc_quality_frame, FALSE); | |
444 vbr_on = 1; | |
445 | |
446 if (vbr_type == 0) { | |
447 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
448 (vbr_type_radio1), TRUE); | |
449 gtk_widget_set_sensitive(abr_frame, FALSE); | |
450 gtk_widget_set_sensitive(vbr_frame, TRUE); | |
451 } | |
452 else if (vbr_type == 1) { | |
453 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
454 (vbr_type_radio2), TRUE); | |
455 gtk_widget_set_sensitive(abr_frame, TRUE); | |
456 gtk_widget_set_sensitive(vbr_frame, FALSE); | |
457 } | |
458 | |
459 } | |
460 else { | |
461 gtk_widget_set_sensitive(vbr_options_vbox, FALSE); | |
462 gtk_widget_set_sensitive(enc_quality_frame, TRUE); | |
463 vbr_on = 0; | |
464 } | |
465 } | |
466 | |
467 static void vbr_abr_toggle(GtkToggleButton * togglebutton, | |
468 gpointer user_data) | |
469 { | |
1044
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
1004
diff
changeset
|
470 if (!strcmp(user_data, "VBR")) { |
984 | 471 gtk_widget_set_sensitive(abr_frame, FALSE); |
472 gtk_widget_set_sensitive(vbr_frame, TRUE); | |
473 vbr_type = 0; | |
474 } | |
1044
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
1004
diff
changeset
|
475 else if (!strcmp(user_data, "ABR")) { |
984 | 476 gtk_widget_set_sensitive(abr_frame, TRUE); |
477 gtk_widget_set_sensitive(vbr_frame, FALSE); | |
478 vbr_type = 1; | |
479 } | |
480 } | |
481 | |
482 static void vbr_min_activate(GtkMenuItem * menuitem, gpointer user_data) | |
483 { | |
484 | |
485 vbr_min_val = GPOINTER_TO_INT(user_data); | |
486 | |
487 } | |
488 | |
489 static void vbr_max_activate(GtkMenuItem * menuitem, gpointer user_data) | |
490 { | |
491 | |
492 vbr_max_val = GPOINTER_TO_INT(user_data); | |
493 | |
494 } | |
495 | |
496 static void toggle_enforce_min(GtkToggleButton * togglebutton, | |
497 gpointer user_data) | |
498 { | |
499 | |
500 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enforce_min_toggle)) | |
501 == TRUE) | |
502 enforce_min_val = 1; | |
503 else | |
504 enforce_min_val = 0; | |
505 | |
506 } | |
507 | |
508 static void vbr_qual(GtkAdjustment * adjustment, gpointer user_data) | |
509 { | |
510 | |
511 vbr_quality_val = | |
512 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON | |
513 (vbr_quality_spin)); | |
514 | |
515 } | |
516 | |
517 static void abr_activate(GtkMenuItem * menuitem, gpointer user_data) | |
518 { | |
519 | |
520 abr_val = GPOINTER_TO_INT(user_data); | |
521 | |
522 } | |
523 | |
524 static void toggle_xing(GtkToggleButton * togglebutton, gpointer user_data) | |
525 { | |
526 | |
527 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(xing_header_toggle)) == TRUE) | |
528 toggle_xing_val = 0; | |
529 else | |
530 toggle_xing_val = 1; | |
531 | |
532 } | |
533 | |
534 static void toggle_original(GtkToggleButton * togglebutton, | |
535 gpointer user_data) | |
536 { | |
537 | |
538 if (gtk_toggle_button_get_active | |
539 (GTK_TOGGLE_BUTTON(tags_original_toggle)) == TRUE) | |
540 mark_original_val = 1; | |
541 else | |
542 mark_original_val = 0; | |
543 | |
544 } | |
545 | |
546 static void toggle_copyright(GtkToggleButton * togglebutton, | |
547 gpointer user_data) | |
548 { | |
549 | |
550 if (gtk_toggle_button_get_active | |
551 (GTK_TOGGLE_BUTTON(tags_copyright_toggle)) == TRUE) | |
552 mark_copyright_val = 1; | |
553 else | |
554 mark_copyright_val = 0; | |
555 | |
556 } | |
557 | |
558 static void force_v2_toggle(GtkToggleButton * togglebutton, | |
559 gpointer user_data) | |
560 { | |
561 | |
562 if (gtk_toggle_button_get_active | |
563 (GTK_TOGGLE_BUTTON(tags_force_id3v2_toggle)) == TRUE) { | |
564 force_v2_val = 1; | |
565 if (gtk_toggle_button_get_active | |
566 (GTK_TOGGLE_BUTTON(tags_only_v1_toggle)) == TRUE) { | |
567 inside = 1; | |
568 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
569 (tags_only_v1_toggle), FALSE); | |
570 only_v1_val = 0; | |
571 inside = 0; | |
572 } | |
573 } | |
574 else | |
575 force_v2_val = 0; | |
576 | |
577 } | |
578 | |
579 static void id3_only_version(GtkToggleButton * togglebutton, | |
580 gpointer user_data) | |
581 { | |
1044
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
1004
diff
changeset
|
582 if (!strcmp(user_data, "v1") && inside != 1) { |
984 | 583 if (gtk_toggle_button_get_active |
584 (GTK_TOGGLE_BUTTON(tags_only_v1_toggle)) == TRUE); | |
585 { | |
586 inside = 1; | |
587 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
588 (tags_only_v2_toggle), FALSE); | |
589 only_v1_val = 1; | |
590 only_v2_val = 0; | |
591 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
592 (tags_force_id3v2_toggle), FALSE); | |
593 inside = 0; | |
594 } | |
595 } | |
1044
b1128efde471
[svn] - get rid of all warnings gcc 4.2.0 emits with my build configuration.
yaz
parents:
1004
diff
changeset
|
596 else if (!strcmp(user_data, "v2") && inside != 1) { |
984 | 597 if (gtk_toggle_button_get_active |
598 (GTK_TOGGLE_BUTTON(tags_only_v2_toggle)) == TRUE); | |
599 { | |
600 inside = 1; | |
601 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
602 (tags_only_v1_toggle), FALSE); | |
603 only_v1_val = 0; | |
604 only_v2_val = 1; | |
605 inside = 0; | |
606 } | |
607 } | |
608 | |
609 } | |
610 | |
611 | |
612 | |
613 /* Save Configuration */ | |
614 | |
615 static void configure_ok_cb(gpointer data) | |
616 { | |
617 ConfigDb *db; | |
618 | |
619 if (vbr_min_val > vbr_max_val) | |
620 vbr_max_val = vbr_min_val; | |
621 | |
622 db = bmp_cfg_db_open(); | |
623 | |
624 bmp_cfg_db_set_int(db, "filewriter_mp3", "vbr_on", vbr_on); | |
625 bmp_cfg_db_set_int(db, "filewriter_mp3", "vbr_type", vbr_type); | |
626 bmp_cfg_db_set_int(db, "filewriter_mp3", "vbr_min_val", vbr_min_val); | |
627 bmp_cfg_db_set_int(db, "filewriter_mp3", "vbr_max_val", vbr_max_val); | |
628 bmp_cfg_db_set_int(db, "filewriter_mp3", "enforce_min_val", enforce_min_val); | |
629 bmp_cfg_db_set_int(db, "filewriter_mp3", "vbr_quality_val", vbr_quality_val); | |
630 bmp_cfg_db_set_int(db, "filewriter_mp3", "abr_val", abr_val); | |
631 bmp_cfg_db_set_int(db, "filewriter_mp3", "toggle_xing_val", toggle_xing_val); | |
632 bmp_cfg_db_set_int(db, "filewriter_mp3", "mark_original_val", | |
633 mark_original_val); | |
634 bmp_cfg_db_set_int(db, "filewriter_mp3", "mark_copyright_val", | |
635 mark_copyright_val); | |
636 bmp_cfg_db_set_int(db, "filewriter_mp3", "force_v2_val", force_v2_val); | |
637 bmp_cfg_db_set_int(db, "filewriter_mp3", "only_v1_val", only_v1_val); | |
638 bmp_cfg_db_set_int(db, "filewriter_mp3", "only_v2_val", only_v2_val); | |
639 bmp_cfg_db_set_int(db, "filewriter_mp3", "algo_quality_val", | |
640 algo_quality_val); | |
641 bmp_cfg_db_set_int(db, "filewriter_mp3", "out_samplerate_val", | |
642 out_samplerate_val); | |
643 bmp_cfg_db_set_int(db, "filewriter_mp3", "bitrate_val", bitrate_val); | |
644 bmp_cfg_db_set_float(db, "filewriter_mp3", "compression_val", | |
645 compression_val); | |
646 bmp_cfg_db_set_int(db, "filewriter_mp3", "enc_toggle_val", enc_toggle_val); | |
647 bmp_cfg_db_set_int(db, "filewriter_mp3", "audio_mode_val", audio_mode_val); | |
648 bmp_cfg_db_set_int(db, "filewriter_mp3", "auto_ms_val", auto_ms_val); | |
649 bmp_cfg_db_set_int(db, "filewriter_mp3", "enforce_iso_val", enforce_iso_val); | |
650 bmp_cfg_db_set_int(db, "filewriter_mp3", "error_protect_val", | |
651 error_protect_val); | |
652 bmp_cfg_db_close(db); | |
653 | |
654 | |
655 gtk_widget_destroy(configure_win); | |
656 } | |
657 | |
658 | |
659 /************************/ | |
660 /* Configuration Widget */ | |
661 /************************/ | |
662 | |
663 | |
664 static void mp3_configure(void) | |
665 { | |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
666 gint i; |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
667 |
984 | 668 if (!configure_win) { |
669 configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
670 | |
671 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy", | |
672 GTK_SIGNAL_FUNC(gtk_widget_destroyed), | |
673 &configure_win); | |
674 gtk_window_set_title(GTK_WINDOW(configure_win), | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
675 _("MP3 Configuration")); |
984 | 676 gtk_window_set_position(GTK_WINDOW(configure_win), |
677 GTK_WIN_POS_MOUSE); | |
678 gtk_window_set_policy(GTK_WINDOW(configure_win), FALSE, TRUE, | |
679 FALSE); | |
680 gtk_container_set_border_width(GTK_CONTAINER(configure_win), 5); | |
681 | |
682 vbox = gtk_vbox_new(FALSE, 5); | |
683 gtk_container_add(GTK_CONTAINER(configure_win), vbox); | |
684 | |
685 notebook = gtk_notebook_new(); | |
686 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); | |
687 | |
688 | |
689 /* Quality */ | |
690 | |
691 quality_vbox = gtk_vbox_new(FALSE, 5); | |
692 gtk_container_set_border_width(GTK_CONTAINER(quality_vbox), 5); | |
693 | |
694 quality_tips = gtk_tooltips_new(); | |
695 | |
696 quality_hbox1 = gtk_hbox_new(FALSE, 5); | |
697 gtk_box_pack_start(GTK_BOX(quality_vbox), quality_hbox1, FALSE, | |
698 FALSE, 0); | |
699 | |
700 /* Algorithm Quality */ | |
701 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
702 alg_quality_frame = gtk_frame_new(_("Algorithm Quality:")); |
984 | 703 gtk_container_set_border_width(GTK_CONTAINER(alg_quality_frame), |
704 5); | |
705 gtk_box_pack_start(GTK_BOX(quality_hbox1), alg_quality_frame, | |
706 FALSE, FALSE, 0); | |
707 | |
708 alg_quality_hbox = gtk_hbox_new(FALSE, 5); | |
709 gtk_container_set_border_width(GTK_CONTAINER(alg_quality_hbox), | |
710 10); | |
711 gtk_container_add(GTK_CONTAINER(alg_quality_frame), | |
712 alg_quality_hbox); | |
713 | |
714 alg_quality_adj = gtk_adjustment_new(5, 0, 9, 1, 1, 1); | |
715 alg_quality_spin = | |
716 gtk_spin_button_new(GTK_ADJUSTMENT(alg_quality_adj), 8, 0); | |
717 gtk_widget_set_usize(alg_quality_spin, 20, 28); | |
718 gtk_box_pack_start(GTK_BOX(alg_quality_hbox), alg_quality_spin, | |
719 TRUE, TRUE, 0); | |
720 gtk_signal_connect(GTK_OBJECT(alg_quality_adj), "value-changed", | |
721 GTK_SIGNAL_FUNC(algo_qual), NULL); | |
722 | |
723 gtk_tooltips_set_tip(GTK_TOOLTIPS(quality_tips), alg_quality_spin, | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
724 _("best/slowest:0;\nworst/fastest:9;\nrecommended:2;\ndefault:5;"), |
984 | 725 ""); |
726 | |
727 gtk_spin_button_set_value(GTK_SPIN_BUTTON(alg_quality_spin), | |
728 algo_quality_val); | |
729 | |
730 /* Output Samplerate */ | |
731 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
732 samplerate_frame = gtk_frame_new(_("Output Samplerate:")); |
984 | 733 gtk_container_set_border_width(GTK_CONTAINER(samplerate_frame), 5); |
734 gtk_box_pack_start(GTK_BOX(quality_hbox1), samplerate_frame, FALSE, | |
735 FALSE, 0); | |
736 | |
737 samplerate_hbox = gtk_hbox_new(TRUE, 5); | |
738 gtk_container_set_border_width(GTK_CONTAINER(samplerate_hbox), 10); | |
739 gtk_container_add(GTK_CONTAINER(samplerate_frame), | |
740 samplerate_hbox); | |
741 samplerate_option_menu = gtk_option_menu_new(); | |
742 samplerate_menu = gtk_menu_new(); | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
743 samplerate_menu_item = gtk_menu_item_new_with_label(_("Auto")); |
984 | 744 gtk_signal_connect(GTK_OBJECT(samplerate_menu_item), "activate", |
745 GTK_SIGNAL_FUNC(samplerate_activate), | |
746 GINT_TO_POINTER(0)); | |
747 gtk_menu_append(GTK_MENU(samplerate_menu), samplerate_menu_item); | |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
748 |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
749 for (i = 0; i < sizeof(available_samplerates)/sizeof(gint); i++) |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
750 { |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
751 gchar *string = g_strdup_printf("%d", available_samplerates[i]); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
752 samplerate_menu_item = gtk_menu_item_new_with_label(string); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
753 gtk_signal_connect(GTK_OBJECT(samplerate_menu_item), "activate", |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
754 GTK_SIGNAL_FUNC(samplerate_activate), |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
755 GINT_TO_POINTER(available_samplerates[i])); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
756 gtk_menu_append(GTK_MENU(samplerate_menu), samplerate_menu_item); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
757 g_free(string); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
758 } |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
759 |
984 | 760 gtk_option_menu_set_menu(GTK_OPTION_MENU(samplerate_option_menu), |
761 samplerate_menu); | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
762 gtk_widget_set_usize(samplerate_option_menu, 75, 28); |
984 | 763 gtk_box_pack_start(GTK_BOX(samplerate_hbox), |
764 samplerate_option_menu, FALSE, FALSE, 0); | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
765 samplerate_label = gtk_label_new(_("(Hz)")); |
984 | 766 gtk_misc_set_alignment(GTK_MISC(samplerate_label), 0, 0.5); |
767 gtk_box_pack_start(GTK_BOX(samplerate_hbox), samplerate_label, | |
768 FALSE, FALSE, 0); | |
769 | |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
770 for (i = 0; i < sizeof(available_samplerates)/sizeof(gint); i++) |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
771 if (out_samplerate_val == available_samplerates[i]) |
984 | 772 gtk_option_menu_set_history(GTK_OPTION_MENU |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
773 (samplerate_option_menu), i+1); |
984 | 774 |
775 /* Encoder Quality */ | |
776 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
777 enc_quality_frame = gtk_frame_new(_("Bitrate / Compression ratio:")); |
984 | 778 gtk_container_set_border_width(GTK_CONTAINER(enc_quality_frame), |
779 5); | |
780 gtk_box_pack_start(GTK_BOX(quality_vbox), enc_quality_frame, FALSE, | |
781 FALSE, 0); | |
782 | |
783 | |
784 /* yaz new code */ | |
785 // vbox sorrounding hbox1 and hbox2 | |
786 enc_quality_vbox = gtk_vbox_new(FALSE, 5); | |
787 gtk_container_set_border_width(GTK_CONTAINER(enc_quality_vbox), 10); | |
788 | |
789 // pack vbox to frame | |
790 gtk_container_add(GTK_CONTAINER(enc_quality_frame), enc_quality_vbox); | |
791 | |
792 // hbox1 for bitrate | |
793 hbox1 = gtk_hbox_new(FALSE, 5); | |
794 gtk_container_add(GTK_CONTAINER(enc_quality_vbox), hbox1); | |
795 | |
796 // radio 1 | |
797 enc_radio1 = gtk_radio_button_new(NULL); | |
798 if (enc_toggle_val == 0) | |
799 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enc_radio1), TRUE); | |
800 gtk_box_pack_start(GTK_BOX(hbox1), enc_radio1, FALSE, FALSE, 0); | |
801 | |
802 // label 1 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
803 enc_quality_label1 = gtk_label_new(_("Bitrate (kbps):")); |
984 | 804 gtk_box_pack_start(GTK_BOX(hbox1), enc_quality_label1, FALSE, FALSE, 0); |
805 | |
806 // bitrate menu | |
807 bitrate_option_menu = gtk_option_menu_new(); | |
808 bitrate_menu = gtk_menu_new(); | |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
809 |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
810 for (i = 0; i < sizeof(available_bitrates)/sizeof(gint); i++) |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
811 { |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
812 gchar *string = g_strdup_printf("%d", available_bitrates[i]); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
813 bitrate_menu_item = gtk_menu_item_new_with_label(string); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
814 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
815 GTK_SIGNAL_FUNC(bitrate_activate), |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
816 GINT_TO_POINTER(available_bitrates[i])); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
817 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
818 g_free(string); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
819 } |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
820 |
984 | 821 gtk_option_menu_set_menu(GTK_OPTION_MENU(bitrate_option_menu), |
822 bitrate_menu); | |
823 gtk_widget_set_usize(bitrate_option_menu, 80, 28); | |
824 gtk_box_pack_end(GTK_BOX(hbox1), bitrate_option_menu, FALSE, FALSE, 0); | |
825 | |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
826 for (i = 0; i < sizeof(available_bitrates)/sizeof(gint); i++) |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
827 if (bitrate_val == available_bitrates[i]) |
984 | 828 gtk_option_menu_set_history(GTK_OPTION_MENU |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
829 (bitrate_option_menu), i); |
984 | 830 |
831 // hbox2 for compression ratio | |
832 hbox2 = gtk_hbox_new(FALSE, 5); | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
833 gtk_container_add(GTK_CONTAINER(enc_quality_vbox), hbox2); |
984 | 834 |
835 // radio 2 | |
836 enc_radio2 = gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(enc_radio1)); | |
837 if (enc_toggle_val == 1) | |
838 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enc_radio2), | |
839 TRUE); | |
840 // pack radio 2 | |
841 gtk_box_pack_start(GTK_BOX(hbox2), enc_radio2, FALSE, FALSE, 0); | |
842 | |
843 // label | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
844 enc_quality_label2 = gtk_label_new(_("Compression ratio:")); |
984 | 845 gtk_box_pack_start(GTK_BOX(hbox2), enc_quality_label2, FALSE, FALSE, 0); |
846 | |
847 // comp-ratio spin | |
848 compression_adj = gtk_adjustment_new(11, 0, 100, 1, 1, 1); | |
849 compression_spin = | |
850 gtk_spin_button_new(GTK_ADJUSTMENT(compression_adj), 8, 0); | |
851 gtk_widget_set_usize(compression_spin, 40, 28); | |
852 gtk_container_add(GTK_CONTAINER(hbox2), compression_spin); | |
853 gtk_box_pack_end(GTK_BOX(hbox2), compression_spin, FALSE, FALSE, 0); | |
854 | |
855 gtk_signal_connect(GTK_OBJECT(compression_adj), "value-changed", | |
856 GTK_SIGNAL_FUNC(compression_change), NULL); | |
857 | |
858 gtk_spin_button_set_value(GTK_SPIN_BUTTON(compression_spin), | |
859 compression_val); | |
860 | |
861 // radio button signale connect | |
862 gtk_signal_connect(GTK_OBJECT(enc_radio1), "toggled", | |
863 GTK_SIGNAL_FUNC(encoding_toggle), | |
864 GINT_TO_POINTER(0)); | |
865 gtk_signal_connect(GTK_OBJECT(enc_radio2), "toggled", | |
866 GTK_SIGNAL_FUNC(encoding_toggle), | |
867 GINT_TO_POINTER(1)); | |
868 | |
869 /* end of yaz new code */ | |
870 | |
871 | |
872 /* Audio Mode */ | |
873 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
874 mode_frame = gtk_frame_new(_("Audio Mode:")); |
984 | 875 gtk_container_set_border_width(GTK_CONTAINER(mode_frame), 5); |
876 gtk_box_pack_start(GTK_BOX(quality_vbox), mode_frame, FALSE, FALSE, | |
877 0); | |
878 | |
879 mode_hbox = gtk_hbox_new(TRUE, 10); | |
880 gtk_container_set_border_width(GTK_CONTAINER(mode_hbox), 10); | |
881 gtk_container_add(GTK_CONTAINER(mode_frame), mode_hbox); | |
882 mode_option_menu = gtk_option_menu_new(); | |
883 mode_menu = gtk_menu_new(); | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
884 mode_menu_item = gtk_menu_item_new_with_label(_("Auto")); |
984 | 885 gtk_signal_connect(GTK_OBJECT(mode_menu_item), "activate", |
886 GTK_SIGNAL_FUNC(mode_activate), | |
887 GINT_TO_POINTER(4)); | |
888 gtk_menu_append(GTK_MENU(mode_menu), mode_menu_item); | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
889 mode_menu_item = gtk_menu_item_new_with_label(_("Joint-Stereo")); |
984 | 890 gtk_signal_connect(GTK_OBJECT(mode_menu_item), "activate", |
891 GTK_SIGNAL_FUNC(mode_activate), | |
892 GINT_TO_POINTER(1)); | |
893 gtk_menu_append(GTK_MENU(mode_menu), mode_menu_item); | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
894 mode_menu_item = gtk_menu_item_new_with_label(_("Stereo")); |
984 | 895 gtk_signal_connect(GTK_OBJECT(mode_menu_item), "activate", |
896 GTK_SIGNAL_FUNC(mode_activate), | |
897 GINT_TO_POINTER(0)); | |
898 gtk_menu_append(GTK_MENU(mode_menu), mode_menu_item); | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
899 mode_menu_item = gtk_menu_item_new_with_label(_("Mono")); |
984 | 900 gtk_signal_connect(GTK_OBJECT(mode_menu_item), "activate", |
901 GTK_SIGNAL_FUNC(mode_activate), | |
902 GINT_TO_POINTER(3)); | |
903 gtk_menu_append(GTK_MENU(mode_menu), mode_menu_item); | |
904 gtk_option_menu_set_menu(GTK_OPTION_MENU(mode_option_menu), | |
905 mode_menu); | |
906 gtk_widget_set_usize(mode_option_menu, 50, 28); | |
907 gtk_box_pack_start(GTK_BOX(mode_hbox), mode_option_menu, TRUE, | |
908 TRUE, 2); | |
909 | |
910 switch (audio_mode_val) { | |
911 | |
912 case 4: | |
913 gtk_option_menu_set_history(GTK_OPTION_MENU(mode_option_menu), | |
914 0); | |
915 break; | |
916 case 1: | |
917 gtk_option_menu_set_history(GTK_OPTION_MENU(mode_option_menu), | |
918 1); | |
919 break; | |
920 case 0: | |
921 gtk_option_menu_set_history(GTK_OPTION_MENU(mode_option_menu), | |
922 2); | |
923 break; | |
924 case 3: | |
925 gtk_option_menu_set_history(GTK_OPTION_MENU(mode_option_menu), | |
926 3); | |
927 break; | |
928 } | |
929 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
930 ms_mode_toggle = gtk_check_button_new_with_label(_("auto-M/S mode")); |
984 | 931 gtk_box_pack_start(GTK_BOX(mode_hbox), ms_mode_toggle, TRUE, TRUE, |
932 5); | |
933 gtk_signal_connect(GTK_OBJECT(ms_mode_toggle), "toggled", | |
934 GTK_SIGNAL_FUNC(toggle_auto_ms), NULL); | |
935 | |
936 if (auto_ms_val == 1) | |
937 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ms_mode_toggle), | |
938 TRUE); | |
939 | |
940 /* Misc */ | |
941 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
942 misc_frame = gtk_frame_new(_("Misc:")); |
984 | 943 gtk_container_set_border_width(GTK_CONTAINER(misc_frame), 5); |
944 gtk_box_pack_start(GTK_BOX(quality_vbox), misc_frame, FALSE, FALSE, | |
945 0); | |
946 | |
947 misc_vbox = gtk_vbox_new(TRUE, 5); | |
948 gtk_container_set_border_width(GTK_CONTAINER(misc_vbox), 5); | |
949 gtk_container_add(GTK_CONTAINER(misc_frame), misc_vbox); | |
950 | |
951 enforce_iso_toggle = | |
952 gtk_check_button_new_with_label | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
953 (_("Enforce strict ISO complience")); |
984 | 954 gtk_box_pack_start(GTK_BOX(misc_vbox), enforce_iso_toggle, TRUE, |
955 TRUE, 2); | |
956 gtk_signal_connect(GTK_OBJECT(enforce_iso_toggle), "toggled", | |
957 GTK_SIGNAL_FUNC(toggle_enforce_iso), NULL); | |
958 | |
959 if (enforce_iso_val == 1) | |
960 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
961 (enforce_iso_toggle), TRUE); | |
962 | |
963 error_protection_toggle = | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
964 gtk_check_button_new_with_label(_("Error protection")); |
984 | 965 gtk_box_pack_start(GTK_BOX(misc_vbox), error_protection_toggle, |
966 TRUE, TRUE, 2); | |
967 gtk_signal_connect(GTK_OBJECT(error_protection_toggle), "toggled", | |
968 GTK_SIGNAL_FUNC(toggle_error_protect), NULL); | |
969 | |
970 if (error_protect_val == 1) | |
971 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
972 (error_protection_toggle), TRUE); | |
973 | |
974 gtk_tooltips_set_tip(GTK_TOOLTIPS(quality_tips), | |
975 error_protection_toggle, | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
976 _("Adds 16 bit checksum to every frame"), ""); |
984 | 977 |
978 | |
979 /* Add the Notebook */ | |
980 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), quality_vbox, | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
981 gtk_label_new(_("Quality"))); |
984 | 982 |
983 | |
984 /* VBR/ABR */ | |
985 | |
986 vbr_vbox = gtk_vbox_new(FALSE, 5); | |
987 gtk_container_set_border_width(GTK_CONTAINER(vbr_vbox), 5); | |
988 | |
989 vbr_tips = gtk_tooltips_new(); | |
990 | |
991 /* Toggle VBR */ | |
992 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
993 vbr_toggle = gtk_check_button_new_with_label(_("Enable VBR/ABR")); |
984 | 994 gtk_widget_set_usize(vbr_toggle, 60, 30); |
995 gtk_box_pack_start(GTK_BOX(vbr_vbox), vbr_toggle, FALSE, FALSE, 2); | |
996 gtk_signal_connect(GTK_OBJECT(vbr_toggle), "toggled", | |
997 GTK_SIGNAL_FUNC(toggle_vbr), NULL); | |
998 | |
999 vbr_options_vbox = gtk_vbox_new(FALSE, 0); | |
1000 gtk_container_add(GTK_CONTAINER(vbr_vbox), vbr_options_vbox); | |
1001 gtk_widget_set_sensitive(vbr_options_vbox, FALSE); | |
1002 | |
1003 /* Choose VBR/ABR */ | |
1004 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1005 vbr_type_frame = gtk_frame_new(_("Type:")); |
984 | 1006 gtk_container_set_border_width(GTK_CONTAINER(vbr_type_frame), 5); |
1007 gtk_box_pack_start(GTK_BOX(vbr_options_vbox), vbr_type_frame, | |
1008 FALSE, FALSE, 2); | |
1009 | |
1010 vbr_type_hbox = gtk_hbox_new(FALSE, 5); | |
1011 gtk_container_set_border_width(GTK_CONTAINER(vbr_type_hbox), 5); | |
1012 gtk_container_add(GTK_CONTAINER(vbr_type_frame), vbr_type_hbox); | |
1013 | |
1014 vbr_type_radio1 = gtk_radio_button_new_with_label(NULL, "VBR"); | |
1015 gtk_tooltips_set_tip(GTK_TOOLTIPS(vbr_tips), vbr_type_radio1, | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1016 _("Variable bitrate"), ""); |
984 | 1017 gtk_box_pack_start(GTK_BOX(vbr_type_hbox), vbr_type_radio1, TRUE, |
1018 TRUE, 2); | |
1019 if (vbr_type == 0) | |
1020 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1021 (vbr_type_radio1), TRUE); | |
1022 | |
1023 vbr_type_radio2 = | |
1024 gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON | |
1025 (vbr_type_radio1), | |
1026 "ABR"); | |
1027 gtk_tooltips_set_tip(GTK_TOOLTIPS(vbr_tips), vbr_type_radio2, | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1028 _("Average bitrate"), ""); |
984 | 1029 gtk_box_pack_start(GTK_BOX(vbr_type_hbox), vbr_type_radio2, TRUE, |
1030 TRUE, 2); | |
1031 if (vbr_type == 1) | |
1032 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1033 (vbr_type_radio2), TRUE); | |
1034 | |
1035 gtk_signal_connect(GTK_OBJECT(vbr_type_radio1), "toggled", | |
1036 GTK_SIGNAL_FUNC(vbr_abr_toggle), "VBR"); | |
1037 gtk_signal_connect(GTK_OBJECT(vbr_type_radio2), "toggled", | |
1038 GTK_SIGNAL_FUNC(vbr_abr_toggle), "ABR"); | |
1039 | |
1040 /* VBR Options */ | |
1041 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1042 vbr_frame = gtk_frame_new(_("VBR Options:")); |
984 | 1043 gtk_container_set_border_width(GTK_CONTAINER(vbr_frame), 5); |
1044 gtk_box_pack_start(GTK_BOX(vbr_options_vbox), vbr_frame, FALSE, | |
1045 FALSE, 2); | |
1046 | |
1047 vbr_options_vbox2 = gtk_vbox_new(FALSE, 5); | |
1048 gtk_container_set_border_width(GTK_CONTAINER(vbr_options_vbox2), | |
1049 5); | |
1050 gtk_container_add(GTK_CONTAINER(vbr_frame), vbr_options_vbox2); | |
1051 | |
1052 vbr_options_hbox1 = gtk_hbox_new(FALSE, 5); | |
1053 gtk_container_set_border_width(GTK_CONTAINER(vbr_options_hbox1), | |
1054 5); | |
1055 gtk_container_add(GTK_CONTAINER(vbr_options_vbox2), | |
1056 vbr_options_hbox1); | |
1057 | |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1058 vbr_min_label = gtk_label_new(_("Minimum bitrate (kbps):")); |
984 | 1059 gtk_misc_set_alignment(GTK_MISC(vbr_min_label), 0, 0.5); |
1060 gtk_box_pack_start(GTK_BOX(vbr_options_hbox1), vbr_min_label, TRUE, | |
1061 TRUE, 0); | |
1062 | |
1063 vbr_min_option_menu = gtk_option_menu_new(); | |
1064 vbr_min_menu = gtk_menu_new(); | |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1065 |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1066 for (i = 0; i < sizeof(available_bitrates)/sizeof(gint); i++) |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1067 { |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1068 gchar *string = g_strdup_printf("%d", available_bitrates[i]); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1069 vbr_min_menu_item = gtk_menu_item_new_with_label(string); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1070 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1071 GTK_SIGNAL_FUNC(vbr_min_activate), |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1072 GINT_TO_POINTER(available_bitrates[i])); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1073 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1074 g_free(string); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1075 } |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1076 |
984 | 1077 gtk_option_menu_set_menu(GTK_OPTION_MENU(vbr_min_option_menu), |
1078 vbr_min_menu); | |
1079 gtk_widget_set_usize(vbr_min_option_menu, 40, 25); | |
1080 gtk_box_pack_start(GTK_BOX(vbr_options_hbox1), vbr_min_option_menu, | |
1081 TRUE, TRUE, 2); | |
1082 | |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1083 for (i = 0; i < sizeof(available_bitrates)/sizeof(gint); i++) |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1084 if (vbr_min_val == available_bitrates[i]) |
984 | 1085 gtk_option_menu_set_history(GTK_OPTION_MENU |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1086 (vbr_min_option_menu), i); |
984 | 1087 |
1088 vbr_options_hbox2 = gtk_hbox_new(FALSE, 5); | |
1089 gtk_container_set_border_width(GTK_CONTAINER(vbr_options_hbox2), | |
1090 5); | |
1091 gtk_container_add(GTK_CONTAINER(vbr_options_vbox2), | |
1092 vbr_options_hbox2); | |
1093 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1094 vbr_max_label = gtk_label_new(_("Maximum bitrate (kbps):")); |
984 | 1095 gtk_misc_set_alignment(GTK_MISC(vbr_max_label), 0, 0.5); |
1096 gtk_box_pack_start(GTK_BOX(vbr_options_hbox2), vbr_max_label, TRUE, | |
1097 TRUE, 0); | |
1098 | |
1099 vbr_max_option_menu = gtk_option_menu_new(); | |
1100 vbr_max_menu = gtk_menu_new(); | |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1101 |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1102 for (i = 0; i < sizeof(available_bitrates)/sizeof(gint); i++) |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1103 { |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1104 gchar *string = g_strdup_printf("%d", available_bitrates[i]); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1105 vbr_max_menu_item = gtk_menu_item_new_with_label(string); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1106 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1107 GTK_SIGNAL_FUNC(vbr_max_activate), |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1108 GINT_TO_POINTER(available_bitrates[i])); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1109 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1110 g_free(string); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1111 } |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1112 |
984 | 1113 gtk_option_menu_set_menu(GTK_OPTION_MENU(vbr_max_option_menu), |
1114 vbr_max_menu); | |
1115 gtk_widget_set_usize(vbr_max_option_menu, 40, 25); | |
1116 gtk_box_pack_start(GTK_BOX(vbr_options_hbox2), vbr_max_option_menu, | |
1117 TRUE, TRUE, 2); | |
1118 | |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1119 for (i = 0; i < sizeof(available_bitrates)/sizeof(gint); i++) |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1120 if (vbr_max_val == available_bitrates[i]) |
984 | 1121 gtk_option_menu_set_history(GTK_OPTION_MENU |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1122 (vbr_max_option_menu), i); |
984 | 1123 |
1124 enforce_min_toggle = | |
1125 gtk_check_button_new_with_label | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1126 (_("Strictly enforce minimum bitrate")); |
984 | 1127 gtk_tooltips_set_tip(GTK_TOOLTIPS(vbr_tips), enforce_min_toggle, |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1128 _("For use with players that do not support low bitrate mp3 (Apex AD600-A DVD/mp3 player)"), |
984 | 1129 ""); |
1130 gtk_box_pack_start(GTK_BOX(vbr_options_vbox2), enforce_min_toggle, | |
1131 FALSE, FALSE, 2); | |
1132 gtk_signal_connect(GTK_OBJECT(enforce_min_toggle), "toggled", | |
1133 GTK_SIGNAL_FUNC(toggle_enforce_min), NULL); | |
1134 | |
1135 if (enforce_min_val == 1) | |
1136 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1137 (enforce_min_toggle), TRUE); | |
1138 | |
1139 /* ABR Options */ | |
1140 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1141 abr_frame = gtk_frame_new(_("ABR Options:")); |
984 | 1142 gtk_container_set_border_width(GTK_CONTAINER(abr_frame), 5); |
1143 gtk_box_pack_start(GTK_BOX(vbr_options_vbox), abr_frame, FALSE, | |
1144 FALSE, 2); | |
1145 gtk_widget_set_sensitive(abr_frame, FALSE); | |
1146 | |
1147 abr_hbox = gtk_hbox_new(FALSE, 5); | |
1148 gtk_container_set_border_width(GTK_CONTAINER(abr_hbox), 5); | |
1149 gtk_container_add(GTK_CONTAINER(abr_frame), abr_hbox); | |
1150 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1151 abr_label = gtk_label_new(_("Average bitrate (kbps):")); |
984 | 1152 gtk_misc_set_alignment(GTK_MISC(abr_label), 0, 0.5); |
1153 gtk_box_pack_start(GTK_BOX(abr_hbox), abr_label, TRUE, TRUE, 0); | |
1154 | |
1155 abr_option_menu = gtk_option_menu_new(); | |
1156 abr_menu = gtk_menu_new(); | |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1157 |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1158 for (i = 0; i < sizeof(available_bitrates)/sizeof(gint); i++) |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1159 { |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1160 gchar *string = g_strdup_printf("%d", available_bitrates[i]); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1161 abr_menu_item = gtk_menu_item_new_with_label(string); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1162 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1163 GTK_SIGNAL_FUNC(abr_activate), |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1164 GINT_TO_POINTER(available_bitrates[i])); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1165 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1166 g_free(string); |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1167 } |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1168 |
984 | 1169 gtk_option_menu_set_menu(GTK_OPTION_MENU(abr_option_menu), |
1170 abr_menu); | |
1171 gtk_widget_set_usize(abr_option_menu, 40, 25); | |
1172 gtk_box_pack_start(GTK_BOX(abr_hbox), abr_option_menu, TRUE, TRUE, | |
1173 2); | |
1174 | |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1175 for (i = 0; i < sizeof(available_bitrates)/sizeof(gint); i++) |
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1176 if (abr_val == available_bitrates[i]) |
984 | 1177 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), |
1525
bee9eaedefa5
- made the MP3 FileWriter output plugin less braindead
mf0102 <0102@gmx.at>
parents:
1441
diff
changeset
|
1178 i); |
984 | 1179 |
1180 /* Quality Level */ | |
1181 | |
1182 vbr_options_hbox3 = gtk_hbox_new(FALSE, 5); | |
1183 gtk_container_set_border_width(GTK_CONTAINER(vbr_options_hbox3), | |
1184 5); | |
1185 gtk_container_add(GTK_CONTAINER(vbr_options_vbox), | |
1186 vbr_options_hbox3); | |
1187 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1188 vbr_quality_label = gtk_label_new(_("VBR quality level:")); |
984 | 1189 gtk_misc_set_alignment(GTK_MISC(vbr_quality_label), 0, 0.5); |
1190 gtk_box_pack_start(GTK_BOX(vbr_options_hbox3), vbr_quality_label, | |
1191 TRUE, TRUE, 0); | |
1192 | |
1193 vbr_quality_adj = gtk_adjustment_new(4, 0, 9, 1, 1, 1); | |
1194 vbr_quality_spin = | |
1195 gtk_spin_button_new(GTK_ADJUSTMENT(vbr_quality_adj), 8, 0); | |
1196 gtk_widget_set_usize(vbr_quality_spin, 20, -1); | |
1197 gtk_box_pack_start(GTK_BOX(vbr_options_hbox3), vbr_quality_spin, | |
1198 TRUE, TRUE, 0); | |
1199 gtk_signal_connect(GTK_OBJECT(vbr_quality_adj), "value-changed", | |
1200 GTK_SIGNAL_FUNC(vbr_qual), NULL); | |
1201 | |
1202 gtk_tooltips_set_tip(GTK_TOOLTIPS(vbr_tips), vbr_quality_spin, | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1203 _("highest:0;\nlowest:9;\ndefault:4;"), ""); |
984 | 1204 |
1205 gtk_spin_button_set_value(GTK_SPIN_BUTTON(vbr_quality_spin), | |
1206 vbr_quality_val); | |
1207 | |
1208 /* Xing Header */ | |
1209 | |
1210 xing_header_toggle = | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1211 gtk_check_button_new_with_label(_("Don't write Xing VBR header")); |
984 | 1212 gtk_box_pack_start(GTK_BOX(vbr_options_vbox), xing_header_toggle, |
1213 FALSE, FALSE, 2); | |
1214 gtk_signal_connect(GTK_OBJECT(xing_header_toggle), "toggled", | |
1215 GTK_SIGNAL_FUNC(toggle_xing), NULL); | |
1216 | |
1217 if (toggle_xing_val == 0) | |
1218 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1219 (xing_header_toggle), TRUE); | |
1220 | |
1221 | |
1222 | |
1223 /* Add the Notebook */ | |
1224 | |
1225 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbr_vbox, | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1226 gtk_label_new(_("VBR/ABR"))); |
984 | 1227 |
1228 | |
1229 /* Tags */ | |
1230 | |
1231 tags_vbox = gtk_vbox_new(FALSE, 5); | |
1232 gtk_container_set_border_width(GTK_CONTAINER(tags_vbox), 5); | |
1233 | |
1234 tags_tips = gtk_tooltips_new(); | |
1235 | |
1236 /* Frame Params */ | |
1237 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1238 tags_frames_frame = gtk_frame_new(_("Frame params:")); |
984 | 1239 gtk_container_set_border_width(GTK_CONTAINER(tags_frames_frame), |
1240 5); | |
1241 gtk_box_pack_start(GTK_BOX(tags_vbox), tags_frames_frame, FALSE, | |
1242 FALSE, 2); | |
1243 | |
1244 tags_frames_hbox = gtk_hbox_new(FALSE, 5); | |
1245 gtk_container_set_border_width(GTK_CONTAINER(tags_frames_hbox), 5); | |
1246 gtk_container_add(GTK_CONTAINER(tags_frames_frame), | |
1247 tags_frames_hbox); | |
1248 | |
1249 tags_copyright_toggle = | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1250 gtk_check_button_new_with_label(_("Mark as copyright")); |
984 | 1251 gtk_box_pack_start(GTK_BOX(tags_frames_hbox), |
1252 tags_copyright_toggle, FALSE, FALSE, 2); | |
1253 gtk_signal_connect(GTK_OBJECT(tags_copyright_toggle), "toggled", | |
1254 GTK_SIGNAL_FUNC(toggle_copyright), NULL); | |
1255 | |
1256 if (mark_copyright_val == 1) | |
1257 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1258 (tags_copyright_toggle), TRUE); | |
1259 | |
1260 tags_original_toggle = | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1261 gtk_check_button_new_with_label(_("Mark as original")); |
984 | 1262 gtk_box_pack_start(GTK_BOX(tags_frames_hbox), tags_original_toggle, |
1263 FALSE, FALSE, 2); | |
1264 gtk_signal_connect(GTK_OBJECT(tags_original_toggle), "toggled", | |
1265 GTK_SIGNAL_FUNC(toggle_original), NULL); | |
1266 | |
1267 if (mark_original_val == 1) | |
1268 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1269 (tags_original_toggle), TRUE); | |
1270 | |
1271 /* ID3 Params */ | |
1272 | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1273 tags_id3_frame = gtk_frame_new(_("ID3 params:")); |
984 | 1274 gtk_container_set_border_width(GTK_CONTAINER(tags_id3_frame), 5); |
1275 gtk_box_pack_start(GTK_BOX(tags_vbox), tags_id3_frame, FALSE, | |
1276 FALSE, 2); | |
1277 | |
1278 tags_id3_vbox = gtk_vbox_new(FALSE, 5); | |
1279 gtk_container_set_border_width(GTK_CONTAINER(tags_id3_vbox), 5); | |
1280 gtk_container_add(GTK_CONTAINER(tags_id3_frame), tags_id3_vbox); | |
1281 | |
1282 tags_force_id3v2_toggle = | |
1283 gtk_check_button_new_with_label | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1284 (_("Force addition of version 2 tag")); |
984 | 1285 gtk_box_pack_start(GTK_BOX(tags_id3_vbox), tags_force_id3v2_toggle, |
1286 FALSE, FALSE, 2); | |
1287 gtk_signal_connect(GTK_OBJECT(tags_force_id3v2_toggle), "toggled", | |
1288 GTK_SIGNAL_FUNC(force_v2_toggle), NULL); | |
1289 | |
1290 tags_id3_hbox = gtk_hbox_new(FALSE, 5); | |
1291 gtk_container_add(GTK_CONTAINER(tags_id3_vbox), tags_id3_hbox); | |
1292 | |
1293 tags_only_v1_toggle = | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1294 gtk_check_button_new_with_label(_("Only add v1 tag")); |
984 | 1295 gtk_box_pack_start(GTK_BOX(tags_id3_hbox), tags_only_v1_toggle, |
1296 FALSE, FALSE, 2); | |
1297 gtk_signal_connect(GTK_OBJECT(tags_only_v1_toggle), "toggled", | |
1298 GTK_SIGNAL_FUNC(id3_only_version), "v1"); | |
1299 | |
1300 tags_only_v2_toggle = | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1301 gtk_check_button_new_with_label(_("Only add v2 tag")); |
984 | 1302 gtk_box_pack_start(GTK_BOX(tags_id3_hbox), tags_only_v2_toggle, |
1303 FALSE, FALSE, 2); | |
1304 gtk_signal_connect(GTK_OBJECT(tags_only_v2_toggle), "toggled", | |
1305 GTK_SIGNAL_FUNC(id3_only_version), "v2"); | |
1306 | |
1307 if (force_v2_val == 1) | |
1308 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1309 (tags_force_id3v2_toggle), TRUE); | |
1310 | |
1311 if (only_v1_val == 1) | |
1312 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1313 (tags_only_v1_toggle), TRUE); | |
1314 | |
1315 if (only_v2_val == 1) | |
1316 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1317 (tags_only_v2_toggle), TRUE); | |
1318 | |
1319 /* Add the Notebook */ | |
1320 | |
1321 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tags_vbox, | |
1298
94eee8a16189
The "i18n" saga is still going on...
Stany HENRY <StrassBoy@gmail.com>
parents:
1197
diff
changeset
|
1322 gtk_label_new(_("Tags"))); |
984 | 1323 |
1324 | |
1325 | |
1326 | |
1327 /* The Rest */ | |
1328 | |
1329 /* Buttons */ | |
1330 | |
1331 configure_bbox = gtk_hbutton_box_new(); | |
1332 gtk_button_box_set_layout(GTK_BUTTON_BOX(configure_bbox), | |
1333 GTK_BUTTONBOX_END); | |
1334 gtk_button_box_set_spacing(GTK_BUTTON_BOX(configure_bbox), 5); | |
1335 gtk_box_pack_start(GTK_BOX(vbox), configure_bbox, FALSE, FALSE, 0); | |
1336 | |
985 | 1337 configure_cancel = gtk_button_new_from_stock(GTK_STOCK_CANCEL); |
1338 gtk_signal_connect_object(GTK_OBJECT(configure_cancel), "clicked", | |
1339 GTK_SIGNAL_FUNC(gtk_widget_destroy), | |
1340 GTK_OBJECT(configure_win)); | |
1341 GTK_WIDGET_SET_FLAGS(configure_cancel, GTK_CAN_DEFAULT); | |
1342 gtk_box_pack_start(GTK_BOX(configure_bbox), configure_cancel, TRUE, | |
1343 TRUE, 0); | |
1344 | |
1345 configure_ok = gtk_button_new_from_stock(GTK_STOCK_OK); | |
984 | 1346 gtk_signal_connect(GTK_OBJECT(configure_ok), "clicked", |
1347 GTK_SIGNAL_FUNC(configure_ok_cb), NULL); | |
1348 GTK_WIDGET_SET_FLAGS(configure_ok, GTK_CAN_DEFAULT); | |
1349 gtk_box_pack_start(GTK_BOX(configure_bbox), configure_ok, TRUE, | |
1350 TRUE, 0); | |
1351 gtk_widget_show(configure_ok); | |
1352 gtk_widget_grab_default(configure_ok); | |
1353 | |
1354 /* Set States */ | |
1355 | |
1356 if (vbr_on == 1) | |
1357 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vbr_toggle), | |
1358 TRUE); | |
1359 else | |
1360 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vbr_toggle), | |
1361 FALSE); | |
1362 | |
1363 /* Show it! */ | |
1364 | |
1365 gtk_widget_show_all(configure_win); | |
1366 | |
1367 } | |
1368 } | |
1197
616928ec054d
Add #ifdef FILEWRITER_MP3 to filewriter/mp3.c
Jonathan Schleifer <js@h3c.de>
parents:
1044
diff
changeset
|
1369 |
616928ec054d
Add #ifdef FILEWRITER_MP3 to filewriter/mp3.c
Jonathan Schleifer <js@h3c.de>
parents:
1044
diff
changeset
|
1370 #endif |