[xiph-commits] r3001 - in liboggplay/trunk: include/oggplay
src/liboggplay
shans at svn.annodex.net
shans at svn.annodex.net
Tue Jun 19 03:47:46 PDT 2007
Author: shans
Date: 2007-06-19 03:47:46 -0700 (Tue, 19 Jun 2007)
New Revision: 3001
Modified:
liboggplay/trunk/include/oggplay/oggplay_reader.h
liboggplay/trunk/src/liboggplay/oggplay_file_reader.c
liboggplay/trunk/src/liboggplay/oggplay_seek.c
liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c
Log:
Seek code calls through to readers
Null implementation for seeking in tcp and file readers
io_seek and io_tell implementation for file reader
Modified: liboggplay/trunk/include/oggplay/oggplay_reader.h
===================================================================
--- liboggplay/trunk/include/oggplay/oggplay_reader.h 2007-06-19 09:26:41 UTC (rev 3000)
+++ liboggplay/trunk/include/oggplay/oggplay_reader.h 2007-06-19 10:47:46 UTC (rev 3001)
@@ -41,12 +41,17 @@
#define __OGGPLAY_READER_H__
#include <stdlib.h>
+#include <oggz/oggz.h>
struct _OggPlayReader;
typedef struct _OggPlayReader {
OggPlayErrorCode (*initialise)(struct _OggPlayReader * me, int block);
OggPlayErrorCode (*destroy)(struct _OggPlayReader * me);
+ OggPlayErrorCode (*seek)(struct _OggPlayReader *me, OGGZ *oggz,
+ ogg_int64_t milliseconds);
+
+ /* low-level io functions for oggz */
size_t (*io_read)(void *user_handle, void *buf, size_t n);
int (*io_seek)(void *user_handle, long offset, int whence);
long (*io_tell)(void *user_handle);
Modified: liboggplay/trunk/src/liboggplay/oggplay_file_reader.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_file_reader.c 2007-06-19 09:26:41 UTC (rev 3000)
+++ liboggplay/trunk/src/liboggplay/oggplay_file_reader.c 2007-06-19 10:47:46 UTC (rev 3001)
@@ -77,6 +77,14 @@
return E_OGGPLAY_OK;
}
+static int
+oggplay_file_reader_seek(OggPlayReader * handle, OGGZ * oggz,
+ ogg_int64_t milliseconds) {
+
+ return E_OGGPLAY_CANT_SEEK;
+
+}
+
static size_t
oggplay_file_reader_io_read(void * user_handle, void * buf, size_t n) {
@@ -90,6 +98,27 @@
return r;
}
+static int
+oggplay_file_reader_io_seek(void * user_handle, long offset, int whence) {
+
+ OggPlayFileReader * me = (OggPlayFileReader *)user_handle;
+ int r;
+
+ r = fseek(me->file, offset, whence);
+ me->current_position = ftell(me->file);
+ return r;
+
+}
+
+static long
+oggplay_file_reader_io_tell(void * user_handle) {
+
+ OggPlayFileReader * me = (OggPlayFileReader *)user_handle;
+
+ return ftell(me->file);
+
+}
+
OggPlayReader *
oggplay_file_reader_new(char *file_name) {
@@ -101,7 +130,10 @@
me->functions.initialise = &oggplay_file_reader_initialise;
me->functions.destroy = &oggplay_file_reader_destroy;
+ me->functions.seek = &oggplay_file_reader_seek;
me->functions.io_read = &oggplay_file_reader_io_read;
+ me->functions.io_seek = &oggplay_file_reader_io_seek;
+ me->functions.io_tell = &oggplay_file_reader_io_tell;
return (OggPlayReader *)me;
Modified: liboggplay/trunk/src/liboggplay/oggplay_seek.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_seek.c 2007-06-19 09:26:41 UTC (rev 3000)
+++ liboggplay/trunk/src/liboggplay/oggplay_seek.c 2007-06-19 10:47:46 UTC (rev 3001)
@@ -45,6 +45,16 @@
return E_OGGPLAY_BAD_OGGPLAY;
}
- return E_OGGPLAY_CANT_SEEK;
+ if
+ (
+ me->reader->seek(me->reader, me->oggz, milliseconds)
+ ==
+ E_OGGPLAY_CANT_SEEK
+ )
+ {
+ return E_OGGPLAY_CANT_SEEK;
+ }
+ return E_OGGPLAY_OK;
+
}
Modified: liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c 2007-06-19 09:26:41 UTC (rev 3000)
+++ liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c 2007-06-19 10:47:46 UTC (rev 3001)
@@ -582,6 +582,14 @@
}
static int
+oggplay_tcp_reader_seek(OggPlayReader * handle, OGGZ * oggz,
+ ogg_int64_t milliseconds) {
+
+ return E_OGGPLAY_CANT_SEEK;
+
+}
+
+static int
oggplay_tcp_reader_io_seek(void * user_handle, long offset, int whence) {
OggPlayTCPReader * me = (OggPlayTCPReader *)user_handle;
@@ -654,6 +662,7 @@
me->functions.initialise = &oggplay_tcp_reader_initialise;
me->functions.destroy = &oggplay_tcp_reader_destroy;
+ me->functions.seek = &oggplay_tcp_reader_seek;
me->functions.io_read = &oggplay_tcp_reader_io_read;
me->functions.io_seek = &oggplay_tcp_reader_io_seek;
me->functions.io_tell = &oggplay_tcp_reader_io_tell;
More information about the commits
mailing list