diff options
Diffstat (limited to 'libopenjpeg/openjpeg.c')
| -rw-r--r-- | libopenjpeg/openjpeg.c | 52 |
1 files changed, 41 insertions, 11 deletions
diff --git a/libopenjpeg/openjpeg.c b/libopenjpeg/openjpeg.c index b90eca6f..5c6cee7b 100644 --- a/libopenjpeg/openjpeg.c +++ b/libopenjpeg/openjpeg.c @@ -24,13 +24,40 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#ifdef WIN32 +#include <windows.h> +#endif /* WIN32 */ + #include "opj_includes.h" -const char * opj_version() { +/* ---------------------------------------------------------------------- */ +#ifdef WIN32 +#ifndef OPJ_STATIC +BOOL APIENTRY +DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { + switch (ul_reason_for_call) { + case DLL_PROCESS_ATTACH : + break; + case DLL_PROCESS_DETACH : + break; + case DLL_THREAD_ATTACH : + case DLL_THREAD_DETACH : + break; + } + + return TRUE; +} +#endif /* OPJ_STATIC */ +#endif /* WIN32 */ + +/* ---------------------------------------------------------------------- */ + + +const char* OPJ_CALLCONV opj_version() { return OPENJPEG_VERSION; } -opj_dinfo_t* opj_create_decompress(OPJ_CODEC_FORMAT format) { +opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format) { opj_dinfo_t *dinfo = (opj_dinfo_t*)opj_malloc(sizeof(opj_dinfo_t)); if(!dinfo) return NULL; dinfo->is_decompressor = true; @@ -63,7 +90,7 @@ opj_dinfo_t* opj_create_decompress(OPJ_CODEC_FORMAT format) { return dinfo; } -void opj_destroy_decompress(opj_dinfo_t *dinfo) { +void OPJ_CALLCONV opj_destroy_decompress(opj_dinfo_t *dinfo) { if(dinfo) { /* destroy the codec */ switch(dinfo->codec_format) { @@ -83,7 +110,7 @@ void opj_destroy_decompress(opj_dinfo_t *dinfo) { } } -void opj_set_default_decoder_parameters(opj_dparameters_t *parameters) { +void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *parameters) { if(parameters) { memset(parameters, 0, sizeof(opj_dparameters_t)); /* default decoding parameters */ @@ -95,7 +122,7 @@ void opj_set_default_decoder_parameters(opj_dparameters_t *parameters) { } } -void opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters) { +void OPJ_CALLCONV opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters) { if(dinfo && parameters) { switch(dinfo->codec_format) { case CODEC_J2K: @@ -112,7 +139,7 @@ void opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters) { } } -opj_image_t* opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio) { +opj_image_t* OPJ_CALLCONV opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio) { if(dinfo && cio) { switch(dinfo->codec_format) { case CODEC_J2K: @@ -121,13 +148,16 @@ opj_image_t* opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio) { return j2k_decode_jpt_stream((opj_j2k_t*)dinfo->j2k_handle, cio); case CODEC_JP2: return jp2_decode((opj_jp2_t*)dinfo->jp2_handle, cio); + case CODEC_UNKNOWN: + default: + break; } } return NULL; } -opj_cinfo_t* opj_create_compress(OPJ_CODEC_FORMAT format) { +opj_cinfo_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format) { opj_cinfo_t *cinfo = (opj_cinfo_t*)opj_malloc(sizeof(opj_cinfo_t)); if(!cinfo) return NULL; cinfo->is_decompressor = false; @@ -160,7 +190,7 @@ opj_cinfo_t* opj_create_compress(OPJ_CODEC_FORMAT format) { return cinfo; } -void opj_destroy_compress(opj_cinfo_t *cinfo) { +void OPJ_CALLCONV opj_destroy_compress(opj_cinfo_t *cinfo) { if(cinfo) { /* destroy the codec */ switch(cinfo->codec_format) { @@ -180,7 +210,7 @@ void opj_destroy_compress(opj_cinfo_t *cinfo) { } } -void opj_set_default_encoder_parameters(opj_cparameters_t *parameters) { +void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *parameters) { if(parameters) { memset(parameters, 0, sizeof(opj_cparameters_t)); /* default coding parameters */ @@ -197,7 +227,7 @@ void opj_set_default_encoder_parameters(opj_cparameters_t *parameters) { } } -void opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_image_t *image) { +void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_image_t *image) { if(cinfo && parameters && image) { switch(cinfo->codec_format) { case CODEC_J2K: @@ -214,7 +244,7 @@ void opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_im } } -bool opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index) { +bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image, char *index) { if(cinfo && cio && image) { switch(cinfo->codec_format) { case CODEC_J2K: |
