aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llimage/llimagej2c.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:11 -0500
committerJacek Antonelli2008-08-15 23:45:11 -0500
commit215f423cbe18fe9ca14a26caef918d303bad28ff (patch)
tree0743442b286216cc8e19aa487c26f4e9345ffd64 /linden/indra/llimage/llimagej2c.cpp
parentSecond Life viewer sources 1.18.3.5-RC (diff)
downloadmeta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.zip
meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.gz
meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.bz2
meta-impy-215f423cbe18fe9ca14a26caef918d303bad28ff.tar.xz
Second Life viewer sources 1.18.4.0-RC
Diffstat (limited to '')
-rw-r--r--linden/indra/llimage/llimagej2c.cpp44
1 files changed, 34 insertions, 10 deletions
diff --git a/linden/indra/llimage/llimagej2c.cpp b/linden/indra/llimage/llimagej2c.cpp
index 305b11d..0911c43 100644
--- a/linden/indra/llimage/llimagej2c.cpp
+++ b/linden/indra/llimage/llimagej2c.cpp
@@ -1,6 +1,8 @@
1/** 1/**
2 * @file llimagej2c.cpp 2 * @file llimagej2c.cpp
3 * 3 *
4 * $LicenseInfo:firstyear=2001&license=viewergpl$
5 *
4 * Copyright (c) 2001-2007, Linden Research, Inc. 6 * Copyright (c) 2001-2007, Linden Research, Inc.
5 * 7 *
6 * Second Life Viewer Source Code 8 * Second Life Viewer Source Code
@@ -23,6 +25,7 @@
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 25 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 26 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE. 27 * COMPLETENESS OR PERFORMANCE.
28 * $/LicenseInfo$
26 */ 29 */
27#include "linden_common.h" 30#include "linden_common.h"
28 31
@@ -35,11 +38,13 @@
35 38
36typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)(); 39typedef LLImageJ2CImpl* (*CreateLLImageJ2CFunction)();
37typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*); 40typedef void (*DestroyLLImageJ2CFunction)(LLImageJ2CImpl*);
41typedef const char* (*EngineInfoLLImageJ2CFunction)();
38 42
39//some "private static" variables so we only attempt to load 43//some "private static" variables so we only attempt to load
40//dynamic libaries once 44//dynamic libaries once
41CreateLLImageJ2CFunction j2cimpl_create_func; 45CreateLLImageJ2CFunction j2cimpl_create_func;
42DestroyLLImageJ2CFunction j2cimpl_destroy_func; 46DestroyLLImageJ2CFunction j2cimpl_destroy_func;
47EngineInfoLLImageJ2CFunction j2cimpl_engineinfo_func;
43apr_pool_t *j2cimpl_dso_memory_pool; 48apr_pool_t *j2cimpl_dso_memory_pool;
44apr_dso_handle_t *j2cimpl_dso_handle; 49apr_dso_handle_t *j2cimpl_dso_handle;
45 50
@@ -49,9 +54,10 @@ apr_dso_handle_t *j2cimpl_dso_handle;
49//function should ever be included 54//function should ever be included
50LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl(); 55LLImageJ2CImpl* fallbackCreateLLImageJ2CImpl();
51void fallbackDestroyLLImageJ2CImpl(LLImageJ2CImpl* impl); 56void fallbackDestroyLLImageJ2CImpl(LLImageJ2CImpl* impl);
57const char* fallbackEngineInfoLLImageJ2CImpl();
52 58
53//static 59//static
54//Loads the required "create" and "destroy" functions needed 60//Loads the required "create", "destroy" and "engineinfo" functions needed
55void LLImageJ2C::openDSO() 61void LLImageJ2C::openDSO()
56{ 62{
57 //attempt to load a DSO and get some functions from it 63 //attempt to load a DSO and get some functions from it
@@ -70,8 +76,8 @@ void LLImageJ2C::openDSO()
70#endif 76#endif
71 77
72 dso_path = gDirUtilp->findFile(dso_name, 78 dso_path = gDirUtilp->findFile(dso_name,
73 gDirUtilp->getAppRODataDir(), 79 gDirUtilp->getAppRODataDir(),
74 gDirUtilp->getExecutableDir()); 80 gDirUtilp->getExecutableDir());
75 81
76 j2cimpl_dso_handle = NULL; 82 j2cimpl_dso_handle = NULL;
77 j2cimpl_dso_memory_pool = NULL; 83 j2cimpl_dso_memory_pool = NULL;
@@ -89,6 +95,7 @@ void LLImageJ2C::openDSO()
89 //now we want to load the functions we're interested in 95 //now we want to load the functions we're interested in
90 CreateLLImageJ2CFunction create_func = NULL; 96 CreateLLImageJ2CFunction create_func = NULL;
91 DestroyLLImageJ2CFunction dest_func = NULL; 97 DestroyLLImageJ2CFunction dest_func = NULL;
98 EngineInfoLLImageJ2CFunction engineinfo_func = NULL;
92 99
93 rv = apr_dso_sym((apr_dso_handle_sym_t*)&create_func, 100 rv = apr_dso_sym((apr_dso_handle_sym_t*)&create_func,
94 j2cimpl_dso_handle, 101 j2cimpl_dso_handle,
@@ -100,13 +107,21 @@ void LLImageJ2C::openDSO()
100 //so lets check for a destruction function 107 //so lets check for a destruction function
101 rv = apr_dso_sym((apr_dso_handle_sym_t*)&dest_func, 108 rv = apr_dso_sym((apr_dso_handle_sym_t*)&dest_func,
102 j2cimpl_dso_handle, 109 j2cimpl_dso_handle,
103 "destroyLLImageJ2CKDU"); 110 "destroyLLImageJ2CKDU");
104 if ( rv == APR_SUCCESS ) 111 if ( rv == APR_SUCCESS )
105 { 112 {
106 //k, everything is loaded alright 113 //we've loaded the destroy function ok
107 j2cimpl_create_func = create_func; 114 rv = apr_dso_sym((apr_dso_handle_sym_t*)&engineinfo_func,
108 j2cimpl_destroy_func = dest_func; 115 j2cimpl_dso_handle,
109 all_functions_loaded = true; 116 "engineInfoLLImageJ2CKDU");
117 if ( rv == APR_SUCCESS )
118 {
119 //ok, everything is loaded alright
120 j2cimpl_create_func = create_func;
121 j2cimpl_destroy_func = dest_func;
122 j2cimpl_engineinfo_func = engineinfo_func;
123 all_functions_loaded = true;
124 }
110 } 125 }
111 } 126 }
112 } 127 }
@@ -149,6 +164,15 @@ void LLImageJ2C::closeDSO()
149 if (j2cimpl_dso_memory_pool) apr_pool_destroy(j2cimpl_dso_memory_pool); 164 if (j2cimpl_dso_memory_pool) apr_pool_destroy(j2cimpl_dso_memory_pool);
150} 165}
151 166
167//static
168std::string LLImageJ2C::getEngineInfo()
169{
170 if (!j2cimpl_engineinfo_func)
171 j2cimpl_engineinfo_func = fallbackEngineInfoLLImageJ2CImpl;
172
173 return j2cimpl_engineinfo_func();
174}
175
152LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C), 176LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
153 mMaxBytes(0), 177 mMaxBytes(0),
154 mRawDiscardLevel(-1), 178 mRawDiscardLevel(-1),
@@ -156,7 +180,7 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
156 mReversible(FALSE) 180 mReversible(FALSE)
157 181
158{ 182{
159 //We assume here that if we wanted to destory via 183 //We assume here that if we wanted to create via
160 //a dynamic library that the approriate open calls were made 184 //a dynamic library that the approriate open calls were made
161 //before any calls to this constructor. 185 //before any calls to this constructor.
162 186
@@ -175,7 +199,7 @@ LLImageJ2C::LLImageJ2C() : LLImageFormatted(IMG_CODEC_J2C),
175// virtual 199// virtual
176LLImageJ2C::~LLImageJ2C() 200LLImageJ2C::~LLImageJ2C()
177{ 201{
178 //We assume here that if we wanted to destory via 202 //We assume here that if we wanted to destroy via
179 //a dynamic library that the approriate open calls were made 203 //a dynamic library that the approriate open calls were made
180 //before any calls to this destructor. 204 //before any calls to this destructor.
181 205