[trunk] Fix compilation:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>
Mon, 15 Oct 2012 09:44:34 +0000 (09:44 +0000)
committerMathieu Malaterre <mathieu.malaterre@gmail.com>
Mon, 15 Oct 2012 09:44:34 +0000 (09:44 +0000)
- using mingw32 compiler (missing exported symbols)
- using -fvisibility=hidden (gcc on UNIX)

32 files changed:
src/bin/jp3d/CMakeLists.txt
src/bin/jpip/CMakeLists.txt
src/bin/jpip/opj_dec_server.c
src/bin/mj2/CMakeLists.txt
src/bin/mj2/opj_mj2_compress.c
src/lib/openjp2/CMakeLists.txt
src/lib/openjp2/cio.c
src/lib/openjp2/cio.h
src/lib/openjp2/event.c
src/lib/openjp2/event.h
src/lib/openjp2/function_list.c
src/lib/openjp2/function_list.h
src/lib/openjp2/j2k.c
src/lib/openjp2/j2k.h
src/lib/openjp2/jp2.c
src/lib/openjp2/jp2.h
src/lib/openjp3d/CMakeLists.txt
src/lib/openjp3d/openjp3d.c
src/lib/openjp3d/openjp3d.h
src/lib/openjp3d/volume.c
src/lib/openjpip/openjpip.c
src/lib/openjpip/openjpip.h
src/lib/openmj2/CMakeLists.txt
src/lib/openmj2/cio.c
src/lib/openmj2/cio.h
src/lib/openmj2/j2k_lib.c
src/lib/openmj2/j2k_lib.h
src/lib/openmj2/mj2.c
src/lib/openmj2/mj2.h
src/lib/openmj2/mj2_convert.c
src/lib/openmj2/mj2_convert.h
src/lib/openmj2/openjpeg.h

index 2ff9f78fe07431ac2f6f6d4c6124658758f39c15..5a35a1695d79ba40953343bd5812278be0522961 100644 (file)
@@ -17,13 +17,13 @@ include_directories(
   ${TIFF_INCLUDE_DIRNAME}
   )
 
-IF(WIN32)
-  IF(BUILD_SHARED_LIBS)
-    ADD_DEFINITIONS(-DOPJ_EXPORTS)
-  ELSE(BUILD_SHARED_LIBS)
-    ADD_DEFINITIONS(-DOPJ_STATIC)
-  ENDIF(BUILD_SHARED_LIBS)
-ENDIF(WIN32)
+if(WIN32)
+  if(BUILD_SHARED_LIBS)
+    add_definitions(-DOPJ_EXPORTS)
+  else()
+    add_definitions(-DOPJ_STATIC)
+  endif()
+endif()
 
 # Loop over all executables:
 FOREACH(exe opj_jp3d_compress opj_jp3d_decompress)
@@ -38,4 +38,4 @@ FOREACH(exe opj_jp3d_compress opj_jp3d_decompress)
     EXPORT OpenJP3DTargets
     DESTINATION ${OPENJPEG_INSTALL_BIN_DIR} COMPONENT Applications
   )
-ENDFOREACH(exe)
+endforeach()
index 6264645ac8212a90cf2c8e312b15a0d52c5770f9..0ba6fa2fce59f8da1e4b3c5fed33be01d67c2b94 100644 (file)
@@ -50,6 +50,11 @@ set(EXES
   )
 foreach(exe ${EXES})
   if(${exe} STREQUAL "opj_jpip_compress")
+    include_directories(
+      ${Z_INCLUDE_DIRNAME}
+      ${PNG_INCLUDE_DIRNAME}
+      ${TIFF_INCLUDE_DIRNAME}
+    )
     add_executable(${exe} ${exe}.c
       ${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c
       ${OPENJPEG_SOURCE_DIR}/src/bin/jp2/convert.c
index b41ef0c952d605dd7e9116714ec61a6d246f11d0..ca3f22ddb72a8bfbd863f36d2474a919b6860cf0 100644 (file)
@@ -47,6 +47,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include "opj_config.h"
 #include "openjpip.h"
 
 #ifdef _WIN32
index a8f5ca9f7459f082ab8f375fbdb3ad0519c8314c..d9cc67de5598b24f7511c51101113f79d6e7a46e 100644 (file)
@@ -3,7 +3,11 @@
 set(common_SRCS ${OPENJPEG_SOURCE_DIR}/src/bin/common/opj_getopt.c)
 
 if(WIN32)
-  add_definitions(-DOPJ_STATIC)
+  if(BUILD_SHARED_LIBS)
+    add_definitions(-DOPJ_EXPORTS)
+  else()
+    add_definitions(-DOPJ_STATIC)
+  endif()
 endif()
 
 # Headers file are located here:
index b17b8f69cc806da54d33889ce02d74cd59c8a0a3..fbf25fe3890e18da12b175bb4c8cd8021e20d0df 100644 (file)
@@ -29,6 +29,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "opj_config.h"
 #include "openjpeg.h"
 #include "j2k_lib.h"
 #include "cio.h"
index 566ec56bb84a0a82f5e20aff45208e85e2aec15f..66ef044de81e3f91f6944fb58c1dddc6c3766a05 100644 (file)
@@ -28,7 +28,7 @@ set(OPENJPEG_SRCS
   ${CMAKE_CURRENT_SOURCE_DIR}/t2.c
   ${CMAKE_CURRENT_SOURCE_DIR}/tcd.c
   ${CMAKE_CURRENT_SOURCE_DIR}/tgt.c
- ${CMAKE_CURRENT_SOURCE_DIR}/function_list.c
 ${CMAKE_CURRENT_SOURCE_DIR}/function_list.c
 )
 
 # Build the library
index 93f488c2d68667875cfbc5c989bc23ae724fd0a8..5b2edd49867669e895c2fbaf3951131339f27937 100644 (file)
@@ -154,7 +154,7 @@ unsigned char cio_bytein(opj_cio_t *cio) {
  * v : value to write
  * n : number of bytes to write
  */
-unsigned int cio_write(opj_cio_t *cio, unsigned long long int v, int n) {
+unsigned int OPJ_CALLCONV cio_write(opj_cio_t *cio, unsigned long long int v, int n) {
        int i;
        for (i = n - 1; i >= 0; i--) {
                if( !cio_byteout(cio, (unsigned char) ((v >> (i << 3)) & 0xff)) )
@@ -171,7 +171,7 @@ unsigned int cio_write(opj_cio_t *cio, unsigned long long int v, int n) {
  *
  * return : value of the n bytes read
  */
-unsigned int cio_read(opj_cio_t *cio, int n) {
+unsigned int OPJ_CALLCONV cio_read(opj_cio_t *cio, int n) {
        int i;
        unsigned int v = 0;
        for (i = n - 1; i >= 0; i--) {
@@ -186,13 +186,13 @@ unsigned int cio_read(opj_cio_t *cio, int n) {
  *
  * n : number of bytes to skip
  */
-void cio_skip(opj_cio_t *cio, int n) {
+void OPJ_CALLCONV cio_skip(opj_cio_t *cio, int n) {
        cio->bp += n;
 }
 
 /* ----------------------------------------------------------------------- */
 
-void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes)
+void OPJ_CALLCONV opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes)
 {
        const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + p_nb_bytes;
 
@@ -201,7 +201,7 @@ void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_n
        memcpy(p_buffer,l_data_ptr,p_nb_bytes);
 }
 
-void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes)
+void OPJ_CALLCONV opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes)
 {
        const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + p_nb_bytes - 1;
        OPJ_UINT32 i;
@@ -213,7 +213,7 @@ void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_n
        }
 }
 
-void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes)
+void OPJ_CALLCONV opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes)
 {
        OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value);
 
@@ -223,7 +223,7 @@ void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT
        memcpy(l_data_ptr+4-p_nb_bytes,p_buffer,p_nb_bytes);
 }
 
-void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes)
+void OPJ_CALLCONV opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes)
 {
        OPJ_BYTE * l_data_ptr = ((OPJ_BYTE *) p_value) + p_nb_bytes-1;
        OPJ_UINT32 i;
@@ -242,7 +242,7 @@ void opj_write_double_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value)
        memcpy(p_buffer,l_data_ptr,sizeof(OPJ_FLOAT64));
 }
 
-void opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value)
+void OPJ_CALLCONV opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value)
 {
        const OPJ_BYTE * l_data_ptr = ((const OPJ_BYTE *) &p_value) + sizeof(OPJ_FLOAT64) - 1;
        OPJ_UINT32 i;
@@ -404,7 +404,7 @@ OPJ_API void OPJ_CALLCONV opj_stream_set_user_data_length(opj_stream_t* p_stream
        l_stream->m_user_data_length = data_length;
 }
 
-OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, opj_event_mgr_t * p_event_mgr)
+OPJ_SIZE_T OPJ_CALLCONV opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, opj_event_mgr_t * p_event_mgr)
 {
        OPJ_SIZE_T l_read_nb_bytes = 0;
        if (p_stream->m_bytes_in_buffer >= p_size) {
@@ -511,7 +511,7 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu
        }
 }
 
-OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream,
+OPJ_SIZE_T OPJ_CALLCONV opj_stream_write_data (opj_stream_private_t * p_stream,
                                                                  const OPJ_BYTE * p_buffer,
                                                                  OPJ_SIZE_T p_size, 
                                                                  opj_event_mgr_t * p_event_mgr)
@@ -683,7 +683,7 @@ OPJ_OFF_T opj_stream_write_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_si
        return l_skip_nb_bytes;
 }
 
-OPJ_OFF_T opj_stream_tell (const opj_stream_private_t * p_stream)
+OPJ_OFF_T OPJ_CALLCONV opj_stream_tell (const opj_stream_private_t * p_stream)
 {
        return p_stream->m_byte_offset;
 }
@@ -697,7 +697,7 @@ OPJ_OFF_T opj_stream_get_number_byte_left (const opj_stream_private_t * p_stream
                                0;
 }
 
-OPJ_OFF_T opj_stream_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr)
+OPJ_OFF_T OPJ_CALLCONV opj_stream_skip (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, opj_event_mgr_t * p_event_mgr)
 {
        assert(p_size >= 0);
        return p_stream->m_opj_skip(p_stream,p_size,p_event_mgr);
@@ -744,13 +744,13 @@ opj_bool opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz
        return OPJ_TRUE;
 }
 
-opj_bool opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr)
+opj_bool OPJ_CALLCONV opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr)
 {
        assert(p_size >= 0);
        return p_stream->m_opj_seek(p_stream,p_size,p_event_mgr);
 }
 
-opj_bool opj_stream_has_seek (const opj_stream_private_t * p_stream)
+opj_bool OPJ_CALLCONV opj_stream_has_seek (const opj_stream_private_t * p_stream)
 {
        return p_stream->m_seek_fn != opj_stream_default_seek;
 }
index f5c4a86290ca8f7cfc20f573d2548f7724100360..08063d1dc5335361ab1fb7c3f7c3ed42b94a366f 100644 (file)
@@ -71,20 +71,20 @@ Write some bytes
 @param n Number of bytes to write
 @return Returns the number of bytes written or 0 if an error occured
 */
-unsigned int cio_write(opj_cio_t *cio, unsigned long long int v, int n);
+OPJ_API unsigned int OPJ_CALLCONV cio_write(opj_cio_t *cio, unsigned long long int v, int n);
 /**
 Read some bytes
 @param cio CIO handle
 @param n Number of bytes to read
 @return Returns the value of the n bytes read
 */
-unsigned int cio_read(opj_cio_t *cio, int n);
+OPJ_API unsigned int OPJ_CALLCONV cio_read(opj_cio_t *cio, int n);
 /**
 Skip some bytes
 @param cio CIO handle
 @param n Number of bytes to skip
 */
-void cio_skip(opj_cio_t *cio, int n);
+OPJ_API void OPJ_CALLCONV cio_skip(opj_cio_t *cio, int n);
 /* ----------------------------------------------------------------------- */
 /*@}*/
 
@@ -206,7 +206,7 @@ opj_stream_private_t;
  * @param p_value              the value to write
  * @param p_nb_bytes   the number of bytes to write
 */
-void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
+OPJ_API void OPJ_CALLCONV opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
 
 /**
  * Reads some bytes from the given data buffer, this function is used in Big Endian cpus.
@@ -215,7 +215,7 @@ void opj_write_bytes_BE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_n
  * @param p_nb_bytes   the nb bytes to read.
  * @return                             the number of bytes read or -1 if an error occured.
  */
-void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
+OPJ_API void OPJ_CALLCONV opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
 
 /**
  * Write some bytes to the given data buffer, this function is used in Little Endian cpus.
@@ -224,7 +224,7 @@ void opj_read_bytes_BE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT
  * @param p_nb_bytes   the number of bytes to write
  * @return                             the number of bytes written or -1 if an error occured
 */
-void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
+OPJ_API void OPJ_CALLCONV opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_nb_bytes);
 
 /**
  * Reads some bytes from the given data buffer, this function is used in Little Endian cpus.
@@ -233,7 +233,7 @@ void opj_write_bytes_LE (OPJ_BYTE * p_buffer, OPJ_UINT32 p_value, OPJ_UINT32 p_n
  * @param p_nb_bytes   the nb bytes to read.
  * @return                             the number of bytes read or -1 if an error occured.
  */
-void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
+OPJ_API void OPJ_CALLCONV opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT32 p_nb_bytes);
 
 
 /**
@@ -241,7 +241,7 @@ void opj_read_bytes_LE(const OPJ_BYTE * p_buffer, OPJ_UINT32 * p_value, OPJ_UINT
  * @param p_buffer             pointer the data buffer to write data to.
  * @param p_value              the value to write
  */
-void opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value);
+OPJ_API void OPJ_CALLCONV opj_write_double_LE(OPJ_BYTE * p_buffer, OPJ_FLOAT64 p_value);
 
 /***
  * Write some bytes to the given data buffer, this function is used in Big Endian cpus.
@@ -300,7 +300,7 @@ void opj_write_float_BE(OPJ_BYTE * p_buffer, OPJ_FLOAT32 p_value);
  * @param              p_event_mgr     the user event manager to be notified of special events.
  * @return             the number of bytes read, or -1 if an error occured or if the stream is at the end.
  */
-OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_API OPJ_SIZE_T OPJ_CALLCONV opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
 
 /**
  * Writes some bytes to the stream.
@@ -310,7 +310,7 @@ OPJ_SIZE_T opj_stream_read_data (opj_stream_private_t * p_stream,OPJ_BYTE * p_bu
  * @param              p_event_mgr     the user event manager to be notified of special events.
  * @return             the number of bytes writtent, or -1 if an error occured.
  */
