Defines three new functions
[openjpeg.git] / src / lib / openjp2 / openjpeg.h
index b5b1e25aed5f9a0d7213524f0909dbc37c500afc..4a8e75ce5a7f3025c2593e33633c084cd8fca9c8 100644 (file)
@@ -78,16 +78,20 @@ Most compilers implement their own version of this keyword ...
 
 #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")))
+#      if __GNUC__ >= 4
+#              if defined(OPJ_STATIC) /* static library uses "hidden" */
+#                      define OPJ_API    __attribute__ ((visibility ("hidden")))
+#              else
+#                      define OPJ_API    __attribute__ ((visibility ("default")))
+#              endif
+#              define OPJ_LOCAL  __attribute__ ((visibility ("hidden")))
+#      else
+#              define OPJ_API
+#              define OPJ_LOCAL
+#      endif
+#      define OPJ_CALLCONV
 #else
-#define OPJ_API
-#define OPJ_LOCAL
-#endif
-#define OPJ_CALLCONV
-#else
-#define OPJ_CALLCONV __stdcall
+#      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
@@ -96,11 +100,11 @@ that uses this DLL. This way any other project whose source files include this f
 OPJ_API functions as being imported from a DLL, wheras this DLL sees symbols
 defined with this macro as being exported.
 */
-#if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)
-#define OPJ_API __declspec(dllexport)
-#else
-#define OPJ_API __declspec(dllimport)
-#endif /* OPJ_EXPORTS */
+#      if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)
+#              define OPJ_API __declspec(dllexport)
+#      else
+#              define OPJ_API __declspec(dllimport)
+#      endif /* OPJ_EXPORTS */
 #endif /* !OPJ_STATIC || !_WIN32 */
 
 typedef int OPJ_BOOL;
@@ -291,7 +295,7 @@ typedef enum CODEC_FORMAT {
        OPJ_CODEC_JPT  = 1,             /**< JPT-stream (JPEG 2000, JPIP) : read only */
     OPJ_CODEC_JP2  = 2,                /**< JP2 file format : read/write */
     OPJ_CODEC_JPP  = 3,                /**< JPP-stream (JPEG 2000, JPIP) : to be coded */
-    OPJ_CODEC_JPX  = 4,                /**< JPX file format (JPEG 2000 Part-2) : to be coded */
+    OPJ_CODEC_JPX  = 4         /**< JPX file format (JPEG 2000 Part-2) : to be coded */
 } OPJ_CODEC_FORMAT;
 
 
@@ -468,13 +472,6 @@ typedef struct opj_cparameters {
      * If == 0, component size limitation is not considered
      * */
        int max_comp_size;
-    /**
-     * Maximum size (in bytes) for the whole codestream.
-     * If == 0, codestream size limitation is not considered
-     * If it does not comply with tcp_rates, max_cs_size prevails
-     * and a warning is issued.
-     * */
-    int max_cs_size;
     /**
      * DEPRECATED: use RSIZ, OPJ_PROFILE_* and OPJ_EXTENSION_* instead
      * Profile name
@@ -491,6 +488,13 @@ typedef struct opj_cparameters {
        /** Naive implementation of MCT restricted to a single reversible array based 
         encoding without offset concerning all the components. */
        void * mct_data;
+    /**
+     * Maximum size (in bytes) for the whole codestream.
+     * If == 0, codestream size limitation is not considered
+     * If it does not comply with tcp_rates, max_cs_size prevails
+     * and a warning is issued.
+     * */
+    int max_cs_size;
     /** RSIZ value
         To be used to combine OPJ_PROFILE_*, OPJ_EXTENSION_* and (sub)levels values. */
     OPJ_UINT16 rsiz;
@@ -1116,14 +1120,6 @@ OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create(OPJ_SIZE_T p_buffer_size, O
  * @param      p_stream        the stream to destroy.
  */
 OPJ_API void OPJ_CALLCONV opj_stream_destroy(opj_stream_t* p_stream);
-
-/**
- * Destroys a stream created by opj_create_stream. This function does NOT close the abstract stream. 
- * If needed the user must close its own implementation of the stream.
- *
- * @param      p_stream        the stream to destroy.
- */
-OPJ_API void OPJ_CALLCONV opj_stream_destroy_v3(opj_stream_t* p_stream);
  
 /**
  * Sets the given function to be used as a read function.
@@ -1153,21 +1149,13 @@ OPJ_API void OPJ_CALLCONV opj_stream_set_skip_function(opj_stream_t* p_stream, o
 */
 OPJ_API void OPJ_CALLCONV opj_stream_set_seek_function(opj_stream_t* p_stream, opj_stream_seek_fn p_function);
 
-/**
- * Sets the given data to be used as a user data for the stream.
- * @param              p_stream        the stream to modify
- * @param              p_data          the data to set.
- * @warning depending on your source object p_stream this function may leak, use opj_stream_set_user_data_v3
-*/
-OPJ_DEPRECATED(OPJ_API void OPJ_CALLCONV opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data));
-
 /**
  * Sets the given data to be used as a user data for the stream.
  * @param              p_stream        the stream to modify
  * @param              p_data          the data to set.
  * @param              p_function      the function to free p_data when opj_stream_destroy() is called.
 */
-OPJ_API void OPJ_CALLCONV opj_stream_set_user_data_v3 (opj_stream_t* p_stream, void * p_data, opj_stream_free_user_data_fn p_function);
+OPJ_API void OPJ_CALLCONV opj_stream_set_user_data (opj_stream_t* p_stream, void * p_data, opj_stream_free_user_data_fn p_function);
 
 /**
  * Sets the length of the user data for the stream.
@@ -1182,14 +1170,14 @@ OPJ_API void OPJ_CALLCONV opj_stream_set_user_data_length(opj_stream_t* p_stream
  * @param fname             the filename of the file to stream
  * @param p_is_read_stream  whether the stream is a read stream (true) or not (false)
 */
-OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_default_file_stream_v3 (const char *fname, OPJ_BOOL p_is_read_stream);
+OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_default_file_stream (const char *fname, OPJ_BOOL p_is_read_stream);
  
 /** Create a stream from a file identified with its filename with a specific buffer size
  * @param fname             the filename of the file to stream
  * @param p_buffer_size     size of the chunk used to stream
  * @param p_is_read_stream  whether the stream is a read stream (true) or not (false)
 */
-OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream_v3 (const char *fname, 
+OPJ_API opj_stream_t* OPJ_CALLCONV opj_stream_create_file_stream (const char *fname,
                                                                      OPJ_SIZE_T p_buffer_size,
                                                                      OPJ_BOOL p_is_read_stream);