DecoderAPI: add decoder_seek_where_ms()

Move to fixed-point integers instead of floating point.
This commit is contained in:
Max Kellermann 2014-08-26 11:02:02 +02:00
parent 9da88eec3e
commit 316c72a4ae
3 changed files with 33 additions and 0 deletions

View File

@ -220,6 +220,23 @@ double decoder_seek_where(gcc_unused Decoder & decoder)
return dc.seek_where; return dc.seek_where;
} }
unsigned
decoder_seek_where_ms(Decoder &decoder)
{
const DecoderControl &dc = decoder.dc;
assert(dc.pipe != nullptr);
if (decoder.initial_seek_running)
return dc.start_ms;
assert(dc.command == DecoderCommand::SEEK);
decoder.seeking = true;
return unsigned(dc.seek_where * 1000);
}
void decoder_seek_error(Decoder & decoder) void decoder_seek_error(Decoder & decoder)
{ {
DecoderControl &dc = decoder.dc; DecoderControl &dc = decoder.dc;

View File

@ -88,6 +88,16 @@ gcc_pure
double double
decoder_seek_where(Decoder &decoder); decoder_seek_where(Decoder &decoder);
/**
* Call this when you have received the DecoderCommand::SEEK command.
*
* @param decoder the decoder object
* @return the destination position for the seek in milliseconds
*/
gcc_pure
unsigned
decoder_seek_where_ms(Decoder &decoder);
/** /**
* Call this instead of decoder_command_finished() when seeking has * Call this instead of decoder_command_finished() when seeking has
* failed. * failed.

View File

@ -61,6 +61,12 @@ decoder_seek_where(gcc_unused Decoder &decoder)
return 1.0; return 1.0;
} }
unsigned
decoder_seek_where_ms(gcc_unused Decoder &decoder)
{
return 1;
}
void void
decoder_seek_error(gcc_unused Decoder &decoder) decoder_seek_error(gcc_unused Decoder &decoder)
{ {