mpg123 decoder: implement seeking
This commit is contained in:
parent
731ea9b489
commit
9ae3acf2e7
2
NEWS
2
NEWS
|
@ -1,6 +1,8 @@
|
||||||
ver 0.17 (2010/??/??)
|
ver 0.17 (2010/??/??)
|
||||||
* input:
|
* input:
|
||||||
- cdio_paranoia: new input plugin to play audio CDs
|
- cdio_paranoia: new input plugin to play audio CDs
|
||||||
|
* decoder:
|
||||||
|
- mpg123: implement seeking
|
||||||
* output:
|
* output:
|
||||||
- osx: allow user to specify other audio devices
|
- osx: allow user to specify other audio devices
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#include <mpg123.h>
|
#include <mpg123.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#undef G_LOG_DOMAIN
|
#undef G_LOG_DOMAIN
|
||||||
#define G_LOG_DOMAIN "mpg123"
|
#define G_LOG_DOMAIN "mpg123"
|
||||||
|
@ -125,7 +126,7 @@ mpd_mpg123_file_decode(struct decoder *decoder, const char *path_fs)
|
||||||
|
|
||||||
/* tell MPD core we're ready */
|
/* tell MPD core we're ready */
|
||||||
|
|
||||||
decoder_initialized(decoder, &audio_format, false,
|
decoder_initialized(decoder, &audio_format, true,
|
||||||
(float)num_samples /
|
(float)num_samples /
|
||||||
(float)audio_format.sample_rate);
|
(float)audio_format.sample_rate);
|
||||||
|
|
||||||
|
@ -172,7 +173,18 @@ mpd_mpg123_file_decode(struct decoder *decoder, const char *path_fs)
|
||||||
|
|
||||||
cmd = decoder_data(decoder, NULL, buffer, nbytes, info.bitrate);
|
cmd = decoder_data(decoder, NULL, buffer, nbytes, info.bitrate);
|
||||||
|
|
||||||
/* seeking not yet implemented */
|
if (cmd == DECODE_COMMAND_SEEK) {
|
||||||
|
off_t c = decoder_seek_where(decoder)*audio_format.sample_rate;
|
||||||
|
c = mpg123_seek(handle, c, SEEK_SET);
|
||||||
|
if (c < 0)
|
||||||
|
decoder_seek_error(decoder);
|
||||||
|
else {
|
||||||
|
decoder_command_finished(decoder);
|
||||||
|
decoder_timestamp(decoder, c/(double)audio_format.sample_rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd = DECODE_COMMAND_NONE;
|
||||||
|
}
|
||||||
} while (cmd == DECODE_COMMAND_NONE);
|
} while (cmd == DECODE_COMMAND_NONE);
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
|
|
Loading…
Reference in New Issue