OpenJPEG  2.2.0
Data Structures | Typedefs | Functions
box_manager.h File Reference
#include "byte_manager.h"

Go to the source code of this file.

Data Structures

struct  box_param
 box parameters More...
 
struct  boxlist_param
 Box list parameters. More...
 

Typedefs

typedef struct box_param box_param_t
 box parameters More...
 
typedef struct boxlist_param boxlist_param_t
 Box list parameters. More...
 

Functions

boxlist_param_tgene_boxlist (void)
 generate a box list More...
 
boxlist_param_tget_boxstructure (int fd, OPJ_OFF_T offset, OPJ_SIZE_T length)
 get box structure of JP2 file More...
 
box_param_tgene_boxbyOffset (int fd, OPJ_OFF_T offset)
 generate box from JP2 file at the given offset More...
 
box_param_tgene_boxbyOffinStream (Byte_t *stream, OPJ_OFF_T offset)
 generate box from code stream (JPP or JPT stream) at the given offset More...
 
box_param_tgene_boxbyType (int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[])
 generate(search) box from JP2 file More...
 
box_param_tgene_boxbyTypeinStream (Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[])
 generate(search) box from code stream More...
 
box_param_tgene_childboxbyOffset (box_param_t *superbox, OPJ_OFF_T offset)
 generate child box from JP2 file at the given offset More...
 
box_param_tgene_childboxbyType (box_param_t *superbox, OPJ_OFF_T offset, const char TBox[])
 generate(search) box from JP2 file More...
 
OPJ_OFF_T get_DBoxoff (box_param_t *box)
 get DBox offset More...
 
OPJ_SIZE_T get_DBoxlen (box_param_t *box)
 get DBox length More...
 
Byte_tfetch_headbytes (box_param_t *box)
 fetch header bytes in file stream More...
 
Byte_tfetch_DBoxbytes (box_param_t *box, OPJ_OFF_T offset, OPJ_SIZE_T size)
 fetch DBox (Box Contents) bytes of data in file stream More...
 
Byte_t fetch_DBox1byte (box_param_t *box, OPJ_OFF_T offset)
 fetch DBox (Box Contents) 1-byte Byte codes in file stream More...
 
Byte2_t fetch_DBox2bytebigendian (box_param_t *box, OPJ_OFF_T offset)
 fetch DBox (Box Contents) 2-byte big endian Byte codes in file stream More...
 
Byte4_t fetch_DBox4bytebigendian (box_param_t *box, OPJ_OFF_T offset)
 fetch DBox (Box Contents) 4-byte big endian Byte codes in file stream More...
 
Byte8_t fetch_DBox8bytebigendian (box_param_t *box, OPJ_OFF_T offset)
 fetch DBox (Box Contents) 8-byte big endian Byte codes in file stream More...
 
box_param_tsearch_box (const char type[], boxlist_param_t *boxlist)
 search a box by box type More...
 
void print_box (box_param_t *box)
 print box parameters More...
 
void print_allbox (boxlist_param_t *boxlist)
 print all box parameters More...
 
void delete_box_in_list (box_param_t **box, boxlist_param_t *boxlist)
 delete a box in list More...
 
void delete_box_in_list_by_type (const char type[], boxlist_param_t *boxlist)
 delete a box in list by Type More...
 
void delete_boxlist (boxlist_param_t **boxlist)
 delete box list More...
 
void insert_box_into_list (box_param_t *box, boxlist_param_t *boxlist)
 insert a box into list More...
 

Typedef Documentation

typedef struct box_param box_param_t

box parameters

Box list parameters.

Function Documentation

void delete_box_in_list ( box_param_t **  box,
boxlist_param_t boxlist 
)

delete a box in list

Parameters
[in,out]boxaddress of the deleting box pointer
[in]boxlistbox list pointer

References boxlist_param::first, boxlist_param::last, and box_param::next.

Referenced by const_metadatalist(), and delete_box_in_list_by_type().

void delete_box_in_list_by_type ( const char  type[],
boxlist_param_t boxlist 
)

delete a box in list by Type

Parameters
[in,out]typebox type
[in]boxlistbox list pointer

References delete_box_in_list(), and search_box().

void delete_boxlist ( boxlist_param_t **  boxlist)

