indexbox_manager.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * $Id: indexbox_manager.h 897 2011-08-28 21:43:57Z Kaori.Hagihara@gmail.com $
  3. *
  4. * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
  5. * Copyright (c) 2002-2014, Professor Benoit Macq
  6. * Copyright (c) 2003-2004, Yannick Verschueren
  7. * Copyright (c) 2010-2011, Kaori Hagihara
  8. * All rights reserved.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
  20. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  23. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  24. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  25. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  26. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  27. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  28. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  29. * POSSIBILITY OF SUCH DAMAGE.
  30. */
  31. /*! \file
  32. * \brief Modification of jpip.c from 2KAN indexer
  33. */
  34. #ifndef INDEXBOX_MANAGER_H_
  35. # define INDEXBOX_MANAGER_H_
  36. #include "openjpeg.h"
  37. #include "j2k.h" /* needed to use jp2.h */
  38. #include "jp2.h"
  39. #define JPIP_CIDX 0x63696478 /* Codestream index */
  40. #define JPIP_CPTR 0x63707472 /* Codestream Finder Box */
  41. #define JPIP_MANF 0x6d616e66 /* Manifest Box */
  42. #define JPIP_FAIX 0x66616978 /* Fragment array Index box */
  43. #define JPIP_MHIX 0x6d686978 /* Main Header Index Table */
  44. #define JPIP_TPIX 0x74706978 /* Tile-part Index Table box */
  45. #define JPIP_THIX 0x74686978 /* Tile header Index Table box */
  46. #define JPIP_PPIX 0x70706978 /* Precinct Packet Index Table box */
  47. #define JPIP_PHIX 0x70686978 /* Packet Header index Table */
  48. #define JPIP_FIDX 0x66696478 /* File Index */
  49. #define JPIP_FPTR 0x66707472 /* File Finder */
  50. #define JPIP_PRXY 0x70727879 /* Proxy boxes */
  51. #define JPIP_IPTR 0x69707472 /* Index finder box */
  52. #define JPIP_PHLD 0x70686c64 /* Place holder */
  53. /*
  54. * Write tile-part Index table box (superbox)
  55. *
  56. * @param[in] coff offset of j2k codestream
  57. * @param[in] cstr_info codestream information
  58. * @param[in] j2klen length of j2k codestream
  59. * @param[in] cio file output handle
  60. * @return length of tpix box
  61. */
  62. int opj_write_tpix(int coff, opj_codestream_info_t cstr_info, int j2klen,
  63. opj_stream_private_t *cio,
  64. opj_event_mgr_t * p_manager);
  65. /*
  66. * Write tile header index table box (superbox)
  67. *
  68. * @param[in] coff offset of j2k codestream
  69. * @param[in] cstr_info codestream information pointer
  70. * @param[in] cio file output handle
  71. * @return length of thix box
  72. */
  73. int opj_write_thix(int coff, opj_codestream_info_t cstr_info,
  74. opj_stream_private_t *cio, opj_event_mgr_t * p_manager);
  75. /*
  76. * Write precinct packet index table box (superbox)
  77. *
  78. * @param[in] coff offset of j2k codestream
  79. * @param[in] cstr_info codestream information
  80. * @param[in] EPHused true if EPH option used
  81. * @param[in] j2klen length of j2k codestream
  82. * @param[in] cio file output handle
  83. * @return length of ppix box
  84. */
  85. int opj_write_ppix(int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused,
  86. int j2klen, opj_stream_private_t *cio,
  87. opj_event_mgr_t * p_manager);
  88. /*
  89. * Write packet header index table box (superbox)
  90. *
  91. * @param[in] coff offset of j2k codestream
  92. * @param[in] cstr_info codestream information
  93. * @param[in] EPHused true if EPH option used
  94. * @param[in] j2klen length of j2k codestream
  95. * @param[in] cio file output handle
  96. * @return length of ppix box
  97. */
  98. int opj_write_phix(int coff, opj_codestream_info_t cstr_info, OPJ_BOOL EPHused,
  99. int j2klen, opj_stream_private_t *cio,
  100. opj_event_mgr_t * p_manager);
  101. /*
  102. * Write manifest box (box)
  103. *
  104. * @param[in] second number to be visited
  105. * @param[in] v number of boxes
  106. * @param[in] box box to be manifested
  107. * @param[in] cio file output handle
  108. */
  109. void opj_write_manf(int second,
  110. int v,
  111. opj_jp2_box_t *box,
  112. opj_stream_private_t *cio,
  113. opj_event_mgr_t * p_manager);
  114. /*
  115. * Write main header index table (box)
  116. *
  117. * @param[in] coff offset of j2k codestream
  118. * @param[in] cstr_info codestream information
  119. * @param[in] cio file output handle
  120. * @return length of mainmhix box
  121. */
  122. int opj_write_mainmhix(int coff, opj_codestream_info_t cstr_info,
  123. opj_stream_private_t *cio,
  124. opj_event_mgr_t * p_manager);
  125. int opj_write_phixfaix(int coff, int compno, opj_codestream_info_t cstr_info,
  126. OPJ_BOOL EPHused, int j2klen, opj_stream_private_t *cio,
  127. opj_event_mgr_t * p_manager);
  128. int opj_write_ppixfaix(int coff, int compno, opj_codestream_info_t cstr_info,
  129. OPJ_BOOL EPHused, int j2klen, opj_stream_private_t *cio,
  130. opj_event_mgr_t * p_manager);
  131. int opj_write_tilemhix(int coff, opj_codestream_info_t cstr_info, int tileno,
  132. opj_stream_private_t *cio,
  133. opj_event_mgr_t * p_manager);
  134. int opj_write_tpixfaix(int coff, int compno, opj_codestream_info_t cstr_info,
  135. int j2klen, opj_stream_private_t *cio,
  136. opj_event_mgr_t * p_manager);
  137. #endif /* !INDEXBOX_MANAGER_H_ */