summaryrefslogtreecommitdiff
path: root/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp
diff options
context:
space:
mode:
authorNicky Dasmijn <nicky.dasmijn@posteo.nl>2024-04-09 20:26:06 +0200
committerGitHub <noreply@github.com>2024-04-09 21:26:06 +0300
commit37392be4171303db08a4842b7882b4cb758a8f8d (patch)
treeb93a6e27f64732395f92421aeec0efc8622c133c /indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp
parent6b4b33cc129e9482342c9280ae79c9c5ce427ef1 (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/media_plugin_gstreamer10.cpp')
-rw-r--r--indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp86
1 files changed, 31 insertions, 55 deletions
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);