master
Nicky 2015-10-05 17:09:58 +02:00
commit 2cdc06af0c
33 changed files with 194 additions and 8586 deletions

View File

@ -1698,11 +1698,11 @@
<key>archive</key>
<map>
<key>hash</key>
<string>84008a5652228d7ce89ebc31c2b08347</string>
<string>d4699b948951903c7657389f12fb5637</string>
<key>hash_algorithm</key>
<string>md5</string>
<key>url</key>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/llceflib_3p-llceflib/rev/305469/arch/Darwin/installer/llceflib-1.1.0.305469-darwin-305469.tar.bz2</string>
<string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-llceflib_3p-llceflib/rev/305639/arch/Darwin/installer/llceflib-1.2.0.305639-darwin-305639.tar.bz2</string>
</map>
<key>name</key>
<string>darwin</string>
@ -1737,7 +1737,7 @@
</map>
</map>
<key>version</key>
<string>1.1.0.305469</string>
<string>1.2.0.305639</string>
</map>
<key>llphysicsextensions_source</key>
<map>

View File

@ -84,16 +84,7 @@ endif (LL_TESTS OR NOT USESYSTEMLIBS)
if (ENABLE_MEDIA_PLUGINS)
# viewer media plugins
add_subdirectory(${LIBS_OPEN_PREFIX}media_plugins)
# llplugin testbed code (is this the right way to include it?)
if (LL_TESTS AND NOT LINUX)
#removed during webkit -> cef update
#add_subdirectory(${VIEWER_PREFIX}test_apps/llplugintest)
#add_subdirectory(${VIEWER_PREFIX}test_apps/llfbconnecttest)
endif (LL_TESTS AND NOT LINUX)
endif (ENABLE_MEDIA_PLUGINS)
# <FS:AW opensim currency support>
#teapot helper library
add_subdirectory(${LIBS_OPEN_PREFIX}teapot)

View File

@ -289,7 +289,7 @@ if (DARWIN)
add_definitions(-DLL_DARWIN=1)
set(CMAKE_CXX_LINK_FLAGS "-Wl,-no_compact_unwind -Wl,-headerpad_max_install_names,-search_paths_first")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_CXX_LINK_FLAGS}")
set(DARWIN_extra_cstar_flags "-g")
set(DARWIN_extra_cstar_flags "-g -Wno-unused-local-typedef -Wno-deprecated-declarations")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${DARWIN_extra_cstar_flags}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${DARWIN_extra_cstar_flags}")
# NOTE: it's critical that the optimization flag is put in front.

View File

@ -106,7 +106,6 @@ set(cmake_SOURCE_FILES
Variables.cmake
ViewerMiscLibs.cmake
VisualLeakDetector.cmake
## WebKitLibPlugin.cmake
WinManifest.cmake
XmlRpcEpi.cmake
ZLIB.cmake

View File

@ -150,10 +150,10 @@ endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(DARWIN 1)
# now we only support Xcode 6.0 using 10.9 (Mavericks), minimum OS 10.7 (Lion)
set(XCODE_VERSION 6.0)
# now we only support Xcode 7.0 using 10.11 (El Capitan), minimum OS 10.7 (Lion)
set(XCODE_VERSION 7.0)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.7)
set(CMAKE_OSX_SYSROOT macosx10.9)
set(CMAKE_OSX_SYSROOT macosx10.11)
set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "com.apple.compilers.llvm.clang.1_0")
set(CMAKE_XCODE_ATTRIBUTE_GCC_OPTIMIZATION_LEVEL 3)

View File

@ -1,98 +0,0 @@
# -*- cmake -*-
include(Linking)
include(Prebuilt)
if (USESYSTEMLIBS)
# The minimal version, 4.4.3, is rather arbitrary: it's the version in Debian/Lenny.
find_package(Qt4 4.4.3 COMPONENTS QtCore QtGui QtNetwork QtOpenGL QtWebKit REQUIRED)
include(${QT_USE_FILE})
set(QTDIR $ENV{QTDIR})
if (QTDIR AND NOT "${QT_BINARY_DIR}" STREQUAL "${QTDIR}/bin")
message(FATAL_ERROR "\"${QT_BINARY_DIR}\" is unequal \"${QTDIR}/bin\"; "
"Qt is found by looking for qmake in your PATH. "
"Please set your PATH such that 'qmake' is found in \$QTDIR/bin, "
"or unset QTDIR if the found Qt is correct.")
endif (QTDIR AND NOT "${QT_BINARY_DIR}" STREQUAL "${QTDIR}/bin")
find_package(LLQtWebkit REQUIRED QUIET)
# Add the plugins.
set(QT_PLUGIN_LIBRARIES)
foreach(qlibname qgif qjpeg)
find_library(QT_PLUGIN_${qlibname} ${qlibname} PATHS ${QT_PLUGINS_DIR}/imageformats NO_DEFAULT_PATH)
if (QT_PLUGIN_${qlibname})
list(APPEND QT_PLUGIN_LIBRARIES ${QT_PLUGIN_${qlibname}})
else (QT_PLUGIN_${qtlibname})
message(FATAL_ERROR "Could not find the Qt plugin ${qlibname} in \"${QT_PLUGINS_DIR}/imageformats\"!")
endif (QT_PLUGIN_${qlibname})
endforeach(qlibname)
# qjpeg depends on libjpeg
list(APPEND QT_PLUGIN_LIBRARIES jpeg)
set(WEBKITLIBPLUGIN OFF CACHE BOOL
"WEBKITLIBPLUGIN support for the llplugin/llmedia test apps.")
else (USESYSTEMLIBS)
use_prebuilt_binary(llqtwebkit)
set(WEBKITLIBPLUGIN ON CACHE BOOL
"WEBKITLIBPLUGIN support for the llplugin/llmedia test apps.")
endif (USESYSTEMLIBS)
if (WINDOWS)
set(WEBKIT_PLUGIN_LIBRARIES
debug llqtwebkitd
debug QtWebKitd4
debug QtOpenGLd4
debug QtNetworkd4
debug QtGuid4
debug QtCored4
debug qtmaind
optimized llqtwebkit
optimized QtWebKit4
optimized QtOpenGL4
optimized QtNetwork4
optimized QtGui4
optimized QtCore4
optimized qtmain
)
elseif (DARWIN)
set(WEBKIT_PLUGIN_LIBRARIES
${ARCH_PREBUILT_DIRS_RELEASE}/libllqtwebkit.a
${ARCH_PREBUILT_DIRS_RELEASE}/libQtWebKit.4.dylib
${ARCH_PREBUILT_DIRS_RELEASE}/libQtOpenGL.4.dylib
${ARCH_PREBUILT_DIRS_RELEASE}/libQtNetwork.4.dylib
${ARCH_PREBUILT_DIRS_RELEASE}/libQtGui.4.dylib
${ARCH_PREBUILT_DIRS_RELEASE}/libQtCore.4.dylib
)
elseif (LINUX)
# FIRE-6108, add missing if clause for standalone builds - TL
if (USESYSTEMLIBS)
set(WEBKIT_PLUGIN_LIBRARIES ${LLQTWEBKIT_LIBRARY} ${QT_LIBRARIES} ${QT_PLUGIN_LIBRARIES})
else (USESYSTEMLIBS)
set(WEBKIT_PLUGIN_LIBRARIES
llqtwebkit
# qico
# qpng
# qtiff
# qsvg
# QtSvg
QtWebKit
QtOpenGL
QtNetwork
QtGui
QtCore
jpeg
jscore
# qgif
# qjpeg
# jpeg
fontconfig
X11
Xrender
GL
# sqlite3
# Xi
# SM
# <FS:ND> Link against ssl and crypto (in this order) to avoid webkit fail
ssl
crypto
# </FS:ND>
)
endif (USESYSTEMLIBS)
endif (WINDOWS)

View File

@ -738,8 +738,11 @@ LLProcess::LLProcess(const LLSDOrParams& params):
{
mPipes.replace(i, new ReadPipeImpl(desc, pipe, FILESLOT(i)));
}
LL_DEBUGS("LLProcess") << "Instantiating " << typeid(mPipes[i]).name()
<< "('" << desc << "')" << LL_ENDL;
// Removed temporaily for Xcode 7 build tests: error was:
// "error: expression with side effects will be evaluated despite
// being used as an operand to 'typeid' [-Werror,-Wpotentially-evaluated-expression]""
//LL_DEBUGS("LLProcess") << "Instantiating " << typeid(mPipes[i]).name()
// << "('" << desc << "')" << LL_ENDL;
}
}

View File

