diff options
-rw-r--r-- | plugins.c | 13 | ||||
-rw-r--r-- | plugins/nullout/nullout.c | 47 | ||||
-rwxr-xr-x | scripts/configure_minimal.sh | 2 | ||||
-rw-r--r-- | streamer.c | 19 |
4 files changed, 27 insertions, 54 deletions
@@ -937,19 +937,22 @@ plug_select_output (void) { void plug_reinit_sound (void) { - DB_output_t *output = plug_get_output (); - int state = output->state (); + DB_output_t *prev = plug_get_output (); + int state = OUTPUT_STATE_STOPPED; - output->free (); + if (prev) { + state = prev->state (); + prev->free (); + } - DB_output_t *prev = plug_get_output (); if (plug_select_output () < 0) { const char *outplugname = conf_get_str ("output_plugin", "ALSA output plugin"); trace ("failed to select output plugin %s\nreverted to %s\n", outplugname, prev->plugin.name); output_plugin = prev; } - streamer_reset (1); + DB_output_t *output = plug_get_output (); if (output->init () < 0) { + streamer_reset (1); streamer_set_nextsong (-2, 0); return; } diff --git a/plugins/nullout/nullout.c b/plugins/nullout/nullout.c index 9df5d9d5..627f8a98 100644 --- a/plugins/nullout/nullout.c +++ b/plugins/nullout/nullout.c @@ -32,7 +32,6 @@ DB_functions_t *deadbeef; static intptr_t null_tid; static int null_terminate; -static int null_rate; static int state; static void @@ -47,8 +46,8 @@ pnull_init (void); static int pnull_free (void); -static int -pnull_change_rate (int rate); +void +pnull_setformat (ddb_waveformat_t *fmt); static int pnull_play (void); @@ -62,32 +61,18 @@ pnull_pause (void); static int pnull_unpause (void); -static int -pnull_get_rate (void); - -static int -pnull_get_bps (void); - -static int -pnull_get_channels (void); - -static int -pnull_get_endianness (void); - int pnull_init (void) { trace ("pnull_init\n"); state = OUTPUT_STATE_STOPPED; - null_rate = 44100; null_terminate = 0; null_tid = deadbeef->thread_start (pnull_thread, NULL); return 0; } -int -pnull_change_rate (int rate) { - null_rate = rate; - return null_rate; +void +pnull_setformat (ddb_waveformat_t *fmt) { + memcpy (&plugin.fmt, fmt, sizeof (ddb_waveformat_t)); } int @@ -140,21 +125,6 @@ pnull_unpause (void) { return 0; } -int -pnull_get_rate (void) { - return null_rate; -} - -int -pnull_get_bps (void) { - return 16; -} - -int -pnull_get_channels (void) { - return 2; -} - static int pnull_get_endianness (void) { #if WORDS_BIGENDIAN @@ -233,14 +203,11 @@ static DB_output_t plugin = { .plugin.stop = null_stop, .init = pnull_init, .free = pnull_free, - .change_rate = pnull_change_rate, + .setformat = pnull_setformat, .play = pnull_play, .stop = pnull_stop, .pause = pnull_pause, .unpause = pnull_unpause, .state = pnull_get_state, - .samplerate = pnull_get_rate, - .bitspersample = pnull_get_bps, - .channels = pnull_get_channels, - .endianness = pnull_get_endianness, + .fmt = {.samplerate = 44100, .channels = 2, .bps = 16, .channelmask = DDB_SPEAKER_FRONT_LEFT | DDB_SPEAKER_FRONT_RIGHT} }; diff --git a/scripts/configure_minimal.sh b/scripts/configure_minimal.sh index e5c989e8..7724f20a 100755 --- a/scripts/configure_minimal.sh +++ b/scripts/configure_minimal.sh @@ -1 +1 @@ -./configure --enable-maintainer-mode --disable-nullout --disable-oss --disable-mms --disable-artwork --disable-lfm --disable-vfs-curl --disable-hotkeys --disable-notify --disable-shellexec +./configure --enable-maintainer-mode --disable-oss --disable-mms --disable-artwork --disable-lfm --disable-vfs-curl --disable-hotkeys --disable-notify --disable-shellexec @@ -1196,21 +1196,24 @@ streamer_reset (int full) { // must be called when current song changes by exter } if (full) { streamer_lock (); + if (prevformat.samplerate) { + DB_output_t *output = plug_get_output (); + if (output) { + output->setformat (&prevformat); + } + } streambuffer_pos = 0; streambuffer_fill = 0; streamer_unlock (); } - srcplug->reset (src, 1); -#if 0 // !!!! FIXME !!!! // reset dsp - DB_dsp_t **dsp = deadbeef->plug_get_dsp_list (); - //int srate = output->fmt.samplerate; - for (int i = 0; dsp[i]; i++) { - if (dsp[i]->enabled ()) { - dsp[i]->reset (); + DB_dsp_instance_t *dsp = dsp_chain; + while (dsp) { + if (dsp->plugin->reset) { + dsp->plugin->reset (dsp); } + dsp = dsp->next; } -#endif } int replaygain = 1; |