delete box list

Parameters
[in,out]boxlistaddress of the box list pointer

References box_param::next.

Referenced by delete_metadata(), and parse_jp2file().

Byte_t fetch_DBox1byte ( box_param_t box,
OPJ_OFF_T  offset 
)

fetch DBox (Box Contents) 1-byte Byte codes in file stream

Parameters
[in]boxbox pointer
[in]offsetstart Byte position in DBox
Returns
fetched code

References box_param::fd, fetch_1byte(), and get_DBoxoff().

Referenced by check_JP2boxidx(), and gene_faixbox().

Byte2_t fetch_DBox2bytebigendian ( box_param_t box,
OPJ_OFF_T  offset 
)

fetch DBox (Box Contents) 2-byte big endian Byte codes in file stream

Parameters
[in]boxbox pointer
[in]offsetstart Byte position in DBox
Returns
fetched code

References box_param::fd, fetch_2bytebigendian(), and get_DBoxoff().

Referenced by gene_mhixbox(), and set_cptrdata().

Byte4_t fetch_DBox4bytebigendian ( box_param_t box,
OPJ_OFF_T  offset 
)

fetch DBox (Box Contents) 4-byte big endian Byte codes in file stream

Parameters
[in]boxbox pointer
[in]offsetstart Byte position in DBox
Returns
fetched code

References box_param::fd, fetch_4bytebigendian(), and get_DBoxoff().

Referenced by gene_faixbox().

Byte8_t fetch_DBox8bytebigendian ( box_param_t box,
OPJ_OFF_T  offset 
)

fetch DBox (Box Contents) 8-byte big endian Byte codes in file stream

Parameters
[in]boxbox pointer
[in]offsetstart Byte position in DBox
Returns
fetched code

References box_param::fd, fetch_8bytebigendian(), and get_DBoxoff().

Referenced by check_JP2boxidx(), gene_faixbox(), gene_mhixbox(), set_cptrdata(), and set_mainmhixdata().

Byte_t* fetch_DBoxbytes ( box_param_t box,
OPJ_OFF_T  offset,
OPJ_SIZE_T  size 
)

fetch DBox (Box Contents) bytes of data in file stream

Parameters
[in]boxbox pointer
[in]offsetstart Byte position in DBox
[in]sizeByte length
Returns
pointer to the fetched data

References box_param::fd, fetch_bytes(), and get_DBoxoff().

Byte_t* fetch_headbytes ( box_param_t box)

fetch header bytes in file stream

Parameters
[in]boxbox pointer
Returns
pointer to the fetched bytes

References box_param::fd, fetch_bytes(), box_param::headlen, and box_param::offset.

Referenced by gene_placeholder().

box_param_t* gene_boxbyOffinStream ( Byte_t stream,
OPJ_OFF_T  offset 
)

generate box from code stream (JPP or JPT stream) at the given offset

Parameters
[in]streamcode stream of a box
[in]offsetBox offset of the whole stream
Returns
pointer to the structure of generate box parameters

References big4(), big8(), box_param::fd, box_param::headlen, box_param::length, box_param::next, box_param::offset, and box_param::type.

Referenced by parse_metadata().

box_param_t* gene_boxbyOffset ( int  fd,
OPJ_OFF_T  offset 
)

generate box from JP2 file at the given offset

Parameters
[in]fdfile discriptor of the JP2 file
[in]offsetBox offset
Returns
pointer to the structure of generate box parameters

References big4(), big8(), FCGI_stderr, box_param::fd, fetch_bytes(), box_param::headlen, box_param::length, box_param::next, box_param::offset, and box_param::type.

Referenced by gene_childboxbyOffset(), get_boxstructure(), and set_ppixdata().

box_param_t* gene_boxbyType ( int  fd,
OPJ_OFF_T  offset,
OPJ_SIZE_T  length,
const char  TBox[] 
)

generate(search) box from JP2 file

Parameters
[in]fdfile discriptor of the JP2 file
[in]offsetstart Byte position of the search
[in]lengthByte length of the search, if 0, size to the end of file
[in]TBoxBox Type
Returns
pointer to the structure of generate/found box parameters

