diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/test_apps/llplugintest/llmediaplugintest.h | 201 |
1 files changed, 201 insertions, 0 deletions
diff --git a/linden/indra/test_apps/llplugintest/llmediaplugintest.h b/linden/indra/test_apps/llplugintest/llmediaplugintest.h new file mode 100644 index 0000000..c2b2bab --- /dev/null +++ b/linden/indra/test_apps/llplugintest/llmediaplugintest.h | |||
@@ -0,0 +1,201 @@ | |||
1 | /** | ||
2 | * @file LLMediaPluginTest.cpp | ||
3 | * @brief Primary test application for LLMedia (Separate Process) Plugin system | ||
4 | * | ||
5 | * $LicenseInfo:firstyear=2008&license=viewergpl$ | ||
6 | * | ||
7 | * Copyright (c) 2009, Linden Research, Inc. | ||
8 | * | ||
9 | * Second Life Viewer Source Code | ||
10 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
11 | * to you under the terms of the GNU General Public License, version 2.0 | ||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
15 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
16 | * | ||
17 | * There are special exceptions to the terms and conditions of the GPL as | ||
18 | * it is applied to this Source Code. View the full text of the exception | ||
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
20 | * online at http://secondlife.com/developers/opensource/flossexception | ||
21 | * | ||
22 | * By copying, modifying or distributing this software, you acknowledge | ||
23 | * that you have read and understood your obligations described above, | ||
24 | * and agree to abide by those obligations. | ||
25 | * | ||
26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
28 | * COMPLETENESS OR PERFORMANCE. | ||
29 | * $/LicenseInfo$ | ||
30 | */ | ||
31 | |||
32 | #ifndef LL_MEDIA_PLUGIN_TEST_H | ||
33 | #define LL_MEDIA_PLUGIN_TEST_H | ||
34 | |||
35 | #include <vector> | ||
36 | #include <string> | ||
37 | #include "llpluginclassmedia.h" | ||
38 | #include "llgl.h" | ||
39 | |||
40 | // Forward declarations | ||
41 | class GLUI_Rotation; | ||
42 | class GLUI_Translation; | ||
43 | class GLUI_Listbox; | ||
44 | class GLUI_EditText; | ||
45 | class GLUI_StaticText; | ||
46 | class GLUI; | ||
47 | class GLUI_Button; | ||
48 | |||
49 | //////////////////////////////////////////////////////////////////////////////// | ||
50 | // | ||
51 | struct mediaPanel | ||
52 | { | ||
53 | public: | ||
54 | mediaPanel(); | ||
55 | ~mediaPanel(); | ||
56 | int mId; | ||
57 | std::string mStartUrl; | ||
58 | std::string mMimeType; | ||
59 | LLPluginClassMedia *mMediaSource; | ||
60 | int mMediaWidth; | ||
61 | int mMediaHeight; | ||
62 | int mTextureWidth; | ||
63 | int mTextureHeight; | ||
64 | double mTextureScaleX; | ||
65 | double mTextureScaleY; | ||
66 | GLuint mMediaTextureHandle; | ||
67 | GLuint mPickTextureHandle; | ||
68 | unsigned char* mPickTexturePixels; | ||
69 | bool mAppTextureCoordsOpenGL; | ||
70 | bool mReadyToRender; | ||
71 | }; | ||
72 | |||
73 | //////////////////////////////////////////////////////////////////////////////// | ||
74 | // | ||
75 | class LLMediaPluginTest : public LLPluginClassMediaOwner | ||
76 | { | ||
77 | public: | ||
78 | LLMediaPluginTest( int app_window, int window_width, int window_height ); | ||
79 | ~LLMediaPluginTest(); | ||
80 | |||
81 | void reshape( int width, int height ); | ||
82 | void display(); | ||
83 | void idle(); | ||
84 | void gluiCallback( int control_id ); | ||
85 | void keyboard( int key ); | ||
86 | void mousePassive( int x, int y ); | ||
87 | void mouseButton( int button, int state, int x, int y ); | ||
88 | void mouseMove( int x, int y ); | ||
89 | |||
90 | void bindTexture(GLuint texture, GLint row_length = 0, GLint alignment = 1); | ||
91 | bool checkGLError(const char *name = "OpenGL"); | ||
92 | void drawGeometry( int panel ); | ||
93 | void startPanelHighlight( float red, float green, float blue, float line_width ); | ||
94 | void endPanelHighlight(); | ||
95 | enum { DrawTypePickTexture, DrawTypeMediaTexture }; | ||
96 | void draw( int draw_type ); | ||
97 | void windowPosToTexturePos( int window_x, int window_y, int& media_x, int& media_y, int& id ); | ||
98 | |||
99 | void addMediaPanel( std::string url ); | ||
100 | void updateMediaPanel( mediaPanel* panel ); | ||
101 | void remMediaPanel( mediaPanel* panel ); | ||
102 | void replaceMediaPanel( mediaPanel* panel, std::string url ); | ||
103 | void getRandomMediaSize( int& width, int& height, std::string mime_type ); | ||
104 | void navigateToNewURI( std::string uri ); | ||
105 | void initUrlHistory( std::string uri ); | ||
106 | void selectPanelById( int id ); | ||
107 | void selectPanel( mediaPanel* panel ); | ||
108 | mediaPanel* findMediaPanel( LLPluginClassMedia* panel ); | ||
109 | void makePickTexture( int id, GLuint* texture_handle, unsigned char** texture_pixels ); | ||
110 | void makeChrome(); | ||
111 | void resetView(); | ||
112 | |||
113 | void dumpPanelInfo(); | ||
114 | void updateStatusBar(); | ||
115 | |||
116 | // Inherited from LLPluginClassMediaOwner | ||
117 | /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, LLPluginClassMediaOwner::EMediaEvent); | ||
118 | |||
119 | private: | ||
120 | const int mVersionMajor; | ||
121 | const int mVersionMinor; | ||
122 | const int mVersionPatch; | ||
123 | const int mMaxPanels; | ||
124 | int mAppWindow; | ||
125 | int mWindowWidth; | ||
126 | int mWindowHeight; | ||
127 | int mCurMouseX; | ||
128 | int mCurMouseY; | ||
129 | unsigned char mPixelReadColor[ 3 ]; | ||
130 | bool mFuzzyMedia; | ||
131 | const std::string mHomeWebUrl; | ||
132 | |||
133 | std::vector< mediaPanel* > mMediaPanels; | ||
134 | mediaPanel* mSelectedPanel; | ||
135 | std::string mimeTypeFromUrl( std::string& url ); | ||
136 | std::string pluginNameFromMimeType( std::string& mime_type ); | ||
137 | |||
138 | GLUI_Rotation* mViewRotationCtrl; | ||
139 | GLUI_Translation* mViewScaleCtrl; | ||
140 | GLUI_Translation* mViewTranslationCtrl; | ||
141 | float mViewportAspect; | ||
142 | float mViewPos[ 3 ]; | ||
143 | float mViewRotation[ 16 ]; | ||
144 | |||
145 | int mIdControlAddPanel; | ||
146 | int mIdControlRemPanel; | ||
147 | |||
148 | std::vector< std::pair< std::string, std::string > > mBookmarks; | ||
149 | GLUI_Listbox* mBookmarkList; | ||
150 | int mIdBookmarks; | ||
151 | int mIdUrlEdit; | ||
152 | GLUI_EditText* mUrlEdit; | ||
153 | int mIdUrlInitHistoryEdit; | ||
154 | GLUI_EditText* mUrlInitHistoryEdit; | ||
155 | int mSelBookmark; | ||
156 | int mIdRandomPanelCount; | ||
157 | int mRandomPanelCount; | ||
158 | int mIdRandomBookmarks; | ||
159 | int mRandomBookmarks; | ||
160 | int mIdDisableTimeout; | ||
161 | int mDisableTimeout; | ||
162 | int mIdControlCrashPlugin; | ||
163 | int mIdControlHangPlugin; | ||
164 | int mIdControlExitApp; | ||
165 | |||
166 | GLUI* mGluiMediaTimeControlWindow; | ||
167 | int mIdMediaTimeControlPlay; | ||
168 | int mIdMediaTimeControlLoop; | ||
169 | int mIdMediaTimeControlPause; | ||
170 | int mIdMediaTimeControlStop; | ||
171 | int mIdMediaTimeControlSeek; | ||
172 | int mIdMediaTimeControlVolume; | ||
173 | int mMediaTimeControlVolume; | ||
174 | int mIdMediaTimeControlSeekSeconds; | ||
175 | int mMediaTimeControlSeekSeconds; | ||
176 | int mIdMediaTimeControlRewind; | ||
177 | int mIdMediaTimeControlFastForward; | ||
178 | |||
179 | GLUI* mGluiMediaBrowserControlWindow; | ||
180 | int mIdMediaBrowserControlBack; | ||
181 | GLUI_Button* mMediaBrowserControlBackButton; | ||
182 | int mIdMediaBrowserControlStop; | ||
183 | int mIdMediaBrowserControlForward; | ||
184 | GLUI_Button* mMediaBrowserControlForwardButton; | ||
185 | bool mGluiMediaTimeControlWindowFlag; | ||
186 | bool mGluiMediaBrowserControlWindowFlag; | ||
187 | bool mMediaBrowserControlBackButtonFlag; | ||
188 | bool mMediaBrowserControlForwardButtonFlag; | ||
189 | int mIdMediaBrowserControlHome; | ||
190 | int mIdMediaBrowserControlReload; | ||
191 | int mIdMediaBrowserControlClearCache; | ||
192 | int mIdMediaBrowserControlClearCookies; | ||
193 | int mIdMediaBrowserControlEnableCookies; | ||
194 | int mMediaBrowserControlEnableCookies; | ||
195 | |||
196 | GLUI* mBottomGLUIWindow; | ||
197 | GLUI_StaticText* mStatusText; | ||
198 | }; | ||
199 | |||
200 | #endif // LL_MEDIA_PLUGIN_TEST_H | ||
201 | |||