Mercurial > audlegacy-plugins
annotate src/lame/out_lame.c @ 670:c92018172bfb trunk
[svn] - don't crash on startup by passing NULL to opendir(2)
author | nenolod |
---|---|
date | Sun, 18 Feb 2007 03:38:05 -0800 |
parents | 622c63a5c191 |
children | b006af49413e |
rev | line source |
---|---|
668 | 1 /* Out_Lame-Plugin |
2 * (C) copyright 2002 Lars Siebold <khandha5@gmx.net> | |
3 * (C) copyright 2006-2007 porting to audacious by Yoshiki Yazawa <yaz@cc.rim.or.jp> | |
4 * | |
5 * Based on the diskwriter-plugin of XMMS. | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
20 */ | |
21 | |
22 #include <gtk/gtk.h> | |
23 #include <stdio.h> | |
24 #include <string.h> | |
25 #include <dirent.h> | |
26 | |
27 #include <audacious/plugin.h> | |
28 #include <audacious/beepctrl.h> | |
29 #include <audacious/dirbrowser.h> | |
30 #include <audacious/configdb.h> | |
31 #include <audacious/util.h> | |
32 | |
33 #include <lame/lame.h> | |
34 | |
35 #define ENCBUFFER_SIZE 35000 | |
36 #define OUT_LAME_VER "0.2d6" | |
37 #define DEBUG 1 | |
38 #undef DEBUG | |
39 | |
40 GtkWidget *configure_win = NULL, *path_vbox; | |
41 GtkWidget *path_hbox, *path_label, *path_entry, *path_browse, | |
42 *path_dirbrowser = NULL; | |
43 GtkWidget *configure_separator; | |
44 GtkWidget *configure_bbox, *configure_ok, *configure_cancel; | |
45 GtkWidget *alg_quality_spin; | |
46 GtkWidget *alg_quality_label, *alg_quality_hbox; | |
47 GtkObject *alg_quality_adj; | |
48 GtkWidget *vbox, *notebook; | |
49 GtkWidget *quality_vbox, *quality_hbox1, *alg_quality_frame; | |
50 GtkWidget *enc_quality_frame, *enc_quality_vbox1, *enc_quality_vbox2, | |
51 *enc_quality_hbox, *enc_quality_label1, *enc_quality_label2; | |
52 GtkWidget *enc_radio1, *enc_radio2, *bitrate_option_menu, *bitrate_menu, | |
53 *bitrate_menu_item, *kbps_label; | |
54 GtkWidget *compression_spin, *compression_label; | |
55 GtkObject *compression_adj; | |
56 GtkWidget *mode_hbox, *mode_option_menu, *mode_menu, *mode_label, | |
57 *mode_frame, *mode_menu_item, *ms_mode_toggle, *use_source_file_path, *prepend_track_number; | |
58 GtkWidget *samplerate_hbox, *samplerate_option_menu, *samplerate_menu, | |
59 *samplerate_label, *samplerate_frame, *samplerate_menu_item; | |
60 GtkWidget *misc_frame, *misc_vbox, *enforce_iso_toggle, | |
61 *error_protection_toggle; | |
62 GtkTooltips *quality_tips, *vbr_tips, *tags_tips; | |
63 GtkWidget *vbr_vbox, *vbr_toggle, *vbr_options_vbox, *vbr_type_frame, | |
64 *vbr_type_hbox, *vbr_type_radio1, *vbr_type_radio2; | |
65 GtkWidget *abr_frame, *abr_option_menu, *abr_menu, *abr_menu_item, | |
66 *abr_hbox, *abr_label; | |
67 GtkWidget *vbr_frame, *vbr_options_vbox2; | |
68 GtkWidget *vbr_options_hbox1, *vbr_min_option_menu, *vbr_min_menu, | |
69 *vbr_min_menu_item, *vbr_min_label; | |
70 GtkWidget *vbr_options_hbox2, *vbr_max_option_menu, *vbr_max_menu, | |
71 *vbr_max_menu_item, *vbr_max_label, *enforce_min_toggle; | |
72 GtkWidget *vbr_options_hbox3, *vbr_quality_spin, *vbr_quality_label; | |
73 GtkObject *vbr_quality_adj; | |
74 GtkWidget *xing_header_toggle; | |
75 GtkWidget *tags_vbox, *tags_frames_frame, *tags_frames_hbox, | |
76 *tags_copyright_toggle, *tags_original_toggle; | |
77 GtkWidget *tags_id3_frame, *tags_id3_vbox, *tags_id3_hbox, | |
78 *tags_force_id3v2_toggle, *tags_only_v1_toggle, *tags_only_v2_toggle; | |
79 | |
80 GtkWidget *enc_quality_vbox, *hbox1, *hbox2; | |
81 | |
82 // will be used in flushing | |
83 AFormat oldfmt; | |
84 gint oldrate, oldnch; | |
85 | |
86 static gchar *file_path = NULL; | |
87 static FILE *output_file = NULL; | |
88 static guint64 written = 0; | |
89 static guint64 olen = 0; | |
90 static AFormat afmt; | |
91 gint ctrlsocket_get_session_id(void); | |
92 | |
93 static guint64 offset = 0; | |
94 | |
95 int inside; | |
96 static gint vbr_on = 0; | |
97 static gint vbr_type = 0; | |
98 static gint vbr_min_val = 32; | |
99 static gint vbr_max_val = 320; | |
100 static gint enforce_min_val = 0; | |
101 static gint vbr_quality_val = 4; | |
102 static gint abr_val = 128; | |
103 static gint toggle_xing_val = 1; | |
104 static gint mark_original_val = 1; | |
105 static gint mark_copyright_val = 0; | |
106 static gint force_v2_val = 0; | |
107 static gint only_v1_val = 0; | |
108 static gint only_v2_val = 0; | |
109 static gint algo_quality_val = 5; | |
110 static gint out_samplerate_val = 0; | |
111 static gint bitrate_val = 128; | |
112 static gfloat compression_val = 11; | |
113 static gint enc_toggle_val = 0; | |
114 static gint audio_mode_val = 4; | |
115 static gint auto_ms_val = 0; | |
116 static gint enforce_iso_val = 0; | |
117 static gint error_protect_val = 0; | |
118 static gint srate; | |
119 static gint inch; | |
120 static gint b_use_source_file_path = 0; | |
121 static gint b_prepend_track_number = 0; | |
122 | |
123 // for id3 tag | |
124 static TitleInput *tuple = NULL; | |
125 extern TitleInput *input_get_song_tuple(const gchar * filename); | |
126 | |
127 typedef struct { | |
128 gchar *track_name; | |
129 gchar *album_name; | |
130 gchar *performer; | |
131 gchar *genre; | |
132 gchar *year; | |
133 gchar *track_number; | |
134 } lameid3_t; | |
135 | |
136 lameid3_t lameid3; | |
137 | |
138 static void outlame_init(void); | |
139 static void outlame_about(void); | |
140 static gint outlame_open(AFormat fmt, gint rate, gint nch); | |
141 static void outlame_write(void *ptr, gint length); | |
142 static void outlame_close(void); | |
143 static void outlame_flush(gint time); | |
144 static void outlame_pause(short p); | |
145 static gint outlame_free(void); | |
146 static gint outlame_playing(void); | |
147 static gint outlame_get_written_time(void); | |
148 static gint outlame_get_output_time(void); | |
149 static void outlame_configure(void); | |
150 | |
151 lame_global_flags *gfp; | |
152 int lame_init_return; | |
153 int encout; | |
154 static unsigned char encbuffer[ENCBUFFER_SIZE]; | |
155 | |
156 OutputPlugin outlame_op = { | |
157 NULL, | |
158 NULL, | |
159 NULL, /* Description */ | |
160 outlame_init, | |
161 NULL, | |
162 outlame_about, | |
163 outlame_configure, | |
164 NULL, /* get_volume */ | |
165 NULL, /* set_volume */ | |
166 outlame_open, | |
167 outlame_write, | |
168 outlame_close, | |
169 outlame_flush, | |
170 outlame_pause, | |
171 outlame_free, | |
172 outlame_playing, | |
173 outlame_get_output_time, | |
174 outlame_get_written_time, | |
175 NULL | |
176 }; | |
177 | |
178 void free_lameid3(lameid3_t *p) | |
179 { | |
180 g_free(p->track_name); | |
181 g_free(p->album_name); | |
182 g_free(p->performer); | |
183 g_free(p->genre); | |
184 g_free(p->year); | |
185 g_free(p->track_number); | |
186 | |
187 p->track_name = NULL; | |
188 p->album_name = NULL; | |
189 p->performer = NULL; | |
190 p->genre = NULL; | |
191 p->year = NULL; | |
192 p->track_number = NULL; | |
193 | |
194 }; | |
195 | |
196 | |
197 OutputPlugin *get_oplugin_info(void) | |
198 { | |
199 outlame_op.description = g_strdup_printf("Out-Lame %s", OUT_LAME_VER); | |
200 return &outlame_op; | |
201 } | |
202 | |
203 static void lame_debugf(const char *format, va_list ap) | |
204 { | |
205 (void) vfprintf(stdout, format, ap); | |
206 } | |
207 | |
208 static void outlame_init(void) | |
209 { | |
210 ConfigDb *db; | |
211 | |
212 db = bmp_cfg_db_open(); | |
213 | |
214 bmp_cfg_db_get_string(db, "out_lame", "file_path", &file_path); | |
215 #ifdef DEBUG | |
216 printf("fle_path = %s\n", file_path); | |
217 #endif | |
218 //validate the path | |
670
c92018172bfb
[svn] - don't crash on startup by passing NULL to opendir(2)
nenolod
parents:
668
diff
changeset
|
219 if(file_path != NULL && opendir(file_path) == NULL) { //error |
668 | 220 #ifdef DEBUG |
221 printf("file_path freed\n"); | |
222 #endif | |
223 g_free(file_path); | |
224 file_path = NULL; | |
225 } | |
226 | |
227 bmp_cfg_db_get_int(db, "out_lame", "use_source_file_path", | |
228 &b_use_source_file_path); | |
229 bmp_cfg_db_get_int(db, "out_lame", "vbr_on", &vbr_on); | |
230 bmp_cfg_db_get_int(db, "out_lame", "vbr_type", &vbr_type); | |
231 bmp_cfg_db_get_int(db, "out_lame", "vbr_min_val", &vbr_min_val); | |
232 bmp_cfg_db_get_int(db, "out_lame", "vbr_max_val", &vbr_max_val); | |
233 bmp_cfg_db_get_int(db, "out_lame", "enforce_min_val", | |
234 &enforce_min_val); | |
235 bmp_cfg_db_get_int(db, "out_lame", "vbr_quality_val", | |
236 &vbr_quality_val); | |
237 bmp_cfg_db_get_int(db, "out_lame", "abr_val", &abr_val); | |
238 bmp_cfg_db_get_int(db, "out_lame", "toggle_xing_val", | |
239 &toggle_xing_val); | |
240 bmp_cfg_db_get_int(db, "out_lame", "mark_original_val", | |
241 &mark_original_val); | |
242 bmp_cfg_db_get_int(db, "out_lame", "mark_copyright_val", | |
243 &mark_copyright_val); | |
244 bmp_cfg_db_get_int(db, "out_lame", "force_v2_val", &force_v2_val); | |
245 bmp_cfg_db_get_int(db, "out_lame", "only_v1_val", &only_v1_val); | |
246 bmp_cfg_db_get_int(db, "out_lame", "only_v2_val", &only_v2_val); | |
247 bmp_cfg_db_get_int(db, "out_lame", "algo_quality_val", | |
248 &algo_quality_val); | |
249 bmp_cfg_db_get_int(db, "out_lame", "out_samplerate_val", | |
250 &out_samplerate_val); | |
251 bmp_cfg_db_get_int(db, "out_lame", "bitrate_val", &bitrate_val); | |
252 bmp_cfg_db_get_float(db, "out_lame", "compression_val", | |
253 &compression_val); | |
254 bmp_cfg_db_get_int(db, "out_lame", "enc_toggle_val", &enc_toggle_val); | |
255 bmp_cfg_db_get_int(db, "out_lame", "audio_mode_val", &audio_mode_val); | |
256 bmp_cfg_db_get_int(db, "out_lame", "auto_ms_val", &auto_ms_val); | |
257 bmp_cfg_db_get_int(db, "out_lame", "enforce_iso_val", | |
258 &enforce_iso_val); | |
259 bmp_cfg_db_get_int(db, "out_lame", "error_protect_val", | |
260 &error_protect_val); | |
261 bmp_cfg_db_get_int(db, "out_lame", "prepend_track_number", | |
262 &b_prepend_track_number); | |
263 | |
264 bmp_cfg_db_close(db); | |
265 | |
266 if (!file_path) | |
267 file_path = g_strdup(g_get_home_dir()); | |
268 | |
269 } | |
270 | |
271 | |
272 void outlame_about(void) | |
273 { | |
274 static GtkWidget *dialog; | |
275 | |
276 if (dialog != NULL) | |
277 return; | |
278 | |
279 dialog = xmms_show_message("About Lame-Output-Plugin", | |
280 "Lame-Output-Plugin\n\n " | |
281 "This program is free software; you can redistribute it and/or modify\n" | |
282 "it under the terms of the GNU General Public License as published by\n" | |
283 "the Free Software Foundation; either version 2 of the License, or\n" | |
284 "(at your option) any later version.\n" | |
285 "\n" | |
286 "This program is distributed in the hope that it will be useful,\n" | |
287 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" | |
288 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" | |
289 "GNU General Public License for more details.\n" | |
290 "\n" | |
291 "You should have received a copy of the GNU General Public License\n" | |
292 "along with this program; if not, write to the Free Software\n" | |
293 "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,\n" | |
294 "USA.", "Ok", FALSE, NULL, NULL); | |
295 gtk_signal_connect(GTK_OBJECT(dialog), "destroy", | |
296 GTK_SIGNAL_FUNC(gtk_widget_destroyed), &dialog); | |
297 } | |
298 | |
299 | |
300 static gint outlame_open(AFormat fmt, gint rate, gint nch) | |
301 { | |
302 | |
303 gchar *filename, *title = NULL, *temp; | |
304 gint pos; | |
305 int b_use_path_anyway = 0; | |
306 gchar *tmpfilename = NULL; | |
307 gchar *tmp = NULL; | |
308 | |
309 /* store open paramators for reopen */ | |
310 oldfmt = fmt; oldrate = rate; oldnch = nch; | |
311 | |
312 /* So all the values will be reset to the ones saved */ | |
313 /* Easier than to implement a tmp variable for every value */ | |
314 outlame_init(); | |
315 | |
316 written = 0; | |
317 afmt = fmt; | |
318 | |
319 if (xmms_check_realtime_priority()) { | |
320 xmms_show_message("Error", | |
321 "You cannot use the Lame-Output plugin\n" | |
322 "when you're running in realtime mode.", | |
323 "Ok", FALSE, NULL, NULL); | |
324 return 0; | |
325 } | |
326 | |
327 pos = xmms_remote_get_playlist_pos(ctrlsocket_get_session_id()); | |
328 | |
329 if (title == NULL || strlen(g_basename(title)) == 0) { | |
330 gchar *utf8 = NULL; | |
331 g_free(title); | |
332 /* No filename, lets try title instead */ | |
333 utf8 = xmms_remote_get_playlist_title(ctrlsocket_get_session_id(), pos); | |
334 g_strchomp(utf8); //chop trailing ^J --yaz | |
335 | |
336 title = g_locale_from_utf8(utf8, -1, NULL, NULL, NULL); | |
337 g_free(utf8); | |
338 while (title != NULL && (temp = strchr(title, '/')) != NULL) | |
339 *temp = '-'; | |
340 | |
341 if (title == NULL || strlen(g_basename(title)) == 0) { | |
342 g_free(title); | |
343 /* No title either. Just set it to something. */ | |
344 title = g_strdup_printf("aud-%d", pos); | |
345 } | |
346 } | |
347 /* That's a stream, save it to the default path anyway ... */ | |
348 if (strstr(title, "//") != NULL) | |
349 b_use_path_anyway = 1; | |
350 | |
351 | |
352 // get file_path from tuple and regrad as the destination path. | |
353 tmpfilename = xmms_remote_get_playlist_file(ctrlsocket_get_session_id(), pos); | |
354 tuple = input_get_song_tuple(tmpfilename); | |
355 g_free(tmpfilename); | |
356 | |
357 | |
358 #ifdef DEBUG | |
359 if(tuple) { | |
360 printf("tuple->file_path = %s\n", tuple->file_path); | |
361 printf("tuple->track_number = %d\n", tuple->track_number); | |
362 } | |
363 printf("file_path = %s\n", file_path); | |
364 printf("anyway = %d\n", b_use_path_anyway); | |
365 #endif | |
366 | |
367 // if (tuple && b_use_source_file_path == 1 && b_use_path_anyway == 0) { | |
368 if (tuple && !b_use_path_anyway) { | |
369 if (b_prepend_track_number && tuple->track_number) { | |
370 filename = g_strdup_printf("%s/%.02d %s.mp3", | |
371 b_use_source_file_path ? tuple->file_path : file_path, | |
372 tuple->track_number, title); | |
373 } | |
374 else { | |
375 filename = g_strdup_printf("%s/%s.mp3", | |
376 b_use_source_file_path ? tuple->file_path : file_path, title); | |
377 } | |
378 } | |
379 else { // no tuple || b_use_path_anyway | |
380 filename = g_strdup_printf("%s/%s.mp3", file_path, g_basename(title)); | |
381 g_free(title); | |
382 } | |
383 | |
384 #ifdef DEBUG | |
385 printf("filename = %s\n", filename); | |
386 #endif | |
387 output_file = fopen(filename, "w"); | |
388 g_free(filename); | |
389 | |
390 if (!output_file) | |
391 return 0; | |
392 | |
393 if ((int) (gfp = lame_init()) == -1) | |
394 return 0; | |
395 | |
396 srate = rate; | |
397 inch = nch; | |
398 | |
399 /* setup id3 data */ | |
400 id3tag_init(gfp); | |
401 | |
402 if (tuple) { | |
403 /* XXX write UTF-8 even though libmp3lame does id3v2.3. --yaz */ | |
404 #ifdef DEBUG | |
405 g_print("track_name = %s\n", tuple->track_name); | |
406 #endif | |
407 lameid3.track_name = g_strdup(tuple->track_name); | |
408 id3tag_set_title(gfp, lameid3.track_name); | |
409 | |
410 lameid3.performer = g_strdup(tuple->performer); | |
411 id3tag_set_artist(gfp, lameid3.performer); | |
412 | |
413 lameid3.album_name = g_strdup(tuple->album_name); | |
414 id3tag_set_album(gfp, lameid3.album_name); | |
415 | |
416 lameid3.genre = g_strdup(tuple->genre); | |
417 id3tag_set_genre(gfp, lameid3.genre); | |
418 | |
419 lameid3.year = g_strdup_printf("%d", tuple->year); | |
420 id3tag_set_year(gfp, lameid3.year); | |
421 | |
422 lameid3.track_number = g_strdup_printf("%d", tuple->track_number); | |
423 id3tag_set_track(gfp, lameid3.track_number); | |
424 | |
425 // id3tag_write_v1(gfp); | |
426 id3tag_add_v2(gfp); | |
427 | |
428 bmp_title_input_free(tuple); | |
429 } | |
430 | |
431 | |
432 /* input stream description */ | |
433 | |
434 lame_set_in_samplerate(gfp, rate); | |
435 lame_set_num_channels(gfp, nch); | |
436 /* Maybe implement this? */ | |
437 /* lame_set_scale(lame_global_flags *, float); */ | |
438 lame_set_out_samplerate(gfp, out_samplerate_val); | |
439 | |
440 /* general control parameters */ | |
441 | |
442 lame_set_bWriteVbrTag(gfp, toggle_xing_val); | |
443 lame_set_quality(gfp, algo_quality_val); | |
444 if (audio_mode_val != 4) { | |
445 #ifdef DEBUG | |
446 printf("set mode to %d\n", audio_mode_val); | |
447 #endif | |
448 lame_set_mode(gfp, audio_mode_val); | |
449 } | |
450 if(auto_ms_val) | |
451 lame_set_mode_automs(gfp, auto_ms_val); // this forces to use joint stereo!! --yaz. | |
452 | |
453 lame_set_errorf(gfp, lame_debugf); | |
454 lame_set_debugf(gfp, lame_debugf); | |
455 lame_set_msgf(gfp, lame_debugf); | |
456 | |
457 if (enc_toggle_val == 0 && vbr_on == 0) | |
458 lame_set_brate(gfp, bitrate_val); | |
459 else if (vbr_on == 0) | |
460 lame_set_compression_ratio(gfp, compression_val); | |
461 | |
462 /* frame params */ | |
463 | |
464 lame_set_copyright(gfp, mark_copyright_val); | |
465 lame_set_original(gfp, mark_original_val); | |
466 lame_set_error_protection(gfp, error_protect_val); | |
467 lame_set_strict_ISO(gfp, enforce_iso_val); | |
468 | |
469 if (vbr_on != 0) { | |
470 if (vbr_type == 0) | |
471 lame_set_VBR(gfp, 2); | |
472 else | |
473 lame_set_VBR(gfp, 3); | |
474 lame_set_VBR_q(gfp, vbr_quality_val); | |
475 lame_set_VBR_mean_bitrate_kbps(gfp, abr_val); | |
476 lame_set_VBR_min_bitrate_kbps(gfp, vbr_min_val); | |
477 lame_set_VBR_max_bitrate_kbps(gfp, vbr_max_val); | |
478 lame_set_VBR_hard_min(gfp, enforce_min_val); | |
479 } | |
480 | |
481 if (lame_init_params(gfp) == -1) | |
482 return 0; | |
483 | |
484 return 1; | |
485 } | |
486 | |
487 static void outlame_write(void *ptr, gint length) | |
488 { | |
489 | |
490 if (inch == 1) { | |
491 encout = | |
492 lame_encode_buffer(gfp, ptr, ptr, length / 2, encbuffer, | |
493 ENCBUFFER_SIZE); | |
494 } | |
495 else { | |
496 encout = | |
497 lame_encode_buffer_interleaved(gfp, ptr, length / 4, encbuffer, | |
498 ENCBUFFER_SIZE); | |
499 } | |
500 fwrite(encbuffer, 1, encout, output_file); | |
501 written += encout; | |
502 olen += length; | |
503 | |
504 } | |
505 | |
506 static void outlame_close(void) | |
507 { | |
508 if (output_file) { | |
509 | |
510 encout = lame_encode_flush_nogap(gfp, encbuffer, ENCBUFFER_SIZE); | |
511 fwrite(encbuffer, 1, encout, output_file); | |
512 | |
513 // lame_mp3_tags_fid(gfp, output_file); // will erase id3v2 tag?? | |
514 | |
515 fclose(output_file); | |
516 lame_close(gfp); | |
517 | |
518 free_lameid3(&lameid3); | |
519 | |
520 written = 0; | |
521 olen = 0; | |
522 } | |
523 | |
524 #ifdef DEBUG | |
525 printf("close called\n"); | |
526 #endif | |
527 output_file = NULL; | |
528 | |
529 } | |
530 | |
531 static void outlame_flush(gint time) | |
532 { | |
533 // some input plugins (typically aac for libmp4) call flush() with an | |
534 // argument like -1000 every end of playing a song. | |
535 // it would break lame context. | |
536 if (time < 0) { | |
537 return; | |
538 } | |
539 outlame_close(); | |
540 outlame_open(oldfmt, oldrate, oldnch); | |
541 #ifdef DEBUG | |
542 printf("flush %d\n", time); | |
543 #endif | |
544 offset = time; | |
545 } | |
546 | |
547 static void outlame_pause(short p) | |
548 { | |
549 } | |
550 | |
551 static gint outlame_free(void) | |
552 { | |
553 return 1000000; | |
554 } | |
555 | |
556 static gint outlame_playing(void) | |
557 { | |
558 return 0; | |
559 } | |
560 | |
561 static gint outlame_get_written_time(void) | |
562 { | |
563 gint time; | |
564 if (srate && inch) { | |
565 time = (gint) ((olen * 1000) / (srate * 2 * inch)); | |
566 return time + offset; | |
567 } | |
568 | |
569 return 0; | |
570 } | |
571 | |
572 static gint outlame_get_output_time(void) | |
573 { | |
574 return outlame_get_written_time(); | |
575 } | |
576 | |
577 /*****************/ | |
578 /* Configuration */ | |
579 /*****************/ | |
580 | |
581 /* Various Singal-Fuctions */ | |
582 | |
583 static void algo_qual(GtkAdjustment * adjustment, gpointer user_data) | |
584 { | |
585 | |
586 algo_quality_val = | |
587 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON | |
588 (alg_quality_spin)); | |
589 | |
590 } | |
591 | |
592 static void samplerate_activate(GtkMenuItem * menuitem, gpointer user_data) | |
593 { | |
594 | |
595 out_samplerate_val = GPOINTER_TO_INT(user_data); | |
596 | |
597 } | |
598 | |
599 static void bitrate_activate(GtkMenuItem * menuitem, gpointer user_data) | |
600 { | |
601 | |
602 bitrate_val = GPOINTER_TO_INT(user_data); | |
603 | |
604 } | |
605 | |
606 static void compression_change(GtkAdjustment * adjustment, | |
607 gpointer user_data) | |
608 { | |
609 | |
610 compression_val = | |
611 gtk_spin_button_get_value_as_float(GTK_SPIN_BUTTON | |
612 (compression_spin)); | |
613 | |
614 } | |
615 | |
616 static void encoding_toggle(GtkToggleButton * togglebutton, | |
617 gpointer user_data) | |
618 { | |
619 | |
620 enc_toggle_val = GPOINTER_TO_INT(user_data); | |
621 | |
622 } | |
623 | |
624 static void mode_activate(GtkMenuItem * menuitem, gpointer user_data) | |
625 { | |
626 | |
627 audio_mode_val = GPOINTER_TO_INT(user_data); | |
628 | |
629 } | |
630 | |
631 static void toggle_auto_ms(GtkToggleButton * togglebutton, | |
632 gpointer user_data) | |
633 { | |
634 | |
635 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ms_mode_toggle)) == | |
636 TRUE) | |
637 auto_ms_val = 1; | |
638 else | |
639 auto_ms_val = 0; | |
640 | |
641 } | |
642 | |
643 static void toggle_enforce_iso(GtkToggleButton * togglebutton, | |
644 gpointer user_data) | |
645 { | |
646 | |
647 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enforce_iso_toggle)) | |
648 == TRUE) | |
649 enforce_iso_val = 1; | |
650 else | |
651 enforce_iso_val = 0; | |
652 | |
653 } | |
654 | |
655 static void toggle_error_protect(GtkToggleButton * togglebutton, | |
656 gpointer user_data) | |
657 { | |
658 | |
659 if (gtk_toggle_button_get_active | |
660 (GTK_TOGGLE_BUTTON(error_protection_toggle)) == TRUE) | |
661 error_protect_val = 1; | |
662 else | |
663 error_protect_val = 0; | |
664 | |
665 } | |
666 | |
667 static void toggle_vbr(GtkToggleButton * togglebutton, gpointer user_data) | |
668 { | |
669 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(vbr_toggle)) == | |
670 TRUE) { | |
671 gtk_widget_set_sensitive(vbr_options_vbox, TRUE); | |
672 gtk_widget_set_sensitive(enc_quality_frame, FALSE); | |
673 vbr_on = 1; | |
674 | |
675 if (vbr_type == 0) { | |
676 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
677 (vbr_type_radio1), TRUE); | |
678 gtk_widget_set_sensitive(abr_frame, FALSE); | |
679 gtk_widget_set_sensitive(vbr_frame, TRUE); | |
680 } | |
681 else if (vbr_type == 1) { | |
682 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
683 (vbr_type_radio2), TRUE); | |
684 gtk_widget_set_sensitive(abr_frame, TRUE); | |
685 gtk_widget_set_sensitive(vbr_frame, FALSE); | |
686 } | |
687 | |
688 } | |
689 else { | |
690 gtk_widget_set_sensitive(vbr_options_vbox, FALSE); | |
691 gtk_widget_set_sensitive(enc_quality_frame, TRUE); | |
692 vbr_on = 0; | |
693 } | |
694 } | |
695 | |
696 static void vbr_abr_toggle(GtkToggleButton * togglebutton, | |
697 gpointer user_data) | |
698 { | |
699 if (user_data == "VBR") { | |
700 gtk_widget_set_sensitive(abr_frame, FALSE); | |
701 gtk_widget_set_sensitive(vbr_frame, TRUE); | |
702 vbr_type = 0; | |
703 } | |
704 else if (user_data == "ABR") { | |
705 gtk_widget_set_sensitive(abr_frame, TRUE); | |
706 gtk_widget_set_sensitive(vbr_frame, FALSE); | |
707 vbr_type = 1; | |
708 } | |
709 } | |
710 | |
711 static void vbr_min_activate(GtkMenuItem * menuitem, gpointer user_data) | |
712 { | |
713 | |
714 vbr_min_val = GPOINTER_TO_INT(user_data); | |
715 | |
716 } | |
717 | |
718 static void vbr_max_activate(GtkMenuItem * menuitem, gpointer user_data) | |
719 { | |
720 | |
721 vbr_max_val = GPOINTER_TO_INT(user_data); | |
722 | |
723 } | |
724 | |
725 static void toggle_enforce_min(GtkToggleButton * togglebutton, | |
726 gpointer user_data) | |
727 { | |
728 | |
729 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enforce_min_toggle)) | |
730 == TRUE) | |
731 enforce_min_val = 1; | |
732 else | |
733 enforce_min_val = 0; | |
734 | |
735 } | |
736 | |
737 static void vbr_qual(GtkAdjustment * adjustment, gpointer user_data) | |
738 { | |
739 | |
740 vbr_quality_val = | |
741 gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON | |
742 (vbr_quality_spin)); | |
743 | |
744 } | |
745 | |
746 static void abr_activate(GtkMenuItem * menuitem, gpointer user_data) | |
747 { | |
748 | |
749 abr_val = GPOINTER_TO_INT(user_data); | |
750 | |
751 } | |
752 | |
753 static void toggle_xing(GtkToggleButton * togglebutton, gpointer user_data) | |
754 { | |
755 | |
756 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(xing_header_toggle)) == TRUE) | |
757 toggle_xing_val = 0; | |
758 else | |
759 toggle_xing_val = 1; | |
760 | |
761 } | |
762 | |
763 static void toggle_original(GtkToggleButton * togglebutton, | |
764 gpointer user_data) | |
765 { | |
766 | |
767 if (gtk_toggle_button_get_active | |
768 (GTK_TOGGLE_BUTTON(tags_original_toggle)) == TRUE) | |
769 mark_original_val = 1; | |
770 else | |
771 mark_original_val = 0; | |
772 | |
773 } | |
774 | |
775 static void toggle_copyright(GtkToggleButton * togglebutton, | |
776 gpointer user_data) | |
777 { | |
778 | |
779 if (gtk_toggle_button_get_active | |
780 (GTK_TOGGLE_BUTTON(tags_copyright_toggle)) == TRUE) | |
781 mark_copyright_val = 1; | |
782 else | |
783 mark_copyright_val = 0; | |
784 | |
785 } | |
786 | |
787 static void force_v2_toggle(GtkToggleButton * togglebutton, | |
788 gpointer user_data) | |
789 { | |
790 | |
791 if (gtk_toggle_button_get_active | |
792 (GTK_TOGGLE_BUTTON(tags_force_id3v2_toggle)) == TRUE) { | |
793 force_v2_val = 1; | |
794 if (gtk_toggle_button_get_active | |
795 (GTK_TOGGLE_BUTTON(tags_only_v1_toggle)) == TRUE) { | |
796 inside = 1; | |
797 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
798 (tags_only_v1_toggle), FALSE); | |
799 only_v1_val = 0; | |
800 inside = 0; | |
801 } | |
802 } | |
803 else | |
804 force_v2_val = 0; | |
805 | |
806 } | |
807 | |
808 static void id3_only_version(GtkToggleButton * togglebutton, | |
809 gpointer user_data) | |
810 { | |
811 if (user_data == "v1" && inside != 1) { | |
812 if (gtk_toggle_button_get_active | |
813 (GTK_TOGGLE_BUTTON(tags_only_v1_toggle)) == TRUE); | |
814 { | |
815 inside = 1; | |
816 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
817 (tags_only_v2_toggle), FALSE); | |
818 only_v1_val = 1; | |
819 only_v2_val = 0; | |
820 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
821 (tags_force_id3v2_toggle), FALSE); | |
822 inside = 0; | |
823 } | |
824 } | |
825 else if (user_data == "v2" && inside != 1) { | |
826 if (gtk_toggle_button_get_active | |
827 (GTK_TOGGLE_BUTTON(tags_only_v2_toggle)) == TRUE); | |
828 { | |
829 inside = 1; | |
830 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
831 (tags_only_v1_toggle), FALSE); | |
832 only_v1_val = 0; | |
833 only_v2_val = 1; | |
834 inside = 0; | |
835 } | |
836 } | |
837 | |
838 } | |
839 | |
840 static void path_dirbrowser_cb(gchar * dir) | |
841 { | |
842 gtk_entry_set_text(GTK_ENTRY(path_entry), dir); | |
843 } | |
844 | |
845 #if 0 | |
846 static void path_browse_cb(GtkWidget * w, gpointer data) | |
847 { | |
848 if (!path_dirbrowser) { | |
849 path_dirbrowser = | |
850 xmms_create_dir_browser | |
851 ("Select the directory where you want to store the output files:", | |
852 file_path, GTK_SELECTION_SINGLE, path_dirbrowser_cb); | |
853 gtk_signal_connect(GTK_OBJECT(path_dirbrowser), "destroy", | |
854 GTK_SIGNAL_FUNC(gtk_widget_destroyed), | |
855 &path_dirbrowser); | |
856 gtk_window_set_transient_for(GTK_WINDOW(path_dirbrowser), | |
857 GTK_WINDOW(configure_win)); | |
858 gtk_widget_show(path_dirbrowser); | |
859 } | |
860 } | |
861 #endif | |
862 | |
863 static void use_source_file_path_cb(GtkToggleButton * togglebutton, | |
864 gpointer user_data) | |
865 { | |
866 if (gtk_toggle_button_get_active | |
867 (GTK_TOGGLE_BUTTON(use_source_file_path)) == TRUE) { | |
868 b_use_source_file_path = 1; | |
869 gtk_widget_set_sensitive(path_dirbrowser, FALSE); | |
870 } | |
871 else { | |
872 b_use_source_file_path = 0; | |
873 gtk_widget_set_sensitive(path_dirbrowser, TRUE); | |
874 } | |
875 } | |
876 | |
877 static void prepend_track_number_cb(GtkToggleButton * togglebutton, | |
878 gpointer user_data) | |
879 { | |
880 if (gtk_toggle_button_get_active | |
881 (GTK_TOGGLE_BUTTON(prepend_track_number)) == TRUE) { | |
882 b_prepend_track_number = 1; | |
883 } | |
884 else { | |
885 b_prepend_track_number = 0; | |
886 } | |
887 } | |
888 | |
889 | |
890 /* Save Configuration */ | |
891 | |
892 static void configure_ok_cb(gpointer data) | |
893 { | |
894 ConfigDb *db; | |
895 | |
896 if (file_path) | |
897 g_free(file_path); | |
898 file_path = g_strdup(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(path_dirbrowser))); | |
899 | |
900 #ifdef DEBUG | |
901 printf("ok_cb: fle_path = %s\n", file_path); | |
902 #endif | |
903 | |
904 if (vbr_min_val > vbr_max_val) | |
905 vbr_max_val = vbr_min_val; | |
906 | |
907 db = bmp_cfg_db_open(); | |
908 | |
909 bmp_cfg_db_set_string(db, "out_lame", "file_path", file_path); | |
910 bmp_cfg_db_set_int(db, "out_lame", "use_source_file_path", | |
911 b_use_source_file_path); | |
912 bmp_cfg_db_set_int(db, "out_lame", "vbr_on", vbr_on); | |
913 bmp_cfg_db_set_int(db, "out_lame", "vbr_type", vbr_type); | |
914 bmp_cfg_db_set_int(db, "out_lame", "vbr_min_val", vbr_min_val); | |
915 bmp_cfg_db_set_int(db, "out_lame", "vbr_max_val", vbr_max_val); | |
916 bmp_cfg_db_set_int(db, "out_lame", "enforce_min_val", enforce_min_val); | |
917 bmp_cfg_db_set_int(db, "out_lame", "vbr_quality_val", vbr_quality_val); | |
918 bmp_cfg_db_set_int(db, "out_lame", "abr_val", abr_val); | |
919 bmp_cfg_db_set_int(db, "out_lame", "toggle_xing_val", toggle_xing_val); | |
920 bmp_cfg_db_set_int(db, "out_lame", "mark_original_val", | |
921 mark_original_val); | |
922 bmp_cfg_db_set_int(db, "out_lame", "mark_copyright_val", | |
923 mark_copyright_val); | |
924 bmp_cfg_db_set_int(db, "out_lame", "force_v2_val", force_v2_val); | |
925 bmp_cfg_db_set_int(db, "out_lame", "only_v1_val", only_v1_val); | |
926 bmp_cfg_db_set_int(db, "out_lame", "only_v2_val", only_v2_val); | |
927 bmp_cfg_db_set_int(db, "out_lame", "algo_quality_val", | |
928 algo_quality_val); | |
929 bmp_cfg_db_set_int(db, "out_lame", "out_samplerate_val", | |
930 out_samplerate_val); | |
931 bmp_cfg_db_set_int(db, "out_lame", "bitrate_val", bitrate_val); | |
932 bmp_cfg_db_set_float(db, "out_lame", "compression_val", | |
933 compression_val); | |
934 bmp_cfg_db_set_int(db, "out_lame", "enc_toggle_val", enc_toggle_val); | |
935 bmp_cfg_db_set_int(db, "out_lame", "audio_mode_val", audio_mode_val); | |
936 bmp_cfg_db_set_int(db, "out_lame", "auto_ms_val", auto_ms_val); | |
937 bmp_cfg_db_set_int(db, "out_lame", "enforce_iso_val", enforce_iso_val); | |
938 bmp_cfg_db_set_int(db, "out_lame", "error_protect_val", | |
939 error_protect_val); | |
940 bmp_cfg_db_set_int(db, "out_lame", "prepend_track_number", | |
941 b_prepend_track_number); | |
942 bmp_cfg_db_close(db); | |
943 | |
944 | |
945 gtk_widget_destroy(configure_win); | |
946 if (path_dirbrowser) | |
947 gtk_widget_destroy(path_dirbrowser); | |
948 } | |
949 | |
950 static void configure_destroy(void) | |
951 { | |
952 if (path_dirbrowser) | |
953 gtk_widget_destroy(path_dirbrowser); | |
954 } | |
955 | |
956 | |
957 /************************/ | |
958 /* Configuration Widget */ | |
959 /************************/ | |
960 | |
961 | |
962 static void outlame_configure(void) | |
963 { | |
964 if (!configure_win) { | |
965 configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
966 | |
967 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy", | |
968 GTK_SIGNAL_FUNC(configure_destroy), NULL); | |
969 gtk_signal_connect(GTK_OBJECT(configure_win), "destroy", | |
970 GTK_SIGNAL_FUNC(gtk_widget_destroyed), | |
971 &configure_win); | |
972 gtk_window_set_title(GTK_WINDOW(configure_win), | |
973 "Out-Lame Configuration"); | |
974 gtk_window_set_position(GTK_WINDOW(configure_win), | |
975 GTK_WIN_POS_MOUSE); | |
976 gtk_window_set_policy(GTK_WINDOW(configure_win), FALSE, TRUE, | |
977 FALSE); | |
978 gtk_container_set_border_width(GTK_CONTAINER(configure_win), 5); | |
979 | |
980 vbox = gtk_vbox_new(FALSE, 5); | |
981 gtk_container_add(GTK_CONTAINER(configure_win), vbox); | |
982 | |
983 notebook = gtk_notebook_new(); | |
984 gtk_box_pack_start(GTK_BOX(vbox), notebook, TRUE, TRUE, 0); | |
985 | |
986 | |
987 /* Quality */ | |
988 | |
989 quality_vbox = gtk_vbox_new(FALSE, 5); | |
990 gtk_container_set_border_width(GTK_CONTAINER(quality_vbox), 5); | |
991 | |
992 quality_tips = gtk_tooltips_new(); | |
993 | |
994 quality_hbox1 = gtk_hbox_new(FALSE, 5); | |
995 gtk_box_pack_start(GTK_BOX(quality_vbox), quality_hbox1, FALSE, | |
996 FALSE, 0); | |
997 | |
998 /* Algorithm Quality */ | |
999 | |
1000 alg_quality_frame = gtk_frame_new("Algorithm Quality:"); | |
1001 gtk_container_set_border_width(GTK_CONTAINER(alg_quality_frame), | |
1002 5); | |
1003 gtk_box_pack_start(GTK_BOX(quality_hbox1), alg_quality_frame, | |
1004 FALSE, FALSE, 0); | |
1005 | |
1006 alg_quality_hbox = gtk_hbox_new(FALSE, 5); | |
1007 gtk_container_set_border_width(GTK_CONTAINER(alg_quality_hbox), | |
1008 10); | |
1009 gtk_container_add(GTK_CONTAINER(alg_quality_frame), | |
1010 alg_quality_hbox); | |
1011 | |
1012 alg_quality_adj = gtk_adjustment_new(5, 0, 9, 1, 1, 1); | |
1013 alg_quality_spin = | |
1014 gtk_spin_button_new(GTK_ADJUSTMENT(alg_quality_adj), 8, 0); | |
1015 gtk_widget_set_usize(alg_quality_spin, 20, 28); | |
1016 gtk_box_pack_start(GTK_BOX(alg_quality_hbox), alg_quality_spin, | |
1017 TRUE, TRUE, 0); | |
1018 gtk_signal_connect(GTK_OBJECT(alg_quality_adj), "value-changed", | |
1019 GTK_SIGNAL_FUNC(algo_qual), NULL); | |
1020 | |
1021 gtk_tooltips_set_tip(GTK_TOOLTIPS(quality_tips), alg_quality_spin, | |
1022 "best/slowest:0;\nworst/fastest:9;\nrecommended:2;\ndefault:5;", | |
1023 ""); | |
1024 | |
1025 gtk_spin_button_set_value(GTK_SPIN_BUTTON(alg_quality_spin), | |
1026 algo_quality_val); | |
1027 | |
1028 /* Output Samplerate */ | |
1029 | |
1030 samplerate_frame = gtk_frame_new("Output Samplerate:"); | |
1031 gtk_container_set_border_width(GTK_CONTAINER(samplerate_frame), 5); | |
1032 gtk_box_pack_start(GTK_BOX(quality_hbox1), samplerate_frame, FALSE, | |
1033 FALSE, 0); | |
1034 | |
1035 samplerate_hbox = gtk_hbox_new(TRUE, 5); | |
1036 gtk_container_set_border_width(GTK_CONTAINER(samplerate_hbox), 10); | |
1037 gtk_container_add(GTK_CONTAINER(samplerate_frame), | |
1038 samplerate_hbox); | |
1039 samplerate_option_menu = gtk_option_menu_new(); | |
1040 samplerate_menu = gtk_menu_new(); | |
1041 samplerate_menu_item = gtk_menu_item_new_with_label("Auto"); | |
1042 gtk_signal_connect(GTK_OBJECT(samplerate_menu_item), "activate", | |
1043 GTK_SIGNAL_FUNC(samplerate_activate), | |
1044 GINT_TO_POINTER(0)); | |
1045 gtk_menu_append(GTK_MENU(samplerate_menu), samplerate_menu_item); | |
1046 samplerate_menu_item = gtk_menu_item_new_with_label("8"); | |
1047 gtk_signal_connect(GTK_OBJECT(samplerate_menu_item), "activate", | |
1048 GTK_SIGNAL_FUNC(samplerate_activate), | |
1049 GINT_TO_POINTER(8000)); | |
1050 gtk_menu_append(GTK_MENU(samplerate_menu), samplerate_menu_item); | |
1051 samplerate_menu_item = gtk_menu_item_new_with_label("11.025"); | |
1052 gtk_signal_connect(GTK_OBJECT(samplerate_menu_item), "activate", | |
1053 GTK_SIGNAL_FUNC(samplerate_activate), | |
1054 GINT_TO_POINTER(11025)); | |
1055 gtk_menu_append(GTK_MENU(samplerate_menu), samplerate_menu_item); | |
1056 samplerate_menu_item = gtk_menu_item_new_with_label("12"); | |
1057 gtk_signal_connect(GTK_OBJECT(samplerate_menu_item), "activate", | |
1058 GTK_SIGNAL_FUNC(samplerate_activate), | |
1059 GINT_TO_POINTER(12000)); | |
1060 gtk_menu_append(GTK_MENU(samplerate_menu), samplerate_menu_item); | |
1061 samplerate_menu_item = gtk_menu_item_new_with_label("16"); | |
1062 gtk_signal_connect(GTK_OBJECT(samplerate_menu_item), "activate", | |
1063 GTK_SIGNAL_FUNC(samplerate_activate), | |
1064 GINT_TO_POINTER(16000)); | |
1065 gtk_menu_append(GTK_MENU(samplerate_menu), samplerate_menu_item); | |
1066 samplerate_menu_item = gtk_menu_item_new_with_label("22.05"); | |
1067 gtk_signal_connect(GTK_OBJECT(samplerate_menu_item), "activate", | |
1068 GTK_SIGNAL_FUNC(samplerate_activate), | |
1069 GINT_TO_POINTER(22050)); | |
1070 gtk_menu_append(GTK_MENU(samplerate_menu), samplerate_menu_item); | |
1071 samplerate_menu_item = gtk_menu_item_new_with_label("24"); | |
1072 gtk_signal_connect(GTK_OBJECT(samplerate_menu_item), "activate", | |
1073 GTK_SIGNAL_FUNC(samplerate_activate), | |
1074 GINT_TO_POINTER(24000)); | |
1075 gtk_menu_append(GTK_MENU(samplerate_menu), samplerate_menu_item); | |
1076 samplerate_menu_item = gtk_menu_item_new_with_label("32"); | |
1077 gtk_signal_connect(GTK_OBJECT(samplerate_menu_item), "activate", | |
1078 GTK_SIGNAL_FUNC(samplerate_activate), | |
1079 GINT_TO_POINTER(32000)); | |
1080 gtk_menu_append(GTK_MENU(samplerate_menu), samplerate_menu_item); | |
1081 samplerate_menu_item = gtk_menu_item_new_with_label("44.1"); | |
1082 gtk_signal_connect(GTK_OBJECT(samplerate_menu_item), "activate", | |
1083 GTK_SIGNAL_FUNC(samplerate_activate), | |
1084 GINT_TO_POINTER(44100)); | |
1085 gtk_menu_append(GTK_MENU(samplerate_menu), samplerate_menu_item); | |
1086 samplerate_menu_item = gtk_menu_item_new_with_label("48"); | |
1087 gtk_signal_connect(GTK_OBJECT(samplerate_menu_item), "activate", | |
1088 GTK_SIGNAL_FUNC(samplerate_activate), | |
1089 GINT_TO_POINTER(48000)); | |
1090 gtk_menu_append(GTK_MENU(samplerate_menu), samplerate_menu_item); | |
1091 gtk_option_menu_set_menu(GTK_OPTION_MENU(samplerate_option_menu), | |
1092 samplerate_menu); | |
1093 gtk_widget_set_usize(samplerate_option_menu, 70, 28); | |
1094 gtk_box_pack_start(GTK_BOX(samplerate_hbox), | |
1095 samplerate_option_menu, FALSE, FALSE, 0); | |
1096 samplerate_label = gtk_label_new("(kHz)"); | |
1097 gtk_misc_set_alignment(GTK_MISC(samplerate_label), 0, 0.5); | |
1098 gtk_box_pack_start(GTK_BOX(samplerate_hbox), samplerate_label, | |
1099 FALSE, FALSE, 0); | |
1100 | |
1101 switch (out_samplerate_val) { | |
1102 | |
1103 case 0: | |
1104 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1105 (samplerate_option_menu), 0); | |
1106 break; | |
1107 case 8000: | |
1108 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1109 (samplerate_option_menu), 1); | |
1110 break; | |
1111 case 11025: | |
1112 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1113 (samplerate_option_menu), 2); | |
1114 break; | |
1115 case 12000: | |
1116 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1117 (samplerate_option_menu), 3); | |
1118 break; | |
1119 case 16000: | |
1120 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1121 (samplerate_option_menu), 4); | |
1122 break; | |
1123 case 22050: | |
1124 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1125 (samplerate_option_menu), 5); | |
1126 break; | |
1127 case 24000: | |
1128 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1129 (samplerate_option_menu), 6); | |
1130 break; | |
1131 case 32000: | |
1132 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1133 (samplerate_option_menu), 7); | |
1134 break; | |
1135 case 44100: | |
1136 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1137 (samplerate_option_menu), 8); | |
1138 break; | |
1139 case 48000: | |
1140 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1141 (samplerate_option_menu), 9); | |
1142 break; | |
1143 | |
1144 } | |
1145 | |
1146 /* Encoder Quality */ | |
1147 | |
1148 enc_quality_frame = gtk_frame_new("Bitrate / Compression ratio:"); | |
1149 gtk_container_set_border_width(GTK_CONTAINER(enc_quality_frame), | |
1150 5); | |
1151 gtk_box_pack_start(GTK_BOX(quality_vbox), enc_quality_frame, FALSE, | |
1152 FALSE, 0); | |
1153 | |
1154 | |
1155 /* yaz new code */ | |
1156 // vbox sorrounding hbox1 and hbox2 | |
1157 enc_quality_vbox = gtk_vbox_new(FALSE, 5); | |
1158 gtk_container_set_border_width(GTK_CONTAINER(enc_quality_vbox), 10); | |
1159 | |
1160 // pack vbox to frame | |
1161 gtk_container_add(GTK_CONTAINER(enc_quality_frame), enc_quality_vbox); | |
1162 | |
1163 // hbox1 for bitrate | |
1164 hbox1 = gtk_hbox_new(FALSE, 5); | |
1165 gtk_container_add(GTK_CONTAINER(enc_quality_vbox), hbox1); | |
1166 | |
1167 // radio 1 | |
1168 enc_radio1 = gtk_radio_button_new(NULL); | |
1169 if (enc_toggle_val == 0) | |
1170 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enc_radio1), TRUE); | |
1171 gtk_box_pack_start(GTK_BOX(hbox1), enc_radio1, FALSE, FALSE, 0); | |
1172 | |
1173 // label 1 | |
1174 enc_quality_label1 = gtk_label_new("Bitrate (kbps):"); | |
1175 gtk_box_pack_start(GTK_BOX(hbox1), enc_quality_label1, FALSE, FALSE, 0); | |
1176 | |
1177 // bitrate menu | |
1178 bitrate_option_menu = gtk_option_menu_new(); | |
1179 bitrate_menu = gtk_menu_new(); | |
1180 bitrate_menu_item = gtk_menu_item_new_with_label("8"); | |
1181 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1182 GTK_SIGNAL_FUNC(bitrate_activate), | |
1183 GINT_TO_POINTER(8)); | |
1184 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1185 bitrate_menu_item = gtk_menu_item_new_with_label("16"); | |
1186 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1187 GTK_SIGNAL_FUNC(bitrate_activate), | |
1188 GINT_TO_POINTER(16)); | |
1189 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1190 bitrate_menu_item = gtk_menu_item_new_with_label("24"); | |
1191 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1192 GTK_SIGNAL_FUNC(bitrate_activate), | |
1193 GINT_TO_POINTER(24)); | |
1194 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1195 bitrate_menu_item = gtk_menu_item_new_with_label("32"); | |
1196 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1197 GTK_SIGNAL_FUNC(bitrate_activate), | |
1198 GINT_TO_POINTER(32)); | |
1199 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1200 bitrate_menu_item = gtk_menu_item_new_with_label("40"); | |
1201 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1202 GTK_SIGNAL_FUNC(bitrate_activate), | |
1203 GINT_TO_POINTER(40)); | |
1204 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1205 bitrate_menu_item = gtk_menu_item_new_with_label("48"); | |
1206 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1207 GTK_SIGNAL_FUNC(bitrate_activate), | |
1208 GINT_TO_POINTER(48)); | |
1209 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1210 bitrate_menu_item = gtk_menu_item_new_with_label("56"); | |
1211 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1212 GTK_SIGNAL_FUNC(bitrate_activate), | |
1213 GINT_TO_POINTER(56)); | |
1214 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1215 bitrate_menu_item = gtk_menu_item_new_with_label("64"); | |
1216 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1217 GTK_SIGNAL_FUNC(bitrate_activate), | |
1218 GINT_TO_POINTER(64)); | |
1219 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1220 bitrate_menu_item = gtk_menu_item_new_with_label("80"); | |
1221 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1222 GTK_SIGNAL_FUNC(bitrate_activate), | |
1223 GINT_TO_POINTER(80)); | |
1224 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1225 bitrate_menu_item = gtk_menu_item_new_with_label("96"); | |
1226 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1227 GTK_SIGNAL_FUNC(bitrate_activate), | |
1228 GINT_TO_POINTER(96)); | |
1229 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1230 bitrate_menu_item = gtk_menu_item_new_with_label("112"); | |
1231 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1232 GTK_SIGNAL_FUNC(bitrate_activate), | |
1233 GINT_TO_POINTER(112)); | |
1234 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1235 bitrate_menu_item = gtk_menu_item_new_with_label("128"); | |
1236 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1237 GTK_SIGNAL_FUNC(bitrate_activate), | |
1238 GINT_TO_POINTER(128)); | |
1239 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1240 bitrate_menu_item = gtk_menu_item_new_with_label("160"); | |
1241 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1242 GTK_SIGNAL_FUNC(bitrate_activate), | |
1243 GINT_TO_POINTER(160)); | |
1244 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1245 bitrate_menu_item = gtk_menu_item_new_with_label("192"); | |
1246 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1247 GTK_SIGNAL_FUNC(bitrate_activate), | |
1248 GINT_TO_POINTER(192)); | |
1249 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1250 bitrate_menu_item = gtk_menu_item_new_with_label("224"); | |
1251 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1252 GTK_SIGNAL_FUNC(bitrate_activate), | |
1253 GINT_TO_POINTER(224)); | |
1254 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1255 bitrate_menu_item = gtk_menu_item_new_with_label("256"); | |
1256 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1257 GTK_SIGNAL_FUNC(bitrate_activate), | |
1258 GINT_TO_POINTER(256)); | |
1259 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1260 bitrate_menu_item = gtk_menu_item_new_with_label("320"); | |
1261 gtk_signal_connect(GTK_OBJECT(bitrate_menu_item), "activate", | |
1262 GTK_SIGNAL_FUNC(bitrate_activate), | |
1263 GINT_TO_POINTER(320)); | |
1264 gtk_menu_append(GTK_MENU(bitrate_menu), bitrate_menu_item); | |
1265 gtk_option_menu_set_menu(GTK_OPTION_MENU(bitrate_option_menu), | |
1266 bitrate_menu); | |
1267 gtk_widget_set_usize(bitrate_option_menu, 80, 28); | |
1268 gtk_box_pack_end(GTK_BOX(hbox1), bitrate_option_menu, FALSE, FALSE, 0); | |
1269 | |
1270 | |
1271 switch (bitrate_val) { | |
1272 | |
1273 case 8: | |
1274 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1275 (bitrate_option_menu), 0); | |
1276 break; | |
1277 case 16: | |
1278 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1279 (bitrate_option_menu), 1); | |
1280 break; | |
1281 case 24: | |
1282 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1283 (bitrate_option_menu), 2); | |
1284 break; | |
1285 case 32: | |
1286 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1287 (bitrate_option_menu), 3); | |
1288 break; | |
1289 case 40: | |
1290 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1291 (bitrate_option_menu), 4); | |
1292 break; | |
1293 case 48: | |
1294 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1295 (bitrate_option_menu), 5); | |
1296 break; | |
1297 case 56: | |
1298 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1299 (bitrate_option_menu), 6); | |
1300 break; | |
1301 case 64: | |
1302 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1303 (bitrate_option_menu), 7); | |
1304 break; | |
1305 case 80: | |
1306 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1307 (bitrate_option_menu), 8); | |
1308 break; | |
1309 case 96: | |
1310 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1311 (bitrate_option_menu), 9); | |
1312 break; | |
1313 case 112: | |
1314 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1315 (bitrate_option_menu), 10); | |
1316 break; | |
1317 case 128: | |
1318 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1319 (bitrate_option_menu), 11); | |
1320 break; | |
1321 case 160: | |
1322 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1323 (bitrate_option_menu), 12); | |
1324 break; | |
1325 case 192: | |
1326 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1327 (bitrate_option_menu), 13); | |
1328 break; | |
1329 case 224: | |
1330 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1331 (bitrate_option_menu), 14); | |
1332 break; | |
1333 case 256: | |
1334 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1335 (bitrate_option_menu), 15); | |
1336 break; | |
1337 case 320: | |
1338 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1339 (bitrate_option_menu), 16); | |
1340 break; | |
1341 | |
1342 } | |
1343 | |
1344 // hbox2 for compression ratio | |
1345 hbox2 = gtk_hbox_new(FALSE, 5); | |
1346 gtk_container_add(GTK_CONTAINER(enc_quality_vbox), hbox2); | |
1347 | |
1348 // radio 2 | |
1349 enc_radio2 = gtk_radio_button_new_from_widget(GTK_RADIO_BUTTON(enc_radio1)); | |
1350 if (enc_toggle_val == 1) | |
1351 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enc_radio2), | |
1352 TRUE); | |
1353 // pack radio 2 | |
1354 gtk_box_pack_start(GTK_BOX(hbox2), enc_radio2, FALSE, FALSE, 0); | |
1355 | |
1356 // label | |
1357 enc_quality_label2 = gtk_label_new("Compression ratio:"); | |
1358 gtk_box_pack_start(GTK_BOX(hbox2), enc_quality_label2, FALSE, FALSE, 0); | |
1359 | |
1360 // comp-ratio spin | |
1361 compression_adj = gtk_adjustment_new(11, 0, 100, 1, 1, 1); | |
1362 compression_spin = | |
1363 gtk_spin_button_new(GTK_ADJUSTMENT(compression_adj), 8, 0); | |
1364 gtk_widget_set_usize(compression_spin, 40, 28); | |
1365 gtk_container_add(GTK_CONTAINER(hbox2), compression_spin); | |
1366 gtk_box_pack_end(GTK_BOX(hbox2), compression_spin, FALSE, FALSE, 0); | |
1367 | |
1368 gtk_signal_connect(GTK_OBJECT(compression_adj), "value-changed", | |
1369 GTK_SIGNAL_FUNC(compression_change), NULL); | |
1370 | |
1371 gtk_spin_button_set_value(GTK_SPIN_BUTTON(compression_spin), | |
1372 compression_val); | |
1373 | |
1374 // radio button signale connect | |
1375 gtk_signal_connect(GTK_OBJECT(enc_radio1), "toggled", | |
1376 GTK_SIGNAL_FUNC(encoding_toggle), | |
1377 GINT_TO_POINTER(0)); | |
1378 gtk_signal_connect(GTK_OBJECT(enc_radio2), "toggled", | |
1379 GTK_SIGNAL_FUNC(encoding_toggle), | |
1380 GINT_TO_POINTER(1)); | |
1381 | |
1382 /* end of yaz new code */ | |
1383 | |
1384 | |
1385 /* Audio Mode */ | |
1386 | |
1387 mode_frame = gtk_frame_new("Audio Mode:"); | |
1388 gtk_container_set_border_width(GTK_CONTAINER(mode_frame), 5); | |
1389 gtk_box_pack_start(GTK_BOX(quality_vbox), mode_frame, FALSE, FALSE, | |
1390 0); | |
1391 | |
1392 mode_hbox = gtk_hbox_new(TRUE, 10); | |
1393 gtk_container_set_border_width(GTK_CONTAINER(mode_hbox), 10); | |
1394 gtk_container_add(GTK_CONTAINER(mode_frame), mode_hbox); | |
1395 mode_option_menu = gtk_option_menu_new(); | |
1396 mode_menu = gtk_menu_new(); | |
1397 mode_menu_item = gtk_menu_item_new_with_label("Auto"); | |
1398 gtk_signal_connect(GTK_OBJECT(mode_menu_item), "activate", | |
1399 GTK_SIGNAL_FUNC(mode_activate), | |
1400 GINT_TO_POINTER(4)); | |
1401 gtk_menu_append(GTK_MENU(mode_menu), mode_menu_item); | |
1402 mode_menu_item = gtk_menu_item_new_with_label("Joint-Stereo"); | |
1403 gtk_signal_connect(GTK_OBJECT(mode_menu_item), "activate", | |
1404 GTK_SIGNAL_FUNC(mode_activate), | |
1405 GINT_TO_POINTER(1)); | |
1406 gtk_menu_append(GTK_MENU(mode_menu), mode_menu_item); | |
1407 mode_menu_item = gtk_menu_item_new_with_label("Stereo"); | |
1408 gtk_signal_connect(GTK_OBJECT(mode_menu_item), "activate", | |
1409 GTK_SIGNAL_FUNC(mode_activate), | |
1410 GINT_TO_POINTER(0)); | |
1411 gtk_menu_append(GTK_MENU(mode_menu), mode_menu_item); | |
1412 mode_menu_item = gtk_menu_item_new_with_label("Mono"); | |
1413 gtk_signal_connect(GTK_OBJECT(mode_menu_item), "activate", | |
1414 GTK_SIGNAL_FUNC(mode_activate), | |
1415 GINT_TO_POINTER(3)); | |
1416 gtk_menu_append(GTK_MENU(mode_menu), mode_menu_item); | |
1417 gtk_option_menu_set_menu(GTK_OPTION_MENU(mode_option_menu), | |
1418 mode_menu); | |
1419 gtk_widget_set_usize(mode_option_menu, 50, 28); | |
1420 gtk_box_pack_start(GTK_BOX(mode_hbox), mode_option_menu, TRUE, | |
1421 TRUE, 2); | |
1422 | |
1423 switch (audio_mode_val) { | |
1424 | |
1425 case 4: | |
1426 gtk_option_menu_set_history(GTK_OPTION_MENU(mode_option_menu), | |
1427 0); | |
1428 break; | |
1429 case 1: | |
1430 gtk_option_menu_set_history(GTK_OPTION_MENU(mode_option_menu), | |
1431 1); | |
1432 break; | |
1433 case 0: | |
1434 gtk_option_menu_set_history(GTK_OPTION_MENU(mode_option_menu), | |
1435 2); | |
1436 break; | |
1437 case 3: | |
1438 gtk_option_menu_set_history(GTK_OPTION_MENU(mode_option_menu), | |
1439 3); | |
1440 break; | |
1441 } | |
1442 | |
1443 ms_mode_toggle = gtk_check_button_new_with_label("auto-M/S mode"); | |
1444 gtk_box_pack_start(GTK_BOX(mode_hbox), ms_mode_toggle, TRUE, TRUE, | |
1445 5); | |
1446 gtk_signal_connect(GTK_OBJECT(ms_mode_toggle), "toggled", | |
1447 GTK_SIGNAL_FUNC(toggle_auto_ms), NULL); | |
1448 | |
1449 if (auto_ms_val == 1) | |
1450 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ms_mode_toggle), | |
1451 TRUE); | |
1452 | |
1453 /* Misc */ | |
1454 | |
1455 misc_frame = gtk_frame_new("Misc:"); | |
1456 gtk_container_set_border_width(GTK_CONTAINER(misc_frame), 5); | |
1457 gtk_box_pack_start(GTK_BOX(quality_vbox), misc_frame, FALSE, FALSE, | |
1458 0); | |
1459 | |
1460 misc_vbox = gtk_vbox_new(TRUE, 5); | |
1461 gtk_container_set_border_width(GTK_CONTAINER(misc_vbox), 5); | |
1462 gtk_container_add(GTK_CONTAINER(misc_frame), misc_vbox); | |
1463 | |
1464 enforce_iso_toggle = | |
1465 gtk_check_button_new_with_label | |
1466 ("Enforce strict ISO complience"); | |
1467 gtk_box_pack_start(GTK_BOX(misc_vbox), enforce_iso_toggle, TRUE, | |
1468 TRUE, 2); | |
1469 gtk_signal_connect(GTK_OBJECT(enforce_iso_toggle), "toggled", | |
1470 GTK_SIGNAL_FUNC(toggle_enforce_iso), NULL); | |
1471 | |
1472 if (enforce_iso_val == 1) | |
1473 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1474 (enforce_iso_toggle), TRUE); | |
1475 | |
1476 error_protection_toggle = | |
1477 gtk_check_button_new_with_label("Error protection"); | |
1478 gtk_box_pack_start(GTK_BOX(misc_vbox), error_protection_toggle, | |
1479 TRUE, TRUE, 2); | |
1480 gtk_signal_connect(GTK_OBJECT(error_protection_toggle), "toggled", | |
1481 GTK_SIGNAL_FUNC(toggle_error_protect), NULL); | |
1482 | |
1483 if (error_protect_val == 1) | |
1484 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1485 (error_protection_toggle), TRUE); | |
1486 | |
1487 gtk_tooltips_set_tip(GTK_TOOLTIPS(quality_tips), | |
1488 error_protection_toggle, | |
1489 "Adds 16 bit checksum to every frame", ""); | |
1490 | |
1491 | |
1492 /* Add the Notebook */ | |
1493 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), quality_vbox, | |
1494 gtk_label_new("Quality")); | |
1495 | |
1496 | |
1497 /* VBR/ABR */ | |
1498 | |
1499 vbr_vbox = gtk_vbox_new(FALSE, 5); | |
1500 gtk_container_set_border_width(GTK_CONTAINER(vbr_vbox), 5); | |
1501 | |
1502 vbr_tips = gtk_tooltips_new(); | |
1503 | |
1504 /* Toggle VBR */ | |
1505 | |
1506 vbr_toggle = gtk_check_button_new_with_label("Enable VBR/ABR"); | |
1507 gtk_widget_set_usize(vbr_toggle, 60, 30); | |
1508 gtk_box_pack_start(GTK_BOX(vbr_vbox), vbr_toggle, FALSE, FALSE, 2); | |
1509 gtk_signal_connect(GTK_OBJECT(vbr_toggle), "toggled", | |
1510 GTK_SIGNAL_FUNC(toggle_vbr), NULL); | |
1511 | |
1512 vbr_options_vbox = gtk_vbox_new(FALSE, 0); | |
1513 gtk_container_add(GTK_CONTAINER(vbr_vbox), vbr_options_vbox); | |
1514 gtk_widget_set_sensitive(vbr_options_vbox, FALSE); | |
1515 | |
1516 /* Choose VBR/ABR */ | |
1517 | |
1518 vbr_type_frame = gtk_frame_new("Type:"); | |
1519 gtk_container_set_border_width(GTK_CONTAINER(vbr_type_frame), 5); | |
1520 gtk_box_pack_start(GTK_BOX(vbr_options_vbox), vbr_type_frame, | |
1521 FALSE, FALSE, 2); | |
1522 | |
1523 vbr_type_hbox = gtk_hbox_new(FALSE, 5); | |
1524 gtk_container_set_border_width(GTK_CONTAINER(vbr_type_hbox), 5); | |
1525 gtk_container_add(GTK_CONTAINER(vbr_type_frame), vbr_type_hbox); | |
1526 | |
1527 vbr_type_radio1 = gtk_radio_button_new_with_label(NULL, "VBR"); | |
1528 gtk_tooltips_set_tip(GTK_TOOLTIPS(vbr_tips), vbr_type_radio1, | |
1529 "Variable bitrate", ""); | |
1530 gtk_box_pack_start(GTK_BOX(vbr_type_hbox), vbr_type_radio1, TRUE, | |
1531 TRUE, 2); | |
1532 if (vbr_type == 0) | |
1533 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1534 (vbr_type_radio1), TRUE); | |
1535 | |
1536 vbr_type_radio2 = | |
1537 gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON | |
1538 (vbr_type_radio1), | |
1539 "ABR"); | |
1540 gtk_tooltips_set_tip(GTK_TOOLTIPS(vbr_tips), vbr_type_radio2, | |
1541 "Average bitrate", ""); | |
1542 gtk_box_pack_start(GTK_BOX(vbr_type_hbox), vbr_type_radio2, TRUE, | |
1543 TRUE, 2); | |
1544 if (vbr_type == 1) | |
1545 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1546 (vbr_type_radio2), TRUE); | |
1547 | |
1548 gtk_signal_connect(GTK_OBJECT(vbr_type_radio1), "toggled", | |
1549 GTK_SIGNAL_FUNC(vbr_abr_toggle), "VBR"); | |
1550 gtk_signal_connect(GTK_OBJECT(vbr_type_radio2), "toggled", | |
1551 GTK_SIGNAL_FUNC(vbr_abr_toggle), "ABR"); | |
1552 | |
1553 /* VBR Options */ | |
1554 | |
1555 vbr_frame = gtk_frame_new("VBR Options:"); | |
1556 gtk_container_set_border_width(GTK_CONTAINER(vbr_frame), 5); | |
1557 gtk_box_pack_start(GTK_BOX(vbr_options_vbox), vbr_frame, FALSE, | |
1558 FALSE, 2); | |
1559 | |
1560 vbr_options_vbox2 = gtk_vbox_new(FALSE, 5); | |
1561 gtk_container_set_border_width(GTK_CONTAINER(vbr_options_vbox2), | |
1562 5); | |
1563 gtk_container_add(GTK_CONTAINER(vbr_frame), vbr_options_vbox2); | |
1564 | |
1565 vbr_options_hbox1 = gtk_hbox_new(FALSE, 5); | |
1566 gtk_container_set_border_width(GTK_CONTAINER(vbr_options_hbox1), | |
1567 5); | |
1568 gtk_container_add(GTK_CONTAINER(vbr_options_vbox2), | |
1569 vbr_options_hbox1); | |
1570 | |
1571 vbr_min_label = gtk_label_new("Minimum bitrate (kbps):"); | |
1572 gtk_misc_set_alignment(GTK_MISC(vbr_min_label), 0, 0.5); | |
1573 gtk_box_pack_start(GTK_BOX(vbr_options_hbox1), vbr_min_label, TRUE, | |
1574 TRUE, 0); | |
1575 | |
1576 vbr_min_option_menu = gtk_option_menu_new(); | |
1577 vbr_min_menu = gtk_menu_new(); | |
1578 vbr_min_menu_item = gtk_menu_item_new_with_label("8"); | |
1579 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1580 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1581 GINT_TO_POINTER(8)); | |
1582 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1583 vbr_min_menu_item = gtk_menu_item_new_with_label("16"); | |
1584 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1585 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1586 GINT_TO_POINTER(16)); | |
1587 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1588 vbr_min_menu_item = gtk_menu_item_new_with_label("24"); | |
1589 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1590 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1591 GINT_TO_POINTER(24)); | |
1592 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1593 vbr_min_menu_item = gtk_menu_item_new_with_label("32"); | |
1594 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1595 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1596 GINT_TO_POINTER(32)); | |
1597 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1598 vbr_min_menu_item = gtk_menu_item_new_with_label("40"); | |
1599 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1600 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1601 GINT_TO_POINTER(40)); | |
1602 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1603 vbr_min_menu_item = gtk_menu_item_new_with_label("48"); | |
1604 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1605 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1606 GINT_TO_POINTER(48)); | |
1607 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1608 vbr_min_menu_item = gtk_menu_item_new_with_label("56"); | |
1609 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1610 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1611 GINT_TO_POINTER(56)); | |
1612 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1613 vbr_min_menu_item = gtk_menu_item_new_with_label("64"); | |
1614 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1615 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1616 GINT_TO_POINTER(64)); | |
1617 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1618 vbr_min_menu_item = gtk_menu_item_new_with_label("80"); | |
1619 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1620 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1621 GINT_TO_POINTER(80)); | |
1622 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1623 vbr_min_menu_item = gtk_menu_item_new_with_label("96"); | |
1624 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1625 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1626 GINT_TO_POINTER(96)); | |
1627 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1628 vbr_min_menu_item = gtk_menu_item_new_with_label("112"); | |
1629 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1630 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1631 GINT_TO_POINTER(112)); | |
1632 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1633 vbr_min_menu_item = gtk_menu_item_new_with_label("128"); | |
1634 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1635 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1636 GINT_TO_POINTER(128)); | |
1637 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1638 vbr_min_menu_item = gtk_menu_item_new_with_label("160"); | |
1639 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1640 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1641 GINT_TO_POINTER(160)); | |
1642 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1643 vbr_min_menu_item = gtk_menu_item_new_with_label("192"); | |
1644 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1645 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1646 GINT_TO_POINTER(192)); | |
1647 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1648 vbr_min_menu_item = gtk_menu_item_new_with_label("224"); | |
1649 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1650 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1651 GINT_TO_POINTER(224)); | |
1652 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1653 vbr_min_menu_item = gtk_menu_item_new_with_label("256"); | |
1654 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1655 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1656 GINT_TO_POINTER(256)); | |
1657 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1658 vbr_min_menu_item = gtk_menu_item_new_with_label("320"); | |
1659 gtk_signal_connect(GTK_OBJECT(vbr_min_menu_item), "activate", | |
1660 GTK_SIGNAL_FUNC(vbr_min_activate), | |
1661 GINT_TO_POINTER(320)); | |
1662 gtk_menu_append(GTK_MENU(vbr_min_menu), vbr_min_menu_item); | |
1663 gtk_option_menu_set_menu(GTK_OPTION_MENU(vbr_min_option_menu), | |
1664 vbr_min_menu); | |
1665 gtk_widget_set_usize(vbr_min_option_menu, 40, 25); | |
1666 gtk_box_pack_start(GTK_BOX(vbr_options_hbox1), vbr_min_option_menu, | |
1667 TRUE, TRUE, 2); | |
1668 | |
1669 switch (vbr_min_val) { | |
1670 | |
1671 case 8: | |
1672 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1673 (vbr_min_option_menu), 0); | |
1674 break; | |
1675 case 16: | |
1676 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1677 (vbr_min_option_menu), 1); | |
1678 break; | |
1679 case 24: | |
1680 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1681 (vbr_min_option_menu), 2); | |
1682 break; | |
1683 case 32: | |
1684 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1685 (vbr_min_option_menu), 3); | |
1686 break; | |
1687 case 40: | |
1688 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1689 (vbr_min_option_menu), 4); | |
1690 break; | |
1691 case 48: | |
1692 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1693 (vbr_min_option_menu), 5); | |
1694 break; | |
1695 case 56: | |
1696 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1697 (vbr_min_option_menu), 6); | |
1698 break; | |
1699 case 64: | |
1700 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1701 (vbr_min_option_menu), 7); | |
1702 break; | |
1703 case 80: | |
1704 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1705 (vbr_min_option_menu), 8); | |
1706 break; | |
1707 case 96: | |
1708 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1709 (vbr_min_option_menu), 9); | |
1710 break; | |
1711 case 112: | |
1712 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1713 (vbr_min_option_menu), 10); | |
1714 break; | |
1715 case 128: | |
1716 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1717 (vbr_min_option_menu), 11); | |
1718 break; | |
1719 case 160: | |
1720 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1721 (vbr_min_option_menu), 12); | |
1722 break; | |
1723 case 192: | |
1724 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1725 (vbr_min_option_menu), 13); | |
1726 break; | |
1727 case 224: | |
1728 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1729 (vbr_min_option_menu), 14); | |
1730 break; | |
1731 case 256: | |
1732 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1733 (vbr_min_option_menu), 15); | |
1734 break; | |
1735 case 320: | |
1736 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1737 (vbr_min_option_menu), 16); | |
1738 break; | |
1739 | |
1740 } | |
1741 | |
1742 vbr_options_hbox2 = gtk_hbox_new(FALSE, 5); | |
1743 gtk_container_set_border_width(GTK_CONTAINER(vbr_options_hbox2), | |
1744 5); | |
1745 gtk_container_add(GTK_CONTAINER(vbr_options_vbox2), | |
1746 vbr_options_hbox2); | |
1747 | |
1748 vbr_max_label = gtk_label_new("Maximum bitrate (kbps):"); | |
1749 gtk_misc_set_alignment(GTK_MISC(vbr_max_label), 0, 0.5); | |
1750 gtk_box_pack_start(GTK_BOX(vbr_options_hbox2), vbr_max_label, TRUE, | |
1751 TRUE, 0); | |
1752 | |
1753 vbr_max_option_menu = gtk_option_menu_new(); | |
1754 vbr_max_menu = gtk_menu_new(); | |
1755 vbr_max_menu_item = gtk_menu_item_new_with_label("8"); | |
1756 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1757 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1758 GINT_TO_POINTER(8)); | |
1759 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1760 vbr_max_menu_item = gtk_menu_item_new_with_label("16"); | |
1761 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1762 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1763 GINT_TO_POINTER(16)); | |
1764 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1765 vbr_max_menu_item = gtk_menu_item_new_with_label("24"); | |
1766 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1767 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1768 GINT_TO_POINTER(24)); | |
1769 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1770 vbr_max_menu_item = gtk_menu_item_new_with_label("32"); | |
1771 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1772 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1773 GINT_TO_POINTER(32)); | |
1774 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1775 vbr_max_menu_item = gtk_menu_item_new_with_label("40"); | |
1776 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1777 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1778 GINT_TO_POINTER(40)); | |
1779 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1780 vbr_max_menu_item = gtk_menu_item_new_with_label("48"); | |
1781 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1782 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1783 GINT_TO_POINTER(48)); | |
1784 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1785 vbr_max_menu_item = gtk_menu_item_new_with_label("56"); | |
1786 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1787 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1788 GINT_TO_POINTER(56)); | |
1789 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1790 vbr_max_menu_item = gtk_menu_item_new_with_label("64"); | |
1791 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1792 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1793 GINT_TO_POINTER(64)); | |
1794 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1795 vbr_max_menu_item = gtk_menu_item_new_with_label("80"); | |
1796 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1797 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1798 GINT_TO_POINTER(80)); | |
1799 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1800 vbr_max_menu_item = gtk_menu_item_new_with_label("96"); | |
1801 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1802 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1803 GINT_TO_POINTER(96)); | |
1804 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1805 vbr_max_menu_item = gtk_menu_item_new_with_label("112"); | |
1806 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1807 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1808 GINT_TO_POINTER(112)); | |
1809 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1810 vbr_max_menu_item = gtk_menu_item_new_with_label("128"); | |
1811 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1812 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1813 GINT_TO_POINTER(128)); | |
1814 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1815 vbr_max_menu_item = gtk_menu_item_new_with_label("160"); | |
1816 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1817 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1818 GINT_TO_POINTER(160)); | |
1819 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1820 vbr_max_menu_item = gtk_menu_item_new_with_label("192"); | |
1821 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1822 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1823 GINT_TO_POINTER(192)); | |
1824 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1825 vbr_max_menu_item = gtk_menu_item_new_with_label("224"); | |
1826 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1827 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1828 GINT_TO_POINTER(224)); | |
1829 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1830 vbr_max_menu_item = gtk_menu_item_new_with_label("256"); | |
1831 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1832 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1833 GINT_TO_POINTER(256)); | |
1834 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1835 vbr_max_menu_item = gtk_menu_item_new_with_label("320"); | |
1836 gtk_signal_connect(GTK_OBJECT(vbr_max_menu_item), "activate", | |
1837 GTK_SIGNAL_FUNC(vbr_max_activate), | |
1838 GINT_TO_POINTER(320)); | |
1839 gtk_menu_append(GTK_MENU(vbr_max_menu), vbr_max_menu_item); | |
1840 gtk_option_menu_set_menu(GTK_OPTION_MENU(vbr_max_option_menu), | |
1841 vbr_max_menu); | |
1842 gtk_widget_set_usize(vbr_max_option_menu, 40, 25); | |
1843 gtk_box_pack_start(GTK_BOX(vbr_options_hbox2), vbr_max_option_menu, | |
1844 TRUE, TRUE, 2); | |
1845 | |
1846 switch (vbr_max_val) { | |
1847 | |
1848 case 8: | |
1849 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1850 (vbr_max_option_menu), 0); | |
1851 break; | |
1852 case 16: | |
1853 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1854 (vbr_max_option_menu), 1); | |
1855 break; | |
1856 case 24: | |
1857 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1858 (vbr_max_option_menu), 2); | |
1859 break; | |
1860 case 32: | |
1861 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1862 (vbr_max_option_menu), 3); | |
1863 break; | |
1864 case 40: | |
1865 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1866 (vbr_max_option_menu), 4); | |
1867 break; | |
1868 case 48: | |
1869 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1870 (vbr_max_option_menu), 5); | |
1871 break; | |
1872 case 56: | |
1873 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1874 (vbr_max_option_menu), 6); | |
1875 break; | |
1876 case 64: | |
1877 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1878 (vbr_max_option_menu), 7); | |
1879 break; | |
1880 case 80: | |
1881 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1882 (vbr_max_option_menu), 8); | |
1883 break; | |
1884 case 96: | |
1885 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1886 (vbr_max_option_menu), 9); | |
1887 break; | |
1888 case 112: | |
1889 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1890 (vbr_max_option_menu), 10); | |
1891 break; | |
1892 case 128: | |
1893 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1894 (vbr_max_option_menu), 11); | |
1895 break; | |
1896 case 160: | |
1897 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1898 (vbr_max_option_menu), 12); | |
1899 break; | |
1900 case 192: | |
1901 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1902 (vbr_max_option_menu), 13); | |
1903 break; | |
1904 case 224: | |
1905 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1906 (vbr_max_option_menu), 14); | |
1907 break; | |
1908 case 256: | |
1909 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1910 (vbr_max_option_menu), 15); | |
1911 break; | |
1912 case 320: | |
1913 gtk_option_menu_set_history(GTK_OPTION_MENU | |
1914 (vbr_max_option_menu), 16); | |
1915 break; | |
1916 | |
1917 } | |
1918 | |
1919 enforce_min_toggle = | |
1920 gtk_check_button_new_with_label | |
1921 ("Strictly enforce minimum bitrate"); | |
1922 gtk_tooltips_set_tip(GTK_TOOLTIPS(vbr_tips), enforce_min_toggle, | |
1923 "For use with players that do not support low bitrate mp3 (Apex AD600-A DVD/mp3 player)", | |
1924 ""); | |
1925 gtk_box_pack_start(GTK_BOX(vbr_options_vbox2), enforce_min_toggle, | |
1926 FALSE, FALSE, 2); | |
1927 gtk_signal_connect(GTK_OBJECT(enforce_min_toggle), "toggled", | |
1928 GTK_SIGNAL_FUNC(toggle_enforce_min), NULL); | |
1929 | |
1930 if (enforce_min_val == 1) | |
1931 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
1932 (enforce_min_toggle), TRUE); | |
1933 | |
1934 /* ABR Options */ | |
1935 | |
1936 abr_frame = gtk_frame_new("ABR Options:"); | |
1937 gtk_container_set_border_width(GTK_CONTAINER(abr_frame), 5); | |
1938 gtk_box_pack_start(GTK_BOX(vbr_options_vbox), abr_frame, FALSE, | |
1939 FALSE, 2); | |
1940 gtk_widget_set_sensitive(abr_frame, FALSE); | |
1941 | |
1942 abr_hbox = gtk_hbox_new(FALSE, 5); | |
1943 gtk_container_set_border_width(GTK_CONTAINER(abr_hbox), 5); | |
1944 gtk_container_add(GTK_CONTAINER(abr_frame), abr_hbox); | |
1945 | |
1946 abr_label = gtk_label_new("Average bitrate (kbps):"); | |
1947 gtk_misc_set_alignment(GTK_MISC(abr_label), 0, 0.5); | |
1948 gtk_box_pack_start(GTK_BOX(abr_hbox), abr_label, TRUE, TRUE, 0); | |
1949 | |
1950 abr_option_menu = gtk_option_menu_new(); | |
1951 abr_menu = gtk_menu_new(); | |
1952 abr_menu_item = gtk_menu_item_new_with_label("8"); | |
1953 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
1954 GTK_SIGNAL_FUNC(abr_activate), | |
1955 GINT_TO_POINTER(8)); | |
1956 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
1957 abr_menu_item = gtk_menu_item_new_with_label("16"); | |
1958 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
1959 GTK_SIGNAL_FUNC(abr_activate), | |
1960 GINT_TO_POINTER(16)); | |
1961 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
1962 abr_menu_item = gtk_menu_item_new_with_label("24"); | |
1963 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
1964 GTK_SIGNAL_FUNC(abr_activate), | |
1965 GINT_TO_POINTER(24)); | |
1966 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
1967 abr_menu_item = gtk_menu_item_new_with_label("32"); | |
1968 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
1969 GTK_SIGNAL_FUNC(abr_activate), | |
1970 GINT_TO_POINTER(32)); | |
1971 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
1972 abr_menu_item = gtk_menu_item_new_with_label("40"); | |
1973 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
1974 GTK_SIGNAL_FUNC(abr_activate), | |
1975 GINT_TO_POINTER(40)); | |
1976 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
1977 abr_menu_item = gtk_menu_item_new_with_label("48"); | |
1978 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
1979 GTK_SIGNAL_FUNC(abr_activate), | |
1980 GINT_TO_POINTER(48)); | |
1981 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
1982 abr_menu_item = gtk_menu_item_new_with_label("56"); | |
1983 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
1984 GTK_SIGNAL_FUNC(abr_activate), | |
1985 GINT_TO_POINTER(56)); | |
1986 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
1987 abr_menu_item = gtk_menu_item_new_with_label("64"); | |
1988 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
1989 GTK_SIGNAL_FUNC(abr_activate), | |
1990 GINT_TO_POINTER(64)); | |
1991 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
1992 abr_menu_item = gtk_menu_item_new_with_label("80"); | |
1993 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
1994 GTK_SIGNAL_FUNC(abr_activate), | |
1995 GINT_TO_POINTER(80)); | |
1996 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
1997 abr_menu_item = gtk_menu_item_new_with_label("96"); | |
1998 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
1999 GTK_SIGNAL_FUNC(abr_activate), | |
2000 GINT_TO_POINTER(96)); | |
2001 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
2002 abr_menu_item = gtk_menu_item_new_with_label("112"); | |
2003 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
2004 GTK_SIGNAL_FUNC(abr_activate), | |
2005 GINT_TO_POINTER(112)); | |
2006 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
2007 abr_menu_item = gtk_menu_item_new_with_label("128"); | |
2008 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
2009 GTK_SIGNAL_FUNC(abr_activate), | |
2010 GINT_TO_POINTER(128)); | |
2011 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
2012 abr_menu_item = gtk_menu_item_new_with_label("160"); | |
2013 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
2014 GTK_SIGNAL_FUNC(abr_activate), | |
2015 GINT_TO_POINTER(160)); | |
2016 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
2017 abr_menu_item = gtk_menu_item_new_with_label("192"); | |
2018 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
2019 GTK_SIGNAL_FUNC(abr_activate), | |
2020 GINT_TO_POINTER(192)); | |
2021 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
2022 abr_menu_item = gtk_menu_item_new_with_label("224"); | |
2023 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
2024 GTK_SIGNAL_FUNC(abr_activate), | |
2025 GINT_TO_POINTER(224)); | |
2026 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
2027 abr_menu_item = gtk_menu_item_new_with_label("256"); | |
2028 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
2029 GTK_SIGNAL_FUNC(abr_activate), | |
2030 GINT_TO_POINTER(256)); | |
2031 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
2032 abr_menu_item = gtk_menu_item_new_with_label("320"); | |
2033 gtk_signal_connect(GTK_OBJECT(abr_menu_item), "activate", | |
2034 GTK_SIGNAL_FUNC(abr_activate), | |
2035 GINT_TO_POINTER(320)); | |
2036 gtk_menu_append(GTK_MENU(abr_menu), abr_menu_item); | |
2037 gtk_option_menu_set_menu(GTK_OPTION_MENU(abr_option_menu), | |
2038 abr_menu); | |
2039 gtk_widget_set_usize(abr_option_menu, 40, 25); | |
2040 gtk_box_pack_start(GTK_BOX(abr_hbox), abr_option_menu, TRUE, TRUE, | |
2041 2); | |
2042 | |
2043 switch (abr_val) { | |
2044 | |
2045 case 8: | |
2046 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2047 0); | |
2048 break; | |
2049 case 16: | |
2050 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2051 1); | |
2052 break; | |
2053 case 24: | |
2054 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2055 2); | |
2056 break; | |
2057 case 32: | |
2058 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2059 3); | |
2060 break; | |
2061 case 40: | |
2062 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2063 4); | |
2064 break; | |
2065 case 48: | |
2066 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2067 5); | |
2068 break; | |
2069 case 56: | |
2070 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2071 6); | |
2072 break; | |
2073 case 64: | |
2074 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2075 7); | |
2076 break; | |
2077 case 80: | |
2078 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2079 8); | |
2080 break; | |
2081 case 96: | |
2082 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2083 9); | |
2084 break; | |
2085 case 112: | |
2086 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2087 10); | |
2088 break; | |
2089 case 128: | |
2090 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2091 11); | |
2092 break; | |
2093 case 160: | |
2094 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2095 12); | |
2096 break; | |
2097 case 192: | |
2098 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2099 13); | |
2100 break; | |
2101 case 224: | |
2102 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2103 14); | |
2104 break; | |
2105 case 256: | |
2106 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2107 15); | |
2108 break; | |
2109 case 320: | |
2110 gtk_option_menu_set_history(GTK_OPTION_MENU(abr_option_menu), | |
2111 16); | |
2112 break; | |
2113 | |
2114 } | |
2115 | |
2116 /* Quality Level */ | |
2117 | |
2118 vbr_options_hbox3 = gtk_hbox_new(FALSE, 5); | |
2119 gtk_container_set_border_width(GTK_CONTAINER(vbr_options_hbox3), | |
2120 5); | |
2121 gtk_container_add(GTK_CONTAINER(vbr_options_vbox), | |
2122 vbr_options_hbox3); | |
2123 | |
2124 vbr_quality_label = gtk_label_new("VBR quality level:"); | |
2125 gtk_misc_set_alignment(GTK_MISC(vbr_quality_label), 0, 0.5); | |
2126 gtk_box_pack_start(GTK_BOX(vbr_options_hbox3), vbr_quality_label, | |
2127 TRUE, TRUE, 0); | |
2128 | |
2129 vbr_quality_adj = gtk_adjustment_new(4, 0, 9, 1, 1, 1); | |
2130 vbr_quality_spin = | |
2131 gtk_spin_button_new(GTK_ADJUSTMENT(vbr_quality_adj), 8, 0); | |
2132 gtk_widget_set_usize(vbr_quality_spin, 20, 20); | |
2133 gtk_box_pack_start(GTK_BOX(vbr_options_hbox3), vbr_quality_spin, | |
2134 TRUE, TRUE, 0); | |
2135 gtk_signal_connect(GTK_OBJECT(vbr_quality_adj), "value-changed", | |
2136 GTK_SIGNAL_FUNC(vbr_qual), NULL); | |
2137 | |
2138 gtk_tooltips_set_tip(GTK_TOOLTIPS(vbr_tips), vbr_quality_spin, | |
2139 "highest:0;\nlowest:9;\ndefault:4;", ""); | |
2140 | |
2141 gtk_spin_button_set_value(GTK_SPIN_BUTTON(vbr_quality_spin), | |
2142 vbr_quality_val); | |
2143 | |
2144 /* Xing Header */ | |
2145 | |
2146 xing_header_toggle = | |
2147 gtk_check_button_new_with_label("Don't write Xing VBR header"); | |
2148 gtk_box_pack_start(GTK_BOX(vbr_options_vbox), xing_header_toggle, | |
2149 FALSE, FALSE, 2); | |
2150 gtk_signal_connect(GTK_OBJECT(xing_header_toggle), "toggled", | |
2151 GTK_SIGNAL_FUNC(toggle_xing), NULL); | |
2152 | |
2153 if (toggle_xing_val == 0) | |
2154 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
2155 (xing_header_toggle), TRUE); | |
2156 | |
2157 | |
2158 | |
2159 /* Add the Notebook */ | |
2160 | |
2161 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), vbr_vbox, | |
2162 gtk_label_new("VBR/ABR")); | |
2163 | |
2164 | |
2165 /* Tags */ | |
2166 | |
2167 tags_vbox = gtk_vbox_new(FALSE, 5); | |
2168 gtk_container_set_border_width(GTK_CONTAINER(tags_vbox), 5); | |
2169 | |
2170 tags_tips = gtk_tooltips_new(); | |
2171 | |
2172 /* Frame Params */ | |
2173 | |
2174 tags_frames_frame = gtk_frame_new("Frame params:"); | |
2175 gtk_container_set_border_width(GTK_CONTAINER(tags_frames_frame), | |
2176 5); | |
2177 gtk_box_pack_start(GTK_BOX(tags_vbox), tags_frames_frame, FALSE, | |
2178 FALSE, 2); | |
2179 | |
2180 tags_frames_hbox = gtk_hbox_new(FALSE, 5); | |
2181 gtk_container_set_border_width(GTK_CONTAINER(tags_frames_hbox), 5); | |
2182 gtk_container_add(GTK_CONTAINER(tags_frames_frame), | |
2183 tags_frames_hbox); | |
2184 | |
2185 tags_copyright_toggle = | |
2186 gtk_check_button_new_with_label("Mark as copyright"); | |
2187 gtk_box_pack_start(GTK_BOX(tags_frames_hbox), | |
2188 tags_copyright_toggle, FALSE, FALSE, 2); | |
2189 gtk_signal_connect(GTK_OBJECT(tags_copyright_toggle), "toggled", | |
2190 GTK_SIGNAL_FUNC(toggle_copyright), NULL); | |
2191 | |
2192 if (mark_copyright_val == 1) | |
2193 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
2194 (tags_copyright_toggle), TRUE); | |
2195 | |
2196 tags_original_toggle = | |
2197 gtk_check_button_new_with_label("Mark as original"); | |
2198 gtk_box_pack_start(GTK_BOX(tags_frames_hbox), tags_original_toggle, | |
2199 FALSE, FALSE, 2); | |
2200 gtk_signal_connect(GTK_OBJECT(tags_original_toggle), "toggled", | |
2201 GTK_SIGNAL_FUNC(toggle_original), NULL); | |
2202 | |
2203 if (mark_original_val == 1) | |
2204 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
2205 (tags_original_toggle), TRUE); | |
2206 | |
2207 /* ID3 Params */ | |
2208 | |
2209 tags_id3_frame = gtk_frame_new("ID3 params:"); | |
2210 gtk_container_set_border_width(GTK_CONTAINER(tags_id3_frame), 5); | |
2211 gtk_box_pack_start(GTK_BOX(tags_vbox), tags_id3_frame, FALSE, | |
2212 FALSE, 2); | |
2213 | |
2214 tags_id3_vbox = gtk_vbox_new(FALSE, 5); | |
2215 gtk_container_set_border_width(GTK_CONTAINER(tags_id3_vbox), 5); | |
2216 gtk_container_add(GTK_CONTAINER(tags_id3_frame), tags_id3_vbox); | |
2217 | |
2218 tags_force_id3v2_toggle = | |
2219 gtk_check_button_new_with_label | |
2220 ("Force addition of version 2 tag"); | |
2221 gtk_box_pack_start(GTK_BOX(tags_id3_vbox), tags_force_id3v2_toggle, | |
2222 FALSE, FALSE, 2); | |
2223 gtk_signal_connect(GTK_OBJECT(tags_force_id3v2_toggle), "toggled", | |
2224 GTK_SIGNAL_FUNC(force_v2_toggle), NULL); | |
2225 | |
2226 tags_id3_hbox = gtk_hbox_new(FALSE, 5); | |
2227 gtk_container_add(GTK_CONTAINER(tags_id3_vbox), tags_id3_hbox); | |
2228 | |
2229 tags_only_v1_toggle = | |
2230 gtk_check_button_new_with_label("Only add v1 tag"); | |
2231 gtk_box_pack_start(GTK_BOX(tags_id3_hbox), tags_only_v1_toggle, | |
2232 FALSE, FALSE, 2); | |
2233 gtk_signal_connect(GTK_OBJECT(tags_only_v1_toggle), "toggled", | |
2234 GTK_SIGNAL_FUNC(id3_only_version), "v1"); | |
2235 | |
2236 tags_only_v2_toggle = | |
2237 gtk_check_button_new_with_label("Only add v2 tag"); | |
2238 gtk_box_pack_start(GTK_BOX(tags_id3_hbox), tags_only_v2_toggle, | |
2239 FALSE, FALSE, 2); | |
2240 gtk_signal_connect(GTK_OBJECT(tags_only_v2_toggle), "toggled", | |
2241 GTK_SIGNAL_FUNC(id3_only_version), "v2"); | |
2242 | |
2243 if (force_v2_val == 1) | |
2244 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
2245 (tags_force_id3v2_toggle), TRUE); | |
2246 | |
2247 if (only_v1_val == 1) | |
2248 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
2249 (tags_only_v1_toggle), TRUE); | |
2250 | |
2251 if (only_v2_val == 1) | |
2252 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
2253 (tags_only_v2_toggle), TRUE); | |
2254 | |
2255 /* Add the Notebook */ | |
2256 | |
2257 gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tags_vbox, | |
2258 gtk_label_new("Tags")); | |
2259 | |
2260 | |
2261 /* Path Config */ | |
2262 | |
2263 path_hbox = gtk_hbox_new(FALSE, 5); | |
2264 gtk_container_set_border_width(GTK_CONTAINER(path_hbox), 10); | |
2265 gtk_box_pack_start(GTK_BOX(vbox), path_hbox, FALSE, FALSE, 0); | |
2266 | |
2267 path_label = gtk_label_new("Path:"); | |
2268 gtk_box_pack_start(GTK_BOX(path_hbox), path_label, FALSE, FALSE, | |
2269 0); | |
2270 gtk_widget_show(path_label); | |
2271 | |
2272 path_dirbrowser = | |
2273 gtk_file_chooser_button_new("Pick a folder", GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); | |
2274 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(path_dirbrowser), file_path); | |
2275 gtk_box_pack_start(GTK_BOX(path_hbox), path_dirbrowser, FALSE, FALSE, 0); | |
2276 | |
2277 use_source_file_path = | |
2278 gtk_check_button_new_with_label("Use source file dir"); | |
2279 gtk_box_pack_start(GTK_BOX(GTK_BOX(path_hbox)), | |
2280 use_source_file_path, TRUE, TRUE, 5); | |
2281 gtk_signal_connect(GTK_OBJECT(use_source_file_path), "toggled", | |
2282 GTK_SIGNAL_FUNC(use_source_file_path_cb), NULL); | |
2283 | |
2284 if (b_use_source_file_path == 1) | |
2285 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
2286 (use_source_file_path), TRUE); | |
2287 | |
2288 prepend_track_number = | |
2289 gtk_check_button_new_with_label("Prepend track number to filename"); | |
2290 gtk_box_pack_start(GTK_BOX(GTK_BOX(path_hbox)), | |
2291 prepend_track_number, TRUE, TRUE, 5); | |
2292 gtk_signal_connect(GTK_OBJECT(prepend_track_number), "toggled", | |
2293 GTK_SIGNAL_FUNC(prepend_track_number_cb), NULL); | |
2294 | |
2295 if (b_prepend_track_number == 1) | |
2296 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON | |
2297 (prepend_track_number), TRUE); | |
2298 | |
2299 | |
2300 /* The Rest */ | |
2301 | |
2302 /* Seperator */ | |
2303 | |
2304 configure_separator = gtk_hseparator_new(); | |
2305 gtk_box_pack_start(GTK_BOX(vbox), configure_separator, FALSE, | |
2306 FALSE, 0); | |
2307 gtk_widget_show(configure_separator); | |
2308 | |
2309 /* Buttons */ | |
2310 | |
2311 configure_bbox = gtk_hbutton_box_new(); | |
2312 gtk_button_box_set_layout(GTK_BUTTON_BOX(configure_bbox), | |
2313 GTK_BUTTONBOX_END); | |
2314 gtk_button_box_set_spacing(GTK_BUTTON_BOX(configure_bbox), 5); | |
2315 gtk_box_pack_start(GTK_BOX(vbox), configure_bbox, FALSE, FALSE, 0); | |
2316 | |
2317 configure_ok = gtk_button_new_with_label("Ok"); | |
2318 gtk_signal_connect(GTK_OBJECT(configure_ok), "clicked", | |
2319 GTK_SIGNAL_FUNC(configure_ok_cb), NULL); | |
2320 GTK_WIDGET_SET_FLAGS(configure_ok, GTK_CAN_DEFAULT); | |
2321 gtk_box_pack_start(GTK_BOX(configure_bbox), configure_ok, TRUE, | |
2322 TRUE, 0); | |
2323 gtk_widget_show(configure_ok); | |
2324 gtk_widget_grab_default(configure_ok); | |
2325 | |
2326 configure_cancel = gtk_button_new_with_label("Cancel"); | |
2327 gtk_signal_connect_object(GTK_OBJECT(configure_cancel), "clicked", | |
2328 GTK_SIGNAL_FUNC(gtk_widget_destroy), | |
2329 GTK_OBJECT(configure_win)); | |
2330 GTK_WIDGET_SET_FLAGS(configure_cancel, GTK_CAN_DEFAULT); | |
2331 gtk_box_pack_start(GTK_BOX(configure_bbox), configure_cancel, TRUE, | |
2332 TRUE, 0); | |
2333 | |
2334 /* Set States */ | |
2335 | |
2336 if (vbr_on == 1) | |
2337 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vbr_toggle), | |
2338 TRUE); | |
2339 else | |
2340 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(vbr_toggle), | |
2341 FALSE); | |
2342 | |
2343 /* Show it! */ | |
2344 | |
2345 gtk_widget_show_all(configure_win); | |
2346 | |
2347 } | |
2348 } |