ogg: get decoder command from decoder_data()
Eliminate two decoder_get_command() invocations from the main loop.
This commit is contained in:
parent
7b575b55c2
commit
0cba1ae312
@ -214,6 +214,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
|
|||||||
char **comments;
|
char **comments;
|
||||||
const char *errorStr;
|
const char *errorStr;
|
||||||
bool initialized = false;
|
bool initialized = false;
|
||||||
|
enum decoder_command cmd = DECODE_COMMAND_NONE;
|
||||||
|
|
||||||
if (ogg_stream_type_detect(inStream) != VORBIS)
|
if (ogg_stream_type_detect(inStream) != VORBIS)
|
||||||
return;
|
return;
|
||||||
@ -259,8 +260,8 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
|
|||||||
}
|
}
|
||||||
audio_format.bits = 16;
|
audio_format.bits = 16;
|
||||||
|
|
||||||
while (true) {
|
do {
|
||||||
if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK) {
|
if (cmd == DECODE_COMMAND_SEEK) {
|
||||||
double seek_where = decoder_seek_where(decoder);
|
double seek_where = decoder_seek_where(decoder);
|
||||||
if (0 == ov_time_seek_page(&vf, seek_where)) {
|
if (0 == ov_time_seek_page(&vf, seek_where)) {
|
||||||
decoder_command_finished(decoder);
|
decoder_command_finished(decoder);
|
||||||
@ -309,13 +310,11 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
|
|||||||
if ((test = ov_bitrate_instant(&vf)) > 0)
|
if ((test = ov_bitrate_instant(&vf)) > 0)
|
||||||
bitRate = test / 1000;
|
bitRate = test / 1000;
|
||||||
|
|
||||||
decoder_data(decoder, inStream,
|
cmd = decoder_data(decoder, inStream,
|
||||||
chunk, ret,
|
chunk, ret,
|
||||||
ov_pcm_tell(&vf) / audio_format.sample_rate,
|
ov_pcm_tell(&vf) / audio_format.sample_rate,
|
||||||
bitRate, replayGainInfo);
|
bitRate, replayGainInfo);
|
||||||
if (decoder_get_command(decoder) == DECODE_COMMAND_STOP)
|
} while (cmd != DECODE_COMMAND_STOP);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (replayGainInfo)
|
if (replayGainInfo)
|
||||||
replay_gain_info_free(replayGainInfo);
|
replay_gain_info_free(replayGainInfo);
|
||||||
|
Loading…
Reference in New Issue
Block a user