OpenJPEG  1.5.1
Functions
cio.c File Reference
#include "opj_includes.h"
#include <assert.h>

Functions

opj_cio_t *OPJ_CALLCONV opj_cio_open (opj_common_ptr cinfo, unsigned char *buffer, int length)
 Open and allocate a memory stream for read / write. More...
 
void OPJ_CALLCONV opj_cio_close (opj_cio_t *cio)
 Close and free a CIO handle. More...
 
int OPJ_CALLCONV cio_tell (opj_cio_t *cio)
 Get position in byte stream. More...
 
void OPJ_CALLCONV cio_seek (opj_cio_t *cio, int pos)
 Set position in byte stream. More...
 
int cio_numbytesleft (opj_cio_t *cio)
 Number of bytes left before the end of the stream. More...
 
unsigned char * cio_getbp (opj_cio_t *cio)
 Get pointer to the current position in the stream. More...
 
opj_bool cio_byteout (opj_cio_t *cio, unsigned char v)
 
unsigned char cio_bytein (opj_cio_t *cio)
 
unsigned int cio_write (opj_cio_t *cio, unsigned int64 v, int n)
 Write some bytes. More...
 
unsigned int cio_read (opj_cio_t *cio, int n)
 Read some bytes. More...
 
void cio_skip (opj_cio_t *cio, int n)
 Skip some bytes. More...
 

Function Documentation

unsigned char cio_bytein ( opj_cio_t cio)
opj_bool cio_byteout ( opj_cio_t cio,
unsigned char  v 
)
void OPJ_CALLCONV cio_seek ( opj_cio_t cio,
int  pos 
)
int OPJ_CALLCONV cio_tell ( opj_cio_t cio)
void OPJ_CALLCONV opj_cio_close ( opj_cio_t cio)

Close and free a CIO handle.

Parameters
cioCIO handle to free

References opj_cio::buffer, opj_cio::openmode, opj_free, and OPJ_STREAM_WRITE.

opj_cio_t* OPJ_CALLCONV opj_cio_open ( opj_common_ptr  cinfo,
unsigned char *  buffer,
int  length 
)

Open and allocate a memory stream for read / write.

On reading, the user must provide a buffer containing encoded data. The buffer will be wrapped by the returned CIO handle. On writing, buffer parameters must be set to 0: a buffer will be allocated by the library to contain encoded data.

Parameters
cinfoCodec context info
bufferReading: buffer address. Writing: NULL
lengthReading: buffer length. Writing: 0
Returns
Returns a CIO handle if successful, returns NULL otherwise

References opj_cio::bp, opj_cio::buffer, opj_cio::cinfo, CODEC_J2K, CODEC_JP2, opj_cio::end, EVT_ERROR, opj_cp::img_size, opj_cio::length, opj_cio::openmode, opj_event_msg(), opj_free, opj_malloc, OPJ_STREAM_READ, OPJ_STREAM_WRITE, and opj_cio::start.