# HG changeset patch # User yaz # Date 1174023415 25200 # Node ID 973d9b6249872129be7ee0ee00a67431aeff467b # Parent baa22cb0216dd87eca1fa5a19df4b11cf886037c [svn] - add mseek support to wav.c (without libsndfile version) too. diff -r baa22cb0216d -r 973d9b624987 ChangeLog --- a/ChangeLog Thu Mar 15 22:09:36 2007 -0700 +++ b/ChangeLog Thu Mar 15 22:36:55 2007 -0700 @@ -1,3 +1,14 @@ +2007-03-16 05:09:36 +0000 Yoshiki Yazawa + revision [1824] + - add mseek support. + - fix a major bug which consumes CPU time heavily. + + trunk/src/wav/Makefile | 2 +- + trunk/src/wav/wav-sndfile.c | 38 +++++++++++++++++++++++--------------- + trunk/src/wav/wav-sndfile.h | 2 +- + 3 files changed, 25 insertions(+), 17 deletions(-) + + 2007-03-15 15:04:47 +0000 Yoshiki Yazawa revision [1822] - refine watchdog thread. diff -r baa22cb0216d -r 973d9b624987 src/wav/wav.c --- a/src/wav/wav.c Thu Mar 15 22:09:36 2007 -0700 +++ b/src/wav/wav.c Thu Mar 15 22:36:55 2007 -0700 @@ -65,6 +65,7 @@ NULL, NULL, wav_fmts, + mseek, }; WaveFile *wav_file = NULL; @@ -296,10 +297,10 @@ else xmms_usleep(10000); if (wav_file->seek_to != -1) { - wav_file->position = wav_file->seek_to * rate; + wav_file->position = (unsigned long)((gint64)wav_file->seek_to * (gint64)rate / 1000L); vfs_fseek(wav_file->file, wav_file->position + wav_file->data_offset, SEEK_SET); - playback->output->flush(wav_file->seek_to * 1000); + playback->output->flush(wav_file->seek_to); wav_file->seek_to = -1; } @@ -447,9 +448,9 @@ } static void -seek(InputPlayback * data, gint time) +mseek(InputPlayback * data, gulong millisecond) { - wav_file->seek_to = time; + wav_file->seek_to = millisecond; wav_file->eof = FALSE; @@ -457,6 +458,13 @@ xmms_usleep(10000); } +static void +seek(InputPlayback * data, gint time) +{ + gulong millisecond = time * 1000; + mseek(data, millisecond); +} + static int get_time(InputPlayback *playback) { diff -r baa22cb0216d -r 973d9b624987 src/wav/wav.h --- a/src/wav/wav.h Thu Mar 15 22:09:36 2007 -0700 +++ b/src/wav/wav.h Thu Mar 15 22:36:55 2007 -0700 @@ -48,7 +48,8 @@ short format_tag, channels, block_align, bits_per_sample, eof; long samples_per_sec, avg_bytes_per_sec; unsigned long position, length; - int seek_to, data_offset, going; + glong seek_to; + int data_offset, going; pid_t pid; } WaveFile; @@ -60,5 +61,6 @@ static void wav_pause(InputPlayback * data, short p); static int get_time(InputPlayback * data); static void get_song_info(char *filename, char **title, int *length); +static void mseek(InputPlayback * data, gulong millisecond); #endif