#endif
#include <vlc_vout.h>
+#include <vlc_vout_display.h>
#include "vout_manager.hpp"
#include "window_manager.hpp"
#include "../commands/cmd_show_window.hpp"
#include "../commands/cmd_resize.hpp"
#include "../commands/cmd_voutwindow.hpp"
+#include "../commands/cmd_on_top.hpp"
VoutManager::VoutManager( intf_thread_t *pIntf ): SkinObject( pIntf ),
- m_pVoutMainWindow( NULL ), m_pCtrlVideoVec(),
+ m_pVoutMainWindow( NULL ), m_pFscWindow( NULL ), m_pCtrlVideoVec(),
m_pCtrlVideoVecBackup(), m_SavedWndVec()
{
m_pVoutMainWindow = new VoutMainWindow( getIntf() );
+
+ OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+ int width = pOsFactory->getScreenWidth();
+ int height = pOsFactory->getScreenHeight();
+
+ m_pVoutMainWindow->move( 0, 0 );
+ m_pVoutMainWindow->resize( width, height );
+
+ VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
+ rFullscreen.addObserver( this );
}
VoutManager::~VoutManager( )
{
+ VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
+ rFullscreen.delObserver( this );
+
delete m_pVoutMainWindow;
}
}
+void VoutManager::registerFSC( TopWindow* p_Win )
+{
+ m_pFscWindow = p_Win;
+
+ int x = p_Win->getLeft();
+ int y = p_Win->getTop();
+ p_Win->setParent( m_pVoutMainWindow, x , y, 0, 0 );
+}
+
+
void VoutManager::saveVoutConfig( )
{
// Save width/height to be consistent across themes
// and detach Video Controls
vector<SavedWnd>::iterator it;
- for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); it++ )
+ for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); ++it )
{
if( (*it).pCtrlVideo )
{
// reattach vout(s) to Video Controls
vector<SavedWnd>::iterator it;
- for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); it++ )
+ for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); ++it )
{
CtrlVideo* pCtrlVideo = getBestCtrlVideo();
if( pCtrlVideo )
void VoutManager::discardVout( CtrlVideo* pCtrlVideo )
{
vector<SavedWnd>::iterator it;
- for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); it++ )
+ for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); ++it )
{
if( (*it).pCtrlVideo == pCtrlVideo )
{
void VoutManager::requestVout( CtrlVideo* pCtrlVideo )
{
vector<SavedWnd>::iterator it;
- for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); it++ )
+ for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); ++it )
{
if( (*it).pCtrlVideo == NULL )
{
// try to find an unused useable VideoControl
vector<CtrlVideo*>::const_iterator it;
- for( it = m_pCtrlVideoVec.begin(); it != m_pCtrlVideoVec.end(); it++ )
+ for( it = m_pCtrlVideoVec.begin(); it != m_pCtrlVideoVec.end(); ++it )
{
if( (*it)->isUseable() && !(*it)->isUsed() )
{
// directly attach vout thread to it
pCtrlVideo->attachVoutWindow( pVoutWindow );
}
+ else
+ {
+ pVoutWindow->setCtrlVideo( NULL );
+ }
// save vout characteristics
m_SavedWndVec.push_back( SavedWnd( pWnd, pVoutWindow, pCtrlVideo ) );
{
// remove vout thread from savedVec
vector<SavedWnd>::iterator it;
- for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); it++ )
+ for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); ++it )
{
if( (*it).pWnd == pWnd )
{
- msg_Dbg( getIntf(), "vout released vout=0x%p, VideoCtrl=0x%p",
+ msg_Dbg( getIntf(), "vout released vout=%p, VideoCtrl=%p",
pWnd, (*it).pCtrlVideo );
// if a video control was being used, detach from it
break;
}
}
+
+ // force fullscreen to false so that user regains control
+ VlcProc::instance( getIntf() )->setFullscreenVar( false );
}
width, height );
vector<SavedWnd>::iterator it;
- for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); it++ )
+ for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); ++it )
{
if( (*it).pWnd == pWnd )
{
}
}
+
void VoutManager::setFullscreenWnd( vout_window_t *pWnd, bool b_fullscreen )
{
- msg_Dbg( pWnd, "setFullscreen (%d) received from vout thread",
- b_fullscreen ? 1 : 0 );
+ msg_Dbg( pWnd, "setFullscreen (%i) received from vout thread",
+ b_fullscreen );
- vector<SavedWnd>::iterator it;
- for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); it++ )
- {
- if( (*it).pWnd == pWnd )
- {
- VoutWindow* pVoutWindow = (*it).pVoutWindow;
+ VlcProc::instance( getIntf() )->setFullscreenVar( b_fullscreen );
+}
- pVoutWindow->setFullscreen( b_fullscreen );
- break;
- }
+
+void VoutManager::onUpdate( Subject<VarBool> &rVariable, void *arg )
+{
+ VarBool &rFullscreen = VlcProc::instance( getIntf() )->getFullscreenVar();
+ if( &rVariable == &rFullscreen )
+ {
+ if( rFullscreen.get() )
+ m_pVoutMainWindow->show();
+ else
+ m_pVoutMainWindow->hide();
}
}
+
// Functions called by window provider
// ///////////////////////////////////
AsyncQueue::instance( pThis->getIntf() );
pQueue->push( CmdGenericPtr( pCmd ) );
}
- return VLC_SUCCESS;
+ return VLC_EGENERIC;
}
case VOUT_WINDOW_SET_FULLSCREEN:
return VLC_SUCCESS;
}
+ case VOUT_WINDOW_SET_STATE:
+ {
+ unsigned i_arg = va_arg( args, unsigned );
+ unsigned on_top = i_arg & VOUT_WINDOW_STATE_ABOVE;
+
+ // Post a SetOnTop command
+ CmdSetOnTop* pCmd =
+ new CmdSetOnTop( pThis->getIntf(), on_top );
+
+ AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
+ pQueue->push( CmdGenericPtr( pCmd ) );
+
+ return VLC_SUCCESS;
+ }
+
+
default:
msg_Dbg( pWnd, "control query not supported" );
return VLC_EGENERIC;