Bug 462916 - Update liboggplay to pick up ability to compute Ogg duration - r+sr=roc

This commit is contained in:
Chris Double 2008-11-04 21:06:40 +13:00
Родитель 9acf5d118f
Коммит 3aabf1eedb
8 изменённых файлов: 15 добавлений и 20 удалений

Просмотреть файл

@ -87,7 +87,6 @@ public:
size_t io_read(char* aBuffer, size_t aCount);
int io_seek(long aOffset, int aWhence);
long io_tell();
int duration();
public:
nsMediaStream mStream;

Просмотреть файл

@ -100,11 +100,6 @@ long nsChannelReader::io_tell()
return mStream.Tell();
}
int nsChannelReader::duration()
{
return 3600000; // TODO: implement correctly
}
static OggPlayErrorCode oggplay_channel_reader_initialise(OggPlayReader* aReader, int aBlock)
{
nsChannelReader * me = static_cast<nsChannelReader*>(aReader);
@ -141,12 +136,6 @@ static long oggplay_channel_reader_io_tell(void* aReader)
return me->io_tell();
}
static int oggplay_channel_reader_duration(OggPlayReader* aReader)
{
nsChannelReader* me = static_cast<nsChannelReader*>(aReader);
return me->duration();
}
nsresult nsChannelReader::Init(nsMediaDecoder* aDecoder, nsIURI* aURI,
nsIChannel* aChannel,
nsIStreamListener** aStreamListener)
@ -170,7 +159,7 @@ nsChannelReader::nsChannelReader()
reader->io_read = &oggplay_channel_reader_io_read;
reader->io_seek = &oggplay_channel_reader_io_seek;
reader->io_tell = &oggplay_channel_reader_io_tell;
reader->duration = &oggplay_channel_reader_duration;
reader->duration = nsnull;
}
nsIPrincipal*

Просмотреть файл

@ -5,7 +5,7 @@ the Mozilla build system.
http://svn.annodex.net/liboggplay/trunk/
The svn revision number used was r3757.
The svn revision number used was r3761.
The patch from Annodex trac ticket 421 is applied to fix bug 459938:
http://trac.annodex.net/ticket/421

Просмотреть файл

@ -134,7 +134,7 @@ oggplay_close(OggPlay *player);
int
oggplay_get_available(OggPlay *player);
int
ogg_int64_t
oggplay_get_duration(OggPlay * player);
int

Просмотреть файл

@ -54,7 +54,7 @@ typedef struct _OggPlayReader {
int (*available)(struct _OggPlayReader *me,
ogg_int64_t current_bytes,
ogg_int64_t current_time);
int (*duration)(struct _OggPlayReader *me);
ogg_int64_t (*duration)(struct _OggPlayReader *me);
int (*finished_retrieving)(struct _OggPlayReader *me);
/* low-level io functions for oggz */

Просмотреть файл

@ -634,14 +634,21 @@ oggplay_get_available(OggPlay *me) {
}
int
ogg_int64_t
oggplay_get_duration(OggPlay *me) {
if (me == NULL) {
return E_OGGPLAY_BAD_OGGPLAY;
}
return me->reader->duration(me->reader);
if (me->reader->duration)
return me->reader->duration(me->reader);
else {
ogg_int64_t pos = oggz_tell_units(me->oggz);
ogg_int64_t duration = oggz_seek_units(me->oggz, 0, SEEK_END);
oggz_seek_units(me->oggz, pos, SEEK_SET);
return duration;
}
}
int

Просмотреть файл

@ -55,7 +55,7 @@ oggplay_seek(OggPlay *me, ogg_int64_t milliseconds) {
return E_OGGPLAY_CANT_SEEK;
}
eof = me->reader->duration(me->reader);
eof = oggplay_get_duration(me);
if (eof > -1 && milliseconds > eof) {
return E_OGGPLAY_CANT_SEEK;
}

Просмотреть файл

@ -597,7 +597,7 @@ oggplay_tcp_reader_available(OggPlayReader * opr, ogg_int64_t current_bytes,
}
int
ogg_int64_t
oggplay_tcp_reader_duration(OggPlayReader * opr) {
OggPlayTCPReader *me = (OggPlayTCPReader *)opr;
return me->duration;