References big4(), big8(), FCGI_stderr, box_param::fd, fetch_bytes(), get_filesize(), box_param::headlen, box_param::length, box_param::next, box_param::offset, and box_param::type.

Referenced by gene_childboxbyType(), set_cidxdata(), set_cptrdata(), set_mainmhixdata(), set_ppixdata(), set_thixdata(), and set_tpixdata().

box_param_t* gene_boxbyTypeinStream ( Byte_t stream,
OPJ_OFF_T  offset,
OPJ_SIZE_T  length,
const char  TBox[] 
)

generate(search) box from code stream

Parameters
[in]streamcode stream ( from the first byte)
[in]offsetstart Byte position of the search
[in]lengthByte length of the search, if 0, size to the end of file
[in]TBoxBox Type
Returns
pointer to the structure of generate/found box parameters

References big4(), big8(), FCGI_stderr, box_param::fd, box_param::headlen, box_param::length, box_param::next, box_param::offset, and box_param::type.

Referenced by gene_ihdrbox().

boxlist_param_t* gene_boxlist ( void  )

generate a box list

Returns
pointer to the generated box list

References boxlist_param::first, and boxlist_param::last.

Referenced by get_boxstructure(), and parse_metadata().

box_param_t* gene_childboxbyOffset ( box_param_t superbox,
OPJ_OFF_T  offset 
)

generate child box from JP2 file at the given offset

Parameters
[in]superboxsuper box pointer
[in]offsetoffset from DBox first byte of superbox
Returns
pointer to the structure of generate box parameters

References box_param::fd, gene_boxbyOffset(), and get_DBoxoff().

box_param_t* gene_childboxbyType ( box_param_t superbox,
OPJ_OFF_T  offset,
const char  TBox[] 
)

generate(search) box from JP2 file

Parameters
[in]superboxsuper box pointer
[in]offsetoffset from DBox first byte of superbox
[in]TBoxBox Type
Returns
pointer to the structure of generate/found box parameters

References FCGI_stderr, box_param::fd, gene_boxbyType(), get_DBoxlen(), and get_DBoxoff().

Referenced by check_JP2boxidx().

boxlist_param_t* get_boxstructure ( int  fd,
OPJ_OFF_T  offset,
OPJ_SIZE_T  length 
)

get box structure of JP2 file

Parameters
[in]fdfile descriptor
[in]offsetoffset of the decomposing region
[in]lengthlength of the decomposing region
Returns
pointer to the generated boxlist

References gene_boxbyOffset(), gene_boxlist(), insert_box_into_list(), and box_param::length.

Referenced by const_metadatalist(), and parse_jp2file().

OPJ_SIZE_T get_DBoxlen ( box_param_t box)

get DBox length

Parameters
[in]boxbox pointer
Returns
DBox length ( content length)

References box_param::headlen, and box_param::length.

Referenced by const_metadatalist(), gene_childboxbyType(), gene_ihdrbox(), gene_manfbox(), gene_mhixbox(), set_cidxdata(), set_cptrdata(), set_mainmhixdata(), set_ppixdata(), set_thixdata(), and set_tpixdata().

OPJ_OFF_T get_DBoxoff ( box_param_t box)
void insert_box_into_list ( box_param_t box,
boxlist_param_t boxlist 
)

insert a box into list

Parameters
[in]boxbox pointer
[in]boxlistbox list pointer

References boxlist_param::first, boxlist_param::last, and box_param::next.

Referenced by get_boxstructure(), and parse_metadata().

void print_allbox ( boxlist_param_t boxlist)

print all box parameters

Parameters
[in]boxlistbox list pointer

References boxlist_param::first, logstream, box_param::next, and print_box().

Referenced by print_metadata().

void print_box ( box_param_t box)

print box parameters

Parameters
[in]boxbox pointer

References box_param::headlen, box_param::length, logstream, box_param::offset, and box_param::type.

Referenced by print_allbox().

box_param_t* search_box ( const char  type[],
boxlist_param_t boxlist 
)

search a box by box type

Parameters
[in]typebox type
[in]boxlistbox list pointer
Returns
found box pointer

References FCGI_stderr, boxlist_param::first, box_param::next, and box_param::type.

Referenced by check_JP2boxidx(), delete_box_in_list_by_type(), gene_ihdrbox(), and parse_jp2file().