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 | |
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')
5 files changed, 90 insertions, 385 deletions
diff --git a/indra/media_plugins/gstreamer10/CMakeLists.txt b/indra/media_plugins/gstreamer10/CMakeLists.txt index ffa3c30519..14ce5bfaa1 100644 --- a/indra/media_plugins/gstreamer10/CMakeLists.txt +++ b/indra/media_plugins/gstreamer10/CMakeLists.txt @@ -16,13 +16,8 @@ include(GStreamer10Plugin) ### media_plugin_gstreamer10 -if(NOT WINDOWS) # not windows therefore gcc LINUX and DARWIN -add_definitions(-fPIC) -endif() - set(media_plugin_gstreamer10_SOURCE_FILES media_plugin_gstreamer10.cpp - llmediaimplgstreamer_syms.cpp ) set(media_plugin_gstreamer10_HEADER_FILES 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; -} - diff --git a/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms.h b/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms.h deleted file mode 100644 index 0874644ee6..0000000000 --- a/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms.h +++ /dev/null @@ -1,68 +0,0 @@ -/** - * @file llmediaimplgstreamer_syms.h - * @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 "linden_common.h" -#include <vector> -extern "C" { -#include <gst/gst.h> -} - -bool grab_gst_syms( std::vector< std::string > const&); -void ungrab_gst_syms(); - -#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) extern RTN (*ll##GSTSYM)(__VA_ARGS__); -#include "llmediaimplgstreamer_syms_raw.inc" -#undef LL_GST_SYM - -// regrettable hacks to give us better runtime compatibility with older systems -#define llg_return_if_fail(COND) do{if (!(COND)) return;}while(0) -#define llg_return_val_if_fail(COND,V) do{if (!(COND)) return V;}while(0) - -// regrettable hacks because GStreamer was not designed for runtime loading -#undef GST_TYPE_MESSAGE -#define GST_TYPE_MESSAGE (llgst_message_get_type()) -#undef GST_TYPE_OBJECT -#define GST_TYPE_OBJECT (llgst_object_get_type()) -#undef GST_TYPE_PIPELINE -#define GST_TYPE_PIPELINE (llgst_pipeline_get_type()) -#undef GST_TYPE_ELEMENT -#define GST_TYPE_ELEMENT (llgst_element_get_type()) -#undef GST_TYPE_VIDEO_SINK -#define GST_TYPE_VIDEO_SINK (llgst_video_sink_get_type()) -// more regrettable hacks to stub-out these .h-exposed GStreamer internals -void ll_gst_debug_register_funcptr(GstDebugFuncPtr func, gchar* ptrname); -#undef _gst_debug_register_funcptr -#define _gst_debug_register_funcptr ll_gst_debug_register_funcptr -GstDebugCategory* ll_gst_debug_category_new(gchar *name, guint color, gchar *description); -#undef _gst_debug_category_new -#define _gst_debug_category_new ll_gst_debug_category_new -#undef __gst_debug_enabled -#define __gst_debug_enabled (0) - -// more hacks -#define LLGST_MESSAGE_TYPE_NAME(M) (llgst_message_type_get_name(GST_MESSAGE_TYPE(M))) diff --git a/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms_raw.inc b/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms_raw.inc index 155eeb6809..e5abf22203 100644 --- a/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms_raw.inc +++ b/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms_raw.inc @@ -1,68 +1,67 @@ -LL_GST_SYM(true, gst_buffer_new, GstBuffer*, void) -LL_GST_SYM(true, gst_structure_set_value, void, GstStructure *, const gchar *, const GValue*) -LL_GST_SYM(true, gst_init_check, gboolean, int *argc, char **argv[], GError ** err) -LL_GST_SYM(true, gst_message_get_type, GType, void) -LL_GST_SYM(true, gst_message_type_get_name, const gchar*, GstMessageType type) -LL_GST_SYM(true, gst_message_parse_error, void, GstMessage *message, GError **gerror, gchar **debug) -LL_GST_SYM(true, gst_message_parse_warning, void, GstMessage *message, GError **gerror, gchar **debug) -LL_GST_SYM(true, gst_message_parse_state_changed, void, GstMessage *message, GstState *oldstate, GstState *newstate, GstState *pending) -LL_GST_SYM(true, gst_element_set_state, GstStateChangeReturn, GstElement *element, GstState state) -LL_GST_SYM(true, gst_object_unref, void, gpointer object) -LL_GST_SYM(true, gst_object_get_type, GType, void) -LL_GST_SYM(true, gst_pipeline_get_type, GType, void) -LL_GST_SYM(true, gst_pipeline_get_bus, GstBus*, GstPipeline *pipeline) -LL_GST_SYM(true, gst_bus_add_watch, guint, GstBus * bus, GstBusFunc func, gpointer user_data) -LL_GST_SYM(true, gst_element_factory_make, GstElement*, const gchar *factoryname, const gchar *name) -LL_GST_SYM(true, gst_element_get_type, GType, void) -LL_GST_SYM(true, gst_static_pad_template_get, GstPadTemplate*, GstStaticPadTemplate *pad_template) -LL_GST_SYM(true, gst_element_class_add_pad_template, void, GstElementClass *klass, GstPadTemplate *temp) -LL_GST_SYM(true, gst_caps_from_string, GstCaps *, const gchar *string) -LL_GST_SYM(true, gst_caps_get_structure, GstStructure *, const GstCaps *caps, guint index) -LL_GST_SYM(true, gst_element_register, gboolean, GstPlugin *plugin, const gchar *name, guint rank, GType type) -LL_GST_SYM(true, gst_structure_get_int, gboolean, const GstStructure *structure, const gchar *fieldname, gint *value) -LL_GST_SYM(true, gst_structure_get_value, const GValue *, const GstStructure *structure, const gchar *fieldname) -LL_GST_SYM(true, gst_value_get_fraction_numerator, gint, const GValue *value) -LL_GST_SYM(true, gst_value_get_fraction_denominator, gint, const GValue *value) -LL_GST_SYM(true, gst_structure_get_name, const gchar *, const GstStructure *structure) -LL_GST_SYM(true, gst_element_seek, bool, GstElement *, gdouble, GstFormat, GstSeekFlags, GstSeekType, gint64, GstSeekType, gint64) +LL_GRAB_SYM(true, gst_buffer_new, GstBuffer*, void) +LL_GRAB_SYM(true, gst_structure_set_value, void, GstStructure *, const gchar *, const GValue*) +LL_GRAB_SYM(true, gst_init_check, gboolean, int *argc, char **argv[], GError ** err) +LL_GRAB_SYM(true, gst_message_get_type, GType, void) +LL_GRAB_SYM(true, gst_message_type_get_name, const gchar*, GstMessageType type) +LL_GRAB_SYM(true, gst_message_parse_error, void, GstMessage *message, GError **gerror, gchar **debug) +LL_GRAB_SYM(true, gst_message_parse_warning, void, GstMessage *message, GError **gerror, gchar **debug) +LL_GRAB_SYM(true, gst_message_parse_state_changed, void, GstMessage *message, GstState *oldstate, GstState *newstate, GstState *pending) +LL_GRAB_SYM(true, gst_element_set_state, GstStateChangeReturn, GstElement *element, GstState state) +LL_GRAB_SYM(true, gst_object_unref, void, gpointer object) +LL_GRAB_SYM(true, gst_object_get_type, GType, void) +LL_GRAB_SYM(true, gst_pipeline_get_type, GType, void) +LL_GRAB_SYM(true, gst_pipeline_get_bus, GstBus*, GstPipeline *pipeline) +LL_GRAB_SYM(true, gst_bus_add_watch, guint, GstBus * bus, GstBusFunc func, gpointer user_data) +LL_GRAB_SYM(true, gst_element_factory_make, GstElement*, const gchar *factoryname, const gchar *name) +LL_GRAB_SYM(true, gst_element_get_type, GType, void) +LL_GRAB_SYM(true, gst_static_pad_template_get, GstPadTemplate*, GstStaticPadTemplate *pad_template) +LL_GRAB_SYM(true, gst_element_class_add_pad_template, void, GstElementClass *klass, GstPadTemplate *temp) +LL_GRAB_SYM(true, gst_caps_from_string, GstCaps *, const gchar *string) +LL_GRAB_SYM(true, gst_caps_get_structure, GstStructure *, const GstCaps *caps, guint index) +LL_GRAB_SYM(true, gst_element_register, gboolean, GstPlugin *plugin, const gchar *name, guint rank, GType type) +LL_GRAB_SYM(true, gst_structure_get_int, gboolean, const GstStructure *structure, const gchar *fieldname, gint *value) +LL_GRAB_SYM(true, gst_structure_get_value, const GValue *, const GstStructure *structure, const gchar *fieldname) +LL_GRAB_SYM(true, gst_value_get_fraction_numerator, gint, const GValue *value) +LL_GRAB_SYM(true, gst_value_get_fraction_denominator, gint, const GValue *value) +LL_GRAB_SYM(true, gst_structure_get_name, const gchar *, const GstStructure *structure) +LL_GRAB_SYM(true, gst_element_seek, bool, GstElement *, gdouble, GstFormat, GstSeekFlags, GstSeekType, gint64, GstSeekType, gint64) -LL_GST_SYM(false, gst_registry_fork_set_enabled, void, gboolean enabled) -LL_GST_SYM(false, gst_segtrap_set_enabled, void, gboolean enabled) -LL_GST_SYM(false, gst_message_parse_buffering, void, GstMessage *message, gint *percent) -LL_GST_SYM(false, gst_message_parse_info, void, GstMessage *message, GError **gerror, gchar **debug) -LL_GST_SYM(false, gst_element_query_position, gboolean, GstElement *element, GstFormat *format, gint64 *cur) -LL_GST_SYM(false, gst_version, void, guint *major, guint *minor, guint *micro, guint *nano) +LL_GRAB_SYM(false, gst_registry_fork_set_enabled, void, gboolean enabled) +LL_GRAB_SYM(false, gst_segtrap_set_enabled, void, gboolean enabled) +LL_GRAB_SYM(false, gst_message_parse_buffering, void, GstMessage *message, gint *percent) +LL_GRAB_SYM(false, gst_message_parse_info, void, GstMessage *message, GError **gerror, gchar **debug) +LL_GRAB_SYM(false, gst_element_query_position, gboolean, GstElement *element, GstFormat *format, gint64 *cur) +LL_GRAB_SYM(false, gst_version, void, guint *major, guint *minor, guint *micro, guint *nano) -LL_GST_SYM( true, gst_message_parse_tag, void, GstMessage *, GstTagList **) -LL_GST_SYM( true, gst_tag_list_foreach, void, const GstTagList *, GstTagForeachFunc, gpointer) -LL_GST_SYM( true, gst_tag_list_get_tag_size, guint, const GstTagList *, const gchar *) -LL_GST_SYM( true, gst_tag_list_get_value_index, const GValue *, const GstTagList *, const gchar *, guint) +LL_GRAB_SYM( true, gst_message_parse_tag, void, GstMessage *, GstTagList **) +LL_GRAB_SYM( true, gst_tag_list_foreach, void, const GstTagList *, GstTagForeachFunc, gpointer) +LL_GRAB_SYM( true, gst_tag_list_get_tag_size, guint, const GstTagList *, const gchar *) +LL_GRAB_SYM( true, gst_tag_list_get_value_index, const GValue *, const GstTagList *, const gchar *, guint) -LL_GST_SYM( true, gst_caps_new_simple, GstCaps*, const char *, const char*, ... ) +LL_GRAB_SYM( true, gst_caps_new_simple, GstCaps*, const char *, const char*, ... ) -LL_GST_SYM( true, gst_sample_get_caps, GstCaps*, GstSample* ) -LL_GST_SYM( true, gst_sample_get_buffer, GstBuffer*, GstSample* ) -LL_GST_SYM( true, gst_buffer_map, gboolean, GstBuffer*, GstMapInfo*, GstMapFlags ) -LL_GST_SYM( true, gst_buffer_unmap, void, GstBuffer*, GstMapInfo* ) +LL_GRAB_SYM( true, gst_sample_get_caps, GstCaps*, GstSample* ) +LL_GRAB_SYM( true, gst_sample_get_buffer, GstBuffer*, GstSample* ) +LL_GRAB_SYM( true, gst_buffer_map, gboolean, GstBuffer*, GstMapInfo*, GstMapFlags ) +LL_GRAB_SYM( true, gst_buffer_unmap, void, GstBuffer*, GstMapInfo* ) -LL_GST_SYM( true, gst_app_sink_set_caps, void, GstAppSink*, GstCaps const* ) -LL_GST_SYM( true, gst_app_sink_pull_sample, GstSample*, GstAppSink* ) +LL_GRAB_SYM( true, gst_app_sink_set_caps, void, GstAppSink*, GstCaps const* ) +LL_GRAB_SYM( true, gst_app_sink_pull_sample, GstSample*, GstAppSink* ) -LL_GST_SYM( true, g_free, void, gpointer ) -LL_GST_SYM( true, g_error_free, void, GError* ) +LL_GRAB_SYM( true, g_free, void, gpointer ) +LL_GRAB_SYM( true, g_error_free, void, GError* ) -LL_GST_SYM( true, g_main_context_pending, gboolean, GMainContext* ) -LL_GST_SYM( true, g_main_loop_get_context, GMainContext*, GMainLoop* ) -LL_GST_SYM( true, g_main_context_iteration, gboolean, GMainContext*, gboolean ) -LL_GST_SYM( true, g_main_loop_new, GMainLoop*, GMainContext*, gboolean ) -LL_GST_SYM( true, g_main_loop_quit, void, GMainLoop* ) -LL_GST_SYM( true, gst_mini_object_unref, void, GstMiniObject* ) -LL_GST_SYM( true, g_object_set, void, gpointer, gchar const*, ... ) -LL_GST_SYM( true, g_source_remove, gboolean, guint ) -LL_GST_SYM( true, g_value_get_string, gchar const*, GValue const* ) +LL_GRAB_SYM( true, g_main_context_pending, gboolean, GMainContext* ) +LL_GRAB_SYM( true, g_main_loop_get_context, GMainContext*, GMainLoop* ) +LL_GRAB_SYM( true, g_main_context_iteration, gboolean, GMainContext*, gboolean ) +LL_GRAB_SYM( true, g_main_loop_new, GMainLoop*, GMainContext*, gboolean ) +LL_GRAB_SYM( true, g_main_loop_quit, void, GMainLoop* ) +LL_GRAB_SYM( true, gst_mini_object_unref, void, GstMiniObject* ) +LL_GRAB_SYM( true, g_object_set, void, gpointer, gchar const*, ... ) +LL_GRAB_SYM( true, g_source_remove, gboolean, guint ) +LL_GRAB_SYM( true, g_value_get_string, gchar const*, GValue const* ) - -LL_GST_SYM( true, gst_debug_set_active, void, gboolean ) -LL_GST_SYM( true, gst_debug_add_log_function, void, GstLogFunction, gpointer, GDestroyNotify ) -LL_GST_SYM( true, gst_debug_set_default_threshold, void, GstDebugLevel ) -LL_GST_SYM( true, gst_debug_message_get , gchar const*, GstDebugMessage * )
\ No newline at end of file +LL_GRAB_SYM( true, gst_debug_set_active, void, gboolean ) +LL_GRAB_SYM( true, gst_debug_add_log_function, void, GstLogFunction, gpointer, GDestroyNotify ) +LL_GRAB_SYM( true, gst_debug_set_default_threshold, void, GstDebugLevel ) +LL_GRAB_SYM( true, gst_debug_message_get , gchar const*, GstDebugMessage * )
\ No newline at end of file diff --git a/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp b/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp index 07bfb67283..dbc544d96b 100644 --- a/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp +++ b/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp @@ -43,9 +43,9 @@ extern "C" { #include <gst/app/gstappsink.h> } +SymbolGrabber gSymbolGrabber; -#include "llmediaimplgstreamer.h" -#include "llmediaimplgstreamer_syms.h" +#include "llmediaimplgstreamer_syms_raw.inc" static inline void llgst_caps_unref( GstCaps * caps ) { @@ -139,9 +139,9 @@ MediaPluginGStreamer10::MediaPluginGStreamer10( LLPluginInstance::sendMessageFun , mBusWatchID ( 0 ) , mSeekWanted(false) , mSeekDestination(0.0) - , mPump ( NULL ) - , mPlaybin ( NULL ) - , mAppSink ( NULL ) + , mPump ( nullptr ) + , mPlaybin ( nullptr ) + , mAppSink ( nullptr ) , mCommand ( COMMAND_NONE ) { } @@ -193,8 +193,8 @@ gboolean MediaPluginGStreamer10::processGSTEvents(GstBus *bus, GstMessage *messa } case GST_MESSAGE_ERROR: { - GError *err = NULL; - gchar *debug = NULL; + GError *err = nullptr; + gchar *debug = nullptr; llgst_message_parse_error (message, &err, &debug); if (err) @@ -211,8 +211,8 @@ gboolean MediaPluginGStreamer10::processGSTEvents(GstBus *bus, GstMessage *messa { if (llgst_message_parse_info) { - GError *err = NULL; - gchar *debug = NULL; + GError *err = nullptr; + gchar *debug = nullptr; llgst_message_parse_info (message, &err, &debug); if (err) @@ -223,8 +223,8 @@ gboolean MediaPluginGStreamer10::processGSTEvents(GstBus *bus, GstMessage *messa } case GST_MESSAGE_WARNING: { - GError *err = NULL; - gchar *debug = NULL; + GError *err = nullptr; + gchar *debug = nullptr; llgst_message_parse_warning (message, &err, &debug); if (err) @@ -293,13 +293,13 @@ bool MediaPluginGStreamer10::navigateTo ( const std::string urlIn ) mSeekWanted = false; - if (NULL == mPump || NULL == mPlaybin) + if (nullptr == mPump || nullptr == mPlaybin) { setStatus(STATUS_ERROR); return false; // error } - llg_object_set (G_OBJECT (mPlaybin), "uri", urlIn.c_str(), NULL); + llg_object_set (G_OBJECT (mPlaybin), "uri", urlIn.c_str(), nullptr); // navigateTo implicitly plays, too. play(1.0); @@ -328,7 +328,7 @@ bool MediaPluginGStreamer10::update(int milliseconds) // DEBUGMSG("updating media..."); // sanity check - if (NULL == mPump || NULL == mPlaybin) + if (nullptr == mPump || nullptr == mPlaybin) { return false; } @@ -475,7 +475,7 @@ bool MediaPluginGStreamer10::setVolume( float volume ) mVolume = volume; if (mDoneInit && mPlaybin) { - llg_object_set(mPlaybin, "volume", mVolume, NULL); + llg_object_set(mPlaybin, "volume", mVolume, nullptr); return true; } @@ -549,7 +549,7 @@ bool MediaPluginGStreamer10::load() mVolume = 0.1234567f; // minor hack to force an initial volume update // Create a pumpable main-loop for this media - mPump = llg_main_loop_new (NULL, FALSE); + mPump = llg_main_loop_new (nullptr, FALSE); if (!mPump) { setStatus(STATUS_ERROR); @@ -582,7 +582,7 @@ bool MediaPluginGStreamer10::load() "format", G_TYPE_STRING, "RGB", "width", G_TYPE_INT, INTERNAL_TEXTURE_SIZE, "height", G_TYPE_INT, INTERNAL_TEXTURE_SIZE, - NULL ); + nullptr ); llgst_app_sink_set_caps( mAppSink, pCaps ); llgst_caps_unref( pCaps ); @@ -593,7 +593,7 @@ bool MediaPluginGStreamer10::load() return false; } - llg_object_set(mPlaybin, "video-sink", mAppSink, NULL); + llg_object_set(mPlaybin, "video-sink", mAppSink, nullptr); return true; } @@ -611,16 +611,16 @@ bool MediaPluginGStreamer10::unload () { llgst_element_set_state (mPlaybin, GST_STATE_NULL); llgst_object_unref (GST_OBJECT (mPlaybin)); - mPlaybin = NULL; + mPlaybin = nullptr; } if (mPump) { llg_main_loop_quit(mPump); - mPump = NULL; + mPump = nullptr; } - mAppSink = NULL; + mAppSink = nullptr; setStatus(STATUS_NONE); @@ -628,20 +628,15 @@ bool MediaPluginGStreamer10::unload () } void LogFunction(GstDebugCategory *category, GstDebugLevel level, const gchar *file, const gchar *function, gint line, GObject *object, GstDebugMessage *message, gpointer user_data ) -#ifndef LL_LINUX // Docu says we need G_GNUC_NO_INSTRUMENT, but GCC says 'error' - G_GNUC_NO_INSTRUMENT -#endif { -#ifdef LL_LINUX std::cerr << file << ":" << line << "(" << function << "): " << llgst_debug_message_get( message ) << std::endl; -#endif } //static bool MediaPluginGStreamer10::startup() { // first - check if GStreamer is explicitly disabled - if (NULL != getenv("LL_DISABLE_GSTREAMER")) + if (nullptr != getenv("LL_DISABLE_GSTREAMER")) return false; // only do global GStreamer initialization once. @@ -651,28 +646,18 @@ bool MediaPluginGStreamer10::startup() // Get symbols! std::vector< std::string > vctDSONames; -#if LL_DARWIN -#elif LL_WINDOWS - vctDSONames.push_back( "libgstreamer-1.0-0.dll" ); - vctDSONames.push_back( "libgstapp-1.0-0.dll" ); - vctDSONames.push_back( "libglib-2.0-0.dll" ); - vctDSONames.push_back( "libgobject-2.0-0.dll" ); -#else // linux or other ELFy unixoid vctDSONames.push_back( "libgstreamer-1.0.so.0" ); vctDSONames.push_back( "libgstapp-1.0.so.0" ); vctDSONames.push_back( "libglib-2.0.so.0" ); vctDSONames.push_back( "libgobject-2.0.so" ); -#endif - if( !grab_gst_syms( vctDSONames ) ) - { + if( !gSymbolGrabber.grabSymbols( vctDSONames ) ) return false; - } if (llgst_segtrap_set_enabled) { llgst_segtrap_set_enabled(FALSE); } -#if LL_LINUX + // Gstreamer tries a fork during init, waitpid-ing on it, // which conflicts with any installed SIGCHLD handler... struct sigaction tmpact, oldact; @@ -689,36 +674,29 @@ bool MediaPluginGStreamer10::startup() tmpact.sa_flags = SA_SIGINFO; sigaction(SIGCHLD, &tmpact, &oldact); } -#endif // LL_LINUX // Protect against GStreamer resetting the locale, yuck. static std::string saved_locale; - saved_locale = setlocale(LC_ALL, NULL); + saved_locale = setlocale(LC_ALL, nullptr); -// _putenv_s( "GST_PLUGIN_PATH", "E:\\gstreamer\\1.0\\x86\\lib\\gstreamer-1.0" ); - llgst_debug_set_default_threshold( GST_LEVEL_WARNING ); - llgst_debug_add_log_function( LogFunction, NULL, NULL ); + llgst_debug_add_log_function( LogFunction, nullptr, nullptr ); llgst_debug_set_active( false ); // finally, try to initialize GStreamer! - GError *err = NULL; - gboolean init_gst_success = llgst_init_check(NULL, NULL, &err); + GError *err = nullptr; + gboolean init_gst_success = llgst_init_check(nullptr, nullptr, &err); // restore old locale setlocale(LC_ALL, saved_locale.c_str() ); -#if LL_LINUX // restore old SIGCHLD handler if (!llgst_registry_fork_set_enabled) - sigaction(SIGCHLD, &oldact, NULL); -#endif // LL_LINUX + sigaction(SIGCHLD, &oldact, nullptr); if (!init_gst_success) // fail { if (err) - { llg_error_free(err); - } return false; } @@ -734,8 +712,7 @@ bool MediaPluginGStreamer10::closedown() if (!mDoneInit) return false; // error - ungrab_gst_syms(); - + gSymbolGrabber.ungrabSymbols(); mDoneInit = false; return true; @@ -746,7 +723,6 @@ MediaPluginGStreamer10::~MediaPluginGStreamer10() closedown(); } - std::string MediaPluginGStreamer10::getVersion() { std::string plugin_version = "GStreamer10 media plugin, GStreamer version "; @@ -823,7 +799,7 @@ void MediaPluginGStreamer10::receiveMessage(const char *message_string) if(mPixels == iter->second.mAddress) { // This is the currently active pixel buffer. Make sure we stop drawing to it. - mPixels = NULL; + mPixels = nullptr; mTextureSegmentName.clear(); } mSharedSegments.erase(iter); |