Commit 1381c17e authored by conrad's avatar conrad
Browse files

fixed oggz_purge to not attempt seek if no io input


git-svn-id: http://svn.annodex.net/liboggz/trunk@378 8158c8cd-e7e1-0310-9fa4-c5954c97daef
parent c91d2ebd
...@@ -476,8 +476,14 @@ oggz_stream_reset (void * data) ...@@ -476,8 +476,14 @@ oggz_stream_reset (void * data)
return 0; return 0;
} }
static void
oggz_reset_streams (OGGZ * oggz)
{
oggz_vector_foreach (oggz->streams, oggz_stream_reset);
}
static long static long
oggz_reset (OGGZ * oggz, oggz_off_t offset, ogg_int64_t unit, int whence) oggz_reset_seek (OGGZ * oggz, oggz_off_t offset, ogg_int64_t unit, int whence)
{ {
OggzReader * reader = &oggz->x.reader; OggzReader * reader = &oggz->x.reader;
...@@ -492,18 +498,18 @@ oggz_reset (OGGZ * oggz, oggz_off_t offset, ogg_int64_t unit, int whence) ...@@ -492,18 +498,18 @@ oggz_reset (OGGZ * oggz, oggz_off_t offset, ogg_int64_t unit, int whence)
printf ("reset to %ld\n", offset_at); printf ("reset to %ld\n", offset_at);
#endif #endif
oggz_vector_foreach (oggz->streams, oggz_stream_reset);
#if 0
ogg_stream_reset (&oggz->ogg_stream);
/* ogg_stream_reset_serialno (&oggz->ogg_stream, oggz->anno_serialno);*/
#endif
if (unit != -1) reader->current_unit = unit; if (unit != -1) reader->current_unit = unit;
return offset_at; return offset_at;
} }
static long
oggz_reset (OGGZ * oggz, oggz_off_t offset, ogg_int64_t unit, int whence)
{
oggz_reset_streams (oggz);
return oggz_reset_seek (oggz, offset, unit, whence);
}
int int
oggz_purge (OGGZ * oggz) oggz_purge (OGGZ * oggz)
{ {
...@@ -515,7 +521,9 @@ oggz_purge (OGGZ * oggz) ...@@ -515,7 +521,9 @@ oggz_purge (OGGZ * oggz)
return OGGZ_ERR_INVALID; return OGGZ_ERR_INVALID;
} }
if (oggz_reset (oggz, oggz->offset, -1, SEEK_SET) < 0) { oggz_reset_streams (oggz);
if (oggz->file && oggz_reset (oggz, oggz->offset, -1, SEEK_SET) < 0) {
return OGGZ_ERR_SYSTEM; return OGGZ_ERR_SYSTEM;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment