comparison src/filewriter/mp3.c @ 2275:e09d9633d6aa

- mp3_playing() should return 0 for now otherwise mp4 playback would halt at the end of a track. - make use of AUDDBG().
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Tue, 01 Jan 2008 22:54:10 +0900
parents b8da6a0b0da2
children 85e03a981a7c
comparison
equal deleted inserted replaced
2274:d9706e29e968 2275:e09d9633d6aa
17 * 17 *
18 * You should have received a copy of the GNU General Public License 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 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. 20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */ 21 */
22
23 /* #define AUD_DEBUG 1 */
22 24
23 #include "plugins.h" 25 #include "plugins.h"
24 26
25 #ifdef FILEWRITER_MP3 27 #ifdef FILEWRITER_MP3
26 28
154 static void lame_debugf(const char *format, va_list ap) 156 static void lame_debugf(const char *format, va_list ap)
155 { 157 {
156 (void) vfprintf(stdout, format, ap); 158 (void) vfprintf(stdout, format, ap);
157 } 159 }
158 160
159
160
161 static void mp3_init(void) 161 static void mp3_init(void)
162 { 162 {
163 ConfigDb *db = aud_cfg_db_open(); 163 ConfigDb *db = aud_cfg_db_open();
164 aud_cfg_db_get_int(db, "filewriter_mp3", "vbr_on", &vbr_on); 164 aud_cfg_db_get_int(db, "filewriter_mp3", "vbr_on", &vbr_on);
165 aud_cfg_db_get_int(db, "filewriter_mp3", "vbr_type", &vbr_type); 165 aud_cfg_db_get_int(db, "filewriter_mp3", "vbr_type", &vbr_type);
204 /* setup id3 data */ 204 /* setup id3 data */
205 id3tag_init(gfp); 205 id3tag_init(gfp);
206 206
207 if (tuple) { 207 if (tuple) {
208 /* XXX write UTF-8 even though libmp3lame does id3v2.3. --yaz */ 208 /* XXX write UTF-8 even though libmp3lame does id3v2.3. --yaz */
209 #ifdef DEBUG 209
210 g_print("track_name = %s\n", aud_tuple_get_string(tuple, FIELD_TITLE, NULL)); 210 AUDDBG("track_name = %s\n", aud_tuple_get_string(tuple, FIELD_TITLE, NULL));
211 #endif 211
212 lameid3.track_name = g_strdup(aud_tuple_get_string(tuple, FIELD_TITLE, NULL)); 212 lameid3.track_name = g_strdup(aud_tuple_get_string(tuple, FIELD_TITLE, NULL));
213 id3tag_set_title(gfp, lameid3.track_name); 213 id3tag_set_title(gfp, lameid3.track_name);
214 214
215 lameid3.performer = g_strdup(aud_tuple_get_string(tuple, FIELD_ARTIST, NULL)); 215 lameid3.performer = g_strdup(aud_tuple_get_string(tuple, FIELD_ARTIST, NULL));
216 id3tag_set_artist(gfp, lameid3.performer); 216 id3tag_set_artist(gfp, lameid3.performer);
242 /* general control parameters */ 242 /* general control parameters */
243 243
244 lame_set_bWriteVbrTag(gfp, toggle_xing_val); 244 lame_set_bWriteVbrTag(gfp, toggle_xing_val);
245 lame_set_quality(gfp, algo_quality_val); 245 lame_set_quality(gfp, algo_quality_val);
246 if (audio_mode_val != 4) { 246 if (audio_mode_val != 4) {
247 #ifdef DEBUG 247 AUDDBG("set mode to %d\n", audio_mode_val);
248 printf("set mode to %d\n", audio_mode_val);
249 #endif
250 lame_set_mode(gfp, audio_mode_val); 248 lame_set_mode(gfp, audio_mode_val);
251 } 249 }
252 if(auto_ms_val) 250 if(auto_ms_val)
253 lame_set_mode_automs(gfp, auto_ms_val); // this forces to use joint stereo!! --yaz. 251 lame_set_mode_automs(gfp, auto_ms_val); // this forces to use joint stereo!! --yaz.
254 252
326 return ENCBUFFER_SIZE - encout; 324 return ENCBUFFER_SIZE - encout;
327 } 325 }
328 326
329 static gint mp3_playing(void) 327 static gint mp3_playing(void)
330 { 328 {
331 #ifdef DEBUG 329 return 0;
332 printf("lame: buffer_playing = %d\n", encout ? 1 : 0);
333 #endif
334 return encout ? 1 : 0;
335 } 330 }
336 331
337 static gint mp3_get_written_time(void) 332 static gint mp3_get_written_time(void)
338 { 333 {
339 gint time; 334 gint time;