Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/sndfile/plugin.c b/src/sndfile/plugin.c
- index 1742730..e7cf038 100644
- --- a/src/sndfile/plugin.c
- +++ b/src/sndfile/plugin.c
- @@ -39,7 +39,6 @@
- */
- #include <math.h>
- -#include <pthread.h>
- #include <stdlib.h>
- #include <sndfile.h>
- @@ -47,10 +46,6 @@
- #include <audacious/plugin.h>
- #include <audacious/i18n.h>
- -static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
- -static int seek_value;
- -static bool_t stop_flag;
- -
- /* Virtual file access wrappers for libsndfile
- */
- static sf_count_t
- @@ -289,7 +284,7 @@ static Tuple * get_song_tuple (const char * filename, VFSFile * file)
- }
- static bool_t play_start (InputPlayback * playback, const char * filename,
- - VFSFile * file, int start_time, int stop_time, bool_t pause)
- + VFSFile * file)
- {
- if (file == NULL)
- return FALSE;
- @@ -312,35 +307,16 @@ static bool_t play_start (InputPlayback * playback, const char * filename,
- * files. */
- playback->set_params (playback, 0, sfinfo.samplerate, sfinfo.channels);
- - seek_value = (start_time > 0) ? start_time : -1;
- - stop_flag = FALSE;
- - playback->set_pb_ready(playback);
- -
- int size = sfinfo.channels * (sfinfo.samplerate / 50);
- float * buffer = malloc (sizeof (float) * size);
- - while (stop_time < 0 || playback->output->written_time () < stop_time)
- + while (! playback->check_stop ())
- {
- - pthread_mutex_lock (& mutex);
- -
- - if (stop_flag)
- - {
- - pthread_mutex_unlock (& mutex);
- - break;
- - }
- -
- + int seek_value = playback->check_seek ();
- if (seek_value != -1)
- - {
- - sf_seek (sndfile, (int64_t) seek_value * sfinfo.samplerate / 1000,
- - SEEK_SET);
- - playback->output->flush (seek_value);
- - seek_value = -1;
- - }
- -
- - pthread_mutex_unlock (& mutex);
- + sf_seek (sndfile, (int64_t) seek_value * sfinfo.samplerate / 1000, SEEK_SET);
- int samples = sf_read_float (sndfile, buffer, size);
- -
- if (! samples)
- break;
- @@ -350,49 +326,9 @@ static bool_t play_start (InputPlayback * playback, const char * filename,
- sf_close (sndfile);
- free (buffer);
- - pthread_mutex_lock (& mutex);
- - stop_flag = TRUE;
- - pthread_mutex_unlock (& mutex);
- -
- return TRUE;
- }
- -static void play_pause (InputPlayback * p, bool_t pause)
- -{
- - pthread_mutex_lock (& mutex);
- -
- - if (! stop_flag)
- - p->output->pause (pause);
- -
- - pthread_mutex_unlock (& mutex);
- -}
- -
- -static void play_stop (InputPlayback * p)
- -{
- - pthread_mutex_lock (& mutex);
- -
- - if (! stop_flag)
- - {
- - stop_flag = TRUE;
- - p->output->abort_write ();
- - }
- -
- - pthread_mutex_unlock (& mutex);
- -}
- -
- -static void file_mseek (InputPlayback * p, int time)
- -{
- - pthread_mutex_lock (& mutex);
- -
- - if (! stop_flag)
- - {
- - seek_value = time;
- - p->output->abort_write();
- - }
- -
- - pthread_mutex_unlock (& mutex);
- -}
- -
- static int
- is_our_file_from_vfs(const char *filename, VFSFile *fin)
- {
- @@ -436,12 +372,9 @@ AUD_INPUT_PLUGIN
- .domain = PACKAGE,
- .about_text = plugin_about,
- .play = play_start,
- - .stop = play_stop,
- - .pause = play_pause,
- .probe_for_tuple = get_song_tuple,
- .is_our_file_from_vfs = is_our_file_from_vfs,
- .extensions = sndfile_fmts,
- - .mseek = file_mseek,
- /* low priority fallback (but before ffaudio) */
- .priority = 9,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement