Back to index

avfs  1.0.1
Functions
xzfile.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_xzfile_pread (struct xzfile *fil, struct xzcache *zc, char *buf, avsize_t nbyte, avoff_t offset)
struct xzfileav_xzfile_new (vfile *vf)
int av_xzfile_size (struct xzfile *fil, struct xzcache *zc, avoff_t *sizep)
struct xzcacheav_xzcache_new ()

Function Documentation

struct xzcache* av_xzcache_new ( ) [read]

Definition at line 345 of file xzread.c.

{
    struct xzcache *zc;

    AV_NEW_OBJ(zc, xzcache_destroy);
    zc->size = -1;

    AV_LOCK(xzread_lock);
    if(xzread_nextid == 0)
        xzread_nextid = 1;

    zc->id = xzread_nextid ++;
    AV_UNLOCK(xzread_lock);
    
    return zc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

struct xzfile* av_xzfile_new ( vfile *  vf) [read]

Definition at line 323 of file xzread.c.

{
    int res;
    struct xzfile *fil;

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

    res = xz_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_xzfile_pread ( struct xzfile fil,
struct xzcache zc,
char *  buf,
avsize_t  nbyte,
avoff_t  offset 
)

Definition at line 262 of file xzread.c.

{
    avssize_t res;

    if(fil->iserror)
        return -EIO;

    res = av_xzfile_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_xzfile_size ( struct xzfile fil,
struct xzcache zc,
avoff_t sizep 
)

Definition at line 277 of file xzread.c.

{
    int res;
    avoff_t size;

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

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

    fil->id = zc->id;

    AV_LOCK(xzread_lock);
    res = xzfile_reset( fil );
    AV_UNLOCK(xzread_lock);
    if(res < 0)
        return res;

    res = xzfile_skip_to(fil, zc, AV_MAXOFF);
    if(res < 0)
        return res;
    
    AV_LOCK(xzread_lock);
    size = zc->size;
    AV_UNLOCK(xzread_lock);
    
    if(size == -1) {
        av_log(AVLOG_ERROR, "XZ: 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: