OpenJPEG
2.2.0
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <assert.h>
#include "box_manager.h"
#include "opj_inttypes.h"
Macros | |
#define | FCGI_stdout stdout |
#define | FCGI_stderr stderr |
#define | logstream stderr |
Functions | |
boxlist_param_t * | gene_boxlist (void) |
generate a box list More... | |
boxlist_param_t * | get_boxstructure (int fd, OPJ_OFF_T offset, OPJ_SIZE_T length) |
get box structure of JP2 file More... | |
box_param_t * | gene_boxbyOffset (int fd, OPJ_OFF_T offset) |
generate box from JP2 file at the given offset More... | |
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 More... | |
box_param_t * | gene_boxbyType (int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[]) |
generate(search) box from JP2 file More... | |
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 More... | |
box_param_t * | gene_childboxbyOffset (box_param_t *superbox, OPJ_OFF_T offset) |
generate child box from JP2 file at the given offset More... | |
box_param_t * | gene_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_t * | fetch_headbytes (box_param_t *box) |
fetch header bytes in file stream More... | |
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 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_t * | search_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... | |
#define FCGI_stderr stderr |
Referenced by gene_boxbyOffset(), gene_boxbyType(), gene_boxbyTypeinStream(), gene_childboxbyType(), and search_box().
#define FCGI_stdout stdout |
#define logstream stderr |
Referenced by print_allbox(), and print_box().
void delete_box_in_list | ( | box_param_t ** | box, |
boxlist_param_t * | boxlist | ||
) |
delete a box in list
[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
[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
[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
[in] | box | box pointer |
[in] | offset | start Byte position in DBox |
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
[in] | box | box pointer |
[in] | offset | start Byte position in DBox |
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
[in] | box | box pointer |
[in] | offset | start Byte position in DBox |
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
[in] | box | box pointer |
[in] | offset | start Byte position in DBox |
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
[in] | box | box pointer |
[in] | offset | start Byte position in DBox |
[in] | size | Byte length |
References box_param::fd, fetch_bytes(), and get_DBoxoff().
Byte_t* fetch_headbytes | ( | box_param_t * | box | ) |
fetch header bytes in file stream
[in] | box | box pointer |
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
[in] | stream | code stream of a box |
[in] | offset | Box offset of the whole stream |
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
[in] | fd | file discriptor of the JP2 file |
[in] | offset | Box offset |
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
[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 |
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
[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 |
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
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
[in] | superbox | super box pointer |
[in] | offset | offset from DBox first byte of superbox |
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
[in] | superbox | super box pointer |
[in] | offset | offset from DBox first byte of superbox |
[in] | TBox | Box Type |
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
[in] | fd | file descriptor |
[in] | offset | offset of the decomposing region |
[in] | length | length of the decomposing region |
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
[in] | box | box pointer |
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 | ) |
get DBox offset
[in] | box | box pointer |
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().
void insert_box_into_list | ( | box_param_t * | box, |
boxlist_param_t * | boxlist | ||
) |
insert a box into list
[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
[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
[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
[in] | type | box type |
[in] | boxlist | box list 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().