Back to index

avfs  1.0.1
Functions
bzfile.h File Reference
#include "avfs.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

avssize_t av_bzfile_pread (struct bzfile *fil, struct bzcache *zc, char *buf, avsize_t nbyte, avoff_t offset)
struct bzfileav_bzfile_new (vfile *vf)
int av_bzfile_size (struct bzfile *fil, struct bzcache *zc, avoff_t *sizep)
struct bzcacheav_bzcache_new ()

Function Documentation

struct bzcache* av_bzcache_new ( ) [read]

Definition at line 509 of file bzread.c.

{
    struct bzcache *zc;

    AV_NEW_OBJ(zc, bzcache_destroy);
    zc->numindex = 0;
    zc->indexes = NULL;
    zc->size = -1;

    AV_LOCK(bzread_lock);
    if(bzread_nextid == 0)
        bzread_nextid = 1;

    zc->id = bzread_nextid ++;
    AV_UNLOCK(bzread_lock);
    
    return zc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct bzfile* av_bzfile_new ( vfile *  vf) [read]

Definition at line 486 of file bzread.c.

{
    int res;
    struct bzfile *fil;

    AV_NEW_OBJ(fil, bzfile_destroy);
    fil->iseof = 0;
    fil->iserror = 0;
    fil->infile = vf;
    fil->id = 0;

    res = bz_new_stream(&fil->s);
    if(res < 0)
        fil->iserror = 1;

    return fil;
}

Here is the call graph for this function:

Here is the caller graph for this function:

avssize_t av_bzfile_pread ( struct bzfile fil,
struct bzcache zc,
char *  buf,
avsize_t  nbyte,
avoff_t  offset 
)

Definition at line 421 of file bzread.c.

{
    avssize_t res;

    if(fil->iserror)
        return -EIO;

    res = av_bzfile_do_pread(fil, zc, buf, nbyte, offset);
    if(res < 0)
        fil->iserror = 1;

    return res;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int av_bzfile_size ( struct bzfile fil,
struct bzcache zc,
avoff_t sizep 
)

Definition at line 436 of file bzread.c.

{
    int res;
    avoff_t size;

    AV_LOCK(bzread_lock);
    size = zc->size;
    AV_UNLOCK(bzread_lock);

    if(size != -1 || fil == NULL) {
        *sizep = size;
        return 0;
    }

    fil->id = zc->id;

    AV_LOCK(bzread_lock);
#ifndef USE_SYSTEM_BZLIB
    res = bzfile_seek(fil, zc, AV_MAXOFF);
#else
    res = bzfile_reset( fil );
#endif
    AV_UNLOCK(bzread_lock);
    if(res < 0)
        return res;

    res = bzfile_skip_to(fil, zc, AV_MAXOFF);
    if(res < 0)
        return res;
    
    AV_LOCK(bzread_lock);
    size = zc->size;
    AV_UNLOCK(bzread_lock);
    
    if(size == -1) {
        av_log(AVLOG_ERROR, "BZFILE: Internal error: could not find size");
        return -EIO;
    }
    
    *sizep = size;
    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function: