зеркало из https://github.com/mozilla/pjs.git
Bug 462916 - Update liboggplay to pick up ability to compute Ogg duration - r+sr=roc
This commit is contained in:
Родитель
f583d46766
Коммит
b14f3be879
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче