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