-OPJ_SIZE_T opj_stream_write_data (opj_stream_private_t * p_stream,const OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_API OPJ_SIZE_T OPJ_CALLCONV opj_stream_write_data (opj_stream_private_t * p_stream,const OPJ_BYTE * p_buffer, OPJ_SIZE_T p_size, struct opj_event_mgr * p_event_mgr);
 
 /**
  * Writes the content of the stream buffer to the stream.
@@ -327,7 +327,7 @@ opj_bool opj_stream_flush (opj_stream_private_t * p_stream, struct opj_event_mgr
  * @param              p_event_mgr     the user event manager to be notified of special events.
  * @return             the number of bytes skipped, or -1 if an error occured.
  */
-OPJ_OFF_T opj_stream_skip (opj_stream_private_t * p_stream,OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_API OPJ_OFF_T OPJ_CALLCONV opj_stream_skip (opj_stream_private_t * p_stream,OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
 
 /**
  * Tells the byte offset on the stream (similar to ftell).
@@ -336,7 +336,7 @@ OPJ_OFF_T opj_stream_skip (opj_stream_private_t * p_stream,OPJ_OFF_T p_size, str
  *
  * @return             the current position o fthe stream.
  */
-OPJ_OFF_T opj_stream_tell (const opj_stream_private_t * p_stream);
+OPJ_API OPJ_OFF_T OPJ_CALLCONV opj_stream_tell (const opj_stream_private_t * p_stream);
 
 
 /**
@@ -391,12 +391,12 @@ opj_bool opj_stream_write_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_siz
  * @param              p_event_mgr     the user event manager to be notified of special events.
  * @return             true if the stream is seekable.
  */
-opj_bool opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
+OPJ_API opj_bool OPJ_CALLCONV opj_stream_seek (opj_stream_private_t * p_stream, OPJ_OFF_T p_size, struct opj_event_mgr * p_event_mgr);
 
 /**
  * Tells if the given stream is seekable.
  */
-opj_bool opj_stream_has_seek (const opj_stream_private_t * p_stream);
+OPJ_API opj_bool OPJ_CALLCONV opj_stream_has_seek (const opj_stream_private_t * p_stream);
 
 OPJ_SIZE_T opj_stream_default_read (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data);
 OPJ_SIZE_T opj_stream_default_write (void * p_buffer, OPJ_SIZE_T p_nb_bytes, void * p_user_data);
index fa5056194ffe8751339eb03e09389a97b4036746..cfc68c195f3a788f30492e397040bcf320ed9202 100644 (file)
@@ -117,7 +117,7 @@ opj_bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ..
 }
 
 /* ----------------------------------------------------------------------- */
-opj_bool opj_event_msg_v2(opj_event_mgr_t* p_event_mgr, int event_type, const char *fmt, ...) {
+opj_bool OPJ_CALLCONV opj_event_msg_v2(opj_event_mgr_t* p_event_mgr, int event_type, const char *fmt, ...) {
 #define MSG_SIZE 512 /* 512 bytes should be more than enough for a short message */
        opj_msg_callback msg_handler = 00;
        void * l_data = 00;
@@ -167,7 +167,7 @@ opj_bool opj_event_msg_v2(opj_event_mgr_t* p_event_mgr, int event_type, const ch
        return OPJ_TRUE;
 }
 
-void opj_set_default_event_handler(opj_event_mgr_t * p_manager)
+void OPJ_CALLCONV opj_set_default_event_handler(opj_event_mgr_t * p_manager)
 {
        p_manager->m_error_data = 00;
        p_manager->m_warning_data = 00;
index 111cea9f1d0ddcd0692d562ffbffaa80fb8fb348..98543b5d50303750fc7f1719beb30191b70ce896 100644 (file)
@@ -89,13 +89,13 @@ opj_bool opj_event_msg(opj_common_ptr cinfo, int event_type, const char *fmt, ..
  *
  * @return Returns true if successful, returns false otherwise
  */
-opj_bool opj_event_msg_v2(opj_event_mgr_t* event_mgr, int event_type, const char *fmt, ...);
+OPJ_API opj_bool OPJ_CALLCONV opj_event_msg_v2(opj_event_mgr_t* event_mgr, int event_type, const char *fmt, ...);
 /* ----------------------------------------------------------------------- */
 
 /**
  * Set the event manager with the default callback function for the 3 levels.
  */
-void opj_set_default_event_handler(opj_event_mgr_t * p_manager);
+OPJ_API void OPJ_CALLCONV opj_set_default_event_handler(opj_event_mgr_t * p_manager);
 
 /*@}*/
 
index 1f84a429f057594c03464c276d3dbf01b8a9e8ea..4b4b0a831cb36a8156fe273fd8b0f11cd67de7fc 100644 (file)
@@ -67,7 +67,7 @@ void  opj_procedure_list_destroy(opj_procedure_list_t * p_list)
         opj_free(p_list);
 }
 
-opj_bool  opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure)
+opj_bool OPJ_CALLCONV opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure)
 {
         if (p_validation_list->m_nb_max_procedures == p_validation_list->m_nb_procedures)
         {
@@ -98,17 +98,17 @@ opj_bool  opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_
         return OPJ_TRUE;
 }
 
-OPJ_UINT32 opj_procedure_list_get_nb_procedures (opj_procedure_list_t * p_validation_list)
+OPJ_UINT32 OPJ_CALLCONV opj_procedure_list_get_nb_procedures (opj_procedure_list_t * p_validation_list)
 {
         return p_validation_list->m_nb_procedures;
 }
 
-opj_procedure* opj_procedure_list_get_first_procedure (opj_procedure_list_t * p_validation_list)
+opj_procedure* OPJ_CALLCONV opj_procedure_list_get_first_procedure (opj_procedure_list_t * p_validation_list)
 {
         return p_validation_list->m_procedures;
 }
 
-void  opj_procedure_list_clear (opj_procedure_list_t * p_validation_list)
+void OPJ_CALLCONV opj_procedure_list_clear (opj_procedure_list_t * p_validation_list)
 {
         p_validation_list->m_nb_procedures = 0;
 }
index f67aa5f2793a634235d81a05844c8472d1fdaf53..0e27d75a5b2b9adb140411380cc055c3d3ad9438 100644 (file)
@@ -90,7 +90,7 @@ void  opj_procedure_list_destroy(opj_procedure_list_t * p_list);
  *
  * @return     OPJ_FALSE if the procedure could ne added.
  */
-opj_bool opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure);
+OPJ_API opj_bool OPJ_CALLCONV opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_list, opj_procedure p_procedure);
 
 /**
  * Gets the number of validation procedures.
@@ -99,7 +99,7 @@ opj_bool opj_procedure_list_add_procedure (opj_procedure_list_t * p_validation_l
  *
  * @return the number of validation procedures.
  */
-OPJ_UINT32 opj_procedure_list_get_nb_procedures (opj_procedure_list_t * p_validation_list);
+OPJ_API OPJ_UINT32 OPJ_CALLCONV opj_procedure_list_get_nb_procedures (opj_procedure_list_t * p_validation_list);
 
 /**
  * Gets the pointer on the first validation procedure. This function is similar to the C++
@@ -110,7 +110,7 @@ OPJ_UINT32 opj_procedure_list_get_nb_procedures (opj_procedure_list_t * p_valida
  *
  * @return     a pointer to the first procedure.
  */
-opj_procedure* opj_procedure_list_get_first_procedure (opj_procedure_list_t * p_validation_list);
+OPJ_API opj_procedure* OPJ_CALLCONV opj_procedure_list_get_first_procedure (opj_procedure_list_t * p_validation_list);
 
 
 /**
@@ -119,7 +119,7 @@ opj_procedure* opj_procedure_list_get_first_procedure (opj_procedure_list_t * p_
  * @param      p_validation_list the list of procedure to clear.
  *
  */
-void  opj_procedure_list_clear (opj_procedure_list_t * p_validation_list);
+OPJ_API void OPJ_CALLCONV opj_procedure_list_clear (opj_procedure_list_t * p_validation_list);
 /*@}*/
 
 #endif /* __FUNCTION_LIST_H */
index 6f1b16e118469d9c9e0aab345c7c7ca09728d45d..5481a6c6812396904ed860a0a27f54fb4d9cacc2 100644 (file)
@@ -9061,7 +9061,7 @@ opj_bool opj_j2k_encode_v2(     opj_j2k_v2_t * p_j2k,
         return OPJ_TRUE;
 }
 
-opj_bool opj_j2k_end_compress(  opj_j2k_v2_t *p_j2k,
+opj_bool OPJ_CALLCONV opj_j2k_end_compress(  opj_j2k_v2_t *p_j2k,
                                                         opj_stream_private_t *p_stream,
                                                         opj_event_mgr_t * p_manager)
 {
@@ -9076,7 +9076,7 @@ opj_bool opj_j2k_end_compress(  opj_j2k_v2_t *p_j2k,
         return OPJ_TRUE;
 }
 
-opj_bool opj_j2k_start_compress(opj_j2k_v2_t *p_j2k,
+OPJ_API opj_bool OPJ_CALLCONV opj_j2k_start_compress(opj_j2k_v2_t *p_j2k,
                                                             opj_stream_private_t *p_stream,
                                                             opj_image_t * p_image,
                                                             opj_event_mgr_t * p_manager)
index 2782a096a8ec91cab334d5be7e5289e4ef5941db..4366fc435052e222d18a4c885274ca9f30b4772e 100644 (file)
@@ -1024,7 +1024,7 @@ opj_bool opj_j2k_encode_v2(       opj_j2k_v2_t * p_j2k,
  *
  * @return true if the codec is valid.
  */
-opj_bool opj_j2k_start_compress(opj_j2k_v2_t *p_j2k,
+opj_bool OPJ_CALLCONV opj_j2k_start_compress(opj_j2k_v2_t *p_j2k,
                                                            opj_stream_private_t *p_stream,
                                                            opj_image_t * p_image,
                                                            opj_event_mgr_t * p_manager);
@@ -1033,7 +1033,7 @@ opj_bool opj_j2k_start_compress(opj_j2k_v2_t *p_j2k,
  * Ends the compression procedures and possibiliy add data to be read after the
  * codestream.
  */
-opj_bool opj_j2k_end_compress(         opj_j2k_v2_t *p_j2k,
+OPJ_API opj_bool OPJ_CALLCONV opj_j2k_end_compress(    opj_j2k_v2_t *p_j2k,
                                                            opj_stream_private_t *cio,
                                                            opj_event_mgr_t * p_manager);
 
index d74583e4aca86fa68403e73fd025906f1179ed4d..198c0e56c4cf2653b0508176f66ceb4efba87610 100644 (file)
@@ -1108,7 +1108,7 @@ opj_bool opj_jp2_decode(opj_jp2_v2_t *jp2,
        return OPJ_TRUE;
 }
 
-opj_bool opj_jp2_write_jp2h(opj_jp2_v2_t *jp2,
+opj_bool OPJ_CALLCONV opj_jp2_write_jp2h(opj_jp2_v2_t *jp2,
                             opj_stream_private_t *stream,
                             opj_event_mgr_t * p_manager
                             )
@@ -1339,7 +1339,7 @@ void opj_jp2_setup_decoder(opj_jp2_v2_t *jp2, opj_dparameters_t *parameters)
 /* JP2 encoder interface                                             */
 /* ----------------------------------------------------------------------- */
 
-void opj_jp2_setup_encoder(    opj_jp2_v2_t *jp2,
+void OPJ_CALLCONV opj_jp2_setup_encoder(       opj_jp2_v2_t *jp2,
                             opj_cparameters_t *parameters,
                             opj_image_t *image,
                             opj_event_mgr_t * p_manager)
@@ -1417,7 +1417,7 @@ void opj_jp2_setup_encoder(       opj_jp2_v2_t *jp2,
        jp2->approx = 0;                /* APPROX */
 }
 
-opj_bool opj_jp2_encode(opj_jp2_v2_t *jp2,
+opj_bool OPJ_CALLCONV opj_jp2_encode(opj_jp2_v2_t *jp2,
                                                opj_stream_private_t *stream,
                                                opj_event_mgr_t * p_manager)
 {
@@ -2095,7 +2095,7 @@ opj_bool opj_jp2_read_tile_header ( opj_jp2_v2_t * p_jp2,
                                                                p_manager);
 }
 
-opj_bool opj_jp2_write_tile (  opj_jp2_v2_t *p_jp2,
+opj_bool OPJ_CALLCONV opj_jp2_write_tile (     opj_jp2_v2_t *p_jp2,
                                                            OPJ_UINT32 p_tile_index,
                                                            OPJ_BYTE * p_data,
                                                            OPJ_UINT32 p_data_size,
@@ -2118,7 +2118,7 @@ opj_bool opj_jp2_decode_tile (  opj_jp2_v2_t * p_jp2,
        return opj_j2k_decode_tile (p_jp2->j2k,p_tile_index,p_data,p_data_size,p_stream,p_manager);
 }
 
-void opj_jp2_destroy(opj_jp2_v2_t *jp2)
+void OPJ_CALLCONV opj_jp2_destroy(opj_jp2_v2_t *jp2)
 {
        if (jp2) {
                /* destroy the J2K codec */
@@ -2249,7 +2249,7 @@ opj_bool opj_jp2_get_tile(        opj_jp2_v2_t *p_jp2,
 /* JP2 encoder interface                                             */
 /* ----------------------------------------------------------------------- */
 
-opj_jp2_v2_t* opj_jp2_create(opj_bool p_is_decoder)
+opj_jp2_v2_t* OPJ_CALLCONV opj_jp2_create(opj_bool p_is_decoder)
 {
        opj_jp2_v2_t *jp2 = (opj_jp2_v2_t*)opj_malloc(sizeof(opj_jp2_v2_t));
        if (jp2) {
@@ -2308,7 +2308,7 @@ opj_codestream_index_t* jp2_get_cstr_index(opj_jp2_v2_t* p_jp2)
        return j2k_get_cstr_index(p_jp2->j2k);
 }
 
-opj_codestream_info_v2_t* jp2_get_cstr_info(opj_jp2_v2_t* p_jp2)
+opj_codestream_info_v2_t* OPJ_CALLCONV jp2_get_cstr_info(opj_jp2_v2_t* p_jp2)
 {
        return j2k_get_cstr_info(p_jp2->j2k);
 }
index 7dc7c1b5f0e06ab93aa237fb88003a7f978be8ca..66c665aae9124846d5f5da432dd504a0122debe3 100644 (file)
@@ -265,7 +265,7 @@ opj_jp2_img_header_writer_handler_t;
  *
  * @return true if writing was successful.
 */
-opj_bool opj_jp2_write_jp2h(opj_jp2_v2_t *jp2,
+OPJ_API opj_bool OPJ_CALLCONV opj_jp2_write_jp2h(opj_jp2_v2_t *jp2,
                             opj_stream_private_t *stream,
                             opj_event_mgr_t * p_manager );
 
@@ -300,7 +300,7 @@ opj_bool opj_jp2_decode(opj_jp2_v2_t *jp2,
  * @param image input filled image
  * @param p_manager  FIXME DOC
 */
-void opj_jp2_setup_encoder(  opj_jp2_v2_t *jp2, 
+OPJ_API void OPJ_CALLCONV opj_jp2_setup_encoder(  opj_jp2_v2_t *jp2, 
                             opj_cparameters_t *parameters, 
                             opj_image_t *image, 
                             opj_event_mgr_t * p_manager);
@@ -312,7 +312,7 @@ Encode an image into a JPEG-2000 file stream
 @param p_manager  event manager
 @return Returns true if successful, returns false otherwise
 */
-opj_bool opj_jp2_encode(  opj_jp2_v2_t *jp2, 
+OPJ_API opj_bool OPJ_CALLCONV opj_jp2_encode(  opj_jp2_v2_t *jp2, 
               opj_stream_private_t *stream, 
               opj_event_mgr_t * p_manager);
 
@@ -402,7 +402,7 @@ opj_bool opj_jp2_read_tile_header ( opj_jp2_v2_t * p_jp2,
  * @param  p_stream      the stream to write data to.
  * @param  p_manager  the user event manager.
  */
-opj_bool opj_jp2_write_tile (  opj_jp2_v2_t *p_jp2,
+OPJ_API opj_bool OPJ_CALLCONV opj_jp2_write_tile (  opj_jp2_v2_t *p_jp2,
                     OPJ_UINT32 p_tile_index,
                     OPJ_BYTE * p_data,
                     OPJ_UINT32 p_data_size,
@@ -432,13 +432,13 @@ opj_bool opj_jp2_decode_tile (  opj_jp2_v2_t * p_jp2,
  *
  * @return  an empty jpeg2000 file codec.
  */
-opj_jp2_v2_t* opj_jp2_create (opj_bool p_is_decoder);
+OPJ_API opj_jp2_v2_t* OPJ_CALLCONV opj_jp2_create (opj_bool p_is_decoder);
 
 /**
 Destroy a JP2 decompressor handle
 @param jp2 JP2 decompressor handle to destroy
 */
-void opj_jp2_destroy(opj_jp2_v2_t *jp2);
+OPJ_API void OPJ_CALLCONV opj_jp2_destroy(opj_jp2_v2_t *jp2);
 
 
 /**
@@ -496,7 +496,7 @@ void jp2_dump (opj_jp2_v2_t* p_jp2, OPJ_INT32 flag, FILE* out_stream);
  *
  *@return  the codestream information extract from the jpg2000 codec
  */
-opj_codestream_info_v2_t* jp2_get_cstr_info(opj_jp2_v2_t* p_jp2);
+OPJ_API opj_codestream_info_v2_t* OPJ_CALLCONV jp2_get_cstr_info(opj_jp2_v2_t* p_jp2);
 
 /**
  * Get the codestream index from a JPEG2000 codec.
index 5f92d7aab4c35086af7df521e834f0029f3c6951..8f034ffeb7e308ff32b28b77590ae3c3ac9a9143 100644 (file)
@@ -1,37 +1,42 @@
+# openjp3d
+include_regular_expression("^.*$")
 
-INCLUDE_REGULAR_EXPRESSION("^.*$")
+include_directories(
+  ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
+  )
 
 SET(OPENJP3D_LIBRARY_NAME openjp3d)
 # Defines the source code for the library
 SET(OPENJP3D_SRCS
-bio.c  cio.c  dwt.c  event.c  jp3d.c  jp3d_lib.c  mct.c  mqc.c  openjp3d.c  pi.c  raw.c  t1.c  t1_3d.c  t2.c  tcd.c  tgt.c  volume.c
+bio.c  cio.c  dwt.c  event.c  jp3d.c  jp3d_lib.c  mct.c  mqc.c  openjp3d.c
+pi.c  raw.c  t1.c  t1_3d.c  t2.c  tcd.c  tgt.c  volume.c
 )
 
 # Build the library
-IF(WIN32)
-  IF(BUILD_SHARED_LIBS)
-    ADD_DEFINITIONS(-DOPJ_EXPORTS)
-  ELSE(BUILD_SHARED_LIBS)
-    ADD_DEFINITIONS(-DOPJ_STATIC)
-  ENDIF(BUILD_SHARED_LIBS)
-ENDIF(WIN32)
+if(WIN32)
+  if(BUILD_SHARED_LIBS)
+    add_definitions(-DOPJ_EXPORTS)
+  else()
+    add_definitions(-DOPJ_STATIC)
+  endif()
+endif()
 
 # build jp3d lib:
-ADD_LIBRARY(${OPENJP3D_LIBRARY_NAME} ${OPENJP3D_SRCS})
-IF(UNIX)
-  TARGET_LINK_LIBRARIES(${OPENJP3D_LIBRARY_NAME} m)
-ENDIF(UNIX)
-SET_TARGET_PROPERTIES(${OPENJP3D_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
+add_library(${OPENJP3D_LIBRARY_NAME} ${OPENJP3D_SRCS})
+if(UNIX)
+  target_link_libraries(${OPENJP3D_LIBRARY_NAME} m)
+endif()
+set_target_properties(${OPENJP3D_LIBRARY_NAME} PROPERTIES ${OPENJPEG_LIBRARY_PROPERTIES})
 
 # Install library
-INSTALL(TARGETS ${OPENJP3D_LIBRARY_NAME}
+install(TARGETS ${OPENJP3D_LIBRARY_NAME}
   EXPORT OpenJP3DTargets
   DESTINATION ${OPENJPEG_INSTALL_LIB_DIR} 
   COMPONENT Libraries
 )
 
 # Install includes files
-INSTALL(FILES openjp3d.h
+install(FILES openjp3d.h
   DESTINATION ${OPENJPEG_INSTALL_INCLUDE_DIR}
   COMPONENT Headers
 )
index ab2744e1ceb985ab4aa6f1c888ceb0673cc20dae..c1f3c44ffe15d89e8975044188ecc9fbfe6317c1 100755 (executable)
@@ -30,6 +30,7 @@
 #endif /* _WIN32 */\r
 \r
 #include "opj_includes.h"\r
+#include "openjp3d.h"\r
 #define JP3D_VERSION "1.3.0"\r
 /* ---------------------------------------------------------------------- */\r
 #ifdef _WIN32\r
index e6829d91f90dda66a281c9c93c1740c173dd70a9..d7ac42da888a328be32fd33dfb02589e8ca3591f 100755 (executable)
 */\r
 \r
 #if defined(OPJ_STATIC) || !defined(_WIN32)\r
+/* http://gcc.gnu.org/wiki/Visibility */\r
+#if __GNUC__ >= 4\r
+#define OPJ_API    __attribute__ ((visibility ("default")))\r
+#define OPJ_LOCAL  __attribute__ ((visibility ("hidden")))\r
+#else\r
 #define OPJ_API\r
+#define OPJ_LOCAL\r
+#endif\r
 #define OPJ_CALLCONV\r
 #else\r
 #define OPJ_CALLCONV __stdcall\r
+\r
 /*\r
 The following ifdef block is the standard way of creating macros which make exporting \r
 from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS\r
index 5b9f18088fdd8a12a8d7ec733541d34141792033..065a7a342836a5963a121e5e5cb86e104af9425a 100755 (executable)
@@ -25,6 +25,8 @@
  */\r
 \r
 #include "opj_includes.h"\r
+#include "volume.h"\r
+#include "openjp3d.h"\r
 \r
 opj_volume_t* OPJ_CALLCONV opj_volume_create(int numcmpts, opj_volume_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc) {\r
        int compno;\r
index a817a4661bd45763098fa840744c5963a816e336..dc1b45b2a543a53fedf1fedfab312f9c63cee2f0 100644 (file)
@@ -209,7 +209,7 @@ void local_log( bool query, bool messages, bool sessions, bool targets, QR_t *qr
 
 #ifndef SERVER
 
-dec_server_record_t * init_dec_server( int port)
+dec_server_record_t * OPJ_CALLCONV init_dec_server( int port)
 {
   dec_server_record_t *record = (dec_server_record_t *)opj_malloc( sizeof(dec_server_record_t));
 
@@ -222,7 +222,7 @@ dec_server_record_t * init_dec_server( int port)
   return record;
 }
 
-void terminate_dec_server( dec_server_record_t **rec)
+void OPJ_CALLCONV terminate_dec_server( dec_server_record_t **rec)
 {
   delete_cachelist( &(*rec)->cachelist);  
   opj_free( (*rec)->jpipstream);
@@ -236,7 +236,7 @@ void terminate_dec_server( dec_server_record_t **rec)
   opj_free( *rec);
 }
 
-client_t accept_connection( dec_server_record_t *rec)
+client_t OPJ_CALLCONV accept_connection( dec_server_record_t *rec)
 {
   client_t client;
   
@@ -247,7 +247,7 @@ client_t accept_connection( dec_server_record_t *rec)
   return client;
 }
 
-bool handle_clientreq( client_t client, dec_server_record_t *rec)
+bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec)
 {
   bool quit = false;
   msgtype_t msgtype = identify_clientmsg( client);
@@ -306,7 +306,7 @@ bool handle_clientreq( client_t client, dec_server_record_t *rec)
 }
 
 
-jpip_dec_param_t * init_jpipdecoder( bool jp2)
+jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( bool jp2)
 {
   jpip_dec_param_t *dec;
   
@@ -321,7 +321,7 @@ jpip_dec_param_t * init_jpipdecoder( bool jp2)
 }
 
 
-bool fread_jpip( const char fname[], jpip_dec_param_t *dec)
+bool OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec)
 {
   int infd;
 
@@ -346,7 +346,7 @@ bool fread_jpip( const char fname[], jpip_dec_param_t *dec)
   return true;
 }
 
-void decode_jpip( jpip_dec_param_t *dec)
+void OPJ_CALLCONV decode_jpip( jpip_dec_param_t *dec)
 {
   parse_JPIPstream( dec->jpipstream, dec->jpiplen, 0, dec->msgqueue);
 
@@ -361,7 +361,7 @@ void decode_jpip( jpip_dec_param_t *dec)
     dec->jp2kstream = recons_j2k( dec->msgqueue, dec->jpipstream, dec->msgqueue->first->csn, 0, 0, &dec->jp2klen);  
 }
 
-bool fwrite_jp2k( const char fname[], jpip_dec_param_t *dec)
+bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec)
 {
   int outfd;
   
@@ -382,7 +382,7 @@ bool fwrite_jp2k( const char fname[], jpip_dec_param_t *dec)
  return true;
 }
 
-void output_log( bool messages, bool metadata, bool ihdrbox, jpip_dec_param_t *dec)
+void OPJ_CALLCONV output_log( bool messages, bool metadata, bool ihdrbox, jpip_dec_param_t *dec)
 {
   if( messages)
     print_msgqueue( dec->msgqueue);
@@ -396,7 +396,7 @@ void output_log( bool messages, bool metadata, bool ihdrbox, jpip_dec_param_t *d
   }
 }
 
-void destroy_jpipdecoder( jpip_dec_param_t **dec)
+void OPJ_CALLCONV destroy_jpipdecoder( jpip_dec_param_t **dec)
 {
   opj_free( (*dec)->jpipstream);
   delete_msgqueue( &(*dec)->msgqueue);
@@ -409,7 +409,7 @@ void destroy_jpipdecoder( jpip_dec_param_t **dec)
   opj_free( *dec);
 }
 
-index_t * get_index_from_JP2file( int fd)
+index_t * OPJ_CALLCONV get_index_from_JP2file( int fd)
 {
   char *data;
  
@@ -437,12 +437,12 @@ index_t * get_index_from_JP2file( int fd)
   return parse_jp2file( fd);
 }
 
-void destroy_index( index_t **idx)
+void OPJ_CALLCONV destroy_index( index_t **idx)
 {
   delete_index( idx);
 }
 
-void output_index( index_t *index)
+void OPJ_CALLCONV output_index( index_t *index)
 {
   print_index( *index);
 }
index 5255ab9c4a995c02d439a41dbe14aa11793a7fa9..584a69b36b9f281a31986852b63fba462da362ef 100644 (file)
@@ -172,14 +172,14 @@ typedef SOCKET client_t;
  * @param[in] port opening tcp port (valid No. 49152-65535)
  * @return         intialized decoding server record pointer
  */
-dec_server_record_t * init_dec_server( int port);
+OPJ_API dec_server_record_t * OPJ_CALLCONV init_dec_server( int port);
 
 /**
  * Terminate the  image decoding server
  *
  * @param[in] rec address of deleting decoding server static record pointer
  */
-void terminate_dec_server( dec_server_record_t **rec);
+OPJ_API void OPJ_CALLCONV terminate_dec_server( dec_server_record_t **rec);
 
 /**
  * Accept client connection
@@ -187,7 +187,7 @@ void terminate_dec_server( dec_server_record_t **rec);
  * @param[in] rec decoding server static record pointer
  * @return        client socket ID, -1 if failed
  */
-client_t accept_connection( dec_server_record_t *rec);
+OPJ_API client_t OPJ_CALLCONV accept_connection( dec_server_record_t *rec);
 
  /**
   * Handle client request
@@ -196,7 +196,7 @@ client_t accept_connection( dec_server_record_t *rec);
   * @param[in] rec    decoding server static record pointer
   * @return           true if succeed
   */
-bool handle_clientreq( client_t client, dec_server_record_t *rec);
+OPJ_API bool OPJ_CALLCONV handle_clientreq( client_t client, dec_server_record_t *rec);
 
 #endif /*SERVER*/
 
@@ -229,14 +229,14 @@ typedef struct jpip_dec_param{
  * @param[in] jp2 true in case of jp2 file encoding, else j2k file encoding
  * @return        JPIP decoding parameters pointer
  */
-jpip_dec_param_t * init_jpipdecoder( bool jp2);
+OPJ_API jpip_dec_param_t * OPJ_CALLCONV init_jpipdecoder( bool jp2);
 
 /**
  * Destroy jpip decoding parameters
  *
  * @param[in]  dec  address of JPIP decoding parameters pointer
  */
-void destroy_jpipdecoder( jpip_dec_param_t **dec);
+OPJ_API void OPJ_CALLCONV destroy_jpipdecoder( jpip_dec_param_t **dec);
 
 /**
  * Read jpip codestream from a file
@@ -245,14 +245,14 @@ void destroy_jpipdecoder( jpip_dec_param_t **dec);
  * @param[in]  dec   JPIP decoding parameters pointer
  * @return           true if succeed
  */
-bool fread_jpip( const char fname[], jpip_dec_param_t *dec);
+OPJ_API bool OPJ_CALLCONV fread_jpip( const char fname[], jpip_dec_param_t *dec);
 
 /**
  * Decode jpip codestream
  *
  * @param[in]  dec   JPIP decoding parameters pointer
  */
-void decode_jpip( jpip_dec_param_t *dec);
+OPJ_API void OPJ_CALLCONV decode_jpip( jpip_dec_param_t *dec);
 
 /**
  * Write J2K/JP2 codestream to a file
@@ -261,7 +261,7 @@ void decode_jpip( jpip_dec_param_t *dec);
  * @param[in]  dec   JPIP decoding parameters pointer
  * @return           true if succeed
  */
-bool fwrite_jp2k( const char fname[], jpip_dec_param_t *dec);
+OPJ_API bool OPJ_CALLCONV fwrite_jp2k( const char fname[], jpip_dec_param_t *dec);
 
 /**
  * Option; print out parameter values to stderr
@@ -271,7 +271,7 @@ bool fwrite_jp2k( const char fname[], jpip_dec_param_t *dec);
  * @param[in]  ihdrbox  true if image header data is to be printed out
  * @param[in]  dec   JPIP decoding parameters pointer
  */
-void output_log( bool messages, bool metadata, bool ihdrbox, jpip_dec_param_t *dec);
+OPJ_API void OPJ_CALLCONV output_log( bool messages, bool metadata, bool ihdrbox, jpip_dec_param_t *dec);
 
 /*
  *  test the format of index (cidx) box in JP2 file
@@ -286,14 +286,14 @@ typedef index_param_t index_t;
  * @param[in] fd file descriptor of the JP2 file
  * @return       pointer to the generated structure of index parameters
  */
-index_t * get_index_from_JP2file( int fd);
+OPJ_API index_t * OPJ_CALLCONV get_index_from_JP2file( int fd);
 
 /**
  * Destroy index parameters
  *
  * @param[in,out] idx addressof the index pointer
  */
-void destroy_index( index_t **idx);
+OPJ_API void OPJ_CALLCONV destroy_index( index_t **idx);
 
 
 /**
@@ -301,7 +301,7 @@ void destroy_index( index_t **idx);
  *
  * @param[in] index index parameters
  */
-void output_index( index_t *index);
+OPJ_API void OPJ_CALLCONV output_index( index_t *index);
 
 OPJ_API opj_codec_t* OPJ_CALLCONV opj_jpip_create_compress(OPJ_CODEC_FORMAT format);
 
index c2efe7e4bb75ec257dc9afca16d0bb501e17a7d2..775c931859513c22ca98e239611298194fafbf35 100644 (file)
@@ -1,4 +1,10 @@
+# openmj2:
 set(OPENMJ2_LIBRARY_NAME openmj2)
+
+include_directories(
+  ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
+  )
+
 set(OPENMJ2_SRCS
   mj2.c
   mj2_convert.c
@@ -27,15 +33,10 @@ set(OPENMJ2_SRCS
 if(WIN32)
   if(BUILD_SHARED_LIBS)
     add_definitions(-DOPJ_EXPORTS)
-  else(BUILD_SHARED_LIBS)
+  else()
     add_definitions(-DOPJ_STATIC)
-  endif(BUILD_SHARED_LIBS)
-endif(WIN32)
-
-include_directories(
-  ${OPENJPEG_BINARY_DIR}/src/lib/openjp2 # opj_config.h
-  #${OPENJPEG_SOURCE_DIR}/src/lib/openjp2
-  )
+  endif()
+endif()
 
 # build mj2 lib:
 add_library(${OPENMJ2_LIBRARY_NAME} ${OPENMJ2_SRCS})
index c0cb02827b0a61841df627a53c83aa97645cb82d..56de6145465c26813405fe265d4b176d6f595a7b 100644 (file)
@@ -152,7 +152,7 @@ unsigned char cio_bytein(opj_cio_t *cio) {
  * v : value to write
  * n : number of bytes to write
  */
-unsigned int cio_write(opj_cio_t *cio, unsigned int64 v, int n) {
+unsigned int OPJ_CALLCONV cio_write(opj_cio_t *cio, unsigned int64 v, int n) {
        int i;
        for (i = n - 1; i >= 0; i--) {
                if( !cio_byteout(cio, (unsigned char) ((v >> (i << 3)) & 0xff)) )
@@ -168,7 +168,7 @@ unsigned int cio_write(opj_cio_t *cio, unsigned int64 v, int n) {
  *
  * return : value of the n bytes read
  */
-unsigned int cio_read(opj_cio_t *cio, int n) {
+unsigned int OPJ_CALLCONV cio_read(opj_cio_t *cio, int n) {
        int i;
        unsigned int v;
        v = 0;
@@ -183,7 +183,7 @@ unsigned int cio_read(opj_cio_t *cio, int n) {
  *
  * n : number of bytes to skip
  */
-void cio_skip(opj_cio_t *cio, int n) {
+void OPJ_CALLCONV cio_skip(opj_cio_t *cio, int n) {
        cio->bp += n;
 }
 
index e62743141ca6684f6a08469d240d1e48cc04e44f..d37a6532b2aa4dc28987c5c238cb43d67a21873c 100644 (file)
@@ -70,20 +70,20 @@ Write some bytes
 @param n Number of bytes to write
 @return Returns the number of bytes written or 0 if an error occured
 */
-unsigned int cio_write(opj_cio_t *cio, unsigned int64 v, int n);
+OPJ_API unsigned int OPJ_CALLCONV cio_write(opj_cio_t *cio, unsigned int64 v, int n);
 /**
 Read some bytes
 @param cio CIO handle
 @param n Number of bytes to read
 @return Returns the value of the n bytes read
 */
-unsigned int cio_read(opj_cio_t *cio, int n);
+OPJ_API unsigned int OPJ_CALLCONV cio_read(opj_cio_t *cio, int n);
 /**
 Skip some bytes
 @param cio CIO handle
 @param n Number of bytes to skip
 */
-void cio_skip(opj_cio_t *cio, int n);
+OPJ_API void OPJ_CALLCONV cio_skip(opj_cio_t *cio, int n);
 /* ----------------------------------------------------------------------- */
 /*@}*/
 
index a66e31e9afb3150d5650714815957177193c8cdc..a792bb7e6a7d26e85e4e118b30e439169016dd45 100644 (file)
@@ -33,7 +33,7 @@
 #endif /* _WIN32 */
 #include "opj_includes.h"
 
-double opj_clock(void) {
+double OPJ_CALLCONV opj_clock(void) {
 #ifdef _WIN32
        /* _WIN32: use QueryPerformance (very accurate) */
     LARGE_INTEGER freq , t ;
index 5f3406e510650511618d8d99e43343d65e2ffaf2..d657b43468e2b795ab84d7fe878cdbc96cff9121 100644 (file)
@@ -43,7 +43,7 @@ The functions in J2K_LIB.C are internal utilities mainly used for timing.
 Difference in successive opj_clock() calls tells you the elapsed time
 @return Returns time in seconds
 */
-double opj_clock(void);
+OPJ_API double OPJ_CALLCONV opj_clock(void);
 
 /* ----------------------------------------------------------------------- */
 /*@}*/
index 4d87d7b8d40ab22d4cc139c23ac42cb71e31b24b..68afb4894cf2dbf50389ea5abc9cbe9cddb59f1e 100644 (file)
@@ -78,7 +78,7 @@ int mj2_read_boxhdr(mj2_box_t * box, opj_cio_t *cio)
 *
 */
 
-int mj2_init_stdmovie(opj_mj2_t * movie)
+int OPJ_CALLCONV mj2_init_stdmovie(opj_mj2_t * movie)
 {
   mj2_tk_t *tk0;
   int i, w, h, prec;
@@ -300,7 +300,7 @@ void mj2_stco_decompact(mj2_tk_t * tk)
 * JP Signature box
 *
 */
-void mj2_write_jp(opj_cio_t *cio)
+void OPJ_CALLCONV mj2_write_jp(opj_cio_t *cio)
 {
   mj2_box_t box;
   box.init_pos = cio_tell(cio);
@@ -348,7 +348,7 @@ int mj2_read_jp(opj_cio_t *cio)
 * File type box
 *
 */
-void mj2_write_ftyp(opj_mj2_t * movie, opj_cio_t *cio)
+void OPJ_CALLCONV mj2_write_ftyp(opj_mj2_t * movie, opj_cio_t *cio)
 {
   int i;
   mj2_box_t box;
@@ -2536,7 +2536,7 @@ int mj2_read_mvhd(opj_mj2_t * movie, opj_cio_t *cio)
 * Movie Box
 *
 */
-void mj2_write_moov(opj_mj2_t * movie, opj_cio_t *cio)
+void OPJ_CALLCONV mj2_write_moov(opj_mj2_t * movie, opj_cio_t *cio)
 {
   int i;
   mj2_box_t box;
@@ -2608,7 +2608,7 @@ int mj2_read_moov(opj_mj2_t * movie, opj_image_t * img, opj_cio_t *cio)
   return 0;
 }
 
-int mj2_read_struct(FILE *file, opj_mj2_t *movie) {
+int OPJ_CALLCONV mj2_read_struct(FILE *file, opj_mj2_t *movie) {
   mj2_box_t box;
   opj_image_t img;
   unsigned char * src;
@@ -2721,7 +2721,7 @@ int mj2_read_struct(FILE *file, opj_mj2_t *movie) {
 /* MJ2 decoder interface                                                                                                                                            */
 /* ----------------------------------------------------------------------- */
 
-opj_dinfo_t* mj2_create_decompress() {
+opj_dinfo_t* OPJ_CALLCONV mj2_create_decompress() {
        opj_mj2_t* mj2;
        opj_dinfo_t *dinfo = (opj_dinfo_t*) opj_calloc(1, sizeof(opj_dinfo_t));
        if(!dinfo) return NULL;
@@ -2739,7 +2739,7 @@ opj_dinfo_t* mj2_create_decompress() {
        return dinfo;
 }
 
-void mj2_setup_decoder(opj_mj2_t *movie, mj2_dparameters_t *mj2_parameters) {
+void OPJ_CALLCONV mj2_setup_decoder(opj_mj2_t *movie, mj2_dparameters_t *mj2_parameters) {
        movie->num_vtk=0;
   movie->num_stk=0;
   movie->num_htk=0;    
@@ -2750,7 +2750,7 @@ void mj2_setup_decoder(opj_mj2_t *movie, mj2_dparameters_t *mj2_parameters) {
 
 }
 
-void mj2_destroy_decompress(opj_mj2_t *movie) {
+void OPJ_CALLCONV mj2_destroy_decompress(opj_mj2_t *movie) {
        if(movie) {
                int i;
                mj2_tk_t *tk=NULL;
@@ -2799,8 +2799,7 @@ void mj2_destroy_decompress(opj_mj2_t *movie) {
 /* MJ2 encoder interface                                                                                                                                            */
 /* ----------------------------------------------------------------------- */
 
-
-opj_cinfo_t* mj2_create_compress() {
+opj_cinfo_t* OPJ_CALLCONV mj2_create_compress() {
        opj_mj2_t* mj2;
        opj_cinfo_t *cinfo = (opj_cinfo_t*) opj_calloc(1, sizeof(opj_cinfo_t));
        if(!cinfo) return NULL;
@@ -2817,7 +2816,7 @@ opj_cinfo_t* mj2_create_compress() {
        return cinfo;
 }
 
-void mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters) {
+void OPJ_CALLCONV mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters) {
        if(movie && parameters) {
                opj_jp2_t *jp2_struct;
                        
@@ -2868,7 +2867,7 @@ void mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters) {
   }
 }
 
-void mj2_destroy_compress(opj_mj2_t *movie) {
+void OPJ_CALLCONV mj2_destroy_compress(opj_mj2_t *movie) {
        if(movie) {
                int i;
                mj2_tk_t *tk=NULL;
index 15e0ed238c65174288263b244636df753363e5f3..611e63500f2b62a567eaa5c02955377c16ea86a7 100644 (file)
@@ -306,30 +306,30 @@ typedef struct mj2_cparameters {
 /**
 Write the JP box 
 */
-void mj2_write_jp(opj_cio_t *cio);
+OPJ_API void OPJ_CALLCONV mj2_write_jp(opj_cio_t *cio);
 /**
 Write the FTYP box
 @param movie MJ2 movie
 @param cio Output buffer stream
 */
-void mj2_write_ftyp(opj_mj2_t *movie, opj_cio_t *cio);
+OPJ_API void OPJ_CALLCONV mj2_write_ftyp(opj_mj2_t *movie, opj_cio_t *cio);
 /**
 Creates an MJ2 decompression structure
 @return Returns a handle to a MJ2 decompressor if successful, returns NULL otherwise
 */
-opj_dinfo_t* mj2_create_decompress();
+OPJ_API opj_dinfo_t* OPJ_CALLCONV mj2_create_decompress();
 /**
 Destroy a MJ2 decompressor handle
 @param movie MJ2 decompressor handle to destroy
 */
-void mj2_destroy_decompress(opj_mj2_t *movie);
+OPJ_API void OPJ_CALLCONV mj2_destroy_decompress(opj_mj2_t *movie);
 /**
 Setup the decoder decoding parameters using user parameters.
 Decoding parameters are returned in mj2->j2k->cp. 
 @param movie MJ2 decompressor handle
 @param mj2_parameters decompression parameters
 */
-void mj2_setup_decoder(opj_mj2_t *movie, mj2_dparameters_t *mj2_parameters);
+OPJ_API void OPJ_CALLCONV mj2_setup_decoder(opj_mj2_t *movie, mj2_dparameters_t *mj2_parameters);
 /**
 Decode an image from a JPEG-2000 file stream
 @param movie MJ2 decompressor handle
@@ -341,19 +341,19 @@ opj_image_t* mj2_decode(opj_mj2_t *movie, opj_cio_t *cio);
 Creates a MJ2 compression structure
 @return Returns a handle to a MJ2 compressor if successful, returns NULL otherwise
 */
-opj_cinfo_t* mj2_create_compress();
+OPJ_API opj_cinfo_t* OPJ_CALLCONV mj2_create_compress();
 /**
 Destroy a MJ2 compressor handle
 @param movie MJ2 compressor handle to destroy
 */
-void mj2_destroy_compress(opj_mj2_t *movie);
+OPJ_API void OPJ_CALLCONV mj2_destroy_compress(opj_mj2_t *movie);
 /**
 Setup the encoder parameters using the current image and using user parameters. 
 Coding parameters are returned in mj2->j2k->cp. 
 @param movie MJ2 compressor handle
 @param parameters compression parameters
 */
-void mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters);
+OPJ_API void OPJ_CALLCONV mj2_setup_encoder(opj_mj2_t *movie, mj2_cparameters_t *parameters);
 /**
 Encode an image into a JPEG-2000 file stream
 @param movie MJ2 compressor handle
@@ -369,20 +369,20 @@ Init a Standard MJ2 movie
 @param movie MJ2 Movie
 @return Returns 0 if successful, returns 1 otherwise
 */
-int mj2_init_stdmovie(opj_mj2_t *movie);
+OPJ_API int OPJ_CALLCONV mj2_init_stdmovie(opj_mj2_t *movie);
 /**
 Read the structure of an MJ2 file
 @param file MJ2 input File
 @param mj2 J2 movie structure 
 @return Returns 0 if successful, returns 1 otherwise
 */
-int mj2_read_struct(FILE *file, opj_mj2_t *mj2);
+OPJ_API int OPJ_CALLCONV mj2_read_struct(FILE *file, opj_mj2_t *mj2);
 /**
 Write the the MOOV box to an output buffer stream
 @param movie MJ2 movie structure 
 @param cio Output buffer stream
 */
-void mj2_write_moov(opj_mj2_t *movie, opj_cio_t *cio);
+OPJ_API void OPJ_CALLCONV mj2_write_moov(opj_mj2_t *movie, opj_cio_t *cio);
 
 
 /* ----------------------------------------------------------------------- */
index ed823f8be45a9c49f312554db74b267a8c5cdfa4..436ac7ed8247b4119f554e73ff110b7483f34567 100644 (file)
@@ -27,7 +27,7 @@
 */
 
 #include "opj_includes.h"
-#include "mj2.h"
+#include "mj2_convert.h"
 
 /*  -----------------------          */
 /*                                   */
@@ -37,7 +37,7 @@
 /*                                   */
 /*  -----------------------          */
 
-unsigned int yuv_num_frames(mj2_tk_t * tk, char *infile)
+unsigned int OPJ_CALLCONV yuv_num_frames(mj2_tk_t * tk, char *infile)
 {
   unsigned int prec_size;
   long end_of_f, frame_size;
@@ -74,7 +74,7 @@ unsigned int yuv_num_frames(mj2_tk_t * tk, char *infile)
 /* */
 /*  ----------------------- */
 
-opj_image_t *mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters)
+opj_image_t * OPJ_CALLCONV mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters)
 {
        opj_image_cmptparm_t cmptparm[3];
        opj_image_t * img;
@@ -99,7 +99,7 @@ opj_image_t *mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters)
        return img;
 }
 
-char yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters_t *parameters, char* infile)
+char OPJ_CALLCONV yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters_t *parameters, char* infile)
 {
   int i, compno;
   int offset, size, max, prec_bytes, is_16, v;
@@ -177,7 +177,7 @@ char yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters
 /*  ----------------------- */
 
 
-opj_bool imagetoyuv(opj_image_t * img, char *outfile)
+opj_bool OPJ_CALLCONV imagetoyuv(opj_image_t * img, char *outfile)
 {
   FILE *f;
   int *data;
@@ -270,7 +270,7 @@ opj_bool imagetoyuv(opj_image_t * img, char *outfile)
 /* */
 /*  ----------------------- */
 
-int imagetobmp(opj_image_t * img, char *outfile) {
+int OPJ_CALLCONV imagetobmp(opj_image_t * img, char *outfile) {
   int w,wr,h,hr,i,pad;
   FILE *f;
   
index 736ef80c2b8a9fde171d1d0b04dbc75348623215..073731b3f3452bb5492f22497d4d285af49fab80 100644 (file)
 #ifndef __MJ2_CONVERT_H
 #define __MJ2_CONVERT_H
 
-int imagetoyuv(opj_image_t * img, char *outfile);
+OPJ_API int OPJ_CALLCONV imagetoyuv(opj_image_t * img, char *outfile);
 
-int imagetobmp(opj_image_t * img, char *outfile);
+OPJ_API int OPJ_CALLCONV imagetobmp(opj_image_t * img, char *outfile);
 
-opj_image_t *mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters);
+OPJ_API opj_image_t * OPJ_CALLCONV mj2_image_create(mj2_tk_t * tk, opj_cparameters_t *parameters);
 
-char yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters_t *parameters, char* infile);
+OPJ_API char OPJ_CALLCONV yuvtoimage(mj2_tk_t * tk, opj_image_t * img, int frame_num, opj_cparameters_t *parameters, char* infile);
 
-unsigned int yuv_num_frames(mj2_tk_t * tk, char *infile);
+OPJ_API unsigned int OPJ_CALLCONV yuv_num_frames(mj2_tk_t * tk, char *infile);
 
 
 #endif
index d77df6ca1c1c76ca20616baa9424c79c148484a9..defed5a3f878572ca8088a4dc6f088015fd2f8e5 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef OPENJPEG_H
 #define OPENJPEG_H
 
-
 /* 
 ==========================================================
    Compiler directives
 */
 
 #if defined(OPJ_STATIC) || !defined(_WIN32)
+/* http://gcc.gnu.org/wiki/Visibility */
+#if __GNUC__ >= 4
+#define OPJ_API    __attribute__ ((visibility ("default")))
+#define OPJ_LOCAL  __attribute__ ((visibility ("hidden")))
+#else
 #define OPJ_API
+#define OPJ_LOCAL
+#endif
 #define OPJ_CALLCONV
 #else
 #define OPJ_CALLCONV __stdcall