aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugins/mp4_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-26 08:27:07 +0200
committerMax Kellermann <max@duempel.org>2008-08-26 08:27:07 +0200
commit17e9cc84c5f94c94c71b2a808b57d4655ee21d12 (patch)
treefbb3c0e6ac5af307ae7e5a4ca4ca525f904d5740 /src/inputPlugins/mp4_plugin.c
parent78c55e24324c881541a87cd0003c60f378a43d68 (diff)
downloadmpd-17e9cc84c5f94c94c71b2a808b57d4655ee21d12.tar.gz
mpd-17e9cc84c5f94c94c71b2a808b57d4655ee21d12.tar.xz
mpd-17e9cc84c5f94c94c71b2a808b57d4655ee21d12.zip
added decoder_seek_where() and decoder_seek_error()
Provide access to seeking for the decoder plugins; they have to know where to seek, and they need a way to tell us that seeking has failed.
Diffstat (limited to '')
-rw-r--r--src/inputPlugins/mp4_plugin.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/inputPlugins/mp4_plugin.c b/src/inputPlugins/mp4_plugin.c
index 2ebb2a49e..8b468168b 100644
--- a/src/inputPlugins/mp4_plugin.c
+++ b/src/inputPlugins/mp4_plugin.c
@@ -106,6 +106,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream)
long offset;
mpd_uint16 bitRate = 0;
int seeking = 0;
+ double seek_where = 0;
mp4cb = xmalloc(sizeof(mp4ff_callback_t));
mp4cb->read = mp4_inputStreamReadCallback;
@@ -178,13 +179,15 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream)
seekTable = xmalloc(sizeof(float) * numSamples);
for (sampleId = 0; sampleId < numSamples; sampleId++) {
- if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK)
+ if (decoder_get_command(mpd_decoder) == DECODE_COMMAND_SEEK) {
seeking = 1;
+ seek_where = decoder_seek_where(mpd_decoder);
+ }
if (seeking && seekTableEnd > 1 &&
- seekTable[seekTableEnd] >= dc.seekWhere) {
+ seekTable[seekTableEnd] >= seek_where) {
int i = 2;
- while (seekTable[i] < dc.seekWhere)
+ while (seekTable[i] < seek_where)
i++;
sampleId = i - 1;
file_time = seekTable[sampleId];
@@ -206,7 +209,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream)
dur -= offset;
file_time += ((float)dur) / scale;
- if (seeking && file_time > dc.seekWhere)
+ if (seeking && file_time > seek_where)
seekPositionFound = 1;
if (seeking && seekPositionFound) {