From bceafa5062db394048312aa7fe0a7706fb9524b7 Mon Sep 17 00:00:00 2001
From: callum_linden <none@none>
Date: Tue, 10 May 2016 17:16:24 -0700
Subject: [PATCH] working test button in web browser floater - video inverted

---
 .../libvlc/media_plugin_libvlc.cpp            |  2 +-
 indra/newview/llfloaterwebcontent.cpp         | 26 ++++--
 indra/newview/llfloaterwebcontent.h           |  1 +
 indra/newview/llmimetypes.cpp                 |  3 +-
 .../default/xui/en/floater_web_content.xml    | 88 ++++++++++++++++++-
 .../skins/default/xui/en/mime_types.xml       | 25 ++++--
 6 files changed, 125 insertions(+), 20 deletions(-)

diff --git a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
index ceb42c0f13e..08716e1a1c7 100644
--- a/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
+++ b/indra/media_plugins/libvlc/media_plugin_libvlc.cpp
@@ -289,7 +289,7 @@ void MediaPluginLibVLC::receiveMessage( const char* message_string )
 				message.setValueU32("internalformat", GL_RGB);
                 message.setValueU32("format", GL_BGRA_EXT);
                 message.setValueU32("type", GL_UNSIGNED_BYTE);
-                message.setValueBoolean("coords_opengl", false);
+                message.setValueBoolean("coords_opengl", true);
                 sendMessage(message);
             }
             else if(message_name == "size_change")
diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp
index 024e3156328..c039b3b8f44 100755
--- a/indra/newview/llfloaterwebcontent.cpp
+++ b/indra/newview/llfloaterwebcontent.cpp
@@ -81,7 +81,8 @@ LLFloaterWebContent::LLFloaterWebContent( const Params& params )
 	mCommitCallbackRegistrar.add( "WebContent.Reload", boost::bind( &LLFloaterWebContent::onClickReload, this ));
 	mCommitCallbackRegistrar.add( "WebContent.Stop", boost::bind( &LLFloaterWebContent::onClickStop, this ));
 	mCommitCallbackRegistrar.add( "WebContent.EnterAddress", boost::bind( &LLFloaterWebContent::onEnterAddress, this ));
-	mCommitCallbackRegistrar.add( "WebContent.PopExternal", boost::bind( &LLFloaterWebContent::onPopExternal, this ));
+	mCommitCallbackRegistrar.add( "WebContent.PopExternal", boost::bind(&LLFloaterWebContent::onPopExternal, this));
+	mCommitCallbackRegistrar.add( "WebContent.TestVideo", boost::bind(&LLFloaterWebContent::onTestVideo, this, _2));
 }
 
 BOOL LLFloaterWebContent::postBuild()
@@ -229,7 +230,7 @@ void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p)
 		for(LLFloaterReg::const_instance_list_t::const_iterator iter = instances.begin(); iter != instances.end(); iter++)
 		{
 			LL_DEBUGS() << "    " << (*iter)->getKey()["target"] << LL_ENDL;
-		}
+		}	
 
 		if(instances.size() >= (size_t)browser_window_limit)
 		{
@@ -243,9 +244,9 @@ void LLFloaterWebContent::open_media(const Params& p)
 {
 	// Specifying a mime type of text/html here causes the plugin system to skip the MIME type probe and just open a browser plugin.
 	LLViewerMedia::proxyWindowOpened(p.target(), p.id());
-	mWebBrowser->setHomePageUrl(p.url, HTTP_CONTENT_TEXT_HTML);
+	mWebBrowser->setHomePageUrl(p.url);
 	mWebBrowser->setTarget(p.target);
-	mWebBrowser->navigateTo(p.url, HTTP_CONTENT_TEXT_HTML, p.clean_browser);
+	mWebBrowser->navigateTo(p.url);
 	
 	set_current_url(p.url);
 
@@ -499,7 +500,7 @@ void LLFloaterWebContent::onEnterAddress()
     LLStringUtil::trim(url);
 	if ( url.length() > 0 )
 	{
-		mWebBrowser->navigateTo(url, HTTP_CONTENT_TEXT_HTML);
+		mWebBrowser->navigateTo(url);
 	};
 }
 
@@ -508,9 +509,18 @@ void LLFloaterWebContent::onPopExternal()
 	// make sure there is at least something there.
 	// (perhaps this test should be for minimum length of a URL)
 	std::string url = mAddressCombo->getValue().asString();
-    LLStringUtil::trim(url);
-	if ( url.length() > 0 )
+	LLStringUtil::trim(url);
+	if (url.length() > 0)
+	{
+		LLWeb::loadURLExternal(url);
+	};
+}
+
+void LLFloaterWebContent::onTestVideo(std::string url)
+{
+	LLStringUtil::trim(url);
+	if (url.length() > 0)
 	{
-		LLWeb::loadURLExternal( url );
+		mWebBrowser->navigateTo(url);
 	};
 }
diff --git a/indra/newview/llfloaterwebcontent.h b/indra/newview/llfloaterwebcontent.h
index 4291fd9f2c3..519b575b38d 100755
--- a/indra/newview/llfloaterwebcontent.h
+++ b/indra/newview/llfloaterwebcontent.h
@@ -92,6 +92,7 @@ class LLFloaterWebContent :
 	void onClickStop();
 	void onEnterAddress();
 	void onPopExternal();
+	void onTestVideo(std::string url);
 
 	static void preCreate(Params& p);
 	void open_media(const Params& );
