From 91b54876b7422422326646e5b4581631883f1e69 Mon Sep 17 00:00:00 2001
From: callum <none@none>
Date: Fri, 30 Oct 2009 10:48:10 -0700
Subject: Adds an example plugin and corresponding changes to LLMediaPluginTest
 test app. We do not copy over the example plugin to the Second Life client
 plugin dir.

---
 indra/test_apps/llplugintest/CMakeLists.txt        |  7 +++++++
 indra/test_apps/llplugintest/bookmarks.txt         |  1 +
 indra/test_apps/llplugintest/llmediaplugintest.cpp | 22 ++++++++++++----------
 3 files changed, 20 insertions(+), 10 deletions(-)

(limited to 'indra/test_apps')

diff --git a/indra/test_apps/llplugintest/CMakeLists.txt b/indra/test_apps/llplugintest/CMakeLists.txt
index 88c4ba8ad9..53b981cccd 100644
--- a/indra/test_apps/llplugintest/CMakeLists.txt
+++ b/indra/test_apps/llplugintest/CMakeLists.txt
@@ -293,6 +293,7 @@ add_dependencies(llmediaplugintest
   SLPlugin
   media_plugin_quicktime
   media_plugin_webkit
+  media_plugin_example
   ${LLPLUGIN_LIBRARIES}
   ${LLMESSAGE_LIBRARIES}
   ${LLCOMMON_LIBRARIES}
@@ -369,6 +370,12 @@ if (DARWIN OR WINDOWS)
     DEPENDS ${BUILT_QUICKTIME_PLUGIN}
   )
   
+  get_target_property(BUILT_EXAMPLE_PLUGIN media_plugin_example LOCATION)
+  add_custom_command(TARGET llmediaplugintest POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_EXAMPLE_PLUGIN}  ${PLUGINS_DESTINATION_DIR}
+    DEPENDS ${BUILT_EXAMPLE_PLUGIN}
+  )
+  
   # copy over bookmarks file if llmediaplugintest gets built
   get_target_property(BUILT_LLMEDIAPLUGINTEST llmediaplugintest LOCATION)
   add_custom_command(TARGET llmediaplugintest POST_BUILD
diff --git a/indra/test_apps/llplugintest/bookmarks.txt b/indra/test_apps/llplugintest/bookmarks.txt
index ef34167b29..b8b83df386 100644
--- a/indra/test_apps/llplugintest/bookmarks.txt
+++ b/indra/test_apps/llplugintest/bookmarks.txt
@@ -34,3 +34,4 @@
 (QT) Movie - The Informers,http://movies.apple.com/movies/independent/theinformers/theinformers_h.320.mov
 (QT) Animated GIF,http://upload.wikimedia.org/wikipedia/commons/4/44/Optical.greysquares.arp-animated.gif
 (QT) Apple Text Descriptors,http://ubrowser.com/tmp/apple_text.txt
+(EX) Example Plugin,example://blah
diff --git a/indra/test_apps/llplugintest/llmediaplugintest.cpp b/indra/test_apps/llplugintest/llmediaplugintest.cpp
index 553d1ab131..d987915bb8 100644
--- a/indra/test_apps/llplugintest/llmediaplugintest.cpp
+++ b/indra/test_apps/llplugintest/llmediaplugintest.cpp
@@ -138,8 +138,6 @@ LLMediaPluginTest::LLMediaPluginTest( int app_window, int window_width, int wind
 	mMediaBrowserControlBackButtonFlag( true ),
 	mMediaBrowserControlForwardButtonFlag( true ),
 	mHomeWebUrl( "http://www.google.com/" )
-	//mHomeWebUrl( "file:///C|/Program Files/QuickTime/Sample.mov" )
-	//mHomeWebUrl( "http://movies.apple.com/movies/wb/watchmen/watchmen-tlr2_480p.mov" )
 {
 	// debugging spam
 	std::cout << std::endl << "             GLUT version: " << "3.7.6" << std::endl;	// no way to get real version from GLUT
@@ -277,8 +275,6 @@ void LLMediaPluginTest::bindTexture(GLuint texture, GLint row_length, GLint alig
 {
 	glEnable( GL_TEXTURE_2D );
 	
-//	std::cerr << "binding texture " << texture << std::endl;
-	
 	glBindTexture( GL_TEXTURE_2D, texture );
 	glPixelStorei( GL_UNPACK_ROW_LENGTH, row_length );
 	glPixelStorei( GL_UNPACK_ALIGNMENT, alignment );
@@ -410,7 +406,7 @@ void LLMediaPluginTest::draw( int draw_type )
 			// only bother with pick if we have something to render
 			// Actually, we need to pick even if we're not ready to render.  
 			// Otherwise you can't select and remove a panel which has gone bad.
-//			if ( mMediaPanels[ panel ]->mReadyToRender )
+			//if ( mMediaPanels[ panel ]->mReadyToRender )
 			{
 				glMatrixMode( GL_TEXTURE );
 				glPushMatrix();
@@ -621,10 +617,10 @@ void LLMediaPluginTest::idle()
 	if ( mSelectedPanel )
 	{
 		// set volume based on slider if we have time media
-//		if ( mGluiMediaTimeControlWindowFlag )
-//		{
-//			mSelectedPanel->mMediaSource->setVolume( (float)mMediaTimeControlVolume / 100.0f );
-//		};
+		//if ( mGluiMediaTimeControlWindowFlag )
+		//{
+		//	mSelectedPanel->mMediaSource->setVolume( (float)mMediaTimeControlVolume / 100.0f );
+		//};
 
 		// NOTE: it is absurd that we need cache the state of GLUI controls
 		//       but enabling/disabling controls drags framerate from 500+
@@ -1463,6 +1459,9 @@ std::string LLMediaPluginTest::mimeTypeFromUrl( std::string& url )
 	else
 	if ( url.find( ".txt" ) != std::string::npos )	// Apple Text descriptors
 		mime_type = "video/quicktime";
+	else
+	if ( url.find( "example://" ) != std::string::npos )	// Example plugin
+		mime_type = "example/example";
 
 	return mime_type;
 }
@@ -1487,6 +1486,9 @@ std::string LLMediaPluginTest::pluginNameFromMimeType( std::string& mime_type )
 	else
 	if ( mime_type == "text/html" )
 		plugin_name = "media_plugin_webkit.dll";
+	else
+	if ( mime_type == "example/example" )
+		plugin_name = "media_plugin_example.dll";
 
 #elif LL_LINUX
 	std::string plugin_name( "libmedia_plugin_null.so" );
@@ -1799,7 +1801,7 @@ void LLMediaPluginTest::getRandomMediaSize( int& width, int& height, std::string
 
 	// adjust this random size if it's a browser so we get 
 	// a more useful size for testing.. 
-	if ( mime_type == "text/html" )
+	if ( mime_type == "text/html" || mime_type == "example/example"  )
 	{
 		width = ( ( rand() % 100 ) + 100 ) * 4;
 		height = ( width * ( ( rand() % 400 ) + 1000 ) ) / 1000;
-- 
cgit v1.2.3