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