parent
b3dfcfef52
commit
863badd91e
|
@ -43,7 +43,7 @@ void decoder_initialized(struct decoder * decoder,
|
|||
getOutputAudioFormat(audio_format, &dc.out_audio_format);
|
||||
|
||||
dc.seekable = seekable;
|
||||
dc.totalTime = total_time;
|
||||
dc.total_time = total_time;
|
||||
|
||||
dc.state = DECODE_STATE_DECODE;
|
||||
notify_signal(&pc.notify);
|
||||
|
@ -63,7 +63,7 @@ void decoder_command_finished(mpd_unused struct decoder * decoder)
|
|||
{
|
||||
assert(dc.command != DECODE_COMMAND_NONE);
|
||||
assert(dc.command != DECODE_COMMAND_SEEK ||
|
||||
dc.seekError || decoder->seeking);
|
||||
dc.seek_error || decoder->seeking);
|
||||
|
||||
if (dc.command == DECODE_COMMAND_SEEK)
|
||||
/* delete frames from the old song position */
|
||||
|
@ -79,14 +79,14 @@ double decoder_seek_where(mpd_unused struct decoder * decoder)
|
|||
|
||||
decoder->seeking = true;
|
||||
|
||||
return dc.seekWhere;
|
||||
return dc.seek_where;
|
||||
}
|
||||
|
||||
void decoder_seek_error(struct decoder * decoder)
|
||||
{
|
||||
assert(dc.command == DECODE_COMMAND_SEEK);
|
||||
|
||||
dc.seekError = true;
|
||||
dc.seek_error = true;
|
||||
decoder_command_finished(decoder);
|
||||
}
|
||||
|
||||
|
|
|
@ -93,11 +93,11 @@ dc_seek(struct notify *notify, double where)
|
|||
if (dc.state == DECODE_STATE_STOP || !dc.seekable)
|
||||
return false;
|
||||
|
||||
dc.seekWhere = where;
|
||||
dc.seekError = false;
|
||||
dc.seek_where = where;
|
||||
dc.seek_error = false;
|
||||
dc_command(notify, DECODE_COMMAND_SEEK);
|
||||
|
||||
if (dc.seekError)
|
||||
if (dc.seek_error)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -44,9 +44,9 @@ struct decoder_control {
|
|||
volatile enum decoder_state state;
|
||||
volatile enum decoder_command command;
|
||||
volatile uint16_t error;
|
||||
bool seekError;
|
||||
bool seek_error;
|
||||
bool seekable;
|
||||
volatile double seekWhere;
|
||||
volatile double seek_where;
|
||||
|
||||
/** the format of the song file */
|
||||
struct audio_format in_audio_format;
|
||||
|
@ -56,7 +56,7 @@ struct decoder_control {
|
|||
|
||||
struct song *current_song;
|
||||
struct song *volatile next_song;
|
||||
volatile float totalTime;
|
||||
volatile float total_time;
|
||||
};
|
||||
|
||||
extern struct decoder_control dc;
|
||||
|
|
|
@ -45,7 +45,7 @@ decoder_try_decode(const struct decoder_plugin *plugin,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void decodeStart(void)
|
||||
static void decoder_run(void)
|
||||
{
|
||||
struct song *song = dc.next_song;
|
||||
char buffer[MPD_PATH_MAX];
|
||||
|
@ -53,7 +53,7 @@ static void decodeStart(void)
|
|||
struct decoder decoder;
|
||||
int ret;
|
||||
bool close_instream = true;
|
||||
struct input_stream inStream;
|
||||
struct input_stream input_stream;
|
||||
const struct decoder_plugin *plugin;
|
||||
|
||||
if (song_is_file(song))
|
||||
|
@ -66,7 +66,7 @@ static void decodeStart(void)
|
|||
}
|
||||
|
||||
dc.current_song = dc.next_song; /* NEED LOCK */
|
||||
if (!input_stream_open(&inStream, uri)) {
|
||||
if (!input_stream_open(&input_stream, uri)) {
|
||||
dc.error = DECODE_ERROR_FILE;
|
||||
return;
|
||||
}
|
||||
|
@ -81,21 +81,21 @@ static void decodeStart(void)
|
|||
/* wait for the input stream to become ready; its metadata
|
||||
will be available then */
|
||||
|
||||
while (!inStream.ready) {
|
||||
while (!input_stream.ready) {
|
||||
if (dc.command != DECODE_COMMAND_NONE) {
|
||||
input_stream_close(&inStream);
|
||||
input_stream_close(&input_stream);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = input_stream_buffer(&inStream);
|
||||
ret = input_stream_buffer(&input_stream);
|
||||
if (ret < 0) {
|
||||
input_stream_close(&inStream);
|
||||
input_stream_close(&input_stream);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (dc.command == DECODE_COMMAND_STOP) {
|
||||
input_stream_close(&inStream);
|
||||
input_stream_close(&input_stream);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -104,14 +104,14 @@ static void decodeStart(void)
|
|||
unsigned int next = 0;
|
||||
|
||||
/* first we try mime types: */
|
||||
while ((plugin = decoder_plugin_from_mime_type(inStream.mime, next++))) {
|
||||
while ((plugin = decoder_plugin_from_mime_type(input_stream.mime, next++))) {
|
||||
if (plugin->stream_decode == NULL)
|
||||
continue;
|
||||
if (!(plugin->stream_types & INPUT_PLUGIN_STREAM_URL))
|
||||
continue;
|
||||
if (!decoder_try_decode(plugin, &inStream))
|
||||
if (!decoder_try_decode(plugin, &input_stream))
|
||||
continue;
|
||||
ret = plugin->stream_decode(&decoder, &inStream);
|
||||
ret = plugin->stream_decode(&decoder, &input_stream);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -125,11 +125,11 @@ static void decodeStart(void)
|
|||
if (!(plugin->stream_types &
|
||||
INPUT_PLUGIN_STREAM_URL))
|
||||
continue;
|
||||
if (!decoder_try_decode(plugin, &inStream))
|
||||
if (!decoder_try_decode(plugin, &input_stream))
|
||||
continue;
|
||||
decoder.plugin = plugin;
|
||||
ret = plugin->stream_decode(&decoder,
|
||||
&inStream);
|
||||
&input_stream);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ static void decodeStart(void)
|
|||
if ((plugin = decoder_plugin_from_name("mp3"))) {
|
||||
decoder.plugin = plugin;
|
||||
ret = plugin->stream_decode(&decoder,
|
||||
&inStream);
|
||||
&input_stream);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -152,11 +152,11 @@ static void decodeStart(void)
|
|||
if (!plugin->stream_types & INPUT_PLUGIN_STREAM_FILE)
|
||||
continue;
|
||||
|
||||
if (!decoder_try_decode(plugin, &inStream))
|
||||
if (!decoder_try_decode(plugin, &input_stream))
|
||||
continue;
|
||||
|
||||
if (plugin->file_decode != NULL) {
|
||||
input_stream_close(&inStream);
|
||||
input_stream_close(&input_stream);
|
||||
close_instream = false;
|
||||
decoder.plugin = plugin;
|
||||
ret = plugin->file_decode(&decoder, uri);
|
||||
|
@ -164,7 +164,7 @@ static void decodeStart(void)
|
|||
} else if (plugin->stream_decode != NULL) {
|
||||
decoder.plugin = plugin;
|
||||
ret = plugin->stream_decode(&decoder,
|
||||
&inStream);
|
||||
&input_stream);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ static void decodeStart(void)
|
|||
}
|
||||
|
||||
if (close_instream)
|
||||
input_stream_close(&inStream);
|
||||
input_stream_close(&input_stream);
|
||||
}
|
||||
|
||||
static void * decoder_task(mpd_unused void *arg)
|
||||
|
@ -190,7 +190,7 @@ static void * decoder_task(mpd_unused void *arg)
|
|||
switch (dc.command) {
|
||||
case DECODE_COMMAND_START:
|
||||
case DECODE_COMMAND_SEEK:
|
||||
decodeStart();
|
||||
decoder_run();
|
||||
|
||||
dc.state = DECODE_STATE_STOP;
|
||||
dc.command = DECODE_COMMAND_NONE;
|
||||
|
|
|
@ -329,7 +329,7 @@ static void do_play(void)
|
|||
if (player.paused)
|
||||
closeAudioDevice();
|
||||
|
||||
pc.totalTime = dc.totalTime;
|
||||
pc.totalTime = dc.total_time;
|
||||
pc.audio_format = dc.in_audio_format;
|
||||
play_audio_format = dc.out_audio_format;
|
||||
sizeToTime = audioFormatSizeToTime(&dc.out_audio_format);
|
||||
|
@ -367,7 +367,7 @@ static void do_play(void)
|
|||
calculate how many chunks will be required
|
||||
for it */
|
||||
crossFadeChunks =
|
||||
cross_fade_calc(pc.crossFade, dc.totalTime,
|
||||
cross_fade_calc(pc.crossFade, dc.total_time,
|
||||
&dc.out_audio_format,
|
||||
music_pipe_size() -
|
||||
pc.buffered_before_play);
|
||||
|
|
Loading…
Reference in New Issue