aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewermedia.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llviewermedia.h')
-rw-r--r--linden/indra/newview/llviewermedia.h200
1 files changed, 171 insertions, 29 deletions
diff --git a/linden/indra/newview/llviewermedia.h b/linden/indra/newview/llviewermedia.h
index 600d740..afda426 100644
--- a/linden/indra/newview/llviewermedia.h
+++ b/linden/indra/newview/llviewermedia.h
@@ -33,50 +33,192 @@
33#ifndef LLVIEWERMEDIA_H 33#ifndef LLVIEWERMEDIA_H
34#define LLVIEWERMEDIA_H 34#define LLVIEWERMEDIA_H
35 35
36#include "llmediabase.h" // for status codes 36#include "llfocusmgr.h"
37 37
38class LLMediaManagerData; 38#include "llpanel.h"
39#include "llpluginclassmediaowner.h"
40
41#include "llviewermediaobserver.h"
42
43class LLViewerMediaImpl;
39class LLUUID; 44class LLUUID;
45class LLViewerImage;
46
47typedef LLPointer<LLViewerMediaImpl> viewer_media_t;
48///////////////////////////////////////////////////////////////////////////////
49//
50class LLViewerMediaEventEmitter
51{
52public:
53 virtual ~LLViewerMediaEventEmitter();
54
55 bool addObserver( LLViewerMediaObserver* subject );
56 bool remObserver( LLViewerMediaObserver* subject );
57 void emitEvent(LLPluginClassMedia* self, LLPluginClassMediaOwner::EMediaEvent event);
58
59private:
60 typedef std::list< LLViewerMediaObserver* > observerListType;
61 observerListType mObservers;
62};
40 63
41class LLViewerMedia 64class LLViewerMedia
42{ 65{
66 LOG_CLASS(LLViewerMedia);
43 public: 67 public:
44 // Special case early init for just web browser component 68 // Special case early init for just web browser component
45 // so we can show login screen. See .cpp file for details. JC 69 // so we can show login screen. See .cpp file for details. JC
46 static void initBrowser();
47 70
48 static void initClass(); 71 static viewer_media_t newMediaImpl(const std::string& media_url,
49 static void cleanupClass(); 72 const LLUUID& texture_id,
73 S32 media_width,
74 S32 media_height,
75 U8 media_auto_scale,
76 U8 media_loop,
77 std::string mime_type = "none/none");
50 78
51 static void play(const std::string& media_url, 79 static void removeMedia(LLViewerMediaImpl* media);
52 const std::string& mime_type, 80 static LLViewerMediaImpl* getMediaImplFromTextureID(const LLUUID& texture_id);
53 const LLUUID& placeholder_texture_id, 81 static std::string getCurrentUserAgent();
54 S32 media_width, S32 media_height, U8 media_auto_scale, 82 static void updateBrowserUserAgent();
55 U8 media_loop); 83 static bool handleSkinCurrentChanged(const LLSD& /*newvalue*/);
56 static void stop(); 84 static bool textureHasMedia(const LLUUID& texture_id);
57 static void pause();
58 static void start();
59 static void seek(F32 time);
60 static void setVolume(F32 volume); 85 static void setVolume(F32 volume);
61 static LLMediaBase::EStatus getStatus();
62 86
63 static LLUUID getMediaTextureID(); 87 static void updateMedia();
64 static bool getMediaSize(S32 *media_width, S32 *media_height); 88
65 static bool getTextureSize(S32 *texture_width, S32 *texture_height); 89 static void cleanupClass();
66 static bool isMediaPlaying(); 90
67 static bool isMediaPaused(); 91};
68 static bool hasMedia(); 92
69 static bool isActiveMediaTexture(const LLUUID& id); 93// Implementation functions not exported into header file
94class LLViewerMediaImpl
95 : public LLMouseHandler, public LLRefCount, public LLPluginClassMediaOwner, public LLViewerMediaEventEmitter, public LLEditMenuHandler
96{
97 LOG_CLASS(LLViewerMediaImpl);
98public:
99
100 LLViewerMediaImpl(const std::string& media_url,
101 const LLUUID& texture_id,
102 S32 media_width,
103 S32 media_height,
104 U8 media_auto_scale,
105 U8 media_loop,
106 const std::string& mime_type);
107
108 ~LLViewerMediaImpl();
109 void createMediaSource();
110 void destroyMediaSource();
111 void setMediaType(const std::string& media_type);
112 bool initializeMedia(const std::string& mime_type);
113 bool initializePlugin(const std::string& media_type);
114 LLPluginClassMedia* getMediaPlugin() { return mMediaSource; }
115 void setSize(int width, int height);
116
117 void play();
118 void stop();
119 void pause();
120 void start();
121 void seek(F32 time);
122 void setVolume(F32 volume);
123 void focus(bool focus);
124 void mouseDown(S32 x, S32 y);
125 void mouseUp(S32 x, S32 y);
126 void mouseMove(S32 x, S32 y);
127 void mouseLeftDoubleClick(S32 x,S32 y );
128 void mouseCapture();
129
130 void navigateHome();
131 void navigateTo(const std::string& url, const std::string& mime_type = "", bool rediscover_type = false);
132 void navigateStop();
133 bool handleKeyHere(KEY key, MASK mask);
134 bool handleUnicodeCharHere(llwchar uni_char);
135 bool canNavigateForward();
136 bool canNavigateBack();
137 std::string getMediaURL() { return mMediaURL; }
138 std::string getMediaHomeURL() { return mHomeURL; }
139 std::string getMimeType() { return mMimeType; }
140 void getTextureSize(S32 *texture_width, S32 *texture_height);
141 void scaleMouse(S32 *mouse_x, S32 *mouse_y);
142
143 void update();
144 void updateMovieImage(const LLUUID& image_id, BOOL active);
145 void updateImagesMediaStreams();
146 LLUUID getMediaTextureID();
147
148 void suspendUpdates(bool suspend) { mSuspendUpdates = suspend; };
149 void setVisible(bool visible);
150
151 bool isMediaPlaying();
152 bool isMediaPaused();
153 bool hasMedia();
154
155 // utility function to create a ready-to-use media instance from a desired media type.
156 static LLPluginClassMedia* newSourceFromMediaType(std::string media_type, LLPluginClassMediaOwner *owner /* may be NULL */, S32 default_width, S32 default_height);
157
158 // Internally set our desired browser user agent string, including
159 // the Second Life version and skin name. Used because we can
160 // switch skins without restarting the app.
161 static void updateBrowserUserAgent();
162
163 // Callback for when the SkinCurrent control is changed to
164 // switch the user agent string to indicate the new skin.
165 static bool handleSkinCurrentChanged(const LLSD& newvalue);
166
167 // need these to handle mouseup...
168 /*virtual*/ void onMouseCaptureLost();
169 /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
170
171 // Grr... the only thing I want as an LLMouseHandler are the onMouseCaptureLost and handleMouseUp calls.
172 // Sadly, these are all pure virtual, so I have to supply implementations here:
173 /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; };
174 /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask) { return FALSE; };
175 /*virtual*/ BOOL handleScrollWheel(S32 x, S32 y, S32 clicks) { return FALSE; };
176 /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask) { return FALSE; };
177 /*virtual*/ BOOL handleRightMouseDown(S32 x, S32 y, MASK mask) { return FALSE; };
178 /*virtual*/ BOOL handleRightMouseUp(S32 x, S32 y, MASK mask) { return FALSE; };
179 /*virtual*/ BOOL handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { return FALSE; };
180 /*virtual*/ BOOL handleMiddleMouseDown(S32 x, S32 y, MASK mask) { return FALSE; };
181 /*virtual*/ BOOL handleMiddleMouseUp(S32 x, S32 y, MASK mask) {return FALSE; };
182 /*virtual*/ const std::string& getName() const { return LLStringUtil::null; };
183 /*virtual*/ BOOL isView() const { return FALSE; };
184 /*virtual*/ void screenPointToLocal(S32 screen_x, S32 screen_y, S32* local_x, S32* local_y) const {};
185 /*virtual*/ void localPointToScreen(S32 local_x, S32 local_y, S32* screen_x, S32* screen_y) const {};
186 /*virtual*/ BOOL hasMouseCapture() { return gFocusMgr.getMouseCapture() == this; };
187
188 // Inherited from LLPluginClassMediaOwner
189 /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, LLPluginClassMediaOwner::EMediaEvent);
190
191 // LLEditMenuHandler overrides
192 /*virtual*/ void cut();
193 /*virtual*/ BOOL canCut() const;
194
195 /*virtual*/ void copy();
196 /*virtual*/ BOOL canCopy() const;
70 197
71 static std::string getMediaURL(); 198 /*virtual*/ void paste();
72 static std::string getMimeType(); 199 /*virtual*/ BOOL canPaste() const;
73 static void setMimeType(std::string mime_type); 200
201public:
202 // a single media url with some data and an impl.
203 LLPluginClassMedia* mMediaSource;
204 LLUUID mTextureId;
205 bool mMovieImageHasMips;
206 std::string mMediaURL;
207 std::string mHomeURL;
208 std::string mMimeType;
209 S32 mLastMouseX; // save the last mouse coord we get, so when we lose capture we can simulate a mouseup at that point.
210 S32 mLastMouseY;
211 S32 mMediaWidth;
212 S32 mMediaHeight;
213 bool mMediaAutoScale;
214 bool mMediaLoop;
215 bool mNeedsNewTexture;
216 bool mSuspendUpdates;
217 bool mVisible;
74 218
75 static void updateImagesMediaStreams();
76 219
77 private: 220private:
78 // Fill in initialization data for LLMediaManager::initClass() 221 LLViewerImage *updatePlaceholderImage();
79 static void buildMediaManagerData( LLMediaManagerData* init_data );
80}; 222};
81 223
82#endif // LLVIEWERMEDIA_H 224#endif // LLVIEWERMEDIA_H