Mercurial > mplayer.hg
comparison libmpcodecs/vd_realvid.c @ 13860:d6f716fdd734
remove mac shlb support to use new helix codec for realvideo support on osx
author | nplourde |
---|---|
date | Wed, 03 Nov 2004 02:50:01 +0000 |
parents | 985e1813e298 |
children | 37b3dd217cdf |
comparison
equal
deleted
inserted
replaced
13859:1b0d5a6ab7dc | 13860:d6f716fdd734 |
---|---|
11 #include "mp_msg.h" | 11 #include "mp_msg.h" |
12 #include "help_mp.h" | 12 #include "help_mp.h" |
13 | 13 |
14 #include "vd_internal.h" | 14 #include "vd_internal.h" |
15 #include "wine/windef.h" | 15 #include "wine/windef.h" |
16 | |
17 #ifdef USE_MACSHLB | |
18 #include <CoreServices/CoreServices.h> | |
19 #endif | |
20 | 16 |
21 static vd_info_t info = { | 17 static vd_info_t info = { |
22 "RealVideo decoder", | 18 "RealVideo decoder", |
23 "realvid", | 19 "realvid", |
24 "Alex Beregszaszi", | 20 "Alex Beregszaszi", |
117 rvyuv_custom_message = dlsym(handle, "RV20toYUV420CustomMessage"); | 113 rvyuv_custom_message = dlsym(handle, "RV20toYUV420CustomMessage"); |
118 rvyuv_free = dlsym(handle, "RV20toYUV420Free"); | 114 rvyuv_free = dlsym(handle, "RV20toYUV420Free"); |
119 rvyuv_hive_message = dlsym(handle, "RV20toYUV420HiveMessage"); | 115 rvyuv_hive_message = dlsym(handle, "RV20toYUV420HiveMessage"); |
120 rvyuv_init = dlsym(handle, "RV20toYUV420Init"); | 116 rvyuv_init = dlsym(handle, "RV20toYUV420Init"); |
121 rvyuv_transform = dlsym(handle, "RV20toYUV420Transform"); | 117 rvyuv_transform = dlsym(handle, "RV20toYUV420Transform"); |
118 | |
119 if(rvyuv_custom_message && | |
120 rvyuv_free && | |
121 rvyuv_hive_message && | |
122 rvyuv_init && | |
123 rvyuv_transform) | |
124 { | |
125 rv_handle = handle; | |
126 return 1; | |
127 } | |
128 | |
129 rvyuv_custom_message = dlsym(handle, "RV40toYUV420CustomMessage"); | |
130 rvyuv_free = dlsym(handle, "RV40toYUV420Free"); | |
131 rvyuv_hive_message = dlsym(handle, "RV40toYUV420HiveMessage"); | |
132 rvyuv_init = dlsym(handle, "RV40toYUV420Init"); | |
133 rvyuv_transform = dlsym(handle, "RV40toYUV420Transform"); | |
122 | 134 |
123 if(rvyuv_custom_message && | 135 if(rvyuv_custom_message && |
124 rvyuv_free && | 136 rvyuv_free && |
125 rvyuv_hive_message && | 137 rvyuv_hive_message && |
126 rvyuv_init && | 138 rvyuv_init && |
179 FreeLibrary(handle); | 191 FreeLibrary(handle); |
180 return 0; // error | 192 return 0; // error |
181 } | 193 } |
182 #endif | 194 #endif |
183 | 195 |
184 #ifdef USE_MACSHLB | |
185 void *load_one_sym_mac(char *symbolName, CFragConnectionID *connID); | |
186 | |
187 static int load_syms_mac(char *path) { | |
188 Ptr mainAddr; | |
189 OSStatus status; | |
190 FSRef fsref; | |
191 FSSpec fsspec; | |
192 OSErr err; | |
193 Str255 errMessage; | |
194 CFragConnectionID *connID; | |
195 | |
196 mp_msg(MSGT_DECVIDEO,MSGL_INFO, "opening mac shlb '%s'\n", path); | |
197 | |
198 if ( (connID = (CFragConnectionID *)NewPtr( sizeof( CFragConnectionID ))) == nil ) { | |
199 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"NewPtr() failed.\n" ); | |
200 return 0; | |
201 } | |
202 | |
203 if ( (status = FSPathMakeRef( path, &fsref, NULL )) != noErr ) { | |
204 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"FSPathMakeRef() failed with error %d.\n", status ); | |
205 return 0; | |
206 } | |
207 | |
208 if ( (status = FSGetCatalogInfo( &fsref, kFSCatInfoNone, NULL, NULL, &fsspec, NULL )) != noErr ) { | |
209 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"FSGetCatalogInfo() failed with error %d.\n", status ); | |
210 return 0; | |
211 } | |
212 | |
213 if ( (err = GetDiskFragment( &fsspec, 0, kCFragGoesToEOF, NULL, kPrivateCFragCopy, connID, &mainAddr, errMessage )) != noErr ) { | |
214 p2cstrcpy( errMessage, errMessage ); | |
215 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"GetDiskFragment() failed with error %d: %s\n", err, errMessage ); | |
216 return 0; | |
217 } | |
218 | |
219 rvyuv_custom_message = load_one_sym_mac("RV20toYUV420CustomMessage", connID); | |
220 rvyuv_free = load_one_sym_mac("RV20toYUV420Free", connID); | |
221 rvyuv_hive_message = load_one_sym_mac("RV20toYUV420HiveMessage", connID); | |
222 rvyuv_init = load_one_sym_mac("RV20toYUV420Init", connID); | |
223 rvyuv_transform = load_one_sym_mac("RV20toYUV420Transform", connID); | |
224 | |
225 if(rvyuv_custom_message && | |
226 rvyuv_free && | |
227 rvyuv_hive_message && | |
228 rvyuv_init && | |
229 rvyuv_transform) | |
230 { | |
231 rv_handle = connID; | |
232 return 1; | |
233 } | |
234 | |
235 mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error resolving symbols! (version incompatibility?)\n"); | |
236 (void)CloseConnection(connID); | |
237 return 0; // error | |
238 } | |
239 #endif | |
240 | |
241 | |
242 /* we need exact positions */ | 196 /* we need exact positions */ |
243 struct rv_init_t { | 197 struct rv_init_t { |
244 short unk1; | 198 short unk1; |
245 short w; | 199 short w; |
246 short h; | 200 short h; |
268 if (!path) return 0; | 222 if (!path) return 0; |
269 sprintf(path, REALCODEC_PATH "/%s", sh->codec->dll); | 223 sprintf(path, REALCODEC_PATH "/%s", sh->codec->dll); |
270 | 224 |
271 /* first try to load linux dlls, if failed and we're supporting win32 dlls, | 225 /* first try to load linux dlls, if failed and we're supporting win32 dlls, |
272 then try to load the windows ones */ | 226 then try to load the windows ones */ |
273 #ifdef USE_MACSHLB | |
274 if (strstr(sh->codec->dll, ".shlb") && !load_syms_mac(path)) | |
275 #endif | |
276 #ifdef HAVE_LIBDL | 227 #ifdef HAVE_LIBDL |
277 if(strstr(sh->codec->dll,".dll") || !load_syms_linux(path)) | 228 if(strstr(sh->codec->dll,".dll") || !load_syms_linux(path)) |
278 #endif | 229 #endif |
279 #ifdef USE_WIN32DLL | 230 #ifdef USE_WIN32DLL |
280 if (!load_syms_windows(sh->codec->dll)) | 231 if (!load_syms_windows(sh->codec->dll)) |
332 if (rv_handle) FreeLibrary(rv_handle); | 283 if (rv_handle) FreeLibrary(rv_handle); |
333 } else | 284 } else |
334 #endif | 285 #endif |
335 #ifdef HAVE_LIBDL | 286 #ifdef HAVE_LIBDL |
336 if(rv_handle) dlclose(rv_handle); | 287 if(rv_handle) dlclose(rv_handle); |
337 #endif | |
338 #ifdef USE_MACSHLB | |
339 if (rv_handle){ | |
340 (void)CloseConnection(rv_handle); | |
341 DisposePtr((Ptr)rv_handle); | |
342 } | |
343 if (rvyuv_custom_message) DisposePtr((Ptr)rvyuv_custom_message); | |
344 if (rvyuv_free) DisposePtr((Ptr)rvyuv_free); | |
345 if (rvyuv_hive_message) DisposePtr((Ptr)rvyuv_hive_message); | |
346 if (rvyuv_init) DisposePtr((Ptr)rvyuv_init); | |
347 if (rvyuv_transform) DisposePtr((Ptr)rvyuv_transform); | |
348 #endif | 288 #endif |
349 rv_handle=NULL; | 289 rv_handle=NULL; |
350 } | 290 } |
351 | 291 |
352 // copypaste from demux_real.c - it should match to get it working! | 292 // copypaste from demux_real.c - it should match to get it working! |