aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-03-30 02:55:33 -0700
committerMcCabe Maxsted2009-03-30 02:55:33 -0700
commit8ad8d0bac5e0305e2f71d05cc9d1c22e71b217af (patch)
tree377f08b13ac8d0f3ba267a5cff91ebd7ae23431d
parentMerge branch 'gst-revamp' into next (diff)
parentAdded flag for multi-core compiling in VS2005 (diff)
downloadmeta-impy-8ad8d0bac5e0305e2f71d05cc9d1c22e71b217af.zip
meta-impy-8ad8d0bac5e0305e2f71d05cc9d1c22e71b217af.tar.gz
meta-impy-8ad8d0bac5e0305e2f71d05cc9d1c22e71b217af.tar.bz2
meta-impy-8ad8d0bac5e0305e2f71d05cc9d1c22e71b217af.tar.xz
Merge commit 'edadcfadf71ac23d301a1b6fb186883d' into next
Diffstat (limited to '')
-rw-r--r--ChangeLog.txt39
-rw-r--r--linden/indra/cmake/00-Common.cmake15
-rw-r--r--linden/indra/llmedia/llmediaimplgstreamer.cpp155
-rw-r--r--linden/indra/llmedia/llmediaimplgstreamer.h4
-rw-r--r--linden/indra/newview/llappviewer.cpp29
-rw-r--r--linden/indra/newview/llappviewer.h2
6 files changed, 184 insertions, 60 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 0a3a9be..1ddae18 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,3 +1,42 @@
12009-03-29 McCabe Maxsted <hakushakukun@gmail.com>
2
3 * linden/indra/llmedia/llmediaimplgstreamer.cpp:
4 Added loading status to the log's plugin list.
5 set_gst_plugin_path now compiles for windows.
6 * linden/indra/newview/llappviewer.cpp:
7 Removed unnecessary headers.
8
9
10 * linden/indra/cmake/00-Common.cmake
11 Added VS optimizations to cmake
12 Added flag for multi-core compiling in VS2005
13
14
152009-03-28 Jacek Antonelli <jacek.antonelli@gmail.com>
16
17 * linden/indra/llmedia/llmediaimplgstreamer.cpp:
18 Improved set_gst_plugin_path, more comprehensive path.
19 Also tried to tidy up a bit.
20
21
22 * linden/indra/llmedia/llmediaimplgstreamer.cpp:
23 Moved Windows GST_PLUGIN_PATH setup to LLMediaImplGStreamer.
24 LLAppViewer::gst_plugin_path -->
25 LLMediaImplGStreamer::set_gst_plugin_path
26
27
28 * linden/indra/llmedia/llmediaimplgstreamer.cpp:
29 Ditto.
30 * linden/indra/newview/llappviewer.h:
31 Ditto.
32 * linden/indra/newview/llappviewer.cpp:
33 Ditto.
34
35
36 * linden/indra/llmedia/llmediaimplgstreamer.cpp:
37 Print out the plugins gstreamer finds, for debugging.
38
39
12009-03-27 McCabe Maxsted <hakushakukun@gmail.com> 402009-03-27 McCabe Maxsted <hakushakukun@gmail.com>
2 41
3 * linden/indra/llmedia/llmediaimplgstreamer.cpp: 42 * linden/indra/llmedia/llmediaimplgstreamer.cpp:
diff --git a/linden/indra/cmake/00-Common.cmake b/linden/indra/cmake/00-Common.cmake
index c41591f..27838d6 100644
--- a/linden/indra/cmake/00-Common.cmake
+++ b/linden/indra/cmake/00-Common.cmake
@@ -57,6 +57,21 @@ if (WINDOWS)
57 /Zc:wchar_t- 57 /Zc:wchar_t-
58 ) 58 )
59 endif (MSVC80 OR MSVC90) 59 endif (MSVC80 OR MSVC90)
60
61 # VS optimization flags
62 if(MSVC80)
63
64 set(NUMBER_OF_CORES $ENV{NUMBER_OF_PROCESSORS})
65
66 set(CMAKE_CXX_FLAGS_RELEASE
67 "${CMAKE_CXX_FLAGS_RELEASE} /Ob2 /Oi /Ot /GT"
68 CACHE STRING "C++ compiler release options" FORCE)
69
70 add_definitions(
71 /MP${NUMBER_OF_CORES}
72 )
73
74 endif (MSVC80)
60 75
61 # Are we using the crummy Visual Studio KDU build workaround? 76 # Are we using the crummy Visual Studio KDU build workaround?
62 if (NOT VS_DISABLE_FATAL_WARNINGS) 77 if (NOT VS_DISABLE_FATAL_WARNINGS)
diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp
index e38dc29..952e22f 100644
--- a/linden/indra/llmedia/llmediaimplgstreamer.cpp
+++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp
@@ -48,6 +48,8 @@ extern "C" {
48 48
49#if LL_WINDOWS 49#if LL_WINDOWS
50 #pragma warning(default : 4244) 50 #pragma warning(default : 4244)
51#include <direct.h>
52#include <stdlib.h>
51#endif 53#endif
52 54
53#include "llmediamanager.h" 55#include "llmediamanager.h"
@@ -175,6 +177,8 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data)
175 // Init the glib type system - we need it. 177 // Init the glib type system - we need it.
176 g_type_init(); 178 g_type_init();
177 179
180 set_gst_plugin_path();
181
178 // Protect against GStreamer resetting the locale, yuck. 182 // Protect against GStreamer resetting the locale, yuck.
179 static std::string saved_locale; 183 static std::string saved_locale;
180 saved_locale = setlocale(LC_ALL, NULL); 184 saved_locale = setlocale(LC_ALL, NULL);
@@ -189,12 +193,89 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data)
189 // Init our custom plugins - only really need do this once. 193 // Init our custom plugins - only really need do this once.
190 gst_slvideo_init_class(); 194 gst_slvideo_init_class();
191 195
196
197 // List the plugins GStreamer can find
198 LL_DEBUGS("MediaImpl") << "Found GStreamer plugins:" << LL_ENDL;
199 GList *list;
200 GstRegistry *registry = gst_registry_get_default();
201 std::string loaded = "";
202 for (list = gst_registry_get_plugin_list(registry);
203 list != NULL;
204 list = g_list_next(list))
205 {
206 GstPlugin *list_plugin = (GstPlugin *)list->data;
207 (bool)gst_plugin_is_loaded(list_plugin) ? loaded = "Yes" : loaded = "No";
208 LL_DEBUGS("MediaImpl") << gst_plugin_get_name(list_plugin) << ", loaded? " << loaded << LL_ENDL;
209 }
210 gst_plugin_list_free(list);
211
212
192 done_init = true; 213 done_init = true;
193 } 214 }
194 return true; 215 return true;
195} 216}
196 217
197 218
219void LLMediaImplGStreamer::set_gst_plugin_path()
220{
221 // Only needed for Windows.
222 // Linux sets in wrapper.sh, Mac sets in Info-Imprudence.plist
223#ifdef LL_WINDOWS
224
225 char* imp_cwd;
226
227 // Get the current working directory:
228 imp_cwd = _getcwd(NULL,0);
229
230 if(imp_cwd == NULL)
231 {
232 LL_DEBUGS("MediaImpl") << "_getcwd failed, not setting GST_PLUGIN_PATH."
233 << LL_ENDL;
234 }
235 else
236 {
237 LL_DEBUGS("MediaImpl") << "Imprudence is installed at "
238 << imp_cwd << LL_ENDL;
239
240 // Grab the current path, if it's set.
241 std::string old_plugin_path = "";
242 char *old_path = getenv("GST_PLUGIN_PATH");
243 if(old_path == NULL)
244 {
245 LL_DEBUGS("MediaImpl") << "Did not find user-set GST_PLUGIN_PATH."
246 << LL_ENDL;
247 }
248 else
249 {
250 old_plugin_path = ";" + std::string( old_path );
251 }
252
253
254 // Search both Imprudence and Imprudence\lib\gstreamer-plugins.
255 // If those fail, search the path the user has set, if any.
256 std::string plugin_path =
257 "GST_PLUGIN_PATH=" +
258 std::string(imp_cwd) + "\\lib\\gstreamer-plugins;" +
259 std::string(imp_cwd) +
260 old_plugin_path;
261
262 // Place GST_PLUGIN_PATH in the environment settings for imprudence.exe
263 // Returns 0 on success
264 if(_putenv( (char*)plugin_path.c_str() ))
265 {
266 LL_WARNS("MediaImpl") << "Setting environment variable failed!" << LL_ENDL;
267 }
268 else
269 {
270 LL_DEBUGS("MediaImpl") << "GST_PLUGIN_PATH set to "
271 << getenv("GST_PLUGIN_PATH") << LL_ENDL;
272 }
273 }
274
275#endif //LL_WINDOWS
276}
277
278
198bool LLMediaImplGStreamer::closedown() 279bool LLMediaImplGStreamer::closedown()
199{ 280{
200 return true; 281 return true;
@@ -572,20 +653,23 @@ bool LLMediaImplGStreamer::stop()
572 if (!mPlaybin || mState == GST_STATE_NULL) 653 if (!mPlaybin || mState == GST_STATE_NULL)
573 return true; 654 return true;
574 655
575 GstElement *pipeline = (GstElement *)gst_object_ref(GST_OBJECT(mPlaybin)); 656 GstStateChangeReturn state_change;
576 gst_object_unref(pipeline);
577
578 gst_element_set_state(pipeline, GST_STATE_READY);
579 657
580 if (mState == GST_STATE_PLAYING) 658 state_change = gst_element_set_state(mPlaybin, GST_STATE_READY);
581 mState = GST_STATE_VOID_PENDING;
582 else
583 mState = GST_STATE_READY;
584 659
585 GstStateChangeReturn state_change = gst_element_get_state(mPlaybin, NULL, NULL, GST_MSECOND*5); 660 LL_DEBUGS("MediaImpl") << "result: "
586 LL_DEBUGS("MediaImpl") << "get_state: " << gst_element_state_change_return_get_name(state_change) << LL_ENDL; 661 << gst_element_state_change_return_get_name(state_change) << LL_ENDL;
587 662
588 return true; 663 if (state_change == GST_STATE_CHANGE_FAILURE)
664 {
665 LL_WARNS("MediaImpl") << "could not stop stream!" << LL_ENDL;
666 return false;
667 }
668 else
669 {
670 mState = GST_STATE_READY;
671 return true;
672 }
589} 673}
590 674
591/////////////////////////////////////////////////////////////////////////////// 675///////////////////////////////////////////////////////////////////////////////
@@ -597,25 +681,28 @@ bool LLMediaImplGStreamer::play()
597 if (!mPlaybin || mState == GST_STATE_NULL) 681 if (!mPlaybin || mState == GST_STATE_NULL)
598 return true; 682 return true;
599 683
600 GstElement *pipeline = (GstElement *)gst_object_ref(GST_OBJECT(mPlaybin)); 684 GstStateChangeReturn state_change;
601 gst_object_unref(pipeline);
602
603 gst_element_set_state(pipeline, GST_STATE_PLAYING);
604 mState = GST_STATE_PLAYING;
605 /*gst_element_set_state(mPlaybin, GST_STATE_PLAYING);
606 mState = GST_STATE_PLAYING;*/
607 685
608 GstStateChangeReturn state_change = gst_element_get_state(mPlaybin, NULL, NULL, GST_MSECOND*5); 686 state_change = gst_element_set_state(mPlaybin, GST_STATE_PLAYING);
609 LL_DEBUGS("MediaImpl") << "get_state: " << gst_element_state_change_return_get_name(state_change) << LL_ENDL; 687
688 LL_DEBUGS("MediaImpl") << "result: "
689 << gst_element_state_change_return_get_name(state_change) << LL_ENDL;
610 690
611 // Check to make sure playing was successful. If not, stop. 691 // Check to make sure playing was successful. If not, stop.
692 // NOTE: state_change is almost always GST_STATE_CHANGE_ASYNC
612 if (state_change == GST_STATE_CHANGE_FAILURE) 693 if (state_change == GST_STATE_CHANGE_FAILURE)
613 { 694 {
614 setStatus(LLMediaBase::STATUS_STOPPED); 695 // If failing from a bad stream, go into pending state
696 // (this is stopped at the callback)
697 mState = GST_STATE_VOID_PENDING;
615 stop(); 698 stop();
699 return false;
700 }
701 else
702 {
703 mState = GST_STATE_PLAYING;
704 return true;
616 } 705 }
617
618 return true;
619} 706}
620 707
621/////////////////////////////////////////////////////////////////////////////// 708///////////////////////////////////////////////////////////////////////////////
@@ -627,13 +714,23 @@ bool LLMediaImplGStreamer::pause()
627 if (!mPlaybin || mState == GST_STATE_NULL) 714 if (!mPlaybin || mState == GST_STATE_NULL)
628 return true; 715 return true;
629 716
630 gst_element_set_state(mPlaybin, GST_STATE_PAUSED); 717 GstStateChangeReturn state_change;
631 mState = GST_STATE_PAUSED;
632
633 GstStateChangeReturn state_change = gst_element_get_state(mPlaybin, NULL, NULL, GST_MSECOND*5);
634 LL_DEBUGS("MediaImpl") << "get_state: " << gst_element_state_change_return_get_name(state_change) << LL_ENDL;
635 718
636 return true; 719 state_change = gst_element_set_state(mPlaybin, GST_STATE_PAUSED);
720
721 LL_DEBUGS("MediaImpl") << "result: "
722 << gst_element_state_change_return_get_name(state_change) << LL_ENDL;
723
724 if (state_change == GST_STATE_CHANGE_FAILURE)
725 {
726 LL_WARNS("MediaImpl") << "could not pause stream!" << LL_ENDL;
727 return false;
728 }
729 else
730 {
731 mState = GST_STATE_PAUSED;
732 return true;
733 }
637}; 734};
638 735
639 736
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:
66 static bool startup( LLMediaManagerData* init_data ); 66 static bool startup( LLMediaManagerData* init_data );
67 static bool closedown(); 67 static bool closedown();
68 68
69 // Sets GST_PLUGIN_PATH env var for GStreamer.
70 static void set_gst_plugin_path();
71
69 /* virtual */ std::string getVersion(); 72 /* virtual */ std::string getVersion();
70 /* virtual */ bool navigateTo( const std::string url ); 73 /* virtual */ bool navigateTo( const std::string url );
71 /* virtual */ bool updateMedia(); 74 /* virtual */ bool updateMedia();
@@ -79,6 +82,7 @@ class LLMediaImplGStreamer:
79 LLMediaEmitter< LLMediaObserver > getEventEmitter() const {return mEventEmitter;}; 82 LLMediaEmitter< LLMediaObserver > getEventEmitter() const {return mEventEmitter;};
80 83
81 private: 84 private:
85
82 // misc 86 // misc
83 bool unload(); 87 bool unload();
84 bool pause(); 88 bool pause();
diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp
index 15ce1a3..b2bfccf 100644
--- a/linden/indra/newview/llappviewer.cpp
+++ b/linden/indra/newview/llappviewer.cpp
@@ -75,9 +75,6 @@
75 75
76#if LL_WINDOWS 76#if LL_WINDOWS
77 #include "llwindebug.h" 77 #include "llwindebug.h"
78 #include <direct.h>
79 #include <errno.h>
80 #include <stdlib.h>
81#endif 78#endif
82 79
83#if LL_WINDOWS 80#if LL_WINDOWS
@@ -320,30 +317,6 @@ std::vector<std::string> gLoginURIs;
320static std::string gHelperURI; 317static std::string gHelperURI;
321 318
322 319
323void LLAppViewer::gst_plugin_path()
324{
325#ifdef LL_WINDOWS
326 char* buffer;
327
328 // Get the current working directory:
329 if((buffer = _getcwd(NULL,0)) == NULL)
330 {
331 LL_INFOS("InitInfo") << "_getcwd error" << LL_ENDL;
332 }
333 else
334 {
335 LL_INFOS("InitInfo") << "Imprudence is installed at " << buffer << LL_ENDL;
336
337 std::string plugin_path = "GST_PLUGIN_PATH=" + std::string(buffer) + "\\lib\\gstreamer-plugins";
338
339 // Place GST_PLUGIN_PATH in the environment settings for imprudence.exe
340 const char* gst_plugin_path = plugin_path.c_str();
341 putenv(gst_plugin_path);
342 LL_INFOS("InitInfo") << "GST_PLUGIN_PATH set to " << getenv("GST_PLUGIN_PATH") << LL_ENDL;
343 }
344#endif //LL_WINDOWS
345}
346
347void idle_afk_check() 320void idle_afk_check()
348{ 321{
349 // check idle timers 322 // check idle timers
@@ -643,8 +616,6 @@ bool LLAppViewer::init()
643 LL_VERSION_PATCH, 616 LL_VERSION_PATCH,
644 LL_VERSION_BUILD ); 617 LL_VERSION_BUILD );
645 618
646 gst_plugin_path();
647
648 ////////////////////////////////////////////////////////////////////////////// 619 //////////////////////////////////////////////////////////////////////////////
649 ////////////////////////////////////////////////////////////////////////////// 620 //////////////////////////////////////////////////////////////////////////////
650 ////////////////////////////////////////////////////////////////////////////// 621 //////////////////////////////////////////////////////////////////////////////
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:
138 138
139protected: 139protected:
140 140
141 void gst_plugin_path(); // Sets GST_PLUGIN_PATH environment variable for GStreamer.
142
143 virtual bool initWindow(); // Initialize the viewer's window. 141 virtual bool initWindow(); // Initialize the viewer's window.
144 virtual bool initLogging(); // Initialize log files, logging system, return false on failure. 142 virtual bool initLogging(); // Initialize log files, logging system, return false on failure.
145 virtual void initConsole() {}; // Initialize OS level debugging console. 143 virtual void initConsole() {}; // Initialize OS level debugging console.