From bebfe34aac9b217a807baea8fc78ab20c0c94045 Mon Sep 17 00:00:00 2001
From: Nicky <sl.nicky.ml@googlemail.com>
Date: Wed, 1 Jun 2016 22:33:30 +0200
Subject: [PATCH] Linux: Use media_plugin_libvlc for media playback.

---
 indra/cmake/LibVLCPlugin.cmake                |  5 ++++
 indra/media_plugins/CMakeLists.txt            |  1 +
 indra/newview/CMakeLists.txt                  |  1 +
 .../skins/default/xui/en/mime_types_linux.xml | 30 +++++++++----------
 indra/newview/viewer_manifest.py              | 12 +++++++-
 5 files changed, 33 insertions(+), 16 deletions(-)

diff --git a/indra/cmake/LibVLCPlugin.cmake b/indra/cmake/LibVLCPlugin.cmake
index 0d2c46bac04..4472676fb48 100644
--- a/indra/cmake/LibVLCPlugin.cmake
+++ b/indra/cmake/LibVLCPlugin.cmake
@@ -19,4 +19,9 @@ if (WINDOWS)
     )
 elseif (DARWIN)
 elseif (LINUX)
+    # Specify a full path to make sure we get a static link
+    set(VLC_PLUGIN_LIBRARIES
+        ${LIBS_PREBUILT_DIR}/lib/libvlc.a
+        ${LIBS_PREBUILT_DIR}/lib/libvlccore.a
+    )
 endif (WINDOWS)
diff --git a/indra/media_plugins/CMakeLists.txt b/indra/media_plugins/CMakeLists.txt
index 6652bd021fc..9055e0111a3 100644
--- a/indra/media_plugins/CMakeLists.txt
+++ b/indra/media_plugins/CMakeLists.txt
@@ -4,6 +4,7 @@ add_subdirectory(base)
 
 if (LINUX)
     add_subdirectory(gstreamer010)
+    add_subdirectory(libvlc)
 endif (LINUX)
 
 if (DARWIN)
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 9ffc99adb2c..f7f01a6e4ed 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1969,6 +1969,7 @@ if (LINUX)
     linux-crash-logger
     SLPlugin
     media_plugin_gstreamer010
+    media_plugin_libvlc
     llcommon
     )
 
diff --git a/indra/newview/skins/default/xui/en/mime_types_linux.xml b/indra/newview/skins/default/xui/en/mime_types_linux.xml
index 84aeaf3b54b..7188b1e6993 100644
--- a/indra/newview/skins/default/xui/en/mime_types_linux.xml
+++ b/indra/newview/skins/default/xui/en/mime_types_linux.xml
@@ -130,7 +130,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</scheme>
 	<mimetype name="blank">
@@ -163,7 +163,7 @@
 			audio
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="video/*">
@@ -174,7 +174,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="image/*">
@@ -196,7 +196,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="application/javascript">
@@ -218,7 +218,7 @@
 			audio
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="application/pdf">
@@ -295,7 +295,7 @@
 			audio
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="audio/mpeg">
@@ -306,7 +306,7 @@
 			audio
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="audio/x-aiff">
@@ -317,7 +317,7 @@
 			audio
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="audio/x-wav">
@@ -328,7 +328,7 @@
 			audio
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype menu="1" name="image/bmp">
@@ -438,7 +438,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="video/mp4">
@@ -449,7 +449,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype menu="1" name="video/quicktime">
@@ -460,7 +460,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="video/x-ms-asf">
@@ -471,7 +471,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype name="video/x-ms-wmv">
@@ -482,7 +482,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 	<mimetype menu="1" name="video/x-msvideo">
@@ -493,7 +493,7 @@
 			movie
 		</widgettype>
 		<impl>
-			media_plugin_gstreamer
+			media_plugin_libvlc
 		</impl>
 	</mimetype>
 </mimetypes>
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index e7f517518b5..04cc4774e4b 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -1092,8 +1092,18 @@ def construct(self):
         # plugins
         if self.prefix(src="", dst="bin/llplugin"):
             self.path("../media_plugins/gstreamer010/libmedia_plugin_gstreamer010.so", "libmedia_plugin_gstreamer.so")
+            self.path("../media_plugins/libvlc/libmedia_plugin_libvlc.so", "libmedia_plugin_libvlc.so")
             self.end_prefix("bin/llplugin")
 
+        if self.prefix(src=os.path.join(os.pardir, 'packages', 'lib', 'vlc', 'plugins'), dst="bin/llplugin/vlc/plugins"):
+            self.path( "plugins.dat" )
+            self.path( "*/*.so" )
+            self.end_prefix()
+
+        if self.prefix(src=os.path.join(os.pardir, 'packages', 'lib' ), dst="lib"):
+            self.path( "libvlc*.so*" )
+            self.end_prefix()
+
         # llcommon
         if not self.path("../llcommon/libllcommon.so", "lib/libllcommon.so"):
             print "Skipping llcommon.so (assuming llcommon was linked statically)"
@@ -1147,7 +1157,7 @@ def package_finish(self):
     def strip_binaries(self):
         if self.args['buildtype'].lower() == 'release' and self.is_packaging_viewer():
             print "* Going strip-crazy on the packaged binaries, since this is a RELEASE build"
-            self.run_command(r"find %(d)r/bin %(d)r/lib -type f \! -name update_install | xargs --no-run-if-empty strip -S" % {'d': self.get_dst_prefix()} ) # makes some small assumptions about our packaged dir structure
+            self.run_command(r"find %(d)r/bin %(d)r/lib -type f \! -name update_install \! -name *.dat | xargs --no-run-if-empty strip -S" % {'d': self.get_dst_prefix()} ) # makes some small assumptions about our packaged dir structure
 
 class Linux_i686_Manifest(LinuxManifest):
     def construct(self):
-- 
GitLab