Mercurial > audlegacy-plugins
changeset 859:301d03667d2f trunk
[svn] - make use of playlist_set_position() instead of playlist_prev/next(). now cuesheet directly jumps to the objective track.
- now eof handling code checks output->buffer_playing().
- revise guard time logic and reduce the amount of time to 500msec.
author | yaz |
---|---|
date | Wed, 14 Mar 2007 23:50:12 -0700 |
parents | 9429121d61ec |
children | cafc7d5769f9 |
files | ChangeLog src/cue/cuesheet.c |
diffstat | 2 files changed, 48 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Mar 14 23:34:56 2007 -0700 +++ b/ChangeLog Wed Mar 14 23:50:12 2007 -0700 @@ -1,3 +1,14 @@ +2007-03-15 06:34:56 +0000 Yoshiki Yazawa <yaz@cc.rim.or.jp> + revision [1816] + - implement real buffer_free() and buffer_playing(). + - remove unused code. + - apply cast to (short *) in lame_encode_xx() + - change version number from 0.2d6 to 0.2. + + trunk/src/lame/out_lame.c | 53 +++++++++++++--------------------------------- + 1 file changed, 15 insertions(+), 38 deletions(-) + + 2007-03-14 15:59:50 +0000 Giacomo Lozito <james@develia.org> revision [1814] statusicon: add missing files
--- a/src/cue/cuesheet.c Wed Mar 14 23:34:56 2007 -0700 +++ b/src/cue/cuesheet.c Wed Mar 14 23:50:12 2007 -0700 @@ -35,6 +35,7 @@ #define MAX_CUE_LINE_LENGTH 1000 #define MAX_CUE_TRACKS 1000 +#define TRANSITION_GUARD_TIME 500000 static void cache_cue_file(gchar *f); static void free_cue_info(void); @@ -357,29 +358,16 @@ g_thread_exit(NULL); } -static gpointer do_prev(gpointer data) +static gpointer do_setpos(gpointer data) { Playlist *playlist = playlist_get_active(); - #ifdef DEBUG - g_print("do_prev\n"); + g_print("do_setpos: %d\n\n", *(guint *)data); #endif - playlist_prev(playlist); + playlist_set_position(playlist, *(guint *)data); g_thread_exit(NULL); } -static gpointer do_next(gpointer data) -{ - Playlist *playlist = playlist_get_active(); - -#ifdef DEBUG - g_print("do_next\n"); -#endif - playlist_next(playlist); - g_thread_exit(NULL); -} - - static void cue_pause(InputPlayback * data, short p) { if (real_ip != NULL) @@ -465,6 +453,7 @@ real_ip->plugin->seek(real_ip, finetune_seek ? finetune_seek / 1000 : cue_tracks[track].index / 1000 + 1); /* kick watchdog thread */ + g_usleep(TRANSITION_GUARD_TIME); g_mutex_lock(cue_mutex); watchdog_state = RUN; g_mutex_unlock(cue_mutex); @@ -555,66 +544,73 @@ } g_mutex_unlock(cue_mutex); + if(watchdog_state != RUN) + continue; + time = get_output_time(); if(time == 0) continue; -#if 0 -#ifdef DEBUG - if(real_ip) { - g_print("real_ip->playing = %d\n", real_ip->playing); - if(real_ip->playing == 0) - g_print("not playing\n"); - if(!real_ip->output->buffer_playing()) - g_print("not buffer_playing\n"); - } -#endif -#endif // prev track if (time < cue_tracks[cur_cue_track].index) { + guint pos; #ifdef DEBUG g_print("i: watchdog prev\n"); g_print("time = %d cur = %d cidx = %d nidx = %d\n", time, cur_cue_track, cue_tracks[cur_cue_track].index, cue_tracks[cur_cue_track+1].index); #endif - cur_cue_track--; - if (time >= cue_tracks[cur_cue_track].index) - finetune_seek = time; - exec_thread = g_thread_create(do_prev, NULL, FALSE, NULL); - g_usleep(1000000); // 1sec guard time + while(time < cue_tracks[cur_cue_track].index) { + cur_cue_track--; + pos = cur_cue_track; + if (time >= cue_tracks[cur_cue_track].index) + finetune_seek = time; + } + + exec_thread = g_thread_create(do_setpos, &pos, FALSE, NULL); + g_usleep(TRANSITION_GUARD_TIME); } // next track - if (cur_cue_track != last_cue_track && (time > cue_tracks[cur_cue_track + 1].index)) + if (time > cue_tracks[cur_cue_track + 1].index) { + guint pos; #ifdef DEBUG g_print("i: watchdog next\n"); - g_print("time = %d cur = %d cidx = %d nidx = %d\n", time, cur_cue_track, + g_print("time = %d cur = %d cidx = %d nidx = %d last = %d\n", time, cur_cue_track, cue_tracks[cur_cue_track].index, - cue_tracks[cur_cue_track+1].index); + cue_tracks[cur_cue_track+1].index, + last_cue_track); #endif - cur_cue_track++; - if (time <= cue_tracks[cur_cue_track].index) - finetune_seek = time; + while(time > cue_tracks[cur_cue_track + 1].index) { + if(cur_cue_track + 1 == last_cue_track) { + break; + } + cur_cue_track++; + pos = cur_cue_track; + if (time <= cue_tracks[cur_cue_track].index) + finetune_seek = time; + } if(cfg.stopaftersong) { exec_thread = g_thread_create(do_stop, (void *)real_ip, FALSE, NULL); } else { - exec_thread = g_thread_create(do_next, NULL, FALSE, NULL); - g_usleep(1000000); // 1sec guard time + exec_thread = g_thread_create(do_setpos, &pos, FALSE, NULL); + g_usleep(TRANSITION_GUARD_TIME); } } // end of file if (cur_cue_track + 1 == last_cue_track && cue_tracks[cur_cue_track + 1].index - time < 500) { // difference < 500ms + if(!real_ip->output->buffer_playing()) { #ifdef DEBUG g_print("i: watchdog eof reached\n"); #endif - exec_thread = g_thread_create(do_stop, (void *)real_ip, FALSE, NULL); + exec_thread = g_thread_create(do_stop, (void *)real_ip, FALSE, NULL); + } } }