/////////////////////////////////////////////////////////////////////////////// /// @brief Creates an instance of the JSAPI object that provides your main /// Javascript interface. /// /// Note that m_host is your BrowserHost and shared_ptr returns a /// FB::PluginCorePtr, which can be used to provide a /// boost::weak_ptr<WebrtcRenderer> for your JSAPI class. /// /// Be very careful where you hold a shared_ptr to your plugin class from, /// as it could prevent your plugin class from getting destroyed properly. /////////////////////////////////////////////////////////////////////////////// FB::JSAPIPtr WebrtcRenderer::createJSAPI() { LOGD("begin.."); // m_host is the BrowserHost m_render = boost::make_shared<WebrtcRendererAPI>(m_host, isWindowless()); return m_render; }
bool FBVLC_Win::isFullscreen() { if( isWindowless() ) { return false; //fullscreen mode not supported in windowless mode for now } else { return m_wm.get() ? m_wm->IsFullScreen() : false ; } }
bool FBVLC::onWindowResized( FB::ResizedEvent *evt, FB::PluginWindow* w ) { if( isWindowless() ) { if( get_options().get_native_scaling() ) vlc::vmem::set_desired_size( vlc::original_media_width, vlc::original_media_height ); else vlc::vmem::set_desired_size( w->getWindowWidth(), w->getWindowHeight() ); } return true; }
void FBVLC_Win::setFullscreen( bool fs ) { //fullscreen mode not supported in windowless mode for now if( !isWindowless() && m_wm.get() ) { if( !m_wm->IsFullScreen() && fs ) { m_wm->StartFullScreen(); } else if( m_wm->IsFullScreen() && !fs ) { m_wm->EndFullScreen(); } } }
bool WebrtcRenderer::onWindowRefresh(FB::RefreshEvent *evt, FB::PluginWindow *pWin) { //LOGD("begin.."); bool ret = false; #if defined(IRENDER_MAC) if (m_render.get()) { ret = irender::VideoRendererMac::OnRefreshRenderArea(m_render->getRenderer().get(), evt, pWin); } #elif defined(IRENDER_WIN) if (m_render.get() && isWindowless()) { ret = irender::VideoRendererWin::OnRefreshRenderArea(m_render->getRenderer().get(), evt, pWin); } #endif return ret; }
void FBVLC::vlc_close() { get_player().stop(); if ( get_player().is_open() && isWindowless() ) { vlc::vmem::close(); } if ( get_player().is_open() ) { VlcEvents(false); get_player().close(); } if ( m_libvlc ) { libvlc_free(m_libvlc); m_libvlc = 0; } }
void FBVLC_Win::on_option_change( vlc_player_option_e option ) { Chimera::on_option_change( option ); vlc_player_options& o = get_options(); switch( option ) { case po_bg_color: { if( isWindowless() ) { HBRUSH hTmpBrush = m_hBgBrush; COLORREF bg_color = HtmlColor2RGB( o.get_bg_color(), RGB( 0, 0, 0 ) ); m_hBgBrush = CreateSolidBrush( bg_color ); DeleteObject( hTmpBrush ); if( GetWindow() ) GetWindow()->InvalidateWindow(); } break; } default: break; } }
void FBVLC::vlc_open() { if( get_player().is_open() ) return ; init_vlc_player_options(); if( !m_libvlc ) { /* prepare VLC command line */ std::vector<std::string> libvlc_options; init_libvlc_options( &libvlc_options ); std::vector<const char*> libvlc_c_opts; libvlc_c_opts.push_back("--no-video-title-show"); /*** add static libvlc options here ***/ std::vector<std::string>::const_iterator i = libvlc_options.begin(); std::vector<std::string>::const_iterator end_i = libvlc_options.end(); for( ; i != end_i; ++i ) { libvlc_c_opts.push_back( i->c_str() ); } m_libvlc = libvlc_new( libvlc_c_opts.size(), libvlc_c_opts.empty() ? 0 : &libvlc_c_opts[0] ); } if ( m_libvlc && !get_player().is_open() ) { get_player().open(m_libvlc); VlcEvents(true); } if ( get_player().is_open() && isWindowless() ) { vlc::vmem::open(); } process_startup_options(); }