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