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
typedef struct boxlist_param | boxlist_param_t
| Box list parameters.

## Functions

boxlist_param_t * | gene_boxlist (void)
| generate a box list
boxlist_param_t * | get_boxstructure (int fd, OPJ_OFF_T offset, OPJ_SIZE_T length)
| get box structure of JP2 file
box_param_t * | gene_boxbyOffset (int fd, OPJ_OFF_T offset)
| generate box from JP2 file at the given offset
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
box_param_t * | gene_boxbyType (int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[])
| generate(search) box from JP2 file
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
box_param_t * | gene_childboxbyOffset (box_param_t *superbox, OPJ_OFF_T offset)
| generate child box from JP2 file at the given offset
box_param_t * | gene_childboxbyType (box_param_t *superbox, OPJ_OFF_T offset, const char TBox[])
| generate(search) box from JP2 file
OPJ_OFF_T | get_DBoxoff (box_param_t *box)
| get DBox offset
OPJ_SIZE_T | get_DBoxlen (box_param_t *box)
| get DBox length
Byte_t * | fetch_headbytes (box_param_t *box)
| fetch header bytes in file stream
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
Byte_t | fetch_DBox1byte (box_param_t *box, OPJ_OFF_T offset)
| fetch DBox (Box Contents) 1-byte Byte codes in file stream
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
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
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
box_param_t * | search_box (const char type[], boxlist_param_t *boxlist)
| search a box by box type
void | print_box (box_param_t *box)
| print box parameters
void | print_allbox (boxlist_param_t *boxlist)
| print all box parameters
void | delete_box_in_list (box_param_t **box, boxlist_param_t *boxlist)
| delete a box in list
void | delete_box_in_list_by_type (const char type[], boxlist_param_t *boxlist)
| delete a box in list by Type
void | delete_boxlist (boxlist_param_t **boxlist)
| delete box list
void | insert_box_into_list (box_param_t *box, boxlist_param_t *boxlist)
| insert a box into list

## Typedef Documentation

## box_param_t

typedef struct box_param box_param_t

box parameters

## boxlist_param_t

typedef struct boxlist_param boxlist_param_t

Box list parameters.

## Function Documentation

## delete_box_in_list()

void delete_box_in_list | ( | box_param_t ** | box,
|  | boxlist_param_t * | boxlist )

delete a box in list

Parameters

  [in,out] | box | address of the deleting box pointer
  [in] | boxlist | box list pointer

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

Referenced by const_metadatalist(), and delete_box_in_list_by_type().

## 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] | type | box type
  [in] | boxlist | box list pointer

References delete_box_in_list(), and search_box().

## delete_boxlist()

void delete_boxlist | ( | boxlist_param_t ** | boxlist | ) |

delete box list

Parameters

  [in,out] | boxlist | address of the box list pointer

References box_param::next.

Referenced by delete_metadata(), and parse_jp2file().

## fetch_DBox1byte()

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] | box | box pointer
  [in] | offset | start Byte position in DBox

Returns
  fetched code

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

Referenced by check_JP2boxidx(), and gene_faixbox().

## fetch_DBox2bytebigendian()

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] | box | box pointer
  [in] | offset | start Byte position in DBox

Returns
  fetched code

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

Referenced by gene_mhixbox(), and set_cptrdata().

## fetch_DBox4bytebigendian()

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] | box | box pointer
  [in] | offset | start Byte position in DBox

Returns
  fetched code

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

Referenced by gene_faixbox().

## fetch_DBox8bytebigendian()

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] | box | box pointer
  [in] | offset | start 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().

## fetch_DBoxbytes()

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] | box | box pointer
  [in] | offset | start Byte position in DBox
  [in] | size | Byte length

Returns
  pointer to the fetched data

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

## fetch_headbytes()

Byte_t * fetch_headbytes | ( | box_param_t * | box | ) |

fetch header bytes in file stream

Parameters

  [in] | box | box pointer

Returns
  pointer to the fetched bytes

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

Referenced by gene_placeholder().

## gene_boxbyOffinStream()

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] | stream | code stream of a box
  [in] | offset | Box 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().

## gene_boxbyOffset()

box_param_t * gene_boxbyOffset | ( | int | fd,
|  | OPJ_OFF_T | offset )

generate box from JP2 file at the given offset

Parameters

  [in] | fd | file descriptor of the JP2 file
  [in] | offset | Box 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().

## gene_boxbyType()

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] | fd | file descriptor of the JP2 file
  [in] | offset | start Byte position of the search
  [in] | length | Byte length of the search, if 0, size to the end of file
  [in] | TBox | Box 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().

## gene_boxbyTypeinStream()

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] | stream | code stream ( from the first byte)
  [in] | offset | start Byte position of the search
  [in] | length | Byte length of the search, if 0, size to the end of file
  [in] | TBox | Box 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().

## gene_boxlist()

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().

## gene_childboxbyOffset()

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] | superbox | super box pointer
  [in] | offset | offset from DBox first byte of superbox

Returns
  pointer to the structure of generate box parameters

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

## gene_childboxbyType()

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

generate(search) box from JP2 file

Parameters

  [in] | superbox | super box pointer
  [in] | offset | offset from DBox first byte of superbox
  [in] | TBox | Box 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().

## get_boxstructure()

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

get box structure of JP2 file

Parameters

  [in] | fd | file descriptor
  [in] | offset | offset of the decomposing region
  [in] | length | length 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().

## get_DBoxlen()

OPJ_SIZE_T get_DBoxlen | ( | box_param_t * | box | ) |

get DBox length

Parameters

  [in] | box | box 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().

## get_DBoxoff()

OPJ_OFF_T get_DBoxoff | ( | box_param_t * | box | ) |

get DBox offset

Parameters

  [in] | box | box pointer

Returns
  DBox offset (byte position) in the file

References box_param::headlen, and box_param::offset.

Referenced by const_metadatalist(), fetch_DBox1byte(), fetch_DBox2bytebigendian(), fetch_DBox4bytebigendian(), fetch_DBox8bytebigendian(), fetch_DBoxbytes(), gene_childboxbyOffset(), gene_childboxbyType(), gene_childboxheader(), gene_ihdrbox(), set_cidxdata(), set_cptrdata(), set_mainmhixdata(), set_ppixdata(), set_thixdata(), and set_tpixdata().

## insert_box_into_list()

void insert_box_into_list | ( | box_param_t * | box,
|  | boxlist_param_t * | boxlist )

insert a box into list

Parameters

  [in] | box | box pointer
  [in] | boxlist | box list pointer

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

Referenced by get_boxstructure(), and parse_metadata().

## print_allbox()

void print_allbox | ( | boxlist_param_t * | boxlist | ) |

print all box parameters

Parameters

  [in] | boxlist | box list pointer

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

Referenced by print_metadata().

## print_box()

void print_box | ( | box_param_t * | box | ) |

print box parameters

Parameters

  [in] | box | box pointer

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

Referenced by print_allbox().

## search_box()

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

search a box by box type

Parameters

  [in] | type | box type
  [in] | boxlist | box 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().