static int seekCallback(void *user_handle, long offset, int whence) { BufferQueue *bq = (BufferQueue *)user_handle; int64_t pos; switch (whence) { case SEEK_SET: pos = offset; break; case SEEK_CUR: pos = bq_tell(bq) + offset; break; case SEEK_END: // not implemented default: return -1; } if (bq_seek(bq, pos)) { printf("Buffer seek failure in ogg demuxer; %lld (%ld %d)\n", pos, offset, whence); return -1; } else { return (long)pos; } }
int64_t bq_headroom(BufferQueue *queue) { return bq_end(queue) - bq_tell(queue); }
static long tellCallback(void *user_handle) { BufferQueue *bq = (BufferQueue *)user_handle; return (long)bq_tell(bq); }