00001 /* 00002 * $Id: indexbox_manager.h 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $ 00003 * 00004 * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium 00005 * Copyright (c) 2002-2014, Professor Benoit Macq 00006 * Copyright (c) 2003-2004, Yannick Verschueren 00007 * Copyright (c) 2010-2011, Kaori Hagihara 00008 * All rights reserved. 00009 * 00010 * Redistribution and use in source and binary forms, with or without 00011 * modification, are permitted provided that the following conditions 00012 * are met: 00013 * 1. Redistributions of source code must retain the above copyright 00014 * notice, this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright 00016 * notice, this list of conditions and the following disclaimer in the 00017 * documentation and/or other materials provided with the distribution. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS' 00020 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00021 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00022 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00023 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00024 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00025 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00026 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00027 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00028 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00029 * POSSIBILITY OF SUCH DAMAGE. 00030 */ 00031 00036 #ifndef INDEXBOX_MANAGER_H_ 00037 # define INDEXBOX_MANAGER_H_ 00038 00039 #include "openjpeg.h" 00040 #include "j2k.h" /* needed to use jp2.h */ 00041 #include "jp2.h" 00042 00043 #define JPIP_CIDX 0x63696478 /* Codestream index */ 00044 #define JPIP_CPTR 0x63707472 /* Codestream Finder Box */ 00045 #define JPIP_MANF 0x6d616e66 /* Manifest Box */ 00046 #define JPIP_FAIX 0x66616978 /* Fragment array Index box */ 00047 #define JPIP_MHIX 0x6d686978 /* Main Header Index Table */ 00048 #define JPIP_TPIX 0x74706978 /* Tile-part Index Table box */ 00049 #define JPIP_THIX 0x74686978 /* Tile header Index Table box */ 00050 #define JPIP_PPIX 0x70706978 /* Precinct Packet Index Table box */ 00051 #define JPIP_PHIX 0x70686978 /* Packet Header index Table */ 00052 #define JPIP_FIDX 0x66696478 /* File Index */ 00053 #define JPIP_FPTR 0x66707472 /* File Finder */ 00054 #define JPIP_PRXY 0x70727879 /* Proxy boxes */ 00055 #define JPIP_IPTR 0x69707472 /* Index finder box */ 00056 #define JPIP_PHLD 0x70686c64 /* Place holder */ 00057 00058 00059 /* 00060 * Write tile-part Index table box (superbox) 00061 * 00062 * @param[in] coff offset of j2k codestream 00063 * @param[in] cstr_info codestream information 00064 * @param[in] j2klen length of j2k codestream 00065 * @param[in] cio file output handle 00066 * @return length of tpix box 00067 */ 00068 int opj_write_tpix(int coff, opj_codestream_info_t cstr_info, int j2klen, 00069 opj_stream_private_t *cio, 00070 opj_event_mgr_t * p_manager); 00071 00072 00073 /* 00074 * Write tile header index table box (superbox) 00075 * 00076 * @param[in] coff offset of j2k codestream 00077 * @param[in] cstr_info codestream information pointer 00078 * @param[in] cio file output handle 00079 * @return length of thix box 00080 */ 00081 int opj_write_thix(int coff, opj_codestream_info_t cstr_info, 00082 opj_stream_private_t *cio, opj_event_mgr_t * p_manager); 00083 00084 00085 /* 00086 * Write precinct packet index table box (superbox) 00087 * 00088 * @param[in] coff offset of j2k codestream 00089 * @param[in] cstr_info codestream information 00090 * @param[in] EPHused true if EPH option used 00091 * @param[in] j2klen length of j2k codestream 00092 * @param[in] cio file output handle 00093 * @return length of ppix box 00094 */ 00095 int opj_write_ppix(int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused, 00096 int j2klen, opj_stream_private_t *cio, 00097 opj_event_mgr_t * p_manager); 00098 00099 00100 /* 00101 * Write packet header index table box (superbox) 00102 * 00103 * @param[in] coff offset of j2k codestream 00104 * @param[in] cstr_info codestream information 00105 * @param[in] EPHused true if EPH option used 00106 * @param[in] j2klen length of j2k codestream 00107 * @param[in] cio file output handle 00108 * @return length of ppix box 00109 */ 00110 int opj_write_phix(int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused, 00111 int j2klen, opj_stream_private_t *cio, 00112 opj_event_mgr_t * p_manager); 00113 00114 /* 00115 * Write manifest box (box) 00116 * 00117 * @param[in] second number to be visited 00118 * @param[in] v number of boxes 00119 * @param[in] box box to be manifested 00120 * @param[in] cio file output handle 00121 */ 00122 00123 void opj_write_manf(int second, 00124 int v, 00125 opj_jp2_box_t *box, 00126 opj_stream_private_t *cio, 00127 opj_event_mgr_t * p_manager); 00128 00129 /* 00130 * Write main header index table (box) 00131 * 00132 * @param[in] coff offset of j2k codestream 00133 * @param[in] cstr_info codestream information 00134 * @param[in] cio file output handle 00135 * @return length of mainmhix box 00136 */ 00137 int opj_write_mainmhix(int coff, opj_codestream_info_t cstr_info, 00138 opj_stream_private_t *cio, 00139 opj_event_mgr_t * p_manager); 00140 00141 int opj_write_phixfaix(int coff, int compno, opj_codestream_info_t cstr_info, 00142 OPJ_BOOL EPHused, int j2klen, opj_stream_private_t *cio, 00143 opj_event_mgr_t * p_manager); 00144 00145 int opj_write_ppixfaix(int coff, int compno, opj_codestream_info_t cstr_info, 00146 OPJ_BOOL EPHused, int j2klen, opj_stream_private_t *cio, 00147 opj_event_mgr_t * p_manager); 00148 00149 int opj_write_tilemhix(int coff, opj_codestream_info_t cstr_info, int tileno, 00150 opj_stream_private_t *cio, 00151 opj_event_mgr_t * p_manager); 00152 00153 int opj_write_tpixfaix(int coff, int compno, opj_codestream_info_t cstr_info, 00154 int j2klen, opj_stream_private_t *cio, 00155 opj_event_mgr_t * p_manager); 00156 00157 #endif /* !INDEXBOX_MANAGER_H_ */