Split plugin classes and derive AIFilePicker from BasicPluginBase (part 4).
Add back fixes that were in Singularity (in indra/media_plugins) but not in imprudence. Also: Add "shutdown" plugin message and terminate file picker plugins cleanly. The DSO (libbasic_plugin_filepicker.so) now tells the child process / plugin loader (SLPlugin) to terminate (using the 'shutdown' message), and AIFilePicker::finish_impl destroys the plugin object on the viewer side when it's ... finished thus. Also added a large comment that gives an overview of all classes involved on the viewer side. Additional fixes for filepicker. Plugin refactor bug fix: mDeleteMe was uninitialized in AIPluginFilePicker.
This commit is contained in:
@@ -113,6 +113,9 @@ protected:
|
|||||||
// Inherited from LLPluginProcessParentOwner.
|
// Inherited from LLPluginProcessParentOwner.
|
||||||
/*virtual*/ void receivePluginMessage(LLPluginMessage const&);
|
/*virtual*/ void receivePluginMessage(LLPluginMessage const&);
|
||||||
|
|
||||||
|
// Inherited from LLPluginProcessParentOwner.
|
||||||
|
/*virtual*/ void receivedShutdown() { mPlugin->exitState(); }
|
||||||
|
|
||||||
//--------------------------------------
|
//--------------------------------------
|
||||||
// Debug use only
|
// Debug use only
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -553,6 +553,15 @@ void LLPluginProcessChild::receivePluginMessage(const std::string &message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (message_class == LLPLUGIN_MESSAGE_CLASS_INTERNAL)
|
||||||
|
{
|
||||||
|
std::string message_name = parsed.getName();
|
||||||
|
if(message_name == "shutdown")
|
||||||
|
{
|
||||||
|
// The plugin is finished.
|
||||||
|
setState(STATE_UNLOADING);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(passMessage)
|
if(passMessage)
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ private:
|
|||||||
STATE_PLUGIN_LOADED, // plugin library has been loaded
|
STATE_PLUGIN_LOADED, // plugin library has been loaded
|
||||||
STATE_PLUGIN_INITIALIZING, // plugin is processing init message
|
STATE_PLUGIN_INITIALIZING, // plugin is processing init message
|
||||||
STATE_RUNNING, // steady state (processing messages)
|
STATE_RUNNING, // steady state (processing messages)
|
||||||
STATE_UNLOADING, // plugin has sent shutdown_response and needs to be unloaded
|
STATE_UNLOADING, // plugin has sent shutdown and needs to be unloaded
|
||||||
STATE_UNLOADED, // plugin has been unloaded
|
STATE_UNLOADED, // plugin has been unloaded
|
||||||
STATE_ERROR, // generic bailout state
|
STATE_ERROR, // generic bailout state
|
||||||
STATE_DONE // state machine will sit in this state after either error or normal termination.
|
STATE_DONE // state machine will sit in this state after either error or normal termination.
|
||||||
|
|||||||
@@ -1001,6 +1001,11 @@ void LLPluginProcessParent::receiveMessage(const LLPluginMessage &message)
|
|||||||
LL_DEBUGS("Plugin") << "cpu usage reported as " << mCPUUsage << LL_ENDL;
|
LL_DEBUGS("Plugin") << "cpu usage reported as " << mCPUUsage << LL_ENDL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
else if(message_name == "shutdown")
|
||||||
|
{
|
||||||
|
LL_INFOS("Plugin") << "received shutdown message" << LL_ENDL;
|
||||||
|
mOwner->receivedShutdown();
|
||||||
|
}
|
||||||
else if(message_name == "shm_add_response")
|
else if(message_name == "shm_add_response")
|
||||||
{
|
{
|
||||||
// Nothing to do here.
|
// Nothing to do here.
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ public:
|
|||||||
virtual ~LLPluginProcessParentOwner();
|
virtual ~LLPluginProcessParentOwner();
|
||||||
virtual void receivePluginMessage(const LLPluginMessage &message) = 0;
|
virtual void receivePluginMessage(const LLPluginMessage &message) = 0;
|
||||||
virtual bool receivePluginMessageEarly(const LLPluginMessage &message) {return false;};
|
virtual bool receivePluginMessageEarly(const LLPluginMessage &message) {return false;};
|
||||||
|
virtual void receivedShutdown() = 0;
|
||||||
// This will only be called when the plugin has died unexpectedly
|
// This will only be called when the plugin has died unexpectedly
|
||||||
virtual void pluginLaunchFailed() {};
|
virtual void pluginLaunchFailed() {};
|
||||||
virtual void pluginDied() {};
|
virtual void pluginDied() {};
|
||||||
@@ -88,6 +89,9 @@ public:
|
|||||||
// Go to the proper error state
|
// Go to the proper error state
|
||||||
void errorState(void);
|
void errorState(void);
|
||||||
|
|
||||||
|
// Go to exit state.
|
||||||
|
void exitState(void) { setState(STATE_EXITING); }
|
||||||
|
|
||||||
void setSleepTime(F64 sleep_time, bool force_send = false);
|
void setSleepTime(F64 sleep_time, bool force_send = false);
|
||||||
F64 getSleepTime(void) const { return mSleepTime; };
|
F64 getSleepTime(void) const { return mSleepTime; };
|
||||||
|
|
||||||
|
|||||||
@@ -4031,7 +4031,7 @@ void LLViewerWindow::saveImageNumbered(LLPointer<LLImageFormatted> image)
|
|||||||
void LLViewerWindow::saveImageNumbered_filepicker_callback(LLPointer<LLImageFormatted> image, std::string const& extension, AIFilePicker* filepicker, bool success)
|
void LLViewerWindow::saveImageNumbered_filepicker_callback(LLPointer<LLImageFormatted> image, std::string const& extension, AIFilePicker* filepicker, bool success)
|
||||||
{
|
{
|
||||||
llassert((bool)*filepicker == success);
|
llassert((bool)*filepicker == success);
|
||||||
if (success)
|
if (success && !filepicker->isCanceled())
|
||||||
{
|
{
|
||||||
// Copy the directory + file name
|
// Copy the directory + file name
|
||||||
std::string filepath = filepicker->getFilename();
|
std::string filepath = filepicker->getFilename();
|
||||||
@@ -4041,7 +4041,7 @@ void LLViewerWindow::saveImageNumbered_filepicker_callback(LLPointer<LLImageForm
|
|||||||
|
|
||||||
saveImageNumbered_continued(image, extension);
|
saveImageNumbered_continued(image, extension);
|
||||||
}
|
}
|
||||||
delete filepicker;
|
filepicker->deleteMe();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLViewerWindow::saveImageNumbered_continued(LLPointer<LLImageFormatted> image, std::string const& extension)
|
void LLViewerWindow::saveImageNumbered_continued(LLPointer<LLImageFormatted> image, std::string const& extension)
|
||||||
|
|||||||
@@ -314,7 +314,11 @@ void AIFilePicker::abort_impl(void)
|
|||||||
|
|
||||||
void AIFilePicker::finish_impl(void)
|
void AIFilePicker::finish_impl(void)
|
||||||
{
|
{
|
||||||
mPluginManager = NULL; // This deletes the plugin, since mPluginManager is a LLPointer.
|
if (mPluginManager)
|
||||||
|
{
|
||||||
|
mPluginManager->destroyPlugin();
|
||||||
|
mPluginManager = NULL;
|
||||||
|
}
|
||||||
mFilter.clear(); // Check that open is called before calling run (again).
|
mFilter.clear(); // Check that open is called before calling run (again).
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,56 @@ enum ESaveFilter
|
|||||||
FFSAVE_LSL
|
FFSAVE_LSL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
AIFilePicker is an AIStateMachine, that has a LLViewerPluginManager (mPluginManager)
|
||||||
|
to manage a plugin that runs the actual filepicker in a separate process.
|
||||||
|
|
||||||
|
The relationship with the plugin is as follows:
|
||||||
|
|
||||||
|
new AIFilePicker
|
||||||
|
|
||||||
|
AIFilePicker::mPluginManager = new LLViewerPluginManager
|
||||||
|
|
||||||
|
LLPluginProcessParentOwner LLPluginMessagePipeOwner
|
||||||
|
| | LLPluginMessagePipeOwner::mOwner = LLPluginProcessParentOwner
|
||||||
|
| | LLPluginMessagePipeOwner::mMessagePipe = LLPluginMessagePipe
|
||||||
|
| | LLPluginMessagePipeOwner::receiveMessageRaw calls
|
||||||
|
v | LLPluginProcessParent::receiveMessageRaw
|
||||||
|
LLPluginClassBasic v
|
||||||
|
| LLPluginClassBasic::mPlugin = new LLPluginProcessParent ---> new LLPluginMessagePipe
|
||||||
|
| LLPluginProcessParent::mOwner = (LLPluginProcessParentOwner*)LLPluginClassBasic
|
||||||
|
| LLPluginProcessParent::sendMessage calls
|
||||||
|
| LLPluginMessagePipeOwner::writeMessageRaw calls
|
||||||
|
| mMessagePipe->LLPluginMessagePipe::addMessage
|
||||||
|
| LLPluginProcessParent::receiveMessageRaw calls
|
||||||
|
| LLPluginProcessParent::receiveMessage calls
|
||||||
|
| LLPluginProcessParentOwner::receivePluginMessage == AIPluginFilePicker::receivePluginMessage
|
||||||
|
|
|
||||||
|
| LLPluginClassBasic::sendMessage calls mPlugin->LLPluginProcessParent::sendMessage
|
||||||
|
|
|
||||||
|
v
|
||||||
|
LLViewerPluginManager::mPluginBase = new AIPluginFilePicker
|
||||||
|
AIPluginFilePicker::receivePluginMessage calls
|
||||||
|
AIFilePicker::receivePluginMessage
|
||||||
|
|
||||||
|
AIPluginFilePicker::mStateMachine = AIFilePicker
|
||||||
|
|
||||||
|
Where the entry point to send messages to the plugin is LLPluginClassBasic::sendMessage,
|
||||||
|
and the end point for messages received from the plugin is AIFilePicker::receivePluginMessage.
|
||||||
|
|
||||||
|
Termination happens by receiving the "canceled" or "done" message,
|
||||||
|
which sets the state to AIFilePicker_canceled or AIFilePicker_done
|
||||||
|
respectively, causing a call to AIStateMachine::finish(), which calls
|
||||||
|
AIFilePicker::finish_impl which destroys the plugin (mPluginBase)
|
||||||
|
and the plugin manager (mPluginManager).
|
||||||
|
|
||||||
|
AIStateMachine::finish() also calls the registered callback function,
|
||||||
|
which should call AIStateMachine::deleteMe(), causing the AIFilePicker
|
||||||
|
to be deleted.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
// A file picker state machine.
|
// A file picker state machine.
|
||||||
//
|
//
|
||||||
// Before calling run(), call open() to pass needed parameters.
|
// Before calling run(), call open() to pass needed parameters.
|
||||||
@@ -151,7 +201,8 @@ public:
|
|||||||
static std::string launcher_name(void) { return gDirUtilp->getLLPluginLauncher(); }
|
static std::string launcher_name(void) { return gDirUtilp->getLLPluginLauncher(); }
|
||||||
static char const* plugin_basename(void) { return "basic_plugin_filepicker"; }
|
static char const* plugin_basename(void) { return "basic_plugin_filepicker"; }
|
||||||
|
|
||||||
/*virtual*/ void receivePluginMessage(LLPluginMessage const& message) { mStateMachine->receivePluginMessage(message); }
|
/*virtual*/ void receivePluginMessage(LLPluginMessage const& message) { mStateMachine->receivePluginMessage(message); }
|
||||||
|
/*virtual*/ void receivedShutdown(void) { /* Nothing -- we terminate on deletion (from AIStateMachine::mainloop) */ }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AIFilePicker* mStateMachine;
|
AIFilePicker* mStateMachine;
|
||||||
|
|||||||
@@ -46,10 +46,9 @@
|
|||||||
///
|
///
|
||||||
/// @param[in] send_message_function Function for sending messages from plugin to plugin loader shell
|
/// @param[in] send_message_function Function for sending messages from plugin to plugin loader shell
|
||||||
/// @param[in] plugin_instance Message data for messages from plugin to plugin loader shell
|
/// @param[in] plugin_instance Message data for messages from plugin to plugin loader shell
|
||||||
BasicPluginBase::BasicPluginBase(LLPluginInstance::sendMessageFunction send_message_function, LLPluginInstance* plugin_instance)
|
BasicPluginBase::BasicPluginBase(LLPluginInstance::sendMessageFunction send_message_function, LLPluginInstance* plugin_instance) :
|
||||||
|
mPluginInstance(plugin_instance), mSendMessageFunction(send_message_function), mDeleteMe(false)
|
||||||
{
|
{
|
||||||
mSendMessageFunction = send_message_function;
|
|
||||||
mPluginInstance = plugin_instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,6 +78,12 @@ void BasicPluginBase::staticReceiveMessage(char const* message_string, BasicPlug
|
|||||||
// This is the loaded DSO.
|
// This is the loaded DSO.
|
||||||
//
|
//
|
||||||
// Call this function to send 'message' to the viewer.
|
// Call this function to send 'message' to the viewer.
|
||||||
|
// Note: mSendMessageFunction points to LLPluginInstance::staticReceiveMessage, so indirectly this
|
||||||
|
// just calls LLPluginInstance::receiveMessage (mPluginInstance->receiveMessage) where
|
||||||
|
// mPluginInstance is the LLPluginInstance created in LLPluginProcessChild::idle during
|
||||||
|
// state STATE_PLUGIN_LOADING. That function then immediately calls mOwner->receivePluginMessage
|
||||||
|
// which is implemented as LLPluginProcessChild::receivePluginMessage, the same
|
||||||
|
// LLPluginProcessChild object that created the LLPluginInstance.
|
||||||
/**
|
/**
|
||||||
* Send message to plugin loader shell.
|
* Send message to plugin loader shell.
|
||||||
*
|
*
|
||||||
@@ -91,6 +96,17 @@ void BasicPluginBase::sendMessage(const LLPluginMessage &message)
|
|||||||
mSendMessageFunction(output.c_str(), &mPluginInstance);
|
mSendMessageFunction(output.c_str(), &mPluginInstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send shutdown message to the plugin loader shell.
|
||||||
|
*
|
||||||
|
* This will cause the SLPlugin process that loaded this DSO to be terminated.
|
||||||
|
*/
|
||||||
|
void BasicPluginBase::sendShutdownMessage(void)
|
||||||
|
{
|
||||||
|
LLPluginMessage shutdownmessage(LLPLUGIN_MESSAGE_CLASS_INTERNAL, "shutdown");
|
||||||
|
sendMessage(shutdownmessage);
|
||||||
|
}
|
||||||
|
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
# define LLSYMEXPORT __declspec(dllexport)
|
# define LLSYMEXPORT __declspec(dllexport)
|
||||||
#elif LL_LINUX
|
#elif LL_LINUX
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ public:
|
|||||||
// This function is actually called and then calls the member function above.
|
// This function is actually called and then calls the member function above.
|
||||||
static void staticReceiveMessage(char const* message_string, BasicPluginBase** self_ptr);
|
static void staticReceiveMessage(char const* message_string, BasicPluginBase** self_ptr);
|
||||||
|
|
||||||
|
// Shoot down the whole process.
|
||||||
|
void sendShutdownMessage(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void sendMessage(LLPluginMessage const& message);
|
void sendMessage(LLPluginMessage const& message);
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,6 @@
|
|||||||
MediaPluginBase::MediaPluginBase(LLPluginInstance::sendMessageFunction send_message_function, LLPluginInstance* plugin_instance)
|
MediaPluginBase::MediaPluginBase(LLPluginInstance::sendMessageFunction send_message_function, LLPluginInstance* plugin_instance)
|
||||||
: BasicPluginBase(send_message_function, plugin_instance)
|
: BasicPluginBase(send_message_function, plugin_instance)
|
||||||
{
|
{
|
||||||
mDeleteMe = false;
|
|
||||||
mPixels = 0;
|
mPixels = 0;
|
||||||
mWidth = 0;
|
mWidth = 0;
|
||||||
mHeight = 0;
|
mHeight = 0;
|
||||||
|
|||||||
@@ -17,13 +17,13 @@ include_directories(
|
|||||||
|
|
||||||
### basic_plugin_example
|
### basic_plugin_example
|
||||||
|
|
||||||
if(NOT CMAKE_SIZEOF_VOID_P MATCHES 4)
|
if(NOT WORD_SIZE EQUAL 32)
|
||||||
if(WINDOWS)
|
if(WINDOWS)
|
||||||
add_definitions(/FIXED:NO)
|
add_definitions(/FIXED:NO)
|
||||||
else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
|
else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
|
||||||
add_definitions(-fPIC)
|
add_definitions(-fPIC)
|
||||||
endif(WINDOWS)
|
endif(WINDOWS)
|
||||||
endif (NOT CMAKE_SIZEOF_VOID_P MATCHES 4)
|
endif (NOT WORD_SIZE EQUAL 32)
|
||||||
|
|
||||||
set(basic_plugin_example_SOURCE_FILES
|
set(basic_plugin_example_SOURCE_FILES
|
||||||
basic_plugin_example.cpp
|
basic_plugin_example.cpp
|
||||||
|
|||||||
@@ -28,13 +28,13 @@ include_directories(
|
|||||||
|
|
||||||
### media_plugin_example
|
### media_plugin_example
|
||||||
|
|
||||||
if(NOT CMAKE_SIZEOF_VOID_P MATCHES 4)
|
if(NOT WORD_SIZE EQUAL 32)
|
||||||
if(WINDOWS)
|
if(WINDOWS)
|
||||||
add_definitions(/FIXED:NO)
|
add_definitions(/FIXED:NO)
|
||||||
else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
|
else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
|
||||||
add_definitions(-fPIC)
|
add_definitions(-fPIC)
|
||||||
endif(WINDOWS)
|
endif(WINDOWS)
|
||||||
endif (NOT CMAKE_SIZEOF_VOID_P MATCHES 4)
|
endif (NOT WORD_SIZE EQUAL 32)
|
||||||
|
|
||||||
set(media_plugin_example_SOURCE_FILES
|
set(media_plugin_example_SOURCE_FILES
|
||||||
media_plugin_example.cpp
|
media_plugin_example.cpp
|
||||||
|
|||||||
@@ -19,13 +19,13 @@ include_directories(
|
|||||||
|
|
||||||
### basic_plugin_filepicker
|
### basic_plugin_filepicker
|
||||||
|
|
||||||
if(NOT CMAKE_SIZEOF_VOID_P MATCHES 4)
|
if(NOT WORD_SIZE EQUAL 32)
|
||||||
if(WINDOWS)
|
if(WINDOWS)
|
||||||
add_definitions(/FIXED:NO)
|
add_definitions(/FIXED:NO)
|
||||||
else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
|
else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
|
||||||
add_definitions(-fPIC)
|
add_definitions(-fPIC)
|
||||||
endif(WINDOWS)
|
endif(WINDOWS)
|
||||||
endif (NOT CMAKE_SIZEOF_VOID_P MATCHES 4)
|
endif (NOT WORD_SIZE EQUAL 32)
|
||||||
|
|
||||||
set(basic_plugin_filepicker_SOURCE_FILES
|
set(basic_plugin_filepicker_SOURCE_FILES
|
||||||
basic_plugin_filepicker.cpp
|
basic_plugin_filepicker.cpp
|
||||||
|
|||||||
@@ -150,6 +150,10 @@ void FilepickerPlugin::receiveMessage(char const* message_string)
|
|||||||
message.setValue("plugin_version", plugin_version);
|
message.setValue("plugin_version", plugin_version);
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
else if (message_name == "cleanup")
|
||||||
|
{
|
||||||
|
// We have no resources that need care. Just do nothing.
|
||||||
|
}
|
||||||
else if (message_name == "idle")
|
else if (message_name == "idle")
|
||||||
{
|
{
|
||||||
// This whole message should not have existed imho -- Aleric
|
// This whole message should not have existed imho -- Aleric
|
||||||
@@ -213,6 +217,8 @@ void FilepickerPlugin::receiveMessage(char const* message_string)
|
|||||||
message.setValueLLSD("filenames", filenames);
|
message.setValueLLSD("filenames", filenames);
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
// We're done. Exit the whole application.
|
||||||
|
sendShutdownMessage();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1048,7 +1048,7 @@ void LLFilePickerBase::chooser_responder(GtkWidget *widget, gint response, gpoin
|
|||||||
if (response == GTK_RESPONSE_ACCEPT)
|
if (response == GTK_RESPONSE_ACCEPT)
|
||||||
{
|
{
|
||||||
GSList *file_list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(widget));
|
GSList *file_list = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(widget));
|
||||||
g_slist_foreach(file_list, (GFunc)add_to_selectedfiles, user_data);
|
g_slist_foreach(file_list, (GFunc)add_to_selectedfiles, picker);
|
||||||
g_slist_foreach(file_list, (GFunc)g_free, NULL);
|
g_slist_foreach(file_list, (GFunc)g_free, NULL);
|
||||||
g_slist_free (file_list);
|
g_slist_free (file_list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -652,7 +652,7 @@ bool
|
|||||||
MediaPluginGStreamer010::getTimePos(double &sec_out)
|
MediaPluginGStreamer010::getTimePos(double &sec_out)
|
||||||
{
|
{
|
||||||
bool got_position = false;
|
bool got_position = false;
|
||||||
if (mPlaybin)
|
if (mDoneInit && mPlaybin)
|
||||||
{
|
{
|
||||||
gint64 pos;
|
gint64 pos;
|
||||||
GstFormat timefmt = GST_FORMAT_TIME;
|
GstFormat timefmt = GST_FORMAT_TIME;
|
||||||
|
|||||||
@@ -40,6 +40,10 @@
|
|||||||
#if defined(LL_DARWIN)
|
#if defined(LL_DARWIN)
|
||||||
#include <QuickTime/QuickTime.h>
|
#include <QuickTime/QuickTime.h>
|
||||||
#elif defined(LL_WINDOWS)
|
#elif defined(LL_WINDOWS)
|
||||||
|
#undef __STDC_CONSTANT_MACROS //Needed, as boost/unordered_map.hpp already defines INT32_C, etc.
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER >= 1600
|
||||||
|
#define _STDINT_H //Visual Studio 2010 includes its own stdint header already
|
||||||
|
#endif
|
||||||
#include "MacTypes.h"
|
#include "MacTypes.h"
|
||||||
#include "QTML.h"
|
#include "QTML.h"
|
||||||
#include "Movies.h"
|
#include "Movies.h"
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ set(media_plugin_webkit_LINK_LIBRARIES
|
|||||||
|
|
||||||
# Select which VolumeCatcher implementation to use
|
# Select which VolumeCatcher implementation to use
|
||||||
if (LINUX)
|
if (LINUX)
|
||||||
if (PULSEAUDIO)
|
if (PULSEAUDIO_FOUND)
|
||||||
list(APPEND media_plugin_webkit_SOURCE_FILES linux_volume_catcher.cpp)
|
list(APPEND media_plugin_webkit_SOURCE_FILES linux_volume_catcher.cpp)
|
||||||
endif (PULSEAUDIO)
|
endif (PULSEAUDIO_FOUND)
|
||||||
list(APPEND media_plugin_webkit_LINK_LIBRARIES
|
list(APPEND media_plugin_webkit_LINK_LIBRARIES
|
||||||
${UI_LIBRARIES} # for glib/GTK
|
${UI_LIBRARIES} # for glib/GTK
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -42,9 +42,8 @@
|
|||||||
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
|
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 <set> //imprudence
|
|
||||||
|
|
||||||
#include "linden_common.h"
|
#include "linden_common.h"
|
||||||
|
# include <set>
|
||||||
|
|
||||||
#include "volume_catcher.h"
|
#include "volume_catcher.h"
|
||||||
|
|
||||||
|
|||||||
@@ -79,20 +79,6 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LL_STANDALONE
|
|
||||||
#include <qglobal.h>
|
|
||||||
#elif defined(LL_LINUX)
|
|
||||||
// We don't provide Qt headers for non-standalone, therefore define this here.
|
|
||||||
// Our prebuilt is built with QT_NAMESPACE undefined.
|
|
||||||
#define QT_MANGLE_NAMESPACE(name) name
|
|
||||||
#define Q_INIT_RESOURCE(name) \
|
|
||||||
do { extern int QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); \
|
|
||||||
QT_MANGLE_NAMESPACE(qInitResources_ ## name) (); } while (0)
|
|
||||||
#else
|
|
||||||
// Apparently this symbol doesn't exist in the windows and Mac tar balls provided by LL.
|
|
||||||
#define Q_INIT_RESOURCE(name) /*nothing*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
class MediaPluginWebKit :
|
class MediaPluginWebKit :
|
||||||
@@ -138,6 +124,7 @@ private:
|
|||||||
F32 mBackgroundR;
|
F32 mBackgroundR;
|
||||||
F32 mBackgroundG;
|
F32 mBackgroundG;
|
||||||
F32 mBackgroundB;
|
F32 mBackgroundB;
|
||||||
|
std::string mTarget;
|
||||||
|
|
||||||
VolumeCatcher mVolumeCatcher;
|
VolumeCatcher mVolumeCatcher;
|
||||||
|
|
||||||
@@ -326,11 +313,7 @@ private:
|
|||||||
LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled );
|
LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled );
|
||||||
|
|
||||||
// create single browser window
|
// create single browser window
|
||||||
#if LLQTWEBKIT_API_VERSION >= 2
|
mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow(mWidth, mHeight, mTarget);
|
||||||
mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow(mWidth, mHeight /*, mTarget*/ ); // We don't have mTarget yet.
|
|
||||||
#else
|
|
||||||
mBrowserWindowId = LLQtWebKit::getInstance()->createBrowserWindow( mWidth, mHeight );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// tell LLQtWebKit about the size of the browser window
|
// tell LLQtWebKit about the size of the browser window
|
||||||
LLQtWebKit::getInstance()->setSize( mBrowserWindowId, mWidth, mHeight );
|
LLQtWebKit::getInstance()->setSize( mBrowserWindowId, mWidth, mHeight );
|
||||||
@@ -537,16 +520,9 @@ private:
|
|||||||
void onClickLinkHref(const EventType& event)
|
void onClickLinkHref(const EventType& event)
|
||||||
{
|
{
|
||||||
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_href");
|
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_href");
|
||||||
#if LLQTWEBKIT_API_VERSION >= 2
|
|
||||||
message.setValue("uri", event.getEventUri());
|
message.setValue("uri", event.getEventUri());
|
||||||
message.setValue("target", event.getStringValue());
|
message.setValue("target", event.getStringValue());
|
||||||
message.setValue("uuid", event.getStringValue2());
|
message.setValue("uuid", event.getStringValue2());
|
||||||
#else
|
|
||||||
// This will work as long as we don't need "uuid", which will be needed for MoaP.
|
|
||||||
message.setValue("uri", event.getStringValue());
|
|
||||||
message.setValue("target", event.getStringValue2());
|
|
||||||
message.setValueU32("target_type", event.getLinkType());
|
|
||||||
#endif
|
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -555,11 +531,7 @@ private:
|
|||||||
void onClickLinkNoFollow(const EventType& event)
|
void onClickLinkNoFollow(const EventType& event)
|
||||||
{
|
{
|
||||||
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_nofollow");
|
LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_nofollow");
|
||||||
#if LLQTWEBKIT_API_VERSION >= 2
|
|
||||||
message.setValue("uri", event.getEventUri());
|
message.setValue("uri", event.getEventUri());
|
||||||
#else
|
|
||||||
message.setValue("uri", event.getStringValue());
|
|
||||||
#endif
|
|
||||||
sendMessage(message);
|
sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -744,9 +716,6 @@ MediaPluginWebKit::MediaPluginWebKit(LLPluginInstance::sendMessageFunction send_
|
|||||||
mJavascriptEnabled = true; // default to on
|
mJavascriptEnabled = true; // default to on
|
||||||
mPluginsEnabled = true; // default to on
|
mPluginsEnabled = true; // default to on
|
||||||
mUserAgent = "LLPluginMedia Web Browser";
|
mUserAgent = "LLPluginMedia Web Browser";
|
||||||
|
|
||||||
// Initialize WebCore resource.
|
|
||||||
Q_INIT_RESOURCE(WebCore);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaPluginWebKit::~MediaPluginWebKit()
|
MediaPluginWebKit::~MediaPluginWebKit()
|
||||||
@@ -773,6 +742,8 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
|
|||||||
{
|
{
|
||||||
if(message_name == "init")
|
if(message_name == "init")
|
||||||
{
|
{
|
||||||
|
mTarget = message_in.getValue("target");
|
||||||
|
|
||||||
LLPluginMessage message("base", "init_response");
|
LLPluginMessage message("base", "init_response");
|
||||||
LLSD versions = LLSD::emptyMap();
|
LLSD versions = LLSD::emptyMap();
|
||||||
versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION;
|
versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION;
|
||||||
@@ -1082,7 +1053,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// std::cerr << "MediaPluginWebKit::receiveMessage: unknown media message: " << message_string << std::endl;
|
// std::cerr << "MediaPluginWebKit::receiveMessage: unknown media message: " << message_string << std::endl;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER)
|
else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user