//////////////////////////////////////////////////////////////////////////////// // virtual void LLViewerMediaImpl::paste() { LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) plugin->paste(); }
bool LLViewerMediaImpl::initializePlugin(const std::string& media_type) { LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) { // Save the previous media source's last set size before destroying it. mMediaWidth = plugin->getSetWidth(); mMediaHeight = plugin->getSetHeight(); } // Always delete the old media impl first. destroyMediaSource(); // and unconditionally set the mime type mMimeType = media_type; LLPluginClassMedia* media_source = newSourceFromMediaType(media_type, this, mMediaWidth, mMediaHeight); if (media_source) { media_source->setDisableTimeout(gSavedSettings.getBOOL("DebugPluginDisableTimeout")); media_source->setLoop(mMediaLoop); media_source->setAutoScale(mMediaAutoScale); media_source->setBrowserUserAgent(LLViewerMedia::getCurrentUserAgent()); mPluginBase = media_source; return true; } return false; }
void LLViewerMediaImpl::getTextureSize(S32 *texture_width, S32 *texture_height) { LLPluginClassMedia* plugin = getMediaPlugin(); if(plugin && plugin->textureValid()) { S32 real_texture_width = plugin->getBitsWidth(); S32 real_texture_height = plugin->getBitsHeight(); { // The "texture width" coming back from the plugin may not be a power of two (thanks to webkit). // It will be the correct "data width" to pass to setSubImage int i; for(i = 1; i < real_texture_width; i <<= 1) ; *texture_width = i; for(i = 1; i < real_texture_height; i <<= 1) ; *texture_height = i; } } else { *texture_width = 0; *texture_height = 0; } }
//////////////////////////////////////////////////////////////////////////////// // virtual void LLViewerMediaImpl::copy() { LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) plugin->copy(); }
BOOL LLWebBrowserTexture::needsRender() { bool texture_dirty = false; if ( mWebBrowserCtrl->getFrequentUpdates() || mWebBrowserCtrl->getAlwaysRefresh() || mWebBrowserCtrl->getForceUpdate() ) { // All of these force an update return TRUE; } // If the texture needs updating, render needs to be called. if (mMediaSource && mMediaSource->hasMedia()) { LLPluginClassMedia* media = mMediaSource->getMediaPlugin(); if(media->textureValid() && media->getDirty()) { texture_dirty = true; } } return texture_dirty; }
void LLViewerMediaImpl::play() { LLPluginClassMedia* plugin = getMediaPlugin(); // first stop any previously playing media // stop(); // plugin->addObserver( this ); if (!plugin) { if(!initializePlugin(mMimeType)) { // Plugin failed initialization... should assert or something return; } plugin = getMediaPlugin(); } // updateMovieImage(mTextureId, true); plugin->loadURI( mMediaURL ); if(/*plugin->pluginSupportsMediaTime()*/ true) { start(); } }
void LLViewerMediaImpl::start() { LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) { plugin->start(); } }
void LLViewerMediaImpl::seek(F32 time) { LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) { plugin->seek(time); } }
void LLViewerMediaImpl::setVolume(F32 volume) { LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) { plugin->setVolume(volume); } }
void LLViewerMediaImpl::onMouseCaptureLost() { LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) { plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, LEFT_BUTTON, mLastMouseX, mLastMouseY, 0); } }
void LLViewerMediaImpl::navigateHome() { LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) { plugin->loadURI( mHomeURL ); } }
void LLViewerMediaImpl::stop() { LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) { plugin->stop(); // destroyMediaSource(); } }
//////////////////////////////////////////////////////////////////////////////// // virtual BOOL LLViewerMediaImpl::canPaste() const { LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) return plugin->canPaste(); else return FALSE; }
void LLViewerMediaImpl::navigateStop() { LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) { plugin->browse_stop(); } }
void LLViewerMediaImpl::setSize(int width, int height) { LLPluginClassMedia* plugin = getMediaPlugin(); mMediaWidth = width; mMediaHeight = height; if (plugin) { plugin->setSize(width, height); } }
bool LLViewerMediaImpl::canNavigateBack() { bool result = false; LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) { result = plugin->getHistoryBackAvailable(); } return result; }
void LLViewerMediaImpl::mouseLeftDoubleClick(S32 x, S32 y) { LLPluginClassMedia* plugin = getMediaPlugin(); scaleMouse(&x, &y); mLastMouseX = x; mLastMouseY = y; if (plugin) { plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOUBLE_CLICK, LEFT_BUTTON, x, y, 0); } }
void LLViewerMediaImpl::mouseMove(S32 x, S32 y) { LLPluginClassMedia* plugin = getMediaPlugin(); scaleMouse(&x, &y); mLastMouseX = x; mLastMouseY = y; if (plugin) { plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_MOVE, LEFT_BUTTON, x, y, 0); } }
void LLFloaterHelpBrowser::buildURLHistory() { // Get all of the entries in the "browser" collection LLSD browser_history = LLURLHistory::getURLHistory("browser"); // initialize URL history in the plugin LLPluginClassMedia *plugin = mBrowser->getMediaPlugin(); if (plugin) { plugin->initializeUrlHistory(browser_history); } }
bool LLViewerMediaImpl::isMediaPaused() { bool result = false; LLPluginClassMedia* plugin = getMediaPlugin(); if(plugin) { if(plugin->getStatus() == MEDIA_PAUSED) result = true; } return result; }
bool LLViewerMediaImpl::isMediaPlaying() { bool result = false; LLPluginClassMedia* plugin = getMediaPlugin(); if(plugin) { EMediaStatus status = plugin->getStatus(); if(status == MEDIA_PLAYING || status == MEDIA_LOADING) result = true; } return result; }
void LLViewerMediaImpl::focus(bool focus) { LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) { // call focus just for the hell of it, even though this apopears to be a nop plugin->focus(focus); if (focus) { // spoof a mouse click to *actually* pass focus // Don't do this anymore -- it actually clicks through now. // plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, 1, 1, 0); // plugin->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, 1, 1, 0); } } }
void LLViewerMediaImpl::navigateTo(const std::string& url, const std::string& mime_type, bool rediscover_type) { LLPluginClassMedia* plugin = getMediaPlugin(); if(rediscover_type) { LLURI uri(url); std::string scheme = uri.scheme(); if(scheme.empty() || "http" == scheme || "https" == scheme) { LLHTTPClient::getHeaderOnly( url, new LLMimeDiscoveryResponder(this)); } else if("data" == scheme || "file" == scheme || "about" == scheme) { // FIXME: figure out how to really discover the type for these schemes // We use "data" internally for a text/html url for loading the login screen if(initializeMedia("text/html")) { plugin->loadURI( url ); } } else { // This catches 'rtsp://' urls if(initializeMedia(scheme)) { plugin->loadURI( url ); } } } else if (plugin) { plugin->loadURI( url ); } else if(initializeMedia(mime_type) && (plugin = getMediaPlugin())) { plugin->loadURI( url ); } else { LL_WARNS("Media") << "Couldn't navigate to: " << url << " as there is no media type for: " << mime_type << LL_ENDL; return; } mMediaURL = url; }
//static void LLFloaterMediaBrowser::onClickPlay(void* user_data) { LLFloaterMediaBrowser* self = (LLFloaterMediaBrowser*)user_data; LLPluginClassMedia* plugin = self->mBrowser->getMediaPlugin(); if(plugin) { if(plugin->getStatus() == LLPluginClassMediaOwner::MEDIA_PLAYING) { plugin->pause(); } else { plugin->start(); } } }
void mouseButton( int button, int state, int x, int y ) { // Texture has been scaled so it's 1:1 with screen pixels, so no need to scale mouse coords here. // x = ( x * mAppTextureWidth ) / mAppWindowWidth; // y = ( y * mAppTextureHeight ) / mAppWindowHeight; if ( button == GLUT_LEFT_BUTTON ) { if ( state == GLUT_DOWN ) mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_DOWN, x, y, getModifiers()); else if ( state == GLUT_UP ) mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_UP, x, y, getModifiers()); } // force a GLUT update glutPostRedisplay(); };
void createTexture() { // create the texture used to display the browser data if(mMediaSource->textureValid()) { mAppTextureWidth = mMediaSource->getTextureWidth(); mAppTextureHeight = mMediaSource->getTextureHeight(); mAppTextureCoordsOpenGL = mMediaSource->getTextureCoordsOpenGL(); if(mAppTexture != 0) { glDeleteTextures( 1, &mAppTexture ); mAppTexture = 0; } glGenTextures( 1, &mAppTexture ); glBindTexture( GL_TEXTURE_2D, mAppTexture ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexImage2D( GL_TEXTURE_2D, 0, mMediaSource->getTextureFormatInternal(), mAppTextureWidth, mAppTextureHeight, 0, mMediaSource->getTextureFormatPrimary(), mMediaSource->getTextureFormatType(), NULL ); } }
////////////////////////////////////////////////////////////////////////////////////////// // static void LLViewerMedia::updateBrowserUserAgent() { std::string user_agent = getCurrentUserAgent(); impl_list::iterator iter = sViewerMediaImplList.begin(); impl_list::iterator end = sViewerMediaImplList.end(); for(; iter != end; iter++) { LLViewerMediaImpl* pimpl = *iter; LLPluginClassMedia* plugin = pimpl->getMediaPlugin(); if(plugin && plugin->pluginSupportsMediaBrowser()) { plugin->setBrowserUserAgent(user_agent); } } }
bool LLViewerMediaImpl::handleUnicodeCharHere(llwchar uni_char) { bool result = false; LLPluginClassMedia* plugin = getMediaPlugin(); if (plugin) { // only accept 'printable' characters, sigh... if (uni_char >= 32 // discard 'control' characters && uni_char != 127) // SDL thinks this is 'delete' - yuck. { LLSD native_key_data = LLSD::emptyMap(); plugin->textInput(wstring_to_utf8str(LLWString(1, uni_char)), gKeyboard->currentMask(FALSE), native_key_data); } } return result; }
void mouseMove( int x , int y ) { // Texture has been scaled so it's 1:1 with screen pixels, so no need to scale mouse coords here. // x = ( x * mAppTextureWidth ) / mAppWindowWidth; // y = ( y * mAppTextureHeight ) / mAppWindowHeight; // GLUT complains if I get the keyboard modifiers here, so just pretend there aren't any. mMediaSource->mouseEvent(LLPluginClassMedia::MOUSE_EVENT_MOVE, x, y, 0); // force a GLUT update glutPostRedisplay(); };
void LLViewerMediaImpl::setVisible(bool visible) { LLPluginClassMedia* plugin = getMediaPlugin(); mVisible = visible; if(mVisible) { if(plugin && plugin->isPluginExited()) { destroyMediaSource(); } if(!plugin) { createMediaSource(); } } if(plugin) { plugin->setPriority(mVisible?LLPluginClassBasic::PRIORITY_NORMAL:LLPluginClassBasic::PRIORITY_SLEEP); } }