From e56c5f8e6939a1b79deb401b7e1fcd129e488d77 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 28 Mar 2009 18:42:42 -0500 Subject: Print out the plugins gstreamer finds, for debugging. --- ChangeLog.txt | 6 ++++++ linden/indra/llmedia/llmediaimplgstreamer.cpp | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 59c780c..dbfa5b6 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,9 @@ +2009-03-28 Jacek Antonelli + + * linden/indra/llmedia/llmediaimplgstreamer.cpp: + Print out the plugins gstreamer finds, for debugging. + + 2009-03-26 Jacek Antonelli * linden/indra/llmedia/llmediaimplgstreamervidplug.cpp: diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp index 5d4d553..d661f74 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp @@ -178,6 +178,21 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) // Init our custom plugins - only really need do this once. gst_slvideo_init_class(); + + // List the plugins GStreamer can find + LL_DEBUGS("MediaImpl") << "Found GStreamer plugins:" << LL_ENDL; + GList *list; + GstRegistry *registry = gst_registry_get_default(); + for (list = gst_registry_get_plugin_list(registry); + list != NULL; + list = g_list_next(list)) + { + GstPlugin *list_plugin = (GstPlugin *)list->data; + LL_DEBUGS("MediaImpl") << gst_plugin_get_name(list_plugin) << LL_ENDL; + } + gst_plugin_list_free(list); + + done_init = true; } return true; -- cgit v1.1 From 6542894a75f826203cab1ae482fdf5187be09205 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 28 Mar 2009 18:53:52 -0500 Subject: Moved Windows GST_PLUGIN_PATH setup to LLMediaImplGStreamer. LLAppViewer::gst_plugin_path --> LLMediaImplGStreamer::set_gst_plugin_path --- ChangeLog.txt | 12 ++++++++++++ linden/indra/llmedia/llmediaimplgstreamer.cpp | 27 +++++++++++++++++++++++++++ linden/indra/llmedia/llmediaimplgstreamer.h | 4 ++++ linden/indra/newview/llappviewer.cpp | 26 -------------------------- linden/indra/newview/llappviewer.h | 2 -- 5 files changed, 43 insertions(+), 28 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index dbfa5b6..eb35e5f 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,6 +1,18 @@ 2009-03-28 Jacek Antonelli * linden/indra/llmedia/llmediaimplgstreamer.cpp: + Moved Windows GST_PLUGIN_PATH setup to LLMediaImplGStreamer. + LLAppViewer::gst_plugin_path --> + LLMediaImplGStreamer::set_gst_plugin_path + * linden/indra/llmedia/llmediaimplgstreamer.cpp: + Ditto. + * linden/indra/newview/llappviewer.h: + Ditto. + * linden/indra/newview/llappviewer.cpp: + Ditto. + + + * linden/indra/llmedia/llmediaimplgstreamer.cpp: Print out the plugins gstreamer finds, for debugging. diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp index d661f74..ed7b36e 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp @@ -164,6 +164,8 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) // Init the glib type system - we need it. g_type_init(); + set_gst_plugin_path(); + // Protect against GStreamer resetting the locale, yuck. static std::string saved_locale; saved_locale = setlocale(LC_ALL, NULL); @@ -199,6 +201,31 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) } +void LLMediaImplGStreamer::set_gst_plugin_path() +{ +#ifdef LL_WINDOWS + char* buffer; + + // Get the current working directory: + if((buffer = _getcwd(NULL,0)) == NULL) + { + LL_INFOS("InitInfo") << "_getcwd error" << LL_ENDL; + } + else + { + LL_INFOS("InitInfo") << "Imprudence is installed at " << buffer << LL_ENDL; + + std::string plugin_path = "GST_PLUGIN_PATH=" + std::string(buffer) + "\\lib\\gstreamer-plugins"; + + // Place GST_PLUGIN_PATH in the environment settings for imprudence.exe + const char* gst_plugin_path = plugin_path.c_str(); + putenv(gst_plugin_path); + LL_INFOS("InitInfo") << "GST_PLUGIN_PATH set to " << getenv("GST_PLUGIN_PATH") << LL_ENDL; + } +#endif //LL_WINDOWS +} + + bool LLMediaImplGStreamer::closedown() { return true; diff --git a/linden/indra/llmedia/llmediaimplgstreamer.h b/linden/indra/llmedia/llmediaimplgstreamer.h index dec970a..2918416 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.h +++ b/linden/indra/llmedia/llmediaimplgstreamer.h @@ -66,6 +66,9 @@ class LLMediaImplGStreamer: static bool startup( LLMediaManagerData* init_data ); static bool closedown(); + // Sets GST_PLUGIN_PATH env var for GStreamer. + static void set_gst_plugin_path(); + /* virtual */ std::string getVersion(); /* virtual */ bool navigateTo( const std::string url ); /* virtual */ bool updateMedia(); @@ -79,6 +82,7 @@ class LLMediaImplGStreamer: LLMediaEmitter< LLMediaObserver > getEventEmitter() const {return mEventEmitter;}; private: + // misc bool unload(); bool pause(); diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp index 15ce1a3..6d87ca8 100644 --- a/linden/indra/newview/llappviewer.cpp +++ b/linden/indra/newview/llappviewer.cpp @@ -320,30 +320,6 @@ std::vector gLoginURIs; static std::string gHelperURI; -void LLAppViewer::gst_plugin_path() -{ -#ifdef LL_WINDOWS - char* buffer; - - // Get the current working directory: - if((buffer = _getcwd(NULL,0)) == NULL) - { - LL_INFOS("InitInfo") << "_getcwd error" << LL_ENDL; - } - else - { - LL_INFOS("InitInfo") << "Imprudence is installed at " << buffer << LL_ENDL; - - std::string plugin_path = "GST_PLUGIN_PATH=" + std::string(buffer) + "\\lib\\gstreamer-plugins"; - - // Place GST_PLUGIN_PATH in the environment settings for imprudence.exe - const char* gst_plugin_path = plugin_path.c_str(); - putenv(gst_plugin_path); - LL_INFOS("InitInfo") << "GST_PLUGIN_PATH set to " << getenv("GST_PLUGIN_PATH") << LL_ENDL; - } -#endif //LL_WINDOWS -} - void idle_afk_check() { // check idle timers @@ -643,8 +619,6 @@ bool LLAppViewer::init() LL_VERSION_PATCH, LL_VERSION_BUILD ); - gst_plugin_path(); - ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// diff --git a/linden/indra/newview/llappviewer.h b/linden/indra/newview/llappviewer.h index 2083a93..58dc835 100644 --- a/linden/indra/newview/llappviewer.h +++ b/linden/indra/newview/llappviewer.h @@ -138,8 +138,6 @@ public: protected: - void gst_plugin_path(); // Sets GST_PLUGIN_PATH environment variable for GStreamer. - virtual bool initWindow(); // Initialize the viewer's window. virtual bool initLogging(); // Initialize log files, logging system, return false on failure. virtual void initConsole() {}; // Initialize OS level debugging console. -- cgit v1.1 From 9538403155fdc574c8562cdaedbeb09fbdcff55e Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 28 Mar 2009 19:29:40 -0500 Subject: Improved set_gst_plugin_path, more comprehensive path. Also tried to tidy up a bit. --- ChangeLog.txt | 7 ++++ linden/indra/llmedia/llmediaimplgstreamer.cpp | 47 ++++++++++++++++++++++----- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index eb35e5f..776a451 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,9 +1,16 @@ 2009-03-28 Jacek Antonelli * linden/indra/llmedia/llmediaimplgstreamer.cpp: + Improved set_gst_plugin_path, more comprehensive path. + Also tried to tidy up a bit. + + + * linden/indra/llmedia/llmediaimplgstreamer.cpp: Moved Windows GST_PLUGIN_PATH setup to LLMediaImplGStreamer. LLAppViewer::gst_plugin_path --> LLMediaImplGStreamer::set_gst_plugin_path + + * linden/indra/llmedia/llmediaimplgstreamer.cpp: Ditto. * linden/indra/newview/llappviewer.h: diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp index ed7b36e..0cc1e8f 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp @@ -203,25 +203,54 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) void LLMediaImplGStreamer::set_gst_plugin_path() { + // Only needed for Windows. + // Linux sets in wrapper.sh, Mac sets in Info-Imprudence.plist #ifdef LL_WINDOWS - char* buffer; + + char* imp_cwd; // Get the current working directory: - if((buffer = _getcwd(NULL,0)) == NULL) + imp_cwd = _getcwd(NULL,0); + + if(imp_cwd == NULL) { - LL_INFOS("InitInfo") << "_getcwd error" << LL_ENDL; + LL_DEBUGS("LLMediaImpl") << "_getcwd failed, not setting GST_PLUGIN_PATH." + << LL_ENDL; } else { - LL_INFOS("InitInfo") << "Imprudence is installed at " << buffer << LL_ENDL; - - std::string plugin_path = "GST_PLUGIN_PATH=" + std::string(buffer) + "\\lib\\gstreamer-plugins"; + LL_DEBUGS("LLMediaImpl") << "Imprudence is installed at " + << buffer << LL_ENDL; + + // Grab the current path, if it's set. + std::string old_plugin_path = ""; + char *old_path = getenv("GST_PLUGIN_PATH"); + if(old_path == NULL) + { + LL_DEBUGS("LLMediaImpl") << "Did not find user-set GST_PLUGIN_PATH." + << LL_ENDL; + } + else + { + old_plugin_path = std::string( old_path ) + ":"; + } + + + // Search both Imprudence and Imprudence\lib\gstreamer-plugins. + // But we also want to first search the path the user has set, if any. + std::string plugin_path = + "GST_PLUGIN_PATH=" + + old_plugin_path + + std::string(imp_cwd) + ":" + + std::string(imp_cwd) + "\\lib\\gstreamer-plugins"; // Place GST_PLUGIN_PATH in the environment settings for imprudence.exe - const char* gst_plugin_path = plugin_path.c_str(); - putenv(gst_plugin_path); - LL_INFOS("InitInfo") << "GST_PLUGIN_PATH set to " << getenv("GST_PLUGIN_PATH") << LL_ENDL; + putenv( plugin_path.c_str() ); + + LL_DEBUGS("LLMediaImpl") << "GST_PLUGIN_PATH set to " + << getenv("GST_PLUGIN_PATH") << LL_ENDL; } + #endif //LL_WINDOWS } -- cgit v1.1 From 0779047440604c5c5ecfd685803059b763a29325 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sat, 28 Mar 2009 19:43:35 -0500 Subject: Fixed some minor mistakes in set_gst_plugin_path(). --- linden/indra/llmedia/llmediaimplgstreamer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp index 0cc1e8f..9a51b7f 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp @@ -220,7 +220,7 @@ void LLMediaImplGStreamer::set_gst_plugin_path() else { LL_DEBUGS("LLMediaImpl") << "Imprudence is installed at " - << buffer << LL_ENDL; + << imp_cwd << LL_ENDL; // Grab the current path, if it's set. std::string old_plugin_path = ""; @@ -245,7 +245,7 @@ void LLMediaImplGStreamer::set_gst_plugin_path() std::string(imp_cwd) + "\\lib\\gstreamer-plugins"; // Place GST_PLUGIN_PATH in the environment settings for imprudence.exe - putenv( plugin_path.c_str() ); + putenv( (char*)plugin_path.c_str() ); LL_DEBUGS("LLMediaImpl") << "GST_PLUGIN_PATH set to " << getenv("GST_PLUGIN_PATH") << LL_ENDL; -- cgit v1.1