diff options
author | Armin Weatherwax | 2010-09-07 10:26:01 +0200 |
---|---|---|
committer | Armin Weatherwax | 2010-09-23 15:38:26 +0200 |
commit | 9d37fb4eeb15f7ac35ebaa3fd7c5cc11e5b1a1dc (patch) | |
tree | fd86b97c3603d8c8f678b4c1be4de9b45f2555e6 /linden/indra/media_plugins/base/media_plugin_base.cpp | |
parent | lost in merge: 1 debug setting, some member variables from llpanellandmedia (diff) | |
download | meta-impy-9d37fb4eeb15f7ac35ebaa3fd7c5cc11e5b1a1dc.zip meta-impy-9d37fb4eeb15f7ac35ebaa3fd7c5cc11e5b1a1dc.tar.gz meta-impy-9d37fb4eeb15f7ac35ebaa3fd7c5cc11e5b1a1dc.tar.bz2 meta-impy-9d37fb4eeb15f7ac35ebaa3fd7c5cc11e5b1a1dc.tar.xz |
First LL update of plugins, mainly documentation
Diffstat (limited to 'linden/indra/media_plugins/base/media_plugin_base.cpp')
-rw-r--r-- | linden/indra/media_plugins/base/media_plugin_base.cpp | 57 |
1 files changed, 56 insertions, 1 deletions
diff --git a/linden/indra/media_plugins/base/media_plugin_base.cpp b/linden/indra/media_plugins/base/media_plugin_base.cpp index 1919419..4d5e374 100644 --- a/linden/indra/media_plugins/base/media_plugin_base.cpp +++ b/linden/indra/media_plugins/base/media_plugin_base.cpp | |||
@@ -2,6 +2,8 @@ | |||
2 | * @file media_plugin_base.cpp | 2 | * @file media_plugin_base.cpp |
3 | * @brief Media plugin base class for LLMedia API plugin system | 3 | * @brief Media plugin base class for LLMedia API plugin system |
4 | * | 4 | * |
5 | * All plugins should be a subclass of MediaPluginBase. | ||
6 | * | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | 7 | * $LicenseInfo:firstyear=2008&license=viewergpl$ |
6 | * | 8 | * |
7 | * Copyright (c) 2008-2009, Linden Research, Inc. | 9 | * Copyright (c) 2008-2009, Linden Research, Inc. |
@@ -36,7 +38,10 @@ | |||
36 | 38 | ||
37 | // TODO: Make sure that the only symbol exported from this library is LLPluginInitEntryPoint | 39 | // TODO: Make sure that the only symbol exported from this library is LLPluginInitEntryPoint |
38 | //////////////////////////////////////////////////////////////////////////////// | 40 | //////////////////////////////////////////////////////////////////////////////// |
39 | // | 41 | /// Media plugin constructor. |
42 | /// | ||
43 | /// @param[in] host_send_func Function for sending messages from plugin to plugin loader shell | ||
44 | /// @param[in] host_user_data Message data for messages from plugin to plugin loader shell | ||
40 | 45 | ||
41 | MediaPluginBase::MediaPluginBase( | 46 | MediaPluginBase::MediaPluginBase( |
42 | LLPluginInstance::sendMessageFunction host_send_func, | 47 | LLPluginInstance::sendMessageFunction host_send_func, |
@@ -54,6 +59,12 @@ MediaPluginBase::MediaPluginBase( | |||
54 | mStatus = STATUS_NONE; | 59 | mStatus = STATUS_NONE; |
55 | } | 60 | } |
56 | 61 | ||
62 | /** | ||
63 | * Converts current media status enum value into string (STATUS_LOADING into "loading", etc.) | ||
64 | * | ||
65 | * @return Media status string ("loading", "playing", "paused", etc) | ||
66 | * | ||
67 | */ | ||
57 | std::string MediaPluginBase::statusString() | 68 | std::string MediaPluginBase::statusString() |
58 | { | 69 | { |
59 | std::string result; | 70 | std::string result; |
@@ -65,6 +76,7 @@ std::string MediaPluginBase::statusString() | |||
65 | case STATUS_ERROR: result = "error"; break; | 76 | case STATUS_ERROR: result = "error"; break; |
66 | case STATUS_PLAYING: result = "playing"; break; | 77 | case STATUS_PLAYING: result = "playing"; break; |
67 | case STATUS_PAUSED: result = "paused"; break; | 78 | case STATUS_PAUSED: result = "paused"; break; |
79 | case STATUS_DONE: result = "done"; break; | ||
68 | default: | 80 | default: |
69 | // keep the empty string | 81 | // keep the empty string |
70 | break; | 82 | break; |
@@ -73,6 +85,12 @@ std::string MediaPluginBase::statusString() | |||
73 | return result; | 85 | return result; |
74 | } | 86 | } |
75 | 87 | ||
88 | /** | ||
89 | * Set media status. | ||
90 | * | ||
91 | * @param[in] status Media status (STATUS_LOADING, STATUS_PLAYING, STATUS_PAUSED, etc) | ||
92 | * | ||
93 | */ | ||
76 | void MediaPluginBase::setStatus(EStatus status) | 94 | void MediaPluginBase::setStatus(EStatus status) |
77 | { | 95 | { |
78 | if(mStatus != status) | 96 | if(mStatus != status) |
@@ -83,6 +101,13 @@ void MediaPluginBase::setStatus(EStatus status) | |||
83 | } | 101 | } |
84 | 102 | ||
85 | 103 | ||
104 | /** | ||
105 | * Receive message from plugin loader shell. | ||
106 | * | ||
107 | * @param[in] message_string Message string | ||
108 | * @param[in] user_data Message data | ||
109 | * | ||
110 | */ | ||
86 | void MediaPluginBase::staticReceiveMessage(const char *message_string, void **user_data) | 111 | void MediaPluginBase::staticReceiveMessage(const char *message_string, void **user_data) |
87 | { | 112 | { |
88 | MediaPluginBase *self = (MediaPluginBase*)*user_data; | 113 | MediaPluginBase *self = (MediaPluginBase*)*user_data; |
@@ -100,12 +125,27 @@ void MediaPluginBase::staticReceiveMessage(const char *message_string, void **us | |||
100 | } | 125 | } |
101 | } | 126 | } |
102 | 127 | ||
128 | /** | ||
129 | * Send message to plugin loader shell. | ||
130 | * | ||
131 | * @param[in] message Message data being sent to plugin loader shell | ||
132 | * | ||
133 | */ | ||
103 | void MediaPluginBase::sendMessage(const LLPluginMessage &message) | 134 | void MediaPluginBase::sendMessage(const LLPluginMessage &message) |
104 | { | 135 | { |
105 | std::string output = message.generate(); | 136 | std::string output = message.generate(); |
106 | mHostSendFunction(output.c_str(), &mHostUserData); | 137 | mHostSendFunction(output.c_str(), &mHostUserData); |
107 | } | 138 | } |
108 | 139 | ||
140 | /** | ||
141 | * Notifies plugin loader shell that part of display area needs to be redrawn. | ||
142 | * | ||
143 | * @param[in] left Left X coordinate of area to redraw (0,0 is at top left corner) | ||
144 | * @param[in] top Top Y coordinate of area to redraw (0,0 is at top left corner) | ||
145 | * @param[in] right Right X-coordinate of area to redraw (0,0 is at top left corner) | ||
146 | * @param[in] bottom Bottom Y-coordinate of area to redraw (0,0 is at top left corner) | ||
147 | * | ||
148 | */ | ||
109 | void MediaPluginBase::setDirty(int left, int top, int right, int bottom) | 149 | void MediaPluginBase::setDirty(int left, int top, int right, int bottom) |
110 | { | 150 | { |
111 | LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "updated"); | 151 | LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "updated"); |
@@ -118,6 +158,10 @@ void MediaPluginBase::setDirty(int left, int top, int right, int bottom) | |||
118 | sendMessage(message); | 158 | sendMessage(message); |
119 | } | 159 | } |
120 | 160 | ||
161 | /** | ||
162 | * Sends "media_status" message to plugin loader shell ("loading", "playing", "paused", etc.) | ||
163 | * | ||
164 | */ | ||
121 | void MediaPluginBase::sendStatus() | 165 | void MediaPluginBase::sendStatus() |
122 | { | 166 | { |
123 | LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "media_status"); | 167 | LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "media_status"); |
@@ -141,6 +185,17 @@ extern "C" | |||
141 | LLSYMEXPORT int LLPluginInitEntryPoint(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data); | 185 | LLSYMEXPORT int LLPluginInitEntryPoint(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data); |
142 | } | 186 | } |
143 | 187 | ||
188 | /** | ||
189 | * Plugin initialization and entry point. Establishes communication channel for messages between plugin and plugin loader shell. TODO:DOC - Please check! | ||
190 | * | ||
191 | * @param[in] host_send_func Function for sending messages from plugin to plugin loader shell | ||
192 | * @param[in] host_user_data Message data for messages from plugin to plugin loader shell | ||
193 | * @param[out] plugin_send_func Function for plugin to receive messages from plugin loader shell | ||
194 | * @param[out] plugin_user_data Pointer to plugin instance | ||
195 | * | ||
196 | * @return int, where 0=success | ||
197 | * | ||
198 | */ | ||
144 | LLSYMEXPORT int | 199 | LLSYMEXPORT int |
145 | LLPluginInitEntryPoint(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data) | 200 | LLPluginInitEntryPoint(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data) |
146 | { | 201 | { |