diff options
Diffstat (limited to 'indra/media_plugins')
-rwxr-xr-x | indra/media_plugins/quicktime/media_plugin_quicktime.cpp | 21 | ||||
-rwxr-xr-x | indra/media_plugins/webkit/mac_volume_catcher.cpp | 1 | ||||
-rwxr-xr-x | indra/media_plugins/webkit/media_plugin_webkit.cpp | 16 | ||||
-rwxr-xr-x | indra/media_plugins/winmmshim/winmm_shim.cpp | 81 |
4 files changed, 71 insertions, 48 deletions
diff --git a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp index 2dd97a9ba7..93d2a8fa6e 100755 --- a/indra/media_plugins/quicktime/media_plugin_quicktime.cpp +++ b/indra/media_plugins/quicktime/media_plugin_quicktime.cpp @@ -28,18 +28,10 @@ #include "linden_common.h" -#include "llgl.h" - -#include "llplugininstance.h" -#include "llpluginmessage.h" -#include "llpluginmessageclasses.h" -#include "media_plugin_base.h" - -#if LL_QUICKTIME_ENABLED - #if defined(LL_DARWIN) #include <QuickTime/QuickTime.h> #elif defined(LL_WINDOWS) + #include "llwin32headers.h" #include "MacTypes.h" #include "QTML.h" #include "Movies.h" @@ -48,6 +40,17 @@ #include "QTLoadLibraryUtils.h" #endif +#include "llgl.h" + +#include "llplugininstance.h" +#include "llpluginmessage.h" +#include "llpluginmessageclasses.h" +#include "media_plugin_base.h" + +#if LL_QUICKTIME_ENABLED + + + // TODO: Make sure that the only symbol exported from this library is LLPluginInitEntryPoint //////////////////////////////////////////////////////////////////////////////// // diff --git a/indra/media_plugins/webkit/mac_volume_catcher.cpp b/indra/media_plugins/webkit/mac_volume_catcher.cpp index cc94556413..73e5bf3da3 100755 --- a/indra/media_plugins/webkit/mac_volume_catcher.cpp +++ b/indra/media_plugins/webkit/mac_volume_catcher.cpp @@ -37,6 +37,7 @@ #include <QuickTime/QuickTime.h> #include <AudioUnit/AudioUnit.h> +#include <list> #if LL_DARWIN #pragma GCC diagnostic ignored "-Wdeprecated-declarations" diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 1812abd7d5..3edeef51e3 100755 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -220,7 +220,7 @@ private: char cwd[ FILENAME_MAX ]; // I *think* this is defined on all platforms we use if (NULL == getcwd( cwd, FILENAME_MAX - 1 )) { - llwarns << "Couldn't get cwd - probably too long - failing to init." << llendl; + LL_WARNS() << "Couldn't get cwd - probably too long - failing to init." << LL_ENDL; return false; } std::string application_dir = std::string( cwd ); @@ -380,13 +380,13 @@ private: url << std::setfill('0') << std::setw(2) << std::hex << int(mBackgroundB * 255.0f); url << "%22%3E%3C/body%3E%3C/html%3E"; - //lldebugs << "data url is: " << url.str() << llendl; + //LL_DEBUGS() << "data url is: " << url.str() << LL_ENDL; // always display loading overlay now #if LLQTWEBKIT_API_VERSION >= 16 LLQtWebKit::getInstance()->enableLoadingOverlay(mBrowserWindowId, true); #else - llwarns << "Ignoring enableLoadingOverlay() call (llqtwebkit version is too old)." << llendl; + LL_WARNS() << "Ignoring enableLoadingOverlay() call (llqtwebkit version is too old)." << LL_ENDL; #endif str.clear(); str << "Loading overlay enabled = " << mEnableMediaPluginDebugging << " for mBrowserWindowId = " << mBrowserWindowId; @@ -426,7 +426,7 @@ private: break; default: - llwarns << "Unknown cursor ID: " << (int)llqt_cursor << llendl; + LL_WARNS() << "Unknown cursor ID: " << (int)llqt_cursor << LL_ENDL; break; } @@ -1326,7 +1326,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) F32 factor = (F32)message_in.getValueReal("factor"); LLQtWebKit::getInstance()->setPageZoomFactor(factor); #else - llwarns << "Ignoring setPageZoomFactor message (llqtwebkit version is too old)." << llendl; + LL_WARNS() << "Ignoring setPageZoomFactor message (llqtwebkit version is too old)." << LL_ENDL; #endif } else if(message_name == "clear_cache") @@ -1405,7 +1405,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) bool val = message_in.getValueBoolean("show"); LLQtWebKit::getInstance()->showWebInspector( val ); #else - llwarns << "Ignoring showWebInspector message (llqtwebkit version is too old)." << llendl; + LL_WARNS() << "Ignoring showWebInspector message (llqtwebkit version is too old)." << LL_ENDL; #endif } else if(message_name == "ignore_ssl_cert_errors") @@ -1413,7 +1413,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) #if LLQTWEBKIT_API_VERSION >= 3 LLQtWebKit::getInstance()->setIgnoreSSLCertErrors( message_in.getValueBoolean("ignore") ); #else - llwarns << "Ignoring ignore_ssl_cert_errors message (llqtwebkit version is too old)." << llendl; + LL_WARNS() << "Ignoring ignore_ssl_cert_errors message (llqtwebkit version is too old)." << LL_ENDL; #endif } else if(message_name == "add_certificate_file_path") @@ -1421,7 +1421,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) #if LLQTWEBKIT_API_VERSION >= 6 LLQtWebKit::getInstance()->setCAFile( message_in.getValue("path") ); #else - llwarns << "Ignoring add_certificate_file_path message (llqtwebkit version is too old)." << llendl; + LL_WARNS() << "Ignoring add_certificate_file_path message (llqtwebkit version is too old)." << LL_ENDL; #endif } else if(message_name == "init_history") diff --git a/indra/media_plugins/winmmshim/winmm_shim.cpp b/indra/media_plugins/winmmshim/winmm_shim.cpp index aac349bf57..78f7a9b0da 100755 --- a/indra/media_plugins/winmmshim/winmm_shim.cpp +++ b/indra/media_plugins/winmmshim/winmm_shim.cpp @@ -4,7 +4,7 @@ * * $LicenseInfo:firstyear=2010&license=viewerlgpl$ * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. + * Copyright (C) 2010-2014, Linden Research, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,8 +30,8 @@ using std::wstring; -static float sVolumeLevel = 1.f; -static bool sMute = false; +static float sVolumeLevel = 1.f; // Could be covered by critical section, +static bool sMute = false; // not needed with atomicity and alignment. static CRITICAL_SECTION sCriticalSection; BOOL APIENTRY DllMain( HMODULE hModule, @@ -39,37 +39,44 @@ BOOL APIENTRY DllMain( HMODULE hModule, LPVOID lpReserved ) { - InitializeCriticalSection(&sCriticalSection); + if (ul_reason_for_call == DLL_PROCESS_ATTACH) + { + InitializeCriticalSection(&sCriticalSection); + } return TRUE; } void ll_winmm_shim_initialize(){ - static bool initialized = false; - // do this only once - EnterCriticalSection(&sCriticalSection); + static volatile bool initialized = false; + + // do this only once using double-check locking if (!initialized) - { // bind to original winmm.dll - TCHAR system_path[MAX_PATH]; - TCHAR dll_path[MAX_PATH]; - ::GetSystemDirectory(system_path, MAX_PATH); - - // grab winmm.dll from system path, where it should live - wsprintf(dll_path, "%s\\winmm.dll", system_path); - HMODULE winmm_handle = ::LoadLibrary(dll_path); - - if (winmm_handle != NULL) - { // we have a dll, let's get out pointers! - initialized = true; - init_function_pointers(winmm_handle); - ::OutputDebugStringA("WINMM_SHIM.DLL: real winmm.dll initialized successfully\n"); - } - else - { - // failed to initialize real winmm.dll - ::OutputDebugStringA("WINMM_SHIM.DLL: Failed to initialize real winmm.dll\n"); + { + EnterCriticalSection(&sCriticalSection); + if (!initialized) + { // bind to original winmm.dll + TCHAR system_path[MAX_PATH]; + TCHAR dll_path[MAX_PATH]; + ::GetSystemDirectory(system_path, MAX_PATH); + + // grab winmm.dll from system path, where it should live + wsprintf(dll_path, "%s\\winmm.dll", system_path); + HMODULE winmm_handle = ::LoadLibrary(dll_path); + + if (winmm_handle != NULL) + { // we have a dll, let's get out pointers! + init_function_pointers(winmm_handle); + ::OutputDebugStringA("WINMM_SHIM.DLL: real winmm.dll initialized successfully\n"); + initialized = true; // Last thing after completing setup + } + else + { + // failed to initialize real winmm.dll + ::OutputDebugStringA("WINMM_SHIM.DLL: Failed to initialize real winmm.dll\n"); + } } + LeaveCriticalSection(&sCriticalSection); } - LeaveCriticalSection(&sCriticalSection); } @@ -84,7 +91,7 @@ extern "C" int mBitsPerSample; }; typedef std::map<HWAVEOUT, WaveOutFormat*> wave_out_map_t; - static wave_out_map_t sWaveOuts; + static wave_out_map_t sWaveOuts; // Covered by sCriticalSection MMRESULT WINAPI waveOutOpen( LPHWAVEOUT phwo, UINT uDeviceID, LPCWAVEFORMATEX pwfx, DWORD_PTR dwCallback, DWORD_PTR dwInstance, DWORD fdwOpen) { @@ -100,7 +107,9 @@ extern "C" && ((fdwOpen & WAVE_FORMAT_QUERY) == 0)) // not just querying for format support { // remember the requested bits per sample, and associate with the given handle WaveOutFormat* wave_outp = new WaveOutFormat(pwfx->wBitsPerSample); + EnterCriticalSection(&sCriticalSection); sWaveOuts.insert(std::make_pair(*phwo, wave_outp)); + LeaveCriticalSection(&sCriticalSection); } return result; } @@ -108,13 +117,15 @@ extern "C" MMRESULT WINAPI waveOutClose( HWAVEOUT hwo) { ll_winmm_shim_initialize(); + EnterCriticalSection(&sCriticalSection); wave_out_map_t::iterator found_it = sWaveOuts.find(hwo); if (found_it != sWaveOuts.end()) { // forget what we know about this handle delete found_it->second; sWaveOuts.erase(found_it); } - return waveOutClose_orig( hwo); + LeaveCriticalSection(&sCriticalSection); + return waveOutClose_orig(hwo); } MMRESULT WINAPI waveOutWrite( HWAVEOUT hwo, LPWAVEHDR pwh, UINT cbwh) @@ -128,11 +139,19 @@ extern "C" } else if (sVolumeLevel != 1.f) { // need to apply volume level + int bits_per_sample(0); + + EnterCriticalSection(&sCriticalSection); wave_out_map_t::iterator found_it = sWaveOuts.find(hwo); if (found_it != sWaveOuts.end()) { - WaveOutFormat* formatp = found_it->second; - switch (formatp->mBitsPerSample){ + bits_per_sample = found_it->second->mBitsPerSample; + } + LeaveCriticalSection(&sCriticalSection); + if (bits_per_sample) + { + switch (bits_per_sample) + { case 8: { char volume = (char)(sVolumeLevel * 127.f); |