diff --git a/indra/newview/llmimetypes.cpp b/indra/newview/llmimetypes.cpp
index a2df14b4e74..790a1840681 100755
--- a/indra/newview/llmimetypes.cpp
+++ b/indra/newview/llmimetypes.cpp
@@ -184,8 +184,7 @@ std::string LLMIMETypes::implType(const std::string& mime_type)
 	mime_info_map_t::const_iterator it = sMap.find(mime_type);
 	if (it != sMap.end())
 	{
-		return "media_plugin_libvlc";
-		//return it->second.mImpl;
+		return it->second.mImpl;
 	}
 	else
 	{
diff --git a/indra/newview/skins/default/xui/en/floater_web_content.xml b/indra/newview/skins/default/xui/en/floater_web_content.xml
index a80440e8448..86be3632456 100755
--- a/indra/newview/skins/default/xui/en/floater_web_content.xml
+++ b/indra/newview/skins/default/xui/en/floater_web_content.xml
@@ -25,10 +25,10 @@
     <layout_panel
       auto_resize="false"
       default_tab_group="1"
-      height="22"
+      height="44"
       layout="topleft"
       left="0"
-      min_height="20"
+      min_height="40"
       name="nav_controls"
       top="400"
       width="770">
@@ -152,6 +152,90 @@
         <button.commit_callback
           function="WebContent.PopExternal" />
       </button>
+
+      <button
+        image_overlay="Video_URL_Off"
+		    image_disabled="PushButton_Disabled"
+		    image_disabled_selected="PushButton_Disabled"
+		    image_selected="PushButton_Selected"
+		    image_unselected="PushButton_Off"
+        chrome="true"
+        tool_tip="MPEG4 Video Test"
+        enabled="true"
+        follows="left|top"
+        height="22"
+        layout="topleft"
+        left="1"
+        name="VLC Plugin Test"
+        top="22"
+        width="22">
+        <button.commit_callback
+          function="WebContent.TestVideo"
+          parameter="https://callum-linden.s3.amazonaws.com/sample_media/ss.mp4"/>
+      </button>
+
+      <button
+        image_overlay="Video_URL_Off"
+		    image_disabled="PushButton_Disabled"
+		    image_disabled_selected="PushButton_Disabled"
+		    image_selected="PushButton_Selected"
+		    image_unselected="PushButton_Off"
+        chrome="true"
+        tool_tip="MKV Video Test"
+        enabled="true"
+        follows="left|top"
+        height="22"
+        layout="topleft"
+        left="27"
+        name="VLC Plugin Test"
+        top="22"
+        width="22">
+        <button.commit_callback
+          function="WebContent.TestVideo"
+          parameter="https://callum-linden.s3.amazonaws.com/sample_media/jellyfish.mkv"/>
+      </button>
+
+      <button
+        image_overlay="Video_URL_Off"
+		    image_disabled="PushButton_Disabled"
+		    image_disabled_selected="PushButton_Disabled"
+		    image_selected="PushButton_Selected"
+		    image_unselected="PushButton_Off"
+        chrome="true"
+        tool_tip="WebM Video Test"
+        enabled="true"
+        follows="left|top"
+        height="22"
+        layout="topleft"
+        left="51"
+        name="VLC Plugin Test"
+        top="22"
+        width="22">
+        <button.commit_callback
+          function="WebContent.TestVideo"
+          parameter="https://callum-linden.s3.amazonaws.com/sample_media/kubo.webm"/>
+      </button>
+
+      <button
+        image_overlay="Video_URL_Off"
+		    image_disabled="PushButton_Disabled"
+		    image_disabled_selected="PushButton_Disabled"
+		    image_selected="PushButton_Selected"
+		    image_unselected="PushButton_Off"
+        chrome="true"
+        tool_tip="MP3 audio Test"
+        enabled="true"
+        follows="left|top"
+        height="22"
+        layout="topleft"
+        left="75"
+        name="VLC Plugin Test"
+        top="22"
+        width="22">
+        function="WebContent.TestVideo"
+        parameter="https://callum-linden.s3.amazonaws.com/alegria.mp3"/>
+      </button>
+
     </layout_panel>
     <layout_panel
       height="40"
diff --git a/indra/newview/skins/default/xui/en/mime_types.xml b/indra/newview/skins/default/xui/en/mime_types.xml
index e2dcc11fb05..28672043189 100755
--- a/indra/newview/skins/default/xui/en/mime_types.xml
+++ b/indra/newview/skins/default/xui/en/mime_types.xml
@@ -185,7 +185,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_cef
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="image/*">
@@ -207,7 +207,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_cef
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="application/javascript">
@@ -449,7 +449,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_cef
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="video/mp4">
@@ -460,10 +460,21 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_cef
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
-	<mimetype menu="1" name="video/quicktime">
+  <mimetype name="application/octet-stream">
+    <label name="video/octet-stream">
+      Movie
+    </label>
+    <widgettype>
+      movie
+    </widgettype>
+    <impl>
+      media_plugin_libvlc
+    </impl>
+  </mimetype>
+  <mimetype menu="1" name="video/quicktime">
 		<label name="video/quicktime_label">
 			Movie (QuickTime)
 		</label>
@@ -471,7 +482,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_cef
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="video/x-ms-asf">
@@ -482,7 +493,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_cef
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="video/x-ms-wmv">
-- 
GitLab