diff options
author | Nicky Dasmijn <nicky.dasmijn@posteo.nl> | 2024-04-09 20:26:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-09 21:26:06 +0300 |
commit | 37392be4171303db08a4842b7882b4cb758a8f8d (patch) | |
tree | b93a6e27f64732395f92421aeec0efc8622c133c /indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms.cpp | |
parent | 6b4b33cc129e9482342c9280ae79c9c5ce427ef1 (diff) |
Update Linux media handling (#1146)
* Enable CEF browser for Linux
* Disable the update for Linux, we don't have that one right now
* Update build_linux.yaml
We need libpulse-dev for volume_catcher Linux
* Add linux_volum_catcher* files
* Enable OpenAL for Linux-ReleaseOS
* Linux: Update OpenAL
* Update SDL2
* Add libsndio-dev to the dependencies.
* Update CEF to an official LL version
* Remove dupe of emoji_shortcodes
* Reording autobuild does because it can and wants to
* Linux: Disable NDOF for the time being. After updating the ndof 3P needs to be rebuilt and we do not have a fresh one from LL yet.
Forcefully undefine LIB_NDOF, it gets defined in the build variables no matter if it is safe to define.
* Remove wrestling with mutliarch and LIBGL_DRIVERS_PATH
* Remove tcmalloc snippet, tcmalloc is a very faint bad dream of the past
* Putting out a warning this viewer ran on a x64 arch and then suggesting to install 32 bit compat packages makes no sense at all
* CEF resources need to be in lib
* It;'s okay to warn about missing plugins
* Linux: CEF keyboard handling
* Remove old gstreamer 0.10 implementation
* Linux DSO loading always had been very peculiar due to macro magic.
At least now it is peculiar shared magic with only one implementation.
* Remove -fPIC. We get that one from LL_BUILD
* /proc/cpuinfo is not reliable to detrmine the max CPU clock. Try to determine this by reading "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq".
Only if this fails go back to /proc/cpuinfo
* Cleanup
* Cleanup common linker and compiler flags, make it more obvious which flags are for which OS/compiler
* Switch to correct plugin file
* Install libpulse-dev for volume catcher.
* And the runner needs libsndio-dev as well.
* check for runner.os=='linux'. matrix.os is the full name of the image (limux-large).
Diffstat (limited to 'indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms.cpp')
-rw-r--r-- | indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms.cpp | 197 |
1 files changed, 0 insertions, 197 deletions
diff --git a/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms.cpp b/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms.cpp deleted file mode 100644 index e5e5c1c9a3..0000000000 --- a/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/** - * @file llmediaimplgstreamer_syms.cpp - * @brief dynamic GStreamer symbol-grabbing code - * - * @cond - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, 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 - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - * @endcond - */ - -#include <string> -#include <iostream> -#include <vector> - -#ifdef LL_WINDOWS -#undef _WIN32_WINNT -#define _WIN32_WINNT 0x0502 -#include <Windows.h> -#endif - -#include "linden_common.h" - -extern "C" { -#include <gst/gst.h> -#include <gst/app/gstappsink.h> -} - -#include "apr_pools.h" -#include "apr_dso.h" - -#ifdef LL_WINDOWS - -#ifndef _M_AMD64 -#define GSTREAMER_REG_KEY "Software\\GStreamer1.0\\x86" -#define GSTREAMER_DIR_SUFFIX "1.0\\x86\\bin\\" -#else -#define GSTREAMER_REG_KEY "Software\\GStreamer1.0\\x86_64" -#define GSTREAMER_DIR_SUFFIX "1.0\\x86_64\\bin\\" -#endif - -bool openRegKey( HKEY &aKey ) -{ - // Try native (32 bit view/64 bit view) of registry first. - if( ERROR_SUCCESS == ::RegOpenKeyExA( HKEY_LOCAL_MACHINE, GSTREAMER_REG_KEY, 0, KEY_QUERY_VALUE, &aKey ) ) - return true; - - // If native view fails, use 32 bit view or registry. - if( ERROR_SUCCESS == ::RegOpenKeyExA( HKEY_LOCAL_MACHINE, GSTREAMER_REG_KEY, 0, KEY_QUERY_VALUE | KEY_WOW64_32KEY, &aKey ) ) - return true; - - return false; -} - -std::string getGStreamerDir() -{ - std::string ret; - HKEY hKey; - - if( openRegKey( hKey ) ) - { - DWORD dwLen(0); - ::RegQueryValueExA( hKey, "InstallDir", nullptr, nullptr, nullptr, &dwLen ); - - if( dwLen > 0 ) - { - std::vector< char > vctBuffer; - vctBuffer.resize( dwLen ); - ::RegQueryValueExA( hKey, "InstallDir", nullptr, nullptr, reinterpret_cast< LPBYTE>(&vctBuffer[ 0 ]), &dwLen ); - ret = &vctBuffer[0]; - - if( ret[ dwLen-1 ] != '\\' ) - ret += "\\"; - ret += GSTREAMER_DIR_SUFFIX; - - SetDllDirectoryA( ret.c_str() ); - } - ::RegCloseKey( hKey ); - } - return ret; -} -#else -std::string getGStreamerDir() { return ""; } -#endif - -#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) RTN (*ll##GSTSYM)(__VA_ARGS__) = NULL; -#include "llmediaimplgstreamer_syms_raw.inc" -#undef LL_GST_SYM - -struct Symloader -{ - bool mRequired; - char const *mName; - apr_dso_handle_sym_t *mPPFunc; -}; - -#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) { REQ, #GSTSYM , (apr_dso_handle_sym_t*)&ll##GSTSYM}, -Symloader sSyms[] = { -#include "llmediaimplgstreamer_syms_raw.inc" -{ false, 0, 0 } }; -#undef LL_GST_SYM - -// a couple of stubs for disgusting reasons -GstDebugCategory* -ll_gst_debug_category_new(gchar *name, guint color, gchar *description) -{ - static GstDebugCategory dummy; - return &dummy; -} -void ll_gst_debug_register_funcptr(GstDebugFuncPtr func, gchar* ptrname) -{ -} - -static bool sSymsGrabbed = false; -static apr_pool_t *sSymGSTDSOMemoryPool = NULL; - -std::vector< apr_dso_handle_t* > sLoadedLibraries; - -bool grab_gst_syms( std::vector< std::string > const &aDSONames ) -{ - if (sSymsGrabbed) - return true; - - //attempt to load the shared libraries - apr_pool_create(&sSymGSTDSOMemoryPool, NULL); - - for( std::vector< std::string >::const_iterator itr = aDSONames.begin(); itr != aDSONames.end(); ++itr ) - { - apr_dso_handle_t *pDSO(NULL); - std::string strDSO = getGStreamerDir() + *itr; - if( APR_SUCCESS == apr_dso_load( &pDSO, strDSO.c_str(), sSymGSTDSOMemoryPool )) - sLoadedLibraries.push_back( pDSO ); - - for( int i = 0; sSyms[ i ].mName; ++i ) - { - if( !*sSyms[ i ].mPPFunc ) - { - apr_dso_sym( sSyms[ i ].mPPFunc, pDSO, sSyms[ i ].mName ); - } - } - } - - std::stringstream strm; - bool sym_error = false; - for( int i = 0; sSyms[ i ].mName; ++i ) - { - if( sSyms[ i ].mRequired && ! *sSyms[ i ].mPPFunc ) - { - sym_error = true; - strm << sSyms[ i ].mName << std::endl; - } - } - - sSymsGrabbed = !sym_error; - return sSymsGrabbed; -} - - -void ungrab_gst_syms() -{ - // should be safe to call regardless of whether we've - // actually grabbed syms. - - for( std::vector< apr_dso_handle_t* >::iterator itr = sLoadedLibraries.begin(); itr != sLoadedLibraries.end(); ++itr ) - apr_dso_unload( *itr ); - - sLoadedLibraries.clear(); - - if ( sSymGSTDSOMemoryPool ) - { - apr_pool_destroy(sSymGSTDSOMemoryPool); - sSymGSTDSOMemoryPool = NULL; - } - - for( int i = 0; sSyms[ i ].mName; ++i ) - *sSyms[ i ].mPPFunc = NULL; - - sSymsGrabbed = false; -} - |