box_manager.c File Reference

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include "box_manager.h"
#include "opj_inttypes.h"

Defines

#define FCGI_stdout   stdout
#define FCGI_stderr   stderr
#define logstream   stderr

Functions

boxlist_param_tgene_boxlist (void)
 generate a box list
boxlist_param_tget_boxstructure (int fd, OPJ_OFF_T offset, OPJ_SIZE_T length)
 get box structure of JP2 file
box_param_tgene_boxbyOffset (int fd, OPJ_OFF_T offset)
 generate box from JP2 file at the given offset
box_param_tgene_boxbyOffinStream (Byte_t *stream, OPJ_OFF_T offset)
 generate box from code stream (JPP or JPT stream) at the given offset
box_param_tgene_boxbyType (int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[])
 generate(search) box from JP2 file
box_param_tgene_boxbyTypeinStream (Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[])
 generate(search) box from code stream
box_param_tgene_childboxbyOffset (box_param_t *superbox, OPJ_OFF_T offset)
 generate child box from JP2 file at the given offset
box_param_tgene_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_tfetch_headbytes (box_param_t *box)
 fetch header bytes in file stream
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
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_tsearch_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

Define Documentation

#define FCGI_stderr   stderr

#define FCGI_stdout   stdout

#define logstream   stderr


Function Documentation

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

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

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

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

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

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

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

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

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

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

box_param_t* gene_boxbyOffset ( int  fd,
OPJ_OFF_T  offset 
)

generate box from JP2 file at the given offset

Parameters:
[in] fd file discriptor 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().

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

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

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

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

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

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

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

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

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

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


Generated on Mon Dec 19 11:42:51 2016 for OpenJPEG by  doxygen 1.5.6