@ -20,7 +20,6 @@ include_directories(
${LLRENDER_INCLUDE_DIRS}
${LLXML_INCLUDE_DIRS}
${LLWINDOW_INCLUDE_DIRS}
${LLQTWEBKIT_INCLUDE_DIR}
)
include_directories(SYSTEM
${LLCOMMON_SYSTEM_INCLUDE_DIRS}

View File

@ -242,25 +242,17 @@ attributedStringInfo getSegments(NSAttributedString *str)
[glContext makeCurrentContext];
// <FS:ND> setValues needs a real pointer, not some integer that is castet into one
// if (vsync)
// {
// [glContext setValues:(const GLint*)1 forParameter:NSOpenGLCPSwapInterval];
// } else {
// [glContext setValues:(const GLint*)0 forParameter:NSOpenGLCPSwapInterval];
// }
GLint glVsync = 0;
if (vsync)
{
glVsync = 1;
[glContext setValues:(const GLint*)1 forParameter:NSOpenGLCPSwapInterval];
} else {
// supress this error after move to Xcode 7:
// error: null passed to a callee that requires a non-null argument [-Werror,-Wnonnull]
// Tried using ObjC 'nonnull' keyword as per SO article but didn't build
GLint swapInterval=0;
[glContext setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
}
[glContext setValues:&glVsync forParameter:NSOpenGLCPSwapInterval];
// </FS:ND>
mOldResize = false;
return self;

View File

@ -65,14 +65,15 @@ private:
void onAddressChangeCallback(std::string url);
void onNavigateURLCallback(std::string url, std::string target);
bool onHTTPAuthCallback(const std::string host, const std::string realm, std::string& username, std::string& password);
void onCursorChangedCallback(LLCEFLib::ECursorType type, unsigned int handle);
void postDebugMessage(const std::string& msg);
void authResponse(LLPluginMessage &message);
EKeyboardModifier decodeModifiers(std::string &modifiers);
LLCEFLib::EKeyboardModifier decodeModifiers(std::string &modifiers);
void deserializeKeyboardData(LLSD native_key_data, uint32_t& native_scan_code, uint32_t& native_virtual_key, uint32_t& native_modifiers);
void keyEvent(EKeyEvent key_event, int key, EKeyboardModifier modifiers, LLSD native_key_data);
void unicodeInput(const std::string &utf8str, EKeyboardModifier modifiers, LLSD native_key_data);
void keyEvent(LLCEFLib::EKeyEvent key_event, int key, LLCEFLib::EKeyboardModifier modifiers, LLSD native_key_data);
void unicodeInput(const std::string &utf8str, LLCEFLib::EKeyboardModifier modifiers, LLSD native_key_data);
void checkEditState();
@ -269,6 +270,38 @@ bool MediaPluginCEF::onHTTPAuthCallback(const std::string host, const std::strin
return mAuthOK;
}
void MediaPluginCEF::onCursorChangedCallback(LLCEFLib::ECursorType type, unsigned int handle)
{
std::string name = "";
switch (type)
{
case LLCEFLib::CT_POINTER:
name = "arrow";
break;
case LLCEFLib::CT_IBEAM:
name = "ibeam";
break;
case LLCEFLib::CT_NORTHSOUTHRESIZE:
name = "splitv";
break;
case LLCEFLib::CT_EASTWESTRESIZE:
name = "splith";
break;
case LLCEFLib::CT_HAND:
name = "hand";
break;
default:
LL_WARNS() << "Unknown cursor ID: " << (int)type << LL_ENDL;
break;
}
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "cursor_changed");
message.setValue("name", name);
sendMessage(message);
}
void MediaPluginCEF::authResponse(LLPluginMessage &message)
{
mAuthOK = message.getValueBoolean("ok");
@ -376,8 +409,9 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
mLLCEFLib->setOnLoadEndCallback(boost::bind(&MediaPluginCEF::onLoadEndCallback, this, _1));
mLLCEFLib->setOnNavigateURLCallback(boost::bind(&MediaPluginCEF::onNavigateURLCallback, this, _1, _2));
mLLCEFLib->setOnHTTPAuthCallback(boost::bind(&MediaPluginCEF::onHTTPAuthCallback, this, _1, _2, _3, _4));
mLLCEFLib->setOnCursorChangedCallback(boost::bind(&MediaPluginCEF::onCursorChangedCallback, this, _1, _2));
LLCEFLibSettings settings;
LLCEFLib::LLCEFLibSettings settings;
settings.initial_width = 1024;
settings.initial_height = 1024;
settings.plugins_enabled = mPluginsEnabled;
@ -472,14 +506,14 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
//std::string modifiers = message_in.getValue("modifiers");
S32 button = message_in.getValueS32("button");
EMouseButton btn = MB_MOUSE_BUTTON_LEFT;
if (button == 0) btn = MB_MOUSE_BUTTON_LEFT;
if (button == 1) btn = MB_MOUSE_BUTTON_RIGHT;
if (button == 2) btn = MB_MOUSE_BUTTON_MIDDLE;
LLCEFLib::EMouseButton btn = LLCEFLib::MB_MOUSE_BUTTON_LEFT;
if (button == 0) btn = LLCEFLib::MB_MOUSE_BUTTON_LEFT;
if (button == 1) btn = LLCEFLib::MB_MOUSE_BUTTON_RIGHT;
if (button == 2) btn = LLCEFLib::MB_MOUSE_BUTTON_MIDDLE;
if (event == "down")
{
mLLCEFLib->mouseButton(btn, ME_MOUSE_DOWN, x, y);
mLLCEFLib->mouseButton(btn, LLCEFLib::ME_MOUSE_DOWN, x, y);
mLLCEFLib->setFocus(true);
std::stringstream str;
@ -488,7 +522,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
}
else if (event == "up")
{
mLLCEFLib->mouseButton(btn, ME_MOUSE_UP, x, y);
mLLCEFLib->mouseButton(btn, LLCEFLib::ME_MOUSE_UP, x, y);
std::stringstream str;
str << "Mouse up at = " << x << ", " << y;
@ -527,13 +561,13 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
if (event == "down")
{
//mLLCEFLib->keyPress(key, true);
mLLCEFLib->keyboardEvent(KE_KEY_DOWN, (uint32_t)key, 0, KM_MODIFIER_NONE, 0, 0, 0);
mLLCEFLib->keyboardEvent(LLCEFLib::KE_KEY_DOWN, (uint32_t)key, 0, LLCEFLib::KM_MODIFIER_NONE, 0, 0, 0);
}
else if (event == "up")
{
//mLLCEFLib->keyPress(key, false);
mLLCEFLib->keyboardEvent(KE_KEY_UP, (uint32_t)key, 0, KM_MODIFIER_NONE, 0, 0, 0);
mLLCEFLib->keyboardEvent(LLCEFLib::KE_KEY_UP, (uint32_t)key, 0, LLCEFLib::KM_MODIFIER_NONE, 0, 0, 0);
}
#elif LL_WINDOWS
@ -543,14 +577,14 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
LLSD native_key_data = message_in.getValueLLSD("native_key_data");
// Treat unknown events as key-up for safety.
EKeyEvent key_event = KE_KEY_UP;
LLCEFLib::EKeyEvent key_event = LLCEFLib::KE_KEY_UP;
if (event == "down")
{
key_event = KE_KEY_DOWN;
key_event = LLCEFLib::KE_KEY_DOWN;
}
else if (event == "repeat")
{
key_event = KE_KEY_REPEAT;
key_event = LLCEFLib::KE_KEY_REPEAT;
}
keyEvent(key_event, key, decodeModifiers(modifiers), native_key_data);
@ -633,23 +667,23 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
}
}
EKeyboardModifier MediaPluginCEF::decodeModifiers(std::string &modifiers)
LLCEFLib::EKeyboardModifier MediaPluginCEF::decodeModifiers(std::string &modifiers)
{
int result = 0;
if (modifiers.find("shift") != std::string::npos)
result |= KM_MODIFIER_SHIFT;
result |= LLCEFLib::KM_MODIFIER_SHIFT;
if (modifiers.find("alt") != std::string::npos)
result |= KM_MODIFIER_ALT;
result |= LLCEFLib::KM_MODIFIER_ALT;
if (modifiers.find("control") != std::string::npos)
result |= KM_MODIFIER_CONTROL;
result |= LLCEFLib::KM_MODIFIER_CONTROL;
if (modifiers.find("meta") != std::string::npos)
result |= KM_MODIFIER_META;
result |= LLCEFLib::KM_MODIFIER_META;
return (EKeyboardModifier)result;
return (LLCEFLib::EKeyboardModifier)result;
}
////////////////////////////////////////////////////////////////////////////////
@ -682,7 +716,7 @@ void MediaPluginCEF::deserializeKeyboardData(LLSD native_key_data, uint32_t& nat
////////////////////////////////////////////////////////////////////////////////
//
void MediaPluginCEF::keyEvent(EKeyEvent key_event, int key, EKeyboardModifier modifiers, LLSD native_key_data = LLSD::emptyMap())
void MediaPluginCEF::keyEvent(LLCEFLib::EKeyEvent key_event, int key, LLCEFLib::EKeyboardModifier modifiers, LLSD native_key_data = LLSD::emptyMap())
{
#if LL_DARWIN || LL_LINUX
std::string utf8_text;
@ -718,11 +752,11 @@ void MediaPluginCEF::keyEvent(EKeyEvent key_event, int key, EKeyboardModifier mo
#endif
};
void MediaPluginCEF::unicodeInput(const std::string &utf8str, EKeyboardModifier modifiers, LLSD native_key_data = LLSD::emptyMap())
void MediaPluginCEF::unicodeInput(const std::string &utf8str, LLCEFLib::EKeyboardModifier modifiers, LLSD native_key_data = LLSD::emptyMap())
{
#if LL_DARWIN
//mLLCEFLib->keyPress(utf8str[0], true);
mLLCEFLib->keyboardEvent(KE_KEY_DOWN, (uint32_t)(utf8str[0]), 0, KM_MODIFIER_NONE, 0, 0, 0);
mLLCEFLib->keyboardEvent(LLCEFLib::KE_KEY_DOWN, (uint32_t)(utf8str[0]), 0, LLCEFLib::KM_MODIFIER_NONE, 0, 0, 0);
#elif LL_WINDOWS
U32 msg = ll_U32_from_sd(native_key_data["msg"]);
U32 wparam = ll_U32_from_sd(native_key_data["w_param"]);

View File

@ -1,133 +0,0 @@
# -*- cmake -*-
project(media_plugin_webkit)
include(00-Common)
include(LLCommon)
include(LLImage)
include(LLPlugin)
include(LLMath)
include(LLRender)
include(LLWindow)
include(UI)
include(Linking)
include(PluginAPI)
include(MediaPluginBase)
include(OpenGL)
include(PulseAudio)
include(WebKitLibPlugin)
include_directories(
${PULSEAUDIO_INCLUDE_DIRS}
${LLPLUGIN_INCLUDE_DIRS}
${MEDIA_PLUGIN_BASE_INCLUDE_DIRS}
${LLCOMMON_INCLUDE_DIRS}
${LLMATH_INCLUDE_DIRS}
${LLIMAGE_INCLUDE_DIRS}
${LLRENDER_INCLUDE_DIRS}
${LLWINDOW_INCLUDE_DIRS}
${LLQTWEBKIT_INCLUDE_DIR}
)
include_directories(SYSTEM
${LLCOMMON_SYSTEM_INCLUDE_DIRS}
)
### media_plugin_webkit
if(NOT WORD_SIZE EQUAL 32)
if(WINDOWS)
add_definitions(/FIXED:NO)
else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
add_definitions(-fPIC)
endif(WINDOWS)
endif(NOT WORD_SIZE EQUAL 32)
set(media_plugin_webkit_SOURCE_FILES
media_plugin_webkit.cpp
)
set(media_plugin_webkit_HEADER_FILES
volume_catcher.h
)
set(media_plugin_webkit_LINK_LIBRARIES
${LLPLUGIN_LIBRARIES}
${MEDIA_PLUGIN_BASE_LIBRARIES}
${LLCOMMON_LIBRARIES}
${WEBKIT_PLUGIN_LIBRARIES}
${PLUGIN_API_WINDOWS_LIBRARIES}
${PULSEAUDIO_LIBRARIES}
)
# Select which VolumeCatcher implementation to use
if (LINUX)
if (PULSEAUDIO_FOUND)
list(APPEND media_plugin_webkit_SOURCE_FILES linux_volume_catcher.cpp)
else (PULSEAUDIO_FOUND)
list(APPEND media_plugin_webkit_SOURCE_FILES dummy_volume_catcher.cpp)
endif (PULSEAUDIO_FOUND)
list(APPEND media_plugin_webkit_LINK_LIBRARIES
${UI_LIBRARIES} # for glib/GTK
Xext #<FS:ND/> force pulling libXext in, otherwise we get undefined symbols.
)
elseif (DARWIN)
list(APPEND media_plugin_webkit_SOURCE_FILES mac_volume_catcher.cpp)
find_library(CORESERVICES_LIBRARY CoreServices)
find_library(AUDIOUNIT_LIBRARY AudioUnit)
list(APPEND media_plugin_webkit_LINK_LIBRARIES
${CORESERVICES_LIBRARY} # for Component Manager calls
${AUDIOUNIT_LIBRARY} # for AudioUnit calls
)
elseif (WINDOWS)
list(APPEND media_plugin_webkit_SOURCE_FILES windows_volume_catcher.cpp)
endif (LINUX)
set_source_files_properties(${media_plugin_webkit_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
list(APPEND media_plugin_webkit_SOURCE_FILES ${media_plugin_webkit_HEADER_FILES})
add_library(media_plugin_webkit
SHARED
${media_plugin_webkit_SOURCE_FILES}
)
target_link_libraries(media_plugin_webkit ${media_plugin_webkit_LINK_LIBRARIES})
add_dependencies(media_plugin_webkit
${LLPLUGIN_LIBRARIES}
${MEDIA_PLUGIN_BASE_LIBRARIES}
${LLCOMMON_LIBRARIES}
)
if (WINDOWS)
set_target_properties(
media_plugin_webkit
PROPERTIES
LINK_FLAGS "/MANIFEST:NO"
)
endif (WINDOWS)
if (DARWIN)
# Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name
set_target_properties(
media_plugin_webkit
PROPERTIES
PREFIX ""
BUILD_WITH_INSTALL_RPATH 1
INSTALL_NAME_DIR "@executable_path"
LINK_FLAGS "-exported_symbols_list ${CMAKE_CURRENT_SOURCE_DIR}/../base/media_plugin_base.exp"
)
# copy the webkit dylib to the build directory
# add_custom_command(
# TARGET media_plugin_webkit POST_BUILD
# # OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libllqtwebkit.dylib
# COMMAND ${CMAKE_COMMAND} -E copy ${ARCH_PREBUILT_DIRS_RELEASE}/libllqtwebkit.dylib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
# DEPENDS media_plugin_webkit ${ARCH_PREBUILT_DIRS_RELEASE}/libllqtwebkit.dylib
# )
endif (DARWIN)

View File

@ -1,58 +0,0 @@
/**
* @file dummy_volume_catcher.cpp
* @brief A null implementation of the "VolumeCatcher" class for platforms where it's not implemented yet.
*
* @cond
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
* @endcond
*/
#include "volume_catcher.h"
class VolumeCatcherImpl
{
};
/////////////////////////////////////////////////////
VolumeCatcher::VolumeCatcher()
{
pimpl = NULL;
}
VolumeCatcher::~VolumeCatcher()
{
}
void VolumeCatcher::setVolume(F32 volume)
{
}
void VolumeCatcher::setPan(F32 pan)
{
}
void VolumeCatcher::pump()
{
}

View File

@ -1,468 +0,0 @@
/**
* @file linux_volume_catcher.cpp
* @brief A Linux-specific, PulseAudio-specific hack to detect and volume-adjust new audio sources
*
* @cond
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
* @endcond
*/
/*
The high-level design is as follows:
1) Connect to the PulseAudio daemon
2) Watch for the creation of new audio players connecting to the daemon (this includes ALSA clients running on the PulseAudio emulation layer, such as Flash plugins)
3) Examine any new audio player's PID to see if it belongs to our own process
4) If so, tell PA to adjust the volume of that audio player ('sink input' in PA parlance)
5) Keep a list of all living audio players that we care about, adjust the volumes of all of them when we get a new setVolume() call
*/
#include "linden_common.h"
#include "volume_catcher.h"
extern "C" {
#include <glib.h>
#include <glib-object.h>
#include <pulse/introspect.h>
#include <pulse/context.h>
#include <pulse/subscribe.h>
#include <pulse/glib-mainloop.h> // There's no special reason why we want the *glib* PA mainloop, but the generic polling implementation seems broken.
#include "apr_pools.h"
#include "apr_dso.h"
}
////////////////////////////////////////////////////
#define DEBUGMSG(...) do {} while(0)
#define INFOMSG(...) do {} while(0)
#define WARNMSG(...) do {} while(0)
#define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) RTN (*ll##PASYM)(__VA_ARGS__) = NULL
#include "linux_volume_catcher_pa_syms.inc"
#include "linux_volume_catcher_paglib_syms.inc"
#undef LL_PA_SYM
static bool sSymsGrabbed = false;
static apr_pool_t *sSymPADSOMemoryPool = NULL;
static apr_dso_handle_t *sSymPADSOHandleG = NULL;
bool grab_pa_syms(std::string pulse_dso_name)
{
if (sSymsGrabbed)
{
// already have grabbed good syms
return true;
}
bool sym_error = false;
bool rtn = false;
apr_status_t rv;
apr_dso_handle_t *sSymPADSOHandle = NULL;
#define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##PASYM, sSymPADSOHandle, #PASYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #PASYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #PASYM, (void*)ll##PASYM);}while(0)
//attempt to load the shared library
apr_pool_create(&sSymPADSOMemoryPool, NULL);
if ( APR_SUCCESS == (rv = apr_dso_load(&sSymPADSOHandle,
pulse_dso_name.c_str(),
sSymPADSOMemoryPool) ))
{
INFOMSG("Found DSO: %s", pulse_dso_name.c_str());
#include "linux_volume_catcher_pa_syms.inc"
#include "linux_volume_catcher_paglib_syms.inc"
if ( sSymPADSOHandle )
{
sSymPADSOHandleG = sSymPADSOHandle;
sSymPADSOHandle = NULL;
}
rtn = !sym_error;
}
else
{
INFOMSG("Couldn't load DSO: %s", pulse_dso_name.c_str());
rtn = false; // failure
}
if (sym_error)
{
WARNMSG("Failed to find necessary symbols in PulseAudio libraries.");
}
#undef LL_PA_SYM
sSymsGrabbed = rtn;
return rtn;
}
void ungrab_pa_syms()
{
// should be safe to call regardless of whether we've
// actually grabbed syms.
if ( sSymPADSOHandleG )
{
apr_dso_unload(sSymPADSOHandleG);
sSymPADSOHandleG = NULL;
}
if ( sSymPADSOMemoryPool )
{
apr_pool_destroy(sSymPADSOMemoryPool);
sSymPADSOMemoryPool = NULL;
}
// NULL-out all of the symbols we'd grabbed
#define LL_PA_SYM(REQUIRED, PASYM, RTN, ...) do{ll##PASYM = NULL;}while(0)
#include "linux_volume_catcher_pa_syms.inc"
#include "linux_volume_catcher_paglib_syms.inc"
#undef LL_PA_SYM
sSymsGrabbed = false;
}
////////////////////////////////////////////////////
// PulseAudio requires a chain of callbacks with C linkage
extern "C" {
void callback_discovered_sinkinput(pa_context *context, const pa_sink_input_info *i, int eol, void *userdata);
void callback_subscription_alert(pa_context *context, pa_subscription_event_type_t t, uint32_t index, void *userdata);
void callback_context_state(pa_context *context, void *userdata);
}
class VolumeCatcherImpl
{
public:
VolumeCatcherImpl();
~VolumeCatcherImpl();
void setVolume(F32 volume);
void pump(void);
// for internal use - can't be private because used from our C callbacks
bool loadsyms(std::string pulse_dso_name);
void init();
void cleanup();
void update_all_volumes(F32 volume);
void update_index_volume(U32 index, F32 volume);
void connected_okay();
std::set<U32> mSinkInputIndices;
std::map<U32,U32> mSinkInputNumChannels;
F32 mDesiredVolume;
pa_glib_mainloop *mMainloop;
pa_context *mPAContext;
bool mConnected;
bool mGotSyms;
};
VolumeCatcherImpl::VolumeCatcherImpl()
: mDesiredVolume(0.0f),
mMainloop(NULL),
mPAContext(NULL),
mConnected(false),
mGotSyms(false)
{
init();
}
VolumeCatcherImpl::~VolumeCatcherImpl()
{
cleanup();
}
bool VolumeCatcherImpl::loadsyms(std::string pulse_dso_name)
{
return grab_pa_syms(pulse_dso_name);
}
void VolumeCatcherImpl::init()
{
// try to be as defensive as possible because PA's interface is a
// bit fragile and (for our purposes) we'd rather simply not function
// than crash
// we cheat and rely upon libpulse-mainloop-glib.so.0 to pull-in
// libpulse.so.0 - this isn't a great assumption, and the two DSOs should
// probably be loaded separately. Our Linux DSO framework needs refactoring,
// we do this sort of thing a lot with practically identical logic...
mGotSyms = loadsyms("libpulse-mainloop-glib.so.0");
if (!mGotSyms) return;
// better make double-sure glib itself is initialized properly.
if (!g_thread_supported ()) g_thread_init (NULL);
g_type_init();
mMainloop = llpa_glib_mainloop_new(g_main_context_default());
if (mMainloop)
{
pa_mainloop_api *api = llpa_glib_mainloop_get_api(mMainloop);
if (api)
{
pa_proplist *proplist = llpa_proplist_new();
if (proplist)
{
llpa_proplist_sets(proplist, PA_PROP_APPLICATION_ICON_NAME, "multimedia-player");
llpa_proplist_sets(proplist, PA_PROP_APPLICATION_ID, "com.secondlife.viewer.mediaplugvoladjust");
llpa_proplist_sets(proplist, PA_PROP_APPLICATION_NAME, "SL Plugin Volume Adjuster");
llpa_proplist_sets(proplist, PA_PROP_APPLICATION_VERSION, "1");
// plain old pa_context_new() is broken!
mPAContext = llpa_context_new_with_proplist(api, NULL, proplist);
llpa_proplist_free(proplist);
}
}
}
// Now we've set up a PA context and mainloop, try connecting the
// PA context to a PA daemon.
if (mPAContext)
{
llpa_context_set_state_callback(mPAContext, callback_context_state, this);
pa_context_flags_t cflags = (pa_context_flags)0; // maybe add PA_CONTEXT_NOAUTOSPAWN?
if (llpa_context_connect(mPAContext, NULL, cflags, NULL) >= 0)
{
// Okay! We haven't definitely connected, but we
// haven't definitely failed yet.
}
else
{
// Failed to connect to PA manager... we'll leave
// things like that. Perhaps we should try again later.
}
}
}
void VolumeCatcherImpl::cleanup()
{
mConnected = false;
if (mGotSyms && mPAContext)
{
llpa_context_disconnect(mPAContext);
llpa_context_unref(mPAContext);
}
mPAContext = NULL;
if (mGotSyms && mMainloop)
{
llpa_glib_mainloop_free(mMainloop);
}
mMainloop = NULL;
}
void VolumeCatcherImpl::setVolume(F32 volume)
{
mDesiredVolume = volume;
if (!mGotSyms) return;
if (mConnected && mPAContext)
{
update_all_volumes(mDesiredVolume);
}
pump();
}
void VolumeCatcherImpl::pump()
{
gboolean may_block = FALSE;
g_main_context_iteration(g_main_context_default(), may_block);
}
void VolumeCatcherImpl::connected_okay()
{
pa_operation *op;
// fetch global list of existing sinkinputs
if ((op = llpa_context_get_sink_input_info_list(mPAContext,
callback_discovered_sinkinput,
this)))
{
llpa_operation_unref(op);
}
// subscribe to future global sinkinput changes
llpa_context_set_subscribe_callback(mPAContext,
callback_subscription_alert,
this);
if ((op = llpa_context_subscribe(mPAContext, (pa_subscription_mask_t)
(PA_SUBSCRIPTION_MASK_SINK_INPUT),
NULL, NULL)))
{
llpa_operation_unref(op);
}
}
void VolumeCatcherImpl::update_all_volumes(F32 volume)
{
for (std::set<U32>::iterator it = mSinkInputIndices.begin();
it != mSinkInputIndices.end(); ++it)
{
update_index_volume(*it, volume);
}
}
void VolumeCatcherImpl::update_index_volume(U32 index, F32 volume)
{
static pa_cvolume cvol;
llpa_cvolume_set(&cvol, mSinkInputNumChannels[index],
llpa_sw_volume_from_linear(volume));
pa_context *c = mPAContext;
uint32_t idx = index;
const pa_cvolume *cvolumep = &cvol;
pa_context_success_cb_t cb = NULL; // okay as null
void *userdata = NULL; // okay as null
pa_operation *op;
if ((op = llpa_context_set_sink_input_volume(c, idx, cvolumep, cb, userdata)))
{
llpa_operation_unref(op);
}
}
void callback_discovered_sinkinput(pa_context *context, const pa_sink_input_info *sii, int eol, void *userdata)
{
VolumeCatcherImpl *impl = dynamic_cast<VolumeCatcherImpl*>((VolumeCatcherImpl*)userdata);
llassert(impl);
if (0 == eol)
{
pa_proplist *proplist = sii->proplist;
pid_t sinkpid = atoll(llpa_proplist_gets(proplist, PA_PROP_APPLICATION_PROCESS_ID));
if (sinkpid == getpid()) // does the discovered sinkinput belong to this process?
{
bool is_new = (impl->mSinkInputIndices.find(sii->index) ==
impl->mSinkInputIndices.end());
impl->mSinkInputIndices.insert(sii->index);
impl->mSinkInputNumChannels[sii->index] = sii->channel_map.channels;
if (is_new)
{
// new!
impl->update_index_volume(sii->index, impl->mDesiredVolume);
}
else
{
// seen it already, do nothing.
}
}
}
}
void callback_subscription_alert(pa_context *context, pa_subscription_event_type_t t, uint32_t index, void *userdata)
{
VolumeCatcherImpl *impl = dynamic_cast<VolumeCatcherImpl*>((VolumeCatcherImpl*)userdata);
llassert(impl);
switch (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) {
case PA_SUBSCRIPTION_EVENT_SINK_INPUT:
if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) ==
PA_SUBSCRIPTION_EVENT_REMOVE)
{
// forget this sinkinput, if we were caring about it
impl->mSinkInputIndices.erase(index);
impl->mSinkInputNumChannels.erase(index);
}
else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) ==
PA_SUBSCRIPTION_EVENT_NEW)
{
// ask for more info about this new sinkinput
pa_operation *op;
if ((op = llpa_context_get_sink_input_info(impl->mPAContext, index, callback_discovered_sinkinput, impl)))
{
llpa_operation_unref(op);
}
}
else
{
// property change on this sinkinput - we don't care.
}
break;
default:;
}
}
void callback_context_state(pa_context *context, void *userdata)
{
VolumeCatcherImpl *impl = dynamic_cast<VolumeCatcherImpl*>((VolumeCatcherImpl*)userdata);
llassert(impl);
switch (llpa_context_get_state(context))
{
case PA_CONTEXT_READY:
impl->mConnected = true;
impl->connected_okay();
break;
case PA_CONTEXT_TERMINATED:
impl->mConnected = false;
break;
case PA_CONTEXT_FAILED:
impl->mConnected = false;
break;
default:;
}
}
/////////////////////////////////////////////////////
VolumeCatcher::VolumeCatcher()
{
pimpl = new VolumeCatcherImpl();
}
VolumeCatcher::~VolumeCatcher()
{
delete pimpl;
pimpl = NULL;
}
void VolumeCatcher::setVolume(F32 volume)
{
llassert(pimpl);
pimpl->setVolume(volume);
}
void VolumeCatcher::setPan(F32 pan)
{
// TODO: implement this (if possible)
}
void VolumeCatcher::pump()
{
llassert(pimpl);
pimpl->pump();
}

View File

@ -1,21 +0,0 @@
// required symbols to grab
LL_PA_SYM(true, pa_context_connect, int, pa_context *c, const char *server, pa_context_flags_t flags, const pa_spawn_api *api);
LL_PA_SYM(true, pa_context_disconnect, void, pa_context *c);
LL_PA_SYM(true, pa_context_get_sink_input_info, pa_operation*, pa_context *c, uint32_t idx, pa_sink_input_info_cb_t cb, void *userdata);
LL_PA_SYM(true, pa_context_get_sink_input_info_list, pa_operation*, pa_context *c, pa_sink_input_info_cb_t cb, void *userdata);
LL_PA_SYM(true, pa_context_get_state, pa_context_state_t, pa_context *c);
LL_PA_SYM(true, pa_context_new_with_proplist, pa_context*, pa_mainloop_api *mainloop, const char *name, pa_proplist *proplist);
LL_PA_SYM(true, pa_context_set_sink_input_volume, pa_operation*, pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata);
LL_PA_SYM(true, pa_context_set_state_callback, void, pa_context *c, pa_context_notify_cb_t cb, void *userdata);
LL_PA_SYM(true, pa_context_set_subscribe_callback, void, pa_context *c, pa_context_subscribe_cb_t cb, void *userdata);
LL_PA_SYM(true, pa_context_subscribe, pa_operation*, pa_context *c, pa_subscription_mask_t m, pa_context_success_cb_t cb, void *userdata);
LL_PA_SYM(true, pa_context_unref, void, pa_context *c);
LL_PA_SYM(true, pa_cvolume_set, pa_cvolume*, pa_cvolume *a, unsigned channels, pa_volume_t v);
LL_PA_SYM(true, pa_operation_unref, void, pa_operation *o);
LL_PA_SYM(true, pa_proplist_free, void, pa_proplist* p);
LL_PA_SYM(true, pa_proplist_gets, const char*, pa_proplist *p, const char *key);
LL_PA_SYM(true, pa_proplist_new, pa_proplist*, void);
LL_PA_SYM(true, pa_proplist_sets, int, pa_proplist *p, const char *key, const char *value);
LL_PA_SYM(true, pa_sw_volume_from_linear, pa_volume_t, double v);
// optional symbols to grab

View File

@ -1,6 +0,0 @@
// required symbols to grab
LL_PA_SYM(true, pa_glib_mainloop_free, void, pa_glib_mainloop* g);
LL_PA_SYM(true, pa_glib_mainloop_get_api, pa_mainloop_api*, pa_glib_mainloop* g);
LL_PA_SYM(true, pa_glib_mainloop_new, pa_glib_mainloop *, GMainContext *c);
// optional symbols to grab

View File

@ -1,275 +0,0 @@
/**
* @file mac_volume_catcher.cpp
* @brief A Mac OS X specific hack to control the volume level of all audio channels opened by a process.
*
* @cond
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
* @endcond
*/
/**************************************************************************************************************
This code works by using CaptureComponent to capture the "Default Output" audio component
(kAudioUnitType_Output/kAudioUnitSubType_DefaultOutput) and delegating all calls to the original component.
It does this just to keep track of all instances of the default output component, so that it can set the
kHALOutputParam_Volume parameter on all of them to adjust the output volume.
**************************************************************************************************************/
#include "volume_catcher.h"
#include <QuickTime/QuickTime.h>
#include <AudioUnit/AudioUnit.h>
#include <list>
#if LL_DARWIN
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#endif
struct VolumeCatcherStorage;
class VolumeCatcherImpl
{
public:
void setVolume(F32 volume);
void setPan(F32 pan);
void setInstanceVolume(VolumeCatcherStorage *instance);
std::list<VolumeCatcherStorage*> mComponentInstances;
Component mOriginalDefaultOutput;
Component mVolumeAdjuster;
static VolumeCatcherImpl *getInstance();
private:
// This is a singleton class -- both callers and the component implementation should use getInstance() to find the instance.
VolumeCatcherImpl();
static VolumeCatcherImpl *sInstance;
// The singlar instance of this class is expected to last until the process exits.
// To ensure this, we declare the destructor here but never define it, so any code which attempts to destroy the instance will not link.
~VolumeCatcherImpl();
F32 mVolume;
F32 mPan;
};
VolumeCatcherImpl *VolumeCatcherImpl::sInstance = NULL;;
struct VolumeCatcherStorage
{
ComponentInstance self;
ComponentInstance delegate;
};
static ComponentResult volume_catcher_component_entry(ComponentParameters *cp, Handle componentStorage);
static ComponentResult volume_catcher_component_open(VolumeCatcherStorage *storage, ComponentInstance self);
static ComponentResult volume_catcher_component_close(VolumeCatcherStorage *storage, ComponentInstance self);
VolumeCatcherImpl *VolumeCatcherImpl::getInstance()
{
if(!sInstance)
{
sInstance = new VolumeCatcherImpl;
}
return sInstance;
}
VolumeCatcherImpl::VolumeCatcherImpl()
{
mVolume = 1.0; // default to full volume
mPan = 0.0; // and center pan
ComponentDescription desc;
desc.componentType = kAudioUnitType_Output;
desc.componentSubType = kAudioUnitSubType_DefaultOutput;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
// Find the original default output component
mOriginalDefaultOutput = FindNextComponent(NULL, &desc);
// Register our own output component with the same parameters
mVolumeAdjuster = RegisterComponent(&desc, NewComponentRoutineUPP(volume_catcher_component_entry), 0, NULL, NULL, NULL);
// Capture the original component, so we always get found instead.
CaptureComponent(mOriginalDefaultOutput, mVolumeAdjuster);
}
static ComponentResult volume_catcher_component_entry(ComponentParameters *cp, Handle componentStorage)
{
ComponentResult result = badComponentSelector;
VolumeCatcherStorage *storage = (VolumeCatcherStorage*)componentStorage;
switch(cp->what)
{
case kComponentOpenSelect:
// std::cerr << "kComponentOpenSelect" << std::endl;
result = CallComponentFunctionWithStorageProcInfo((Handle)storage, cp, (ProcPtr)volume_catcher_component_open, uppCallComponentOpenProcInfo);
break;
case kComponentCloseSelect:
// std::cerr << "kComponentCloseSelect" << std::endl;
result = CallComponentFunctionWithStorageProcInfo((Handle)storage, cp, (ProcPtr)volume_catcher_component_close, uppCallComponentCloseProcInfo);
// CallComponentFunctionWithStorageProcInfo
break;
default:
// std::cerr << "Delegating selector: " << cp->what << " to component instance " << storage->delegate << std::endl;
result = DelegateComponentCall(cp, storage->delegate);
break;
}
return result;
}
static ComponentResult volume_catcher_component_open(VolumeCatcherStorage *storage, ComponentInstance self)
{
ComponentResult result = noErr;
VolumeCatcherImpl *impl = VolumeCatcherImpl::getInstance();
storage = new VolumeCatcherStorage;
storage->self = self;
storage->delegate = NULL;
result = OpenAComponent(impl->mOriginalDefaultOutput, &(storage->delegate));
if(result != noErr)
{
// std::cerr << "OpenAComponent result = " << result << ", component ref = " << storage->delegate << std::endl;
// If we failed to open the delagate component, our open is going to fail. Clean things up.
delete storage;
}
else
{
// Success -- set up this component's storage
SetComponentInstanceStorage(self, (Handle)storage);
// add this instance to the global list
impl->mComponentInstances.push_back(storage);
// and set up the initial volume
impl->setInstanceVolume(storage);
}
return result;
}
static ComponentResult volume_catcher_component_close(VolumeCatcherStorage *storage, ComponentInstance self)
{
ComponentResult result = noErr;
if(storage)
{
if(storage->delegate)
{
CloseComponent(storage->delegate);
storage->delegate = NULL;
}
VolumeCatcherImpl *impl = VolumeCatcherImpl::getInstance();
impl->mComponentInstances.remove(storage);
delete[] storage;
}
return result;
}
void VolumeCatcherImpl::setVolume(F32 volume)
{
VolumeCatcherImpl *impl = VolumeCatcherImpl::getInstance();
impl->mVolume = volume;
// Iterate through all known instances, setting the volume on each.
for(std::list<VolumeCatcherStorage*>::iterator iter = mComponentInstances.begin(); iter != mComponentInstances.end(); ++iter)
{
impl->setInstanceVolume(*iter);
}
}
void VolumeCatcherImpl::setPan(F32 pan)
{
VolumeCatcherImpl *impl = VolumeCatcherImpl::getInstance();
impl->mPan = pan;
// TODO: implement this.
// This will probably require adding a "panner" audio unit to the chain somehow.
// There's also a "3d mixer" component that we might be able to use...
}
void VolumeCatcherImpl::setInstanceVolume(VolumeCatcherStorage *instance)
{
// std::cerr << "Setting volume on component instance: " << (instance->delegate) << " to " << mVolume << std::endl;
OSStatus err = noErr;
if(instance && instance->delegate)
{
err = AudioUnitSetParameter(
instance->delegate,
kHALOutputParam_Volume,
kAudioUnitScope_Global,
0,
mVolume,
0);
}
if(err)
{
// std::cerr << " AudioUnitSetParameter returned " << err << std::endl;
}
}
/////////////////////////////////////////////////////
VolumeCatcher::VolumeCatcher()
{
pimpl = VolumeCatcherImpl::getInstance();
}
VolumeCatcher::~VolumeCatcher()
{
// Let the instance persist until exit.
}
void VolumeCatcher::setVolume(F32 volume)
{
pimpl->setVolume(volume);
}
void VolumeCatcher::setPan(F32 pan)
{
pimpl->setPan(pan);
}
void VolumeCatcher::pump()
{
// No periodic tasks are necessary for this implementation.
}
#if LL_DARWIN
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,54 +0,0 @@
/**
* @file volume_catcher.h
* @brief Interface to a class with platform-specific implementations that allows control of the audio volume of all sources in the current process.
*
* @cond
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
* @endcond
*/
#ifndef VOLUME_CATCHER_H
#define VOLUME_CATCHER_H
#include "linden_common.h"
class VolumeCatcherImpl;
class VolumeCatcher
{
public:
VolumeCatcher();
~VolumeCatcher();
void setVolume(F32 volume); // 0.0 - 1.0
// Set the left-right pan of audio sources
// where -1.0 = left, 0 = center, and 1.0 = right
void setPan(F32 pan);
void pump(); // call this at least a few times a second if you can - it affects how quickly we can 'catch' a new audio source and adjust its volume
private:
VolumeCatcherImpl *pimpl;
};
#endif // VOLUME_CATCHER_H

View File

@ -1,147 +0,0 @@
/**
* @file windows_volume_catcher.cpp
* @brief A Windows implementation of volume level control of all audio channels opened by a process.
*
* @cond
* $LicenseInfo:firstyear=2010&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
* @endcond
*/
#include "volume_catcher.h"
#include <windows.h>
#include "llsingleton.h"
class VolumeCatcherImpl : public LLSingleton<VolumeCatcherImpl>
{
friend LLSingleton<VolumeCatcherImpl>;
public:
void setVolume(F32 volume);
void setPan(F32 pan);
private:
// This is a singleton class -- both callers and the component implementation should use getInstance() to find the instance.
VolumeCatcherImpl();
~VolumeCatcherImpl();
typedef void (WINAPI *set_volume_func_t)(F32);
typedef void (WINAPI *set_mute_func_t)(bool);
set_volume_func_t mSetVolumeFunc;
set_mute_func_t mSetMuteFunc;
// tests if running on Vista, 7, 8 + once in CTOR
bool isWindowsVistaOrHigher();
F32 mVolume;
F32 mPan;
bool mSystemIsVistaOrHigher;
};
bool VolumeCatcherImpl::isWindowsVistaOrHigher()
{
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
return osvi.dwMajorVersion >= 6;
}
VolumeCatcherImpl::VolumeCatcherImpl()
: mVolume(1.0f), // default volume is max
mPan(0.f) // default pan is centered
{
mSystemIsVistaOrHigher = isWindowsVistaOrHigher();
if ( ! mSystemIsVistaOrHigher )
{
HMODULE handle = ::LoadLibrary(L"winmm.dll");
if(handle)
{
mSetVolumeFunc = (set_volume_func_t)::GetProcAddress(handle, "setPluginVolume");
mSetMuteFunc = (set_mute_func_t)::GetProcAddress(handle, "setPluginMute");
}
}
}
VolumeCatcherImpl::~VolumeCatcherImpl()
{
}
void VolumeCatcherImpl::setVolume(F32 volume)
{
mVolume = volume;
if ( mSystemIsVistaOrHigher )
{
// set both left/right to same volume
// TODO: use pan value to set independently
DWORD left_channel = (DWORD)(mVolume * 65535.0f);
DWORD right_channel = (DWORD)(mVolume * 65535.0f);
DWORD hw_volume = left_channel << 16 | right_channel;
::waveOutSetVolume(NULL, hw_volume);
}
else
{
if (mSetMuteFunc)
{
mSetMuteFunc(volume == 0.f);
}
if (mSetVolumeFunc)
{
mSetVolumeFunc(mVolume);
}
}
}
void VolumeCatcherImpl::setPan(F32 pan)
{ // remember pan for calculating individual channel levels later
mPan = pan;
}
/////////////////////////////////////////////////////
VolumeCatcher::VolumeCatcher()
{
pimpl = VolumeCatcherImpl::getInstance();
}
VolumeCatcher::~VolumeCatcher()
{
// Let the instance persist until exit.
}
void VolumeCatcher::setVolume(F32 volume)
{
pimpl->setVolume(volume);
}
void VolumeCatcher::setPan(F32 pan)
{
pimpl->setPan(pan);
}
void VolumeCatcher::pump()
{
// No periodic tasks are necessary for this implementation.
}

View File

@ -22,9 +22,6 @@ set(winmm_shim_HEADER_FILES
list(APPEND winmm_shim_SOURCE_FILES ${winmm_shim_HEADER_FILES})
set_source_files_properties(${media_plugin_webkit_HEADER_FILES}
PROPERTIES HEADER_FILE_ONLY TRUE)
add_library(winmm_shim
SHARED
${winmm_shim_SOURCE_FILES}

View File

@ -2109,41 +2109,9 @@ if (WINDOWS)
${CMAKE_CURRENT_SOURCE_DIR}/featuretable.txt
${CMAKE_CURRENT_SOURCE_DIR}/featuretable_xp.txt
${ARCH_PREBUILT_DIRS_RELEASE}/libeay32.dll
${ARCH_PREBUILT_DIRS_RELEASE}/qtcore4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/qtgui4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/qtnetwork4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/qtopengl4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/qtwebkit4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/qtxmlpatterns4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/ssleay32.dll
${ARCH_PREBUILT_DIRS_RELEASE}/imageformats/qgif4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/imageformats/qico4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/imageformats/qjpeg4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/imageformats/qmng4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/imageformats/qsvg4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/imageformats/qtiff4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/codecs/qcncodecs4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/codecs/qjpcodecs4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/codecs/qkrcodecs4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/codecs/qtwcodecs4.dll
${ARCH_PREBUILT_DIRS_DEBUG}/libeay32.dll
${ARCH_PREBUILT_DIRS_DEBUG}/qtcored4.dll
${ARCH_PREBUILT_DIRS_DEBUG}/qtguid4.dll
${ARCH_PREBUILT_DIRS_DEBUG}/qtnetworkd4.dll
${ARCH_PREBUILT_DIRS_DEBUG}/qtopengld4.dll
${ARCH_PREBUILT_DIRS_DEBUG}/qtwebkitd4.dll
${ARCH_PREBUILT_DIRS_DEBUG}/qtxmlpatternsd4.dll
${ARCH_PREBUILT_DIRS_DEBUG}/ssleay32.dll
${ARCH_PREBUILT_DIRS_DEBUG}/imageformats/qgifd4.dll
${ARCH_PREBUILT_DIRS_DEBUG}/imageformats/qicod4.dll
${ARCH_PREBUILT_DIRS_DEBUG}/imageformats/qjpegd4.dll
${ARCH_PREBUILT_DIRS_DEBUG}/imageformats/qmngd4.dll
${ARCH_PREBUILT_DIRS_DEBUG}/imageformats/qsvgd4.dll
${ARCH_PREBUILT_DIRS_DEBUG}/imageformats/qtiffd4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/codecs/qcncodecsd4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/codecs/qjpcodecsd4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/codecs/qkrcodecsd4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/codecs/qtwcodecsd4.dll
${ARCH_PREBUILT_DIRS_RELEASE}/growl.dll
SLPlugin
media_plugin_quicktime
@ -2587,7 +2555,6 @@ if (PACKAGE)
list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/mac_crash_logger/${CMAKE_CFG_INTDIR}")
list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/gstreamer010/${CMAKE_CFG_INTDIR}")
list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/quicktime/${CMAKE_CFG_INTDIR}")
## list(APPEND SYMBOL_SEARCH_DIRS "${CMAKE_BINARY_DIR}/media_plugins/webkit/${CMAKE_CFG_INTDIR}")
set(VIEWER_SYMBOL_FILE "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/firestorm-symbols-darwin.tar.bz2")
## set(VIEWER_EXE_GLOBS "'Second Life' SLPlugin mac-crash-logger")
set(VIEWER_EXE_GLOBS "'Firestorm' mac-crash-logger")

View File

@ -140,7 +140,9 @@
#include "llleap.h"
#include "stringize.h"
#include "llcoros.h"
#if !LL_LINUX
#include "cef/llceflib.h"
#endif
// Third party library includes
#include <boost/bind.hpp>
@ -3991,7 +3993,11 @@ LLSD LLAppViewer::getViewerInfo() const
info["VOICE_VERSION"] = LLTrans::getString("NotConnected");
}
#if !LL_LINUX
info["LLCEFLIB_VERSION"] = LLCEFLIB_VERSION;
#else
info["LLCEFLIB_VERSION"] = "Undefined";
#endif
// <FS:ND> Use the total accumulated samples.
//S32 packets_in = LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN);

View File

@ -219,10 +219,7 @@ std::string stripSuffix(std::string name)
}
LLMeshFilePicker::LLMeshFilePicker(LLModelPreview* mp, S32 lod)
// <FS:CR> Threaded Filepickers
//: LLFilePickerThread(LLFilePicker::FFLOAD_COLLADA)
: LLLoadFilePickerThread(LLFilePicker::FFLOAD_COLLADA)
// </FS:CR>
: LLFilePickerThread(LLFilePicker::FFLOAD_COLLADA)
{
mMP = mp;
mLOD = lod;
@ -1299,7 +1296,7 @@ LLModelPreview::~LLModelPreview()
// WS: Mark the preview avatar as dead, when the floater closes. Prevents memleak!
mPreviewAvatar->markDead();
//*HACK : *TODO : turn this back on when we understand why this crashes
//glodShutdown();
}
@ -1661,6 +1658,34 @@ void LLModelPreview::rebuildUploadData()
}
}
for (U32 lod = 0; lod < LLModel::NUM_LODS-1; lod++)
{
// Search for models that are not included into upload data
// If we found any, that means something we loaded is not a sub-model.
for (U32 model_ind = 0; model_ind < mModel[lod].size(); ++model_ind)
{
bool found_model = false;
for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter)
{
LLModelInstance& instance = *iter;
if (instance.mLOD[lod] == mModel[lod][model_ind])
{
found_model = true;
break;
}
}
if (!found_model && mModel[lod][model_ind] && !mModel[lod][model_ind]->mSubmodelID)
{
if (importerDebug)
{
LL_INFOS() << "Model " << mModel[lod][model_ind]->mLabel << " was not used - mismatching lod models." << LL_ENDL;
}
setLoadState( LLModelLoader::ERROR_MATERIALS );
mFMP->childDisable( "calculate_btn" );
}
}
}
// <FS:AW> OpenSim limits
//F32 max_import_scale = (DEFAULT_MAX_PRIM_SCALE-0.1f)/max_scale;
F32 region_max_prim_scale = LLWorld::getInstance()->getRegionMaxPrimScale();
@ -3516,6 +3541,75 @@ U32 LLModelPreview::loadTextures(LLImportMaterial& material,void* opaque)
return 0;
}
//static
U32 LLModelPreview::countRootModels(LLModelLoader::model_list models)
{
U32 root_models = 0;
model_list::iterator model_iter = models.begin();
while (model_iter != models.end())
{
LLModel* mdl = *model_iter;
if (mdl && mdl->mSubmodelID == 0)
{
root_models++;
}
model_iter++;
}
return root_models;
}
void LLModelPreview::loadedCallback(
LLModelLoader::scene& scene,
LLModelLoader::model_list& model_list,
S32 lod,
void* opaque)
{
LLModelPreview* pPreview = static_cast< LLModelPreview* >(opaque);
if (pPreview && !LLModelPreview::sIgnoreLoadedCallback)
{
pPreview->loadModelCallback(lod);
}
}
void LLModelPreview::stateChangedCallback(U32 state,void* opaque)
{
LLModelPreview* pPreview = static_cast< LLModelPreview* >(opaque);
if (pPreview)
{
pPreview->setLoadState(state);
}
}
LLJoint* LLModelPreview::lookupJointByName(const std::string& str, void* opaque)
{
LLModelPreview* pPreview = static_cast< LLModelPreview* >(opaque);
if (pPreview)
{
return pPreview->getPreviewAvatar()->getJoint(str);
}
return NULL;
}
U32 LLModelPreview::loadTextures(LLImportMaterial& material,void* opaque)
{
(void)opaque;
if (material.mDiffuseMapFilename.size())
{
material.mOpaqueData = new LLPointer< LLViewerFetchedTexture >;
LLPointer< LLViewerFetchedTexture >& tex = (*reinterpret_cast< LLPointer< LLViewerFetchedTexture > * >(material.mOpaqueData));
tex = LLViewerTextureManager::getFetchedTextureFromUrl("file://" + material.mDiffuseMapFilename, FTT_LOCAL_FILE, TRUE, LLGLTexture::BOOST_PREVIEW);
tex->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, TRUE, FALSE, opaque, NULL, FALSE);
tex->forceToSaveRawImage(0, F32_MAX);
material.setDiffuseMap(tex->getID()); // record tex ID
return 1;
}
material.mOpaqueData = NULL;
return 0;
}
void LLModelPreview::addEmptyFace( LLModel* pTarget )
{
U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0;
@ -4177,7 +4271,6 @@ BOOL LLModelPreview::render()
{
mTextureSet.insert(tex);
}
} else // <FS:ND> FIRE-13465 Make sure there's a material set before dereferencing it, if none, set buffer type and unbind texture.
{

View File

@ -3510,7 +3510,6 @@ void LLMeshRepository::notifyLoadedMeshes()
REQUEST2_LOW_WATER_MAX);
}
//clean up completed upload threads
for (std::vector<LLMeshUploadThread*>::iterator iter = mUploads.begin(); iter != mUploads.end(); )
{

View File

@ -1296,7 +1296,6 @@ class LinuxManifest(ViewerManifest):
# plugins
if self.prefix(src="", dst="bin/llplugin"):
#self.path2basename("../media_plugins/webkit", "libmedia_plugin_webkit.so")
self.path("../media_plugins/gstreamer010/libmedia_plugin_gstreamer010.so", "libmedia_plugin_gstreamer.so")
self.path( "../media_plugins/cef/libmedia_plugin_cef.so", "libmedia_plugin_cef.so" )
self.end_prefix("bin/llplugin")
@ -1606,37 +1605,6 @@ class Linux_i686_Manifest(LinuxManifest):
self.path("libvivoxplatform.so")
self.end_prefix("lib")
# plugin runtime
if self.prefix(src=os.path.join(pkgdir, "lib"), dst="lib"):
self.path("libQtCore.so*")
self.path("libQtGui.so*")
self.path("libQtNetwork.so*")
self.path("libQtOpenGL.so*")
self.path("libQtSvg.so*")
self.path("libQtWebKit.so*")
self.path("libQtXml.so*")
self.end_prefix("lib")
# For WebKit/Qt plugin runtimes (image format plugins)
if self.prefix(src=os.path.join(pkgdir, "llplugin", "imageformats"),
dst="bin/llplugin/imageformats"):
self.path("libqgif.so")
self.path("libqico.so")
self.path("libqjpeg.so")
self.path("libqmng.so")
self.path("libqsvg.so")
self.path("libqtiff.so")
self.end_prefix("bin/llplugin/imageformats")
# For WebKit/Qt plugin runtimes (codec/character encoding plugins)
if self.prefix(src=os.path.join(pkgdir, "llplugin", "codecs"),
dst="bin/llplugin/codecs"):
self.path("libqcncodecs.so")
self.path("libqjpcodecs.so")
self.path("libqkrcodecs.so")
self.path("libqtwcodecs.so")
self.end_prefix("bin/llplugin/codecs")
self.fs_delete_linux_symbols() # <FS:ND/> Delete old syms
self.strip_binaries()

View File

@ -1,296 +0,0 @@
# -*- cmake -*-
project(llfbconnecttest)
include(00-Common)
include(FindOpenGL)
include(LLCommon)
include(LLPlugin)
include(Linking)
include(LLSharedLibs)
include(PluginAPI)
include(LLImage)
include(LLMath)
include(LLMessage)
include(LLRender)
include(LLWindow)
include(Glut)
include(Glui)
include_directories(
${LLPLUGIN_INCLUDE_DIRS}
${LLCOMMON_INCLUDE_DIRS}
${LLIMAGE_INCLUDE_DIRS}
${LLMATH_INCLUDE_DIRS}
${LLMESSAGE_INCLUDE_DIRS}
${LLRENDER_INCLUDE_DIRS}
${LLWINDOW_INCLUDE_DIRS}
)
if (DARWIN)
include(CMakeFindFrameworks)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
endif (DARWIN)
### llfbconnecttest
set(llfbconnecttest_SOURCE_FILES
llfbconnecttest.cpp
llfbconnecttest.h
bookmarks.txt
)
add_executable(llfbconnecttest
WIN32
MACOSX_BUNDLE
${llfbconnecttest_SOURCE_FILES}
)
set_target_properties(llfbconnecttest
PROPERTIES
WIN32_EXECUTABLE
FALSE
)
target_link_libraries(llfbconnecttest
${GLUT_LIBRARY}
${GLUI_LIBRARY}
${OPENGL_LIBRARIES}
${LLPLUGIN_LIBRARIES}
${LLMESSAGE_LIBRARIES}
${LLCOMMON_LIBRARIES}
${PLUGIN_API_WINDOWS_LIBRARIES}
)
if (DARWIN)
# The testbed needs to use a couple of CoreFoundation calls now, to deal with being a bundled app.
target_link_libraries(llfbconnecttest
${COREFOUNDATION_LIBRARY}
)
endif (DARWIN)
add_dependencies(llfbconnecttest
stage_third_party_libs
SLPlugin
media_plugin_webkit
${LLPLUGIN_LIBRARIES}
${LLMESSAGE_LIBRARIES}
${LLCOMMON_LIBRARIES}
)
# turn off weird GLUI pragma
add_definitions(-DGLUI_NO_LIB_PRAGMA)
if (DARWIN OR LINUX)
# glui.h contains code that triggers the "overloaded-virtual" warning in gcc.
set_source_files_properties(llfbconnecttest.cpp PROPERTIES COMPILE_FLAGS "-Wno-overloaded-virtual")
endif (DARWIN OR LINUX)
# Gather build products of the various dependencies into the build directory for the testbed.
if (DARWIN)
# path inside the app bundle where we'll need to copy plugins and other related files
set(PLUGINS_DESTINATION_DIR
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llfbconnecttest.app/Contents/Resources
)
# create the Contents/Resources directory
add_custom_command(
TARGET llfbconnecttest POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS
-E
make_directory
${PLUGINS_DESTINATION_DIR}
COMMENT "Creating Resources directory in app bundle."
)
else (DARWIN)
set(PLUGINS_DESTINATION_DIR
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
)
endif (DARWIN)
set(BUILT_SLPLUGIN $<TARGET_FILE:SLPlugin>)
add_custom_command(TARGET llfbconnecttest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_SLPLUGIN} ${PLUGINS_DESTINATION_DIR}
DEPENDS ${BUILT_SLPLUGIN}
)
set(BUILT_LLCOMMON $<TARGET_FILE:llcommon>)
add_custom_command(TARGET llfbconnecttest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_LLCOMMON} ${PLUGINS_DESTINATION_DIR}
DEPENDS ${BUILT_LLCOMMON}
)
set(BUILT_WEBKIT_PLUGIN $<TARGET_FILE:media_plugin_webkit>)
add_custom_command(TARGET llfbconnecttest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_WEBKIT_PLUGIN} ${PLUGINS_DESTINATION_DIR}
DEPENDS ${BUILT_WEBKIT_PLUGIN}
)
# copy over bookmarks file if llfbconnecttest gets built
set(BUILT_LLFBCONNECTTEST $<TARGET_FILE:llfbconnecttest>)
add_custom_command(TARGET llfbconnecttest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bookmarks.txt ${CMAKE_CURRENT_BINARY_DIR}/
DEPENDS ${BUILT_LLFBCONNECTTEST}
)
# also copy it to the same place as SLPlugin, which is what the mac wants...
add_custom_command(TARGET llfbconnecttest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bookmarks.txt ${PLUGINS_DESTINATION_DIR}
DEPENDS ${BUILT_LLFBCONNECTTEST}
)
if(WINDOWS)
#********************
# Plugin test library deploy
#
# Debug config runtime files required for the FB connect test
set(fbconnecttest_debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}")
set(fbconnecttest_debug_files
libeay32.dll
libglib-2.0-0.dll
libgmodule-2.0-0.dll
libgobject-2.0-0.dll
libgthread-2.0-0.dll
qtcored4.dll
qtguid4.dll
qtnetworkd4.dll
qtopengld4.dll
qtwebkitd4.dll
ssleay32.dll
)
copy_if_different(
${fbconnecttest_debug_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/Debug"
out_targets
${fbconnecttest_debug_files}
)
set(fbconnect_test_targets ${fbconnect_test_targets} ${out_targets})
# Debug config runtime files required for the FB connect test (Qt image format plugins)
set(fbconecttest_debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}/imageformats")
set(fbconecttest_debug_files
qgifd4.dll
qicod4.dll
qjpegd4.dll
qmngd4.dll
qsvgd4.dll
qtiffd4.dll
)
copy_if_different(
${fbconecttest_debug_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/Debug/imageformats"
out_targets
${fbconecttest_debug_files}
)
set(fbconnect_test_targets ${fbconnect_test_targets} ${out_targets})
# Debug config runtime files required for the FB connect test (Qt codec plugins)
set(fbconnecttest_debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}/codecs")
set(fbconnecttest_debug_files
qcncodecsd4.dll
qjpcodecsd4.dll
qkrcodecsd4.dll
qtwcodecsd4.dll
)
copy_if_different(
${fbconnecttest_debug_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/Debug/codecs"
out_targets
${fbconnecttest_debug_files}
)
set(fbconnect_test_targets ${fbconnect_test_targets} ${out_targets})
# Release & ReleaseDebInfo config runtime files required for the FB connect test
set(fbconnecttest_release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
set(fbconnecttest_release_files
libeay32.dll
libglib-2.0-0.dll
libgmodule-2.0-0.dll
libgobject-2.0-0.dll
libgthread-2.0-0.dll
qtcore4.dll
qtgui4.dll
qtnetwork4.dll
qtopengl4.dll
qtwebkit4.dll
qtxmlpatterns4.dll
ssleay32.dll
)
copy_if_different(
${fbconnecttest_release_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/Release"
out_targets
${fbconnecttest_release_files}
)
set(fbconnect_test_targets ${fbconnect_test_targets} ${out_targets})
copy_if_different(
${fbconnecttest_release_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo"
out_targets
${fbconnecttest_release_files}
)
set(fbconnect_test_targets ${fbconnect_test_targets} ${out_targets})
# Release & ReleaseDebInfo config runtime files required for the FB connect test (Qt image format plugins)
set(fbconnecttest_release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}/imageformats")
set(fbconnecttest_release_files
qgif4.dll
qico4.dll
qjpeg4.dll
qmng4.dll
qsvg4.dll
qtiff4.dll
)
copy_if_different(
${fbconnecttest_release_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/Release/imageformats"
out_targets
${fbconnecttest_release_files}
)
set(fbconnect_test_targets ${fbconnect_test_targets} ${out_targets})
copy_if_different(
${fbconnecttest_release_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/imageformats"
out_targets
${fbconnecttest_release_files}
)
set(fbconnect_test_targets ${fbconnect_test_targets} ${out_targets})
# Release & ReleaseDebInfo config runtime files required for the FB connect test (Qt codec plugins)
set(fbconnecttest_release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}/codecs")
set(fbconnecttest_release_files
qcncodecs4.dll
qjpcodecs4.dll
qkrcodecs4.dll
qtwcodecs4.dll
)
copy_if_different(
${fbconnecttest_release_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/Release/codecs"
out_targets
${fbconnecttest_release_files}
)
set(fbconnect_test_targets ${fbconnect_test_targets} ${out_targets})
copy_if_different(
${fbconnecttest_release_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/codecs"
out_targets
${fbconnecttest_release_files}
)
set(fbconnect_test_targets ${fbconnect_test_targets} ${out_targets})
add_custom_target(copy_fbconnecttest_libs ALL
DEPENDS
${fbconnect_test_targets}
)
add_dependencies(llfbconnecttest copy_fbconnecttest_libs)
endif(WINDOWS)
ll_deploy_sharedlibs_command(llfbconnecttest)

View File

@ -1,20 +0,0 @@
1. Description
Exercises SLPlugin. Specific functions and goals aren't clear
from the source.
2. Running
2.1 Mac
Make certain '.' is included in PATH. E.g.:
PATH=.:"$PATH" open build-darwin-i386/test_apps/llfbconnecttest/RelWithDebInfo/llfbconnecttest.app
Otherwise the program won't find SLPlugin and will timeout and
fail after 30 seconds and give you little information as to why.
Running 'dtruss' on plugin test applications will give you a great
deal of insight into why they aren't activating.

View File

@ -1,4 +0,0 @@
# format is description, url (don't put ',' chars in description :)
# if no ',' found, whole line is used for both description and url
Google Home Page,http://www.google.com
Facebook Home Page,http://www.facebook.com

File diff suppressed because it is too large Load Diff

View File

@ -1,173 +0,0 @@
/**
* @file LLFBConnectTest.cpp
* @brief Facebook Connect Test App
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_FB_CONNECT_H
#define LL_FB_CONNECT_H
#include <vector>
#include <string>
#include "llpluginclassmedia.h"
#include "llgl.h"
// Forward declarations
class GLUI_Rotation;
class GLUI_Translation;
class GLUI_Listbox;
class GLUI_EditText;
class GLUI_StaticText;
class GLUI;
class GLUI_Button;
////////////////////////////////////////////////////////////////////////////////
//
struct mediaPanel
{
public:
mediaPanel();
~mediaPanel();
int mId;
std::string mStartUrl;
std::string mMimeType;
std::string mTarget;
LLPluginClassMedia *mMediaSource;
int mMediaWidth;
int mMediaHeight;
int mTextureWidth;
int mTextureHeight;
double mTextureScaleX;
double mTextureScaleY;
GLuint mMediaTextureHandle;
GLuint mPickTextureHandle;
unsigned char* mPickTexturePixels;
bool mAppTextureCoordsOpenGL;
bool mReadyToRender;
};
////////////////////////////////////////////////////////////////////////////////
//
class LLFBConnectTest : public LLPluginClassMediaOwner
{
public:
LLFBConnectTest( int app_window, int window_width, int window_height );
~LLFBConnectTest();
void reshape( int width, int height );
void display();
void idle();
void gluiCallback( int control_id );
void keyboard( int key );
void mousePassive( int x, int y );
void mouseButton( int button, int state, int x, int y );
void mouseMove( int x, int y );
void bindTexture(GLuint texture, GLint row_length = 0, GLint alignment = 1);
bool checkGLError(const char *name = "OpenGL");
void drawGeometry( int panel, bool selected );
void startPanelHighlight( float red, float green, float blue, float line_width );
void endPanelHighlight();
enum { DrawTypePickTexture, DrawTypeMediaTexture };
void draw( int draw_type );
void windowPosToTexturePos( int window_x, int window_y, int& media_x, int& media_y, int& id );
mediaPanel* addMediaPanel( std::string url );
void updateMediaPanel( mediaPanel* panel );
void remMediaPanel( mediaPanel* panel );
mediaPanel* replaceMediaPanel( mediaPanel* panel, std::string url );
void getRandomMediaSize( int& width, int& height, std::string mime_type );
void navigateToNewURI( std::string uri );
void initUrlHistory( std::string uri );
void selectPanelById( int id );
void selectPanel( mediaPanel* panel );
mediaPanel* findMediaPanel( LLPluginClassMedia* panel );
mediaPanel* findMediaPanel( const std::string &target_name );
void makePickTexture( int id, GLuint* texture_handle, unsigned char** texture_pixels );
void makeChrome();
void resetView();
void dumpPanelInfo();
void updateStatusBar();
GLfloat distanceToCamera( GLfloat point_x, GLfloat point_y, GLfloat point_z );
// Inherited from LLPluginClassMediaOwner
/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, LLPluginClassMediaOwner::EMediaEvent);
private:
const int mVersionMajor;
const int mVersionMinor;
const int mVersionPatch;
const int mMaxPanels;
int mAppWindow;
int mWindowWidth;
int mWindowHeight;
int mCurMouseX;
int mCurMouseY;
unsigned char mPixelReadColor[ 3 ];
bool mFuzzyMedia;
const std::string mHomeWebUrl;
std::vector< mediaPanel* > mMediaPanels;
mediaPanel* mSelectedPanel;
std::string mimeTypeFromUrl( std::string& url );
std::string pluginNameFromMimeType( std::string& mime_type );
GLUI_Rotation* mViewRotationCtrl;
GLUI_Translation* mViewScaleCtrl;
GLUI_Translation* mViewTranslationCtrl;
float mViewportAspect;
float mViewPos[ 3 ];
float mViewRotation[ 16 ];
float mDistanceCameraToSelectedGeometry;
std::vector< std::pair< std::string, std::string > > mBookmarks;
GLUI_Listbox* mBookmarkList;
int mIdBookmarks;
int mIdUrlEdit;
GLUI_EditText* mUrlEdit;
int mSelBookmark;
int mIdControlExitApp;
GLUI* mGluiMediaBrowserControlWindow;
int mIdMediaBrowserControlBack;
GLUI_Button* mMediaBrowserControlBackButton;
int mIdMediaBrowserControlStop;
int mIdMediaBrowserControlForward;
GLUI_Button* mMediaBrowserControlForwardButton;
bool mGluiMediaBrowserControlWindowFlag;
bool mMediaBrowserControlBackButtonFlag;
bool mMediaBrowserControlForwardButtonFlag;
int mIdMediaBrowserControlHome;
int mIdMediaBrowserControlReload;
GLUI* mBottomGLUIWindow;
GLUI_StaticText* mStatusText;
};
#endif // LL_FB_CONNECT_H

View File

@ -254,138 +254,8 @@ endif (DARWIN)
# )
#endif (DARWIN)
### llmediaplugintest
set(llmediaplugintest_SOURCE_FILES
llmediaplugintest.cpp
llmediaplugintest.h
bookmarks.txt
)
add_executable(llmediaplugintest
WIN32
MACOSX_BUNDLE
${llmediaplugintest_SOURCE_FILES}
)
set_target_properties(llmediaplugintest
PROPERTIES
WIN32_EXECUTABLE
FALSE
)
target_link_libraries(llmediaplugintest
${GLUT_LIBRARY}
${GLUI_LIBRARY}
${OPENGL_LIBRARIES}
${LLPLUGIN_LIBRARIES}
${LLMESSAGE_LIBRARIES}
${LLCOMMON_LIBRARIES}
${PLUGIN_API_WINDOWS_LIBRARIES}
)
if (DARWIN)
# The testbed needs to use a couple of CoreFoundation calls now, to deal with being a bundled app.
target_link_libraries(llmediaplugintest
${COREFOUNDATION_LIBRARY}
)
endif (DARWIN)
add_dependencies(llmediaplugintest
stage_third_party_libs
SLPlugin
media_plugin_quicktime
media_plugin_webkit
media_plugin_example
${LLPLUGIN_LIBRARIES}
${LLMESSAGE_LIBRARIES}
${LLCOMMON_LIBRARIES}
)
# turn off weird GLUI pragma
add_definitions(-DGLUI_NO_LIB_PRAGMA)
if (DARWIN OR LINUX)
# glui.h contains code that triggers the "overloaded-virtual" warning in gcc.
set_source_files_properties(llmediaplugintest.cpp PROPERTIES COMPILE_FLAGS "-Wno-overloaded-virtual")
endif (DARWIN OR LINUX)
# Gather build products of the various dependencies into the build directory for the testbed.
if (DARWIN)
# path inside the app bundle where we'll need to copy plugins and other related files
set(PLUGINS_DESTINATION_DIR
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llmediaplugintest.app/Contents/Resources
)
# create the Contents/Resources directory
add_custom_command(
TARGET llmediaplugintest POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS
-E
make_directory
${PLUGINS_DESTINATION_DIR}
COMMENT "Creating Resources directory in app bundle."
)
else (DARWIN)
set(PLUGINS_DESTINATION_DIR
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/
)
endif (DARWIN)
set(BUILT_SLPLUGIN $<TARGET_FILE:SLPlugin>)
add_custom_command(TARGET llmediaplugintest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_SLPLUGIN} ${PLUGINS_DESTINATION_DIR}
DEPENDS ${BUILT_SLPLUGIN}
)
set(BUILT_LLCOMMON $<TARGET_FILE:llcommon>)
add_custom_command(TARGET llmediaplugintest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_LLCOMMON} ${PLUGINS_DESTINATION_DIR}
DEPENDS ${BUILT_LLCOMMON}
)
set(BUILT_WEBKIT_PLUGIN $<TARGET_FILE:media_plugin_webkit>)
add_custom_command(TARGET llmediaplugintest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_WEBKIT_PLUGIN} ${PLUGINS_DESTINATION_DIR}
DEPENDS ${BUILT_WEBKIT_PLUGIN}
)
if (DARWIN OR WINDOWS)
set(BUILT_QUICKTIME_PLUGIN $<TARGET_FILE:media_plugin_quicktime>)
add_custom_command(TARGET llmediaplugintest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_QUICKTIME_PLUGIN} ${PLUGINS_DESTINATION_DIR}
DEPENDS ${BUILT_QUICKTIME_PLUGIN}
)
endif (DARWIN OR WINDOWS)
set(BUILT_EXAMPLE_PLUGIN $<TARGET_FILE:media_plugin_example>)
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
set(BUILT_LLMEDIAPLUGINTEST $<TARGET_FILE:llmediaplugintest>)
add_custom_command(TARGET llmediaplugintest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bookmarks.txt ${CMAKE_CURRENT_BINARY_DIR}/
DEPENDS ${BUILT_LLMEDIAPLUGINTEST}
)
# also copy it to the same place as SLPlugin, which is what the mac wants...
add_custom_command(TARGET llmediaplugintest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/bookmarks.txt ${PLUGINS_DESTINATION_DIR}
DEPENDS ${BUILT_LLMEDIAPLUGINTEST}
)
if (DARWIN)
add_custom_command(TARGET llmediaplugintest POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${ARCH_PREBUILT_DIRS_RELEASE}/libllqtwebkit.dylib ${PLUGINS_DESTINATION_DIR}
DEPENDS ${ARCH_PREBUILT_DIRS_RELEASE}/libllqtwebkit.dylib
)
endif (DARWIN)
if(WINDOWS)
#********************
# Plugin test library deploy
@ -398,11 +268,6 @@ if(WINDOWS)
libgmodule-2.0-0.dll
libgobject-2.0-0.dll
libgthread-2.0-0.dll
qtcored4.dll
qtguid4.dll
qtnetworkd4.dll
qtopengld4.dll
qtwebkitd4.dll
ssleay32.dll
)
copy_if_different(
@ -413,40 +278,6 @@ if(WINDOWS)
)
set(plugin_test_targets ${plugin_test_targets} ${out_targets})
# Debug config runtime files required for the plugin test mule (Qt image format plugins)
set(plugintest_debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}/imageformats")
set(plugintest_debug_files
qgifd4.dll
qicod4.dll
qjpegd4.dll
qmngd4.dll
qsvgd4.dll
qtiffd4.dll
)
copy_if_different(
${plugintest_debug_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/Debug/imageformats"
out_targets
${plugintest_debug_files}
)
set(plugin_test_targets ${plugin_test_targets} ${out_targets})
# Debug config runtime files required for the plugin test mule (Qt codec plugins)
set(plugintest_debug_src_dir "${ARCH_PREBUILT_DIRS_DEBUG}/codecs")
set(plugintest_debug_files
qcncodecsd4.dll
qjpcodecsd4.dll
qkrcodecsd4.dll
qtwcodecsd4.dll
)
copy_if_different(
${plugintest_debug_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/Debug/codecs"
out_targets
${plugintest_debug_files}
)
set(plugin_test_targets ${plugin_test_targets} ${out_targets})
# Release & ReleaseDebInfo config runtime files required for the plugin test mule
set(plugintest_release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}")
set(plugintest_release_files
@ -455,12 +286,6 @@ if(WINDOWS)
libgmodule-2.0-0.dll
libgobject-2.0-0.dll
libgthread-2.0-0.dll
qtcore4.dll
qtgui4.dll
qtnetwork4.dll
qtopengl4.dll
qtwebkit4.dll
qtxmlpatterns4.dll
ssleay32.dll
)
copy_if_different(
@ -479,63 +304,22 @@ if(WINDOWS)
)
set(plugin_test_targets ${plugin_test_targets} ${out_targets})
# Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt image format plugins)
set(plugintest_release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}/imageformats")
set(plugintest_release_files
qgif4.dll
qico4.dll
qjpeg4.dll
qmng4.dll
qsvg4.dll
qtiff4.dll
)
copy_if_different(
${plugintest_release_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/Release/imageformats"
out_targets
${plugintest_release_files}
)
set(plugin_test_targets ${plugin_test_targets} ${out_targets})
copy_if_different(
${plugintest_release_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/imageformats"
out_targets
${plugintest_release_files}
)
set(plugin_test_targets ${plugin_test_targets} ${out_targets})
# Release & ReleaseDebInfo config runtime files required for the plugin test mule (Qt codec plugins)
set(plugintest_release_src_dir "${ARCH_PREBUILT_DIRS_RELEASE}/codecs")
set(plugintest_release_files
qcncodecs4.dll
qjpcodecs4.dll
qkrcodecs4.dll
qtwcodecs4.dll
)
copy_if_different(
${plugintest_release_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/Release/codecs"
out_targets
${plugintest_release_files}
)
set(plugin_test_targets ${plugin_test_targets} ${out_targets})
copy_if_different(
${plugintest_release_src_dir}
"${CMAKE_CURRENT_BINARY_DIR}/RelWithDebInfo/codecs"
out_targets
${plugintest_release_files}
)
set(plugin_test_targets ${plugin_test_targets} ${out_targets})
add_custom_target(copy_plugintest_libs ALL
DEPENDS
${plugin_test_targets}
)
add_dependencies(llmediaplugintest copy_plugintest_libs)
endif(WINDOWS)
ll_deploy_sharedlibs_command(llmediaplugintest)
out_targets
${plugintest_release_files}
)
set(plugin_test_targets ${plugin_test_targets} ${out_targets})
add_custom_target(copy_plugintest_libs ALL
DEPENDS
${plugin_test_targets}
)
endif (DARWIN)

File diff suppressed because it is too large Load Diff

View File

@ -1,207 +0,0 @@
/**
* @file LLMediaPluginTest.cpp
* @brief Primary test application for LLMedia (Separate Process) Plugin system
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_MEDIA_PLUGIN_TEST_H
#define LL_MEDIA_PLUGIN_TEST_H
#include <vector>
#include <string>
#include "llpluginclassmedia.h"
#include "llgl.h"
// Forward declarations
class GLUI_Rotation;
class GLUI_Translation;
class GLUI_Listbox;
class GLUI_EditText;
class GLUI_StaticText;
class GLUI;
class GLUI_Button;
////////////////////////////////////////////////////////////////////////////////
//
struct mediaPanel
{
public:
mediaPanel();
~mediaPanel();
int mId;
std::string mStartUrl;
std::string mMimeType;
std::string mTarget;
LLPluginClassMedia *mMediaSource;
int mMediaWidth;
int mMediaHeight;
int mTextureWidth;
int mTextureHeight;
double mTextureScaleX;
double mTextureScaleY;
GLuint mMediaTextureHandle;
GLuint mPickTextureHandle;
unsigned char* mPickTexturePixels;
bool mAppTextureCoordsOpenGL;
bool mReadyToRender;
};
////////////////////////////////////////////////////////////////////////////////
//
class LLMediaPluginTest : public LLPluginClassMediaOwner
{
public:
LLMediaPluginTest( int app_window, int window_width, int window_height );
~LLMediaPluginTest();
void reshape( int width, int height );
void display();
void idle();
void gluiCallback( int control_id );
void keyboard( int key );
void mousePassive( int x, int y );
void mouseButton( int button, int state, int x, int y );
void mouseMove( int x, int y );
void bindTexture(GLuint texture, GLint row_length = 0, GLint alignment = 1);
bool checkGLError(const char *name = "OpenGL");
void drawGeometry( int panel, bool selected );
void startPanelHighlight( float red, float green, float blue, float line_width );
void endPanelHighlight();
enum { DrawTypePickTexture, DrawTypeMediaTexture };
void draw( int draw_type );
void windowPosToTexturePos( int window_x, int window_y, int& media_x, int& media_y, int& id );
mediaPanel* addMediaPanel( std::string url );
void updateMediaPanel( mediaPanel* panel );
void remMediaPanel( mediaPanel* panel );
mediaPanel* replaceMediaPanel( mediaPanel* panel, std::string url );
void getRandomMediaSize( int& width, int& height, std::string mime_type );
void navigateToNewURI( std::string uri );
void initUrlHistory( std::string uri );
void selectPanelById( int id );
void selectPanel( mediaPanel* panel );
mediaPanel* findMediaPanel( LLPluginClassMedia* panel );
mediaPanel* findMediaPanel( const std::string &target_name );
void makePickTexture( int id, GLuint* texture_handle, unsigned char** texture_pixels );
void makeChrome();
void resetView();
void dumpPanelInfo();
void updateStatusBar();
GLfloat distanceToCamera( GLfloat point_x, GLfloat point_y, GLfloat point_z );
// Inherited from LLPluginClassMediaOwner
/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, LLPluginClassMediaOwner::EMediaEvent);
private:
const int mVersionMajor;
const int mVersionMinor;
const int mVersionPatch;
const int mMaxPanels;
int mAppWindow;
int mWindowWidth;
int mWindowHeight;
int mCurMouseX;
int mCurMouseY;
unsigned char mPixelReadColor[ 3 ];
bool mFuzzyMedia;
const std::string mHomeWebUrl;
std::vector< mediaPanel* > mMediaPanels;
mediaPanel* mSelectedPanel;
std::string mimeTypeFromUrl( std::string& url );
std::string pluginNameFromMimeType( std::string& mime_type );
GLUI_Rotation* mViewRotationCtrl;
GLUI_Translation* mViewScaleCtrl;
GLUI_Translation* mViewTranslationCtrl;
float mViewportAspect;
float mViewPos[ 3 ];
float mViewRotation[ 16 ];
float mDistanceCameraToSelectedGeometry;
int mIdControlAddPanel;
int mIdControlRemPanel;
std::vector< std::pair< std::string, std::string > > mBookmarks;
GLUI_Listbox* mBookmarkList;
int mIdBookmarks;
int mIdUrlEdit;
GLUI_EditText* mUrlEdit;
int mIdUrlInitHistoryEdit;
GLUI_EditText* mUrlInitHistoryEdit;
int mSelBookmark;
int mIdRandomPanelCount;
int mRandomPanelCount;
int mIdRandomBookmarks;
int mRandomBookmarks;
int mIdDisableTimeout;
int mDisableTimeout;
int mIdUsePluginReadThread;
int mUsePluginReadThread;
int mIdLargePanelSpacing;
int mLargePanelSpacing;
int mIdControlCrashPlugin;
int mIdControlHangPlugin;
int mIdControlExitApp;
GLUI* mGluiMediaTimeControlWindow;
int mIdMediaTimeControlPlay;
int mIdMediaTimeControlLoop;
int mIdMediaTimeControlPause;
int mIdMediaTimeControlStop;
int mIdMediaTimeControlSeek;
int mIdMediaTimeControlVolume;
int mMediaTimeControlVolume;
int mIdMediaTimeControlSeekSeconds;
int mMediaTimeControlSeekSeconds;
int mIdMediaTimeControlRewind;
int mIdMediaTimeControlFastForward;
GLUI* mGluiMediaBrowserControlWindow;
int mIdMediaBrowserControlBack;
GLUI_Button* mMediaBrowserControlBackButton;
int mIdMediaBrowserControlStop;
int mIdMediaBrowserControlForward;
GLUI_Button* mMediaBrowserControlForwardButton;
bool mGluiMediaTimeControlWindowFlag;
bool mGluiMediaBrowserControlWindowFlag;
bool mMediaBrowserControlBackButtonFlag;
bool mMediaBrowserControlForwardButtonFlag;
int mIdMediaBrowserControlHome;
int mIdMediaBrowserControlReload;
int mIdMediaBrowserControlClearCache;
int mIdMediaBrowserControlClearCookies;
int mIdMediaBrowserControlEnableCookies;
int mMediaBrowserControlEnableCookies;
GLUI* mBottomGLUIWindow;
GLUI_StaticText* mStatusText;
};
#endif // LL_MEDIA_PLUGIN_TEST_H