From 68c8467913451099154b28d5a876ae14c1a9e1dd Mon Sep 17 00:00:00 2001
From: dknn <yoann.blein@free.fr>
Date: Mon, 9 Jul 2012 13:57:44 +0200
Subject: Fix linking errors + add libvpx


diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot
index 58f6adc..c4b5168 100644
--- a/BuildTools/SCons/SConscript.boot
+++ b/BuildTools/SCons/SConscript.boot
@@ -62,6 +62,9 @@ vars.Add(BoolVariable("set_iterator_debug_level", "Set _ITERATOR_DEBUG_LEVEL=0",
 vars.Add(PathVariable("jrtplib_includedir", "JRTPLIB headers location", None, PathVariable.PathAccept))
 vars.Add(PathVariable("jrtplib_libdir", "JRTPLIB library location", None, PathVariable.PathAccept))
 vars.Add("jrtplib_libname", "JRTPLIB library name", "libjrtp" if os.name == "nt" else "jrtp")
+vars.Add(PathVariable("libvpx_includedir", "libvpx headers location", None, PathVariable.PathAccept))
+vars.Add(PathVariable("libvpx_libdir", "libvpx library location", None, PathVariable.PathAccept))
+vars.Add("libvpx_libname", "libvpx library name", "libvpx" if os.name == "nt" else "vpx")
 
 ################################################################################
 # Set up default build & configure environment
diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 6919ba1..daaa98d 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -499,6 +499,24 @@ if env["experimental"] :
 #else :
 	#env["JRTPLIB_FLAGS"] = {}
 
+# libvpx
+if env["experimental"] :
+	libvpx_conf_env = conf_env.Clone()
+	libvpx_flags = {}
+	if env.get("libvpx_libdir", None) :
+		libvpx_flags["LIBPATH"] = [env["libvpx_libdir"]]
+	if env.get("libvpx_includedir", None) :
+		libvpx_flags["CPPATH"] = [env["libvpx_includedir"]]
+	libvpx_conf_env.MergeFlags(libvpx_flags)
+	conf = Configure(libvpx_conf_env)
+
+	if conf.CheckLibWithHeader(env["libvpx_libname"], "vpx/vpx_codec.h", language='C') :
+		env["HAVE_LIBVPX"] = 1
+		env["LIBVPX_FLAGS"] = { "LIBS": [env["libvpx_libname"]] }
+		env["LIBVPX_FLAGS"].update(libvpx_flags)
+	conf.Finish()
+
+
 ################################################################################
 # DocBook setup
 ################################################################################
diff --git a/Swiften/Network/UDPSocketFactory.h b/Swiften/Network/UDPSocketFactory.h
index 33dd78c..8e1cc6f 100644
--- a/Swiften/Network/UDPSocketFactory.h
+++ b/Swiften/Network/UDPSocketFactory.h
@@ -13,7 +13,7 @@ namespace Swift {
 
 	class UDPSocketFactory {
 		public:
-			virtual ~UDPSocketFactory();
+			virtual ~UDPSocketFactory() {}
 
 			virtual boost::shared_ptr<UDPSocket> createUDPSocket() = 0;
 	};
diff --git a/Swiften/ScreenSharing/RTPSession.h b/Swiften/ScreenSharing/RTPSession.h
index 717ac17..bdb2861 100644
--- a/Swiften/ScreenSharing/RTPSession.h
+++ b/Swiften/ScreenSharing/RTPSession.h
@@ -24,7 +24,7 @@ namespace Swift {
 			};
 
 		public:
-			virtual ~RTPSession();
+			virtual ~RTPSession() {}
 
 			virtual void create(boost::shared_ptr<UDPSocket> udpSocket, const HostAddressPort& remotePeer, PayloadType payloadType, int frequency) = 0;
 			virtual void poll() = 0;
diff --git a/Swiften/ScreenSharing/SConscript b/Swiften/ScreenSharing/SConscript
index 6504541..a593296 100644
--- a/Swiften/ScreenSharing/SConscript
+++ b/Swiften/ScreenSharing/SConscript
@@ -2,14 +2,10 @@ Import("swiften_env", "env")
 
 sources = [
 		"Image.cpp",
-		"VP8Encoder.cpp",
-		"VP8RTPPacketizer.cpp",
-		"VP8Decoder.cpp",
-		"VP8RTPParser.cpp",
 		"ScreenSharing.cpp",
 		"OutgoingScreenSharing.cpp",
-        "OutgoingScreenSharingManager.cpp",
 		"IncomingScreenSharing.cpp",
+        "OutgoingScreenSharingManager.cpp",
         "IncomingScreenSharingManager.cpp",
 		"ScreenSharingManagerImpl.cpp",
     ]
@@ -24,6 +20,17 @@ if swiften_env["experimental"] :
 				"RTPSessionImpl.cpp",
 			])
 
+	# libvpx classes
+	libvpx_env = swiften_env.Clone()
+	#libvpx_env.Append(CPPDEFINES = libvpx_env["LIBVPX_FLAGS"].get("INTERNAL_CPPDEFINES", []))
+	libvpx_env.MergeFlags(libvpx_env.get("LIBVPX_FLAGS", {}))
+	objects += libvpx_env.SwiftenObject([
+				"VP8Encoder.cpp",
+				"VP8Decoder.cpp",
+				"VP8RTPPacketizer.cpp",
+				"VP8RTPParser.cpp",
+			])
+
 swiften_env.Append(SWIFTEN_OBJECTS = [objects])
 
 #env.Append(UNITTEST_SOURCES = [])
diff --git a/Swiften/ScreenSharing/VP8Encoder.cpp b/Swiften/ScreenSharing/VP8Encoder.cpp
index 3ca0edd..ed4d3de 100644
--- a/Swiften/ScreenSharing/VP8Encoder.cpp
+++ b/Swiften/ScreenSharing/VP8Encoder.cpp
@@ -82,7 +82,6 @@ void VP8Encoder::encodeImage(const Image &frame)
 	while ((pkt = vpx_codec_get_cx_data(&codecContext, &iter))) {
 		switch (pkt->kind) {
 			case VPX_CODEC_CX_FRAME_PKT:
-				// TODO: Packetize this frame data
 				packetizer->packetizeFrame(pkt);
 				break;
 			default:
diff --git a/Swiften/ScreenSharing/VP8RTPPacketizer.cpp b/Swiften/ScreenSharing/VP8RTPPacketizer.cpp
index 4c1e8e9..b88e2171 100644
--- a/Swiften/ScreenSharing/VP8RTPPacketizer.cpp
+++ b/Swiften/ScreenSharing/VP8RTPPacketizer.cpp
@@ -6,7 +6,6 @@
 
 #include <Swiften/ScreenSharing/VP8RTPPacketizer.h>
 
-
 namespace Swift {
 
 VP8RTPPacketizer::VP8RTPPacketizer()
diff --git a/Swiften/ScreenSharing/VP8RTPPacketizer.h b/Swiften/ScreenSharing/VP8RTPPacketizer.h
index 50cc8a0..d5343c0 100644
--- a/Swiften/ScreenSharing/VP8RTPPacketizer.h
+++ b/Swiften/ScreenSharing/VP8RTPPacketizer.h
@@ -6,12 +6,14 @@
 
 #pragma once
 
-#include <boost/shared_ptr.hpp>
+#include <Swiften/Base/boost_bsignals.h>
+
 #include <vector>
 #include <stdint.h>
-#include <Swiften/Base/boost_bsignals.h>
-#include "vpx/vpx_encoder.h"
 
+#include <boost/shared_ptr.hpp>
+
+#include "vpx/vpx_encoder.h"
 
 namespace Swift {
 	class VP8RTPPacketizer {
-- 
cgit v0.10.2-6-g49f6