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