Exemplo n.º 1
0
static int _mvefile_fetch_next_chunk(MVEFILE *movie)
{
    unsigned char buffer[4];
    unsigned short length;

    /* fail if not open */
    if (! movie->stream)
        return 0;

    /* fail if we can't read the next segment descriptor */
    if (! mve_read(movie->stream, buffer, 4))
        return 0;

    /* pull out the next length */
    length = _mve_get_short(buffer);

    /* make sure we've got sufficient space */
    _mvefile_set_buffer_size(movie, length);

    /* read the chunk */
    if (! mve_read(movie->stream, &movie->cur_chunk[0], length))
        return 0;
    movie->cur_chunk.resize(length);
    movie->next_segment = 0;

    return 1;
}
Exemplo n.º 2
0
void mvefile_reset (MVEFILE *file)
{
    _mvefile_reset (file);
// initialize the file
    _mvefile_set_buffer_size (file, 1024);
// verify the file's header
    if (!_mvefile_read_header (file)) {
        _mvefile_free (file);
        //return NULL;
    }
// now, prefetch the next chunk
    _mvefile_fetch_next_chunk (file);
}
Exemplo n.º 3
0
/*
 * reset a MVE file
 */
static void mvefile_reset(MVEFILE *file)
{
    /* initialize the file */
    _mvefile_set_buffer_size(file, 1024);

    /* verify the file's header */
    if (! _mvefile_read_header(file))
    {
		*file = {};
    }

    /* now, prefetch the next chunk */
    _mvefile_fetch_next_chunk(file);
}
Exemplo n.º 4
0
MVEFILE *mvefile_open (void *stream)
{
    MVEFILE *file;

// create the file
    file = _mvefile_alloc ();
    if (!_mvefile_open (file, stream)) {
        _mvefile_free (file);
        return NULL;
    }
// initialize the file
    _mvefile_set_buffer_size (file, 1024);
// verify the file's header
    if (!_mvefile_read_header (file)) {
        _mvefile_free (file);
        return NULL;
    }
// now, prefetch the next chunk
    _mvefile_fetch_next_chunk (file);
    return file;
}
Exemplo n.º 5
0
static int _mvefile_fetch_next_chunk (MVEFILE *movie)
{
    unsigned char buffer[4];
    unsigned short length;

// fail if not open
    if (!movie->stream)
        return 0;
// fail if we can't read the next tSegment descriptor
    if (!mve_read (movie->stream, buffer, 4))
        return 0;
// pull out the next length
    length = _mve_get_short (buffer);
// make sure we've got sufficient space
    _mvefile_set_buffer_size (movie, length);
// read the chunk
    if (!mve_read (movie->stream, movie->cur_chunk, length))
        return 0;
    movie->cur_fill = length;
    movie->next_segment = 0;
    return 1;
}
Exemplo n.º 6
0
/*
 * open an MVE file
 */
std::unique_ptr<MVEFILE> mvefile_open(void *stream)
{
    /* create the file */
	auto file = make_unique<MVEFILE>();
	if (! _mvefile_open(file.get(), stream))
    {
		return nullptr;
    }

    /* initialize the file */
	_mvefile_set_buffer_size(file.get(), 1024);

    /* verify the file's header */
	if (! _mvefile_read_header(file.get()))
    {
		return nullptr;
    }

    /* now, prefetch the next chunk */
	_mvefile_fetch_next_chunk(file.get());
    return file;
}