OpenJPEG 2.1.0

box_manager.h

Go to the documentation of this file.
00001 /*
00002  * $Id: box_manager.h 2835 2014-04-03 15:30:57Z antonin $
00003  *
00004  * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
00005  * Copyright (c) 2002-2014, Professor Benoit Macq
00006  * Copyright (c) 2010-2011, Kaori Hagihara
00007  * All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted provided that the following conditions
00011  * are met:
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer.
00014  * 2. Redistributions in binary form must reproduce the above copyright
00015  *    notice, this list of conditions and the following disclaimer in the
00016  *    documentation and/or other materials provided with the distribution.
00017  *
00018  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
00019  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00022  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00023  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00024  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00025  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00026  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00027  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00028  * POSSIBILITY OF SUCH DAMAGE.
00029  */
00030 
00031 #ifndef         BOX_MANAGER_H_
00032 # define        BOX_MANAGER_H_
00033 
00034 #include "byte_manager.h"
00035 
00037 typedef struct box_param{
00038   int fd;                 
00039   OPJ_OFF_T offset;         
00040   Byte_t  headlen;        
00041   Byte8_t length;         
00042   char    type[4];        
00043   struct box_param *next; 
00044 } box_param_t;
00045 
00046 
00048 typedef struct boxlist_param{
00049   box_param_t *first; 
00050   box_param_t *last;  
00051 } boxlist_param_t;
00052 
00053 
00059 boxlist_param_t * gene_boxlist(void);
00060 
00069 boxlist_param_t * get_boxstructure( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length);
00070 
00071 
00079 box_param_t * gene_boxbyOffset( int fd, OPJ_OFF_T offset);
00080 
00081 
00089 box_param_t * gene_boxbyOffinStream( Byte_t *stream, OPJ_OFF_T offset);
00090 
00100 box_param_t * gene_boxbyType( int fd, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[]);
00101 
00111 box_param_t * gene_boxbyTypeinStream( Byte_t *stream, OPJ_OFF_T offset, OPJ_SIZE_T length, const char TBox[]);
00112 
00120 box_param_t * gene_childboxbyOffset( box_param_t *superbox, OPJ_OFF_T offset);
00121 
00130 box_param_t * gene_childboxbyType( box_param_t *superbox, OPJ_OFF_T offset, const char TBox[]);
00131 
00138 OPJ_OFF_T get_DBoxoff( box_param_t *box);
00139 
00140 
00147 OPJ_SIZE_T get_DBoxlen( box_param_t *box);
00148 
00149 
00156 Byte_t * fetch_headbytes( box_param_t *box);
00157 
00158 
00167 Byte_t * fetch_DBoxbytes( box_param_t *box, OPJ_OFF_T offset, OPJ_SIZE_T size);
00168 
00176 Byte_t fetch_DBox1byte( box_param_t *box, OPJ_OFF_T offset);
00177 
00185 Byte2_t fetch_DBox2bytebigendian( box_param_t *box, OPJ_OFF_T offset);
00186 
00194 Byte4_t fetch_DBox4bytebigendian( box_param_t *box, OPJ_OFF_T offset);
00195 
00203 Byte8_t fetch_DBox8bytebigendian( box_param_t *box, OPJ_OFF_T offset);
00204 
00205 
00213 box_param_t * search_box( const char type[], boxlist_param_t *boxlist);
00214 
00220 void print_box( box_param_t *box);
00221 
00222 
00228 void print_allbox( boxlist_param_t *boxlist);
00229 
00236 void delete_box_in_list( box_param_t **box, boxlist_param_t *boxlist);
00237 
00238 
00245 void delete_box_in_list_by_type( const char type[], boxlist_param_t *boxlist);
00246 
00247 
00253 void delete_boxlist( boxlist_param_t **boxlist);
00254 
00255 
00262 void insert_box_into_list( box_param_t *box, boxlist_param_t *boxlist);
00263 
00264 #endif      /* !BOX_MANAGER_H_ */