From dff377a741ec87f8737002cf112ae12655881777 Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Mon, 15 Oct 2012 09:44:34 +0000 Subject: [PATCH] [trunk] Fix compilation: - using mingw32 compiler (missing exported symbols) - using -fvisibility=hidden (gcc on UNIX) --- src/bin/jp3d/CMakeLists.txt | 16 +++++++------- src/bin/jpip/CMakeLists.txt | 5 +++++ src/bin/jpip/opj_dec_server.c | 1 + src/bin/mj2/CMakeLists.txt | 6 +++++- src/bin/mj2/opj_mj2_compress.c | 1 + src/lib/openjp2/CMakeLists.txt | 2 +- src/lib/openjp2/cio.c | 28 ++++++++++++------------- src/lib/openjp2/cio.h | 28 ++++++++++++------------- src/lib/openjp2/event.c | 4 ++-- src/lib/openjp2/event.h | 4 ++-- src/lib/openjp2/function_list.c | 8 +++---- src/lib/openjp2/function_list.h | 8 +++---- src/lib/openjp2/j2k.c | 4 ++-- src/lib/openjp2/j2k.h | 4 ++-- src/lib/openjp2/jp2.c | 14 ++++++------- src/lib/openjp2/jp2.h | 14 ++++++------- src/lib/openjp3d/CMakeLists.txt | 37 +++++++++++++++++++-------------- src/lib/openjp3d/openjp3d.c | 1 + src/lib/openjp3d/openjp3d.h | 8 +++++++ src/lib/openjp3d/volume.c | 2 ++ src/lib/openjpip/openjpip.c | 26 +++++++++++------------ src/lib/openjpip/openjpip.h | 26 +++++++++++------------ src/lib/openmj2/CMakeLists.txt | 17 ++++++++------- src/lib/openmj2/cio.c | 6 +++--- src/lib/openmj2/cio.h | 6 +++--- src/lib/openmj2/j2k_lib.c | 2 +- src/lib/openmj2/j2k_lib.h | 2 +- src/lib/openmj2/mj2.c | 23 ++++++++++---------- src/lib/openmj2/mj2.h | 22 ++++++++++---------- src/lib/openmj2/mj2_convert.c | 12 +++++------ src/lib/openmj2/mj2_convert.h | 10 ++++----- src/lib/openmj2/openjpeg.h | 8 ++++++- 32 files changed, 194 insertions(+), 161 deletions(-) diff --git a/src/bin/jp3d/CMakeLists.txt b/src/bin/jp3d/CMakeLists.txt index 2ff9f78f..5a35a169 100644 --- a/src/bin/jp3d/CMakeLists.txt +++ b/src/bin/jp3d/CMakeLists.txt @@ -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() diff --git a/src/bin/jpip/CMakeLists.txt b/src/bin/jpip/CMakeLists.txt index 6264645a..0ba6fa2f 100644 --- a/src/bin/jpip/CMakeLists.txt +++ b/src/bin/jpip/CMakeLists.txt @@ -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 diff --git a/src/bin/jpip/opj_dec_server.c b/src/bin/jpip/opj_dec_server.c index b41ef0c9..ca3f22dd 100644 --- a/src/bin/jpip/opj_dec_server.c +++ b/src/bin/jpip/opj_dec_server.c @@ -47,6 +47,7 @@ #include #include +#include "opj_config.h" #include "openjpip.h" #ifdef _WIN32 diff --git a/src/bin/mj2/CMakeLists.txt b/src/bin/mj2/CMakeLists.txt index a8f5ca9f..d9cc67de 100644 --- a/src/bin/mj2/CMakeLists.txt +++ b/src/bin/mj2/CMakeLists.txt @@ -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: diff --git a/src/bin/mj2/opj_mj2_compress.c b/src/bin/mj2/opj_mj2_compress.c index b17b8f69..fbf25fe3 100644 --- a/src/bin/mj2/opj_mj2_compress.c +++ b/src/bin/mj2/opj_mj2_compress.c @@ -29,6 +29,7 @@ #include #include +#include "opj_config.h" #include "openjpeg.h" #include "j2k_lib.h" #include "cio.h" diff --git a/src/lib/openjp2/CMakeLists.txt b/src/lib/openjp2/CMakeLists.txt index 566ec56b..66ef044d 100644 --- a/src/lib/openjp2/CMakeLists.txt +++ b/src/lib/openjp2/CMakeLists.txt @@ -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 diff --git a/src/lib/openjp2/cio.c b/src/lib/openjp2/cio.c index 93f488c2..5b2edd49 100644 --- a/src/lib/openjp2/cio.c +++ b/src/lib/openjp2/cio.c @@ -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; } diff --git a/src/lib/openjp2/cio.h b/src/lib/openjp2/cio.h index f5c4a862..08063d1d 100644 --- a/src/lib/openjp2/cio.h +++ b/src/lib/openjp2/cio.h @@ -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); diff --git a/src/lib/openjp2/event.c b/src/lib/openjp2/event.c index fa505619..cfc68c19 100644 --- a/src/lib/openjp2/event.c +++ b/src/lib/openjp2/event.c @@ -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; diff --git a/src/lib/openjp2/event.h b/src/lib/openjp2/event.h index 111cea9f..98543b5d 100644 --- a/src/lib/openjp2/event.h +++ b/src/lib/openjp2/event.h @@ -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); /*@}*/ diff --git a/src/lib/openjp2/function_list.c b/src/lib/openjp2/function_list.c index 1f84a429..4b4b0a83 100644 --- a/src/lib/openjp2/function_list.c +++ b/src/lib/openjp2/function_list.c @@ -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; } diff --git a/src/lib/openjp2/function_list.h b/src/lib/openjp2/function_list.h index f67aa5f2..0e27d75a 100644 --- a/src/lib/openjp2/function_list.h +++ b/src/lib/openjp2/function_list.h @@ -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 */ diff --git a/src/lib/openjp2/j2k.c b/src/lib/openjp2/j2k.c index 6f1b16e1..5481a6c6 100644 --- a/src/lib/openjp2/j2k.c +++ b/src/lib/openjp2/j2k.c @@ -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) diff --git a/src/lib/openjp2/j2k.h b/src/lib/openjp2/j2k.h index 2782a096..4366fc43 100644 --- a/src/lib/openjp2/j2k.h +++ b/src/lib/openjp2/j2k.h @@ -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); diff --git a/src/lib/openjp2/jp2.c b/src/lib/openjp2/jp2.c index d74583e4..198c0e56 100644 --- a/src/lib/openjp2/jp2.c +++ b/src/lib/openjp2/jp2.c @@ -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); } diff --git a/src/lib/openjp2/jp2.h b/src/lib/openjp2/jp2.h index 7dc7c1b5..66c665aa 100644 --- a/src/lib/openjp2/jp2.h +++ b/src/lib/openjp2/jp2.h @@ -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. diff --git a/src/lib/openjp3d/CMakeLists.txt b/src/lib/openjp3d/CMakeLists.txt index 5f92d7aa..8f034ffe 100644 --- a/src/lib/openjp3d/CMakeLists.txt +++ b/src/lib/openjp3d/CMakeLists.txt @@ -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 ) diff --git a/src/lib/openjp3d/openjp3d.c b/src/lib/openjp3d/openjp3d.c index ab2744e1..c1f3c44f 100755 --- a/src/lib/openjp3d/openjp3d.c +++ b/src/lib/openjp3d/openjp3d.c @@ -30,6 +30,7 @@ #endif /* _WIN32 */ #include "opj_includes.h" +#include "openjp3d.h" #define JP3D_VERSION "1.3.0" /* ---------------------------------------------------------------------- */ #ifdef _WIN32 diff --git a/src/lib/openjp3d/openjp3d.h b/src/lib/openjp3d/openjp3d.h index e6829d91..d7ac42da 100755 --- a/src/lib/openjp3d/openjp3d.h +++ b/src/lib/openjp3d/openjp3d.h @@ -38,10 +38,18 @@ */ #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 + /* The following ifdef block is the standard way of creating macros which make exporting from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS diff --git a/src/lib/openjp3d/volume.c b/src/lib/openjp3d/volume.c index 5b9f1808..065a7a34 100755 --- a/src/lib/openjp3d/volume.c +++ b/src/lib/openjp3d/volume.c @@ -25,6 +25,8 @@ */ #include "opj_includes.h" +#include "volume.h" +#include "openjp3d.h" opj_volume_t* OPJ_CALLCONV opj_volume_create(int numcmpts, opj_volume_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc) { int compno; diff --git a/src/lib/openjpip/openjpip.c b/src/lib/openjpip/openjpip.c index a817a466..dc1b45b2 100644 --- a/src/lib/openjpip/openjpip.c +++ b/src/lib/openjpip/openjpip.c @@ -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); } diff --git a/src/lib/openjpip/openjpip.h b/src/lib/openjpip/openjpip.h index 5255ab9c..584a69b3 100644 --- a/src/lib/openjpip/openjpip.h +++ b/src/lib/openjpip/openjpip.h @@ -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); diff --git a/src/lib/openmj2/CMakeLists.txt b/src/lib/openmj2/CMakeLists.txt index c2efe7e4..775c9318 100644 --- a/src/lib/openmj2/CMakeLists.txt +++ b/src/lib/openmj2/CMakeLists.txt @@ -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}) diff --git a/src/lib/openmj2/cio.c b/src/lib/openmj2/cio.c index c0cb0282..56de6145 100644 --- a/src/lib/openmj2/cio.c +++ b/src/lib/openmj2/cio.c @@ -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; } diff --git a/src/lib/openmj2/cio.h b/src/lib/openmj2/cio.h index e6274314..d37a6532 100644 --- a/src/lib/openmj2/cio.h +++ b/src/lib/openmj2/cio.h @@ -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); /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openmj2/j2k_lib.c b/src/lib/openmj2/j2k_lib.c index a66e31e9..a792bb7e 100644 --- a/src/lib/openmj2/j2k_lib.c +++ b/src/lib/openmj2/j2k_lib.c @@ -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 ; diff --git a/src/lib/openmj2/j2k_lib.h b/src/lib/openmj2/j2k_lib.h index 5f3406e5..d657b434 100644 --- a/src/lib/openmj2/j2k_lib.h +++ b/src/lib/openmj2/j2k_lib.h @@ -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); /* ----------------------------------------------------------------------- */ /*@}*/ diff --git a/src/lib/openmj2/mj2.c b/src/lib/openmj2/mj2.c index 4d87d7b8..68afb489 100644 --- a/src/lib/openmj2/mj2.c +++ b/src/lib/openmj2/mj2.c @@ -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; diff --git a/src/lib/openmj2/mj2.h b/src/lib/openmj2/mj2.h index 15e0ed23..611e6350 100644 --- a/src/lib/openmj2/mj2.h +++ b/src/lib/openmj2/mj2.h @@ -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); /* ----------------------------------------------------------------------- */ diff --git a/src/lib/openmj2/mj2_convert.c b/src/lib/openmj2/mj2_convert.c index ed823f8b..436ac7ed 100644 --- a/src/lib/openmj2/mj2_convert.c +++ b/src/lib/openmj2/mj2_convert.c @@ -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; diff --git a/src/lib/openmj2/mj2_convert.h b/src/lib/openmj2/mj2_convert.h index 736ef80c..073731b3 100644 --- a/src/lib/openmj2/mj2_convert.h +++ b/src/lib/openmj2/mj2_convert.h @@ -31,15 +31,15 @@ #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 diff --git a/src/lib/openmj2/openjpeg.h b/src/lib/openmj2/openjpeg.h index d77df6ca..defed5a3 100644 --- a/src/lib/openmj2/openjpeg.h +++ b/src/lib/openmj2/openjpeg.h @@ -33,7 +33,6 @@ #ifndef OPENJPEG_H #define OPENJPEG_H - /* ========================================================== Compiler directives @@ -41,7 +40,14 @@ */ #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 -- 2.40.0