Commit 411471d7 authored by Laurent Aimar's avatar Laurent Aimar

Updated skins2 vout_window provider to the new API.

parent 15431387
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <vlc_demux.h> #include <vlc_demux.h>
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include <vlc_threads.h> #include <vlc_threads.h>
#include <vlc_window.h> #include <vlc_vout_window.h>
#include "dialogs.hpp" #include "dialogs.hpp"
#include "os_factory.hpp" #include "os_factory.hpp"
...@@ -364,7 +364,7 @@ static int WindowOpen( vlc_object_t *p_this ) ...@@ -364,7 +364,7 @@ static int WindowOpen( vlc_object_t *p_this )
if( pWnd->handle.hwnd ) if( pWnd->handle.hwnd )
{ {
pWnd->p_private = pIntf; pWnd->sys = (vout_window_sys_t*)pIntf;
pWnd->control = &VoutManager::controlWindow; pWnd->control = &VoutManager::controlWindow;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -377,7 +377,7 @@ static int WindowOpen( vlc_object_t *p_this ) ...@@ -377,7 +377,7 @@ static int WindowOpen( vlc_object_t *p_this )
static void WindowClose( vlc_object_t *p_this ) static void WindowClose( vlc_object_t *p_this )
{ {
vout_window_t *pWnd = (vout_window_t *)p_this; vout_window_t *pWnd = (vout_window_t *)p_this;
intf_thread_t *pIntf = (intf_thread_t *)p_this->p_private; intf_thread_t *pIntf = (intf_thread_t *)pWnd->sys;
VoutManager::releaseWindow( pIntf, pWnd ); VoutManager::releaseWindow( pIntf, pWnd );
} }
...@@ -569,11 +569,7 @@ vlc_module_begin () ...@@ -569,11 +569,7 @@ vlc_module_begin ()
add_shortcut( "skins" ) add_shortcut( "skins" )
add_submodule () add_submodule ()
#ifndef WIN32 set_capability( "vout window", 51 )
set_capability( "xwindow", 51 )
#else
set_capability( "hwnd", 51 )
#endif
set_callbacks( WindowOpen, WindowClose ) set_callbacks( WindowOpen, WindowClose )
add_submodule () add_submodule ()
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include <vlc_aout.h> #include <vlc_aout.h>
#include <vlc_vout.h> #include <vlc_vout.h>
#include <vlc_playlist.h> #include <vlc_playlist.h>
#include <vlc_window.h>
#include "vlcproc.hpp" #include "vlcproc.hpp"
#include "os_factory.hpp" #include "os_factory.hpp"
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#endif #endif
#include <vlc_vout.h> #include <vlc_vout.h>
#include <vlc_window.h>
#include "vout_manager.hpp" #include "vout_manager.hpp"
#include "window_manager.hpp" #include "window_manager.hpp"
...@@ -57,7 +56,7 @@ void VoutManager::destroy( intf_thread_t *pIntf ) ...@@ -57,7 +56,7 @@ void VoutManager::destroy( intf_thread_t *pIntf )
VoutManager::VoutManager( intf_thread_t *pIntf ): SkinObject( pIntf ), VoutManager::VoutManager( intf_thread_t *pIntf ): SkinObject( pIntf ),
m_pVoutMainWindow( NULL ), m_pCtrlVideoVec(), m_pVoutMainWindow( NULL ), m_pCtrlVideoVec(),
m_pCtrlVideoVecBackup(), m_SavedVoutVec() m_pCtrlVideoVecBackup(), m_SavedWndVec()
{ {
vlc_mutex_init( &vout_lock ); vlc_mutex_init( &vout_lock );
...@@ -83,8 +82,8 @@ void VoutManager::saveVoutConfig( ) ...@@ -83,8 +82,8 @@ void VoutManager::saveVoutConfig( )
{ {
// Save width/height to be consistent across themes // Save width/height to be consistent across themes
// and detach Video Controls // and detach Video Controls
vector<SavedVout>::iterator it; vector<SavedWnd>::iterator it;
for( it = m_SavedVoutVec.begin(); it != m_SavedVoutVec.end(); it++ ) for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); it++ )
{ {
if( (*it).pCtrlVideo ) if( (*it).pCtrlVideo )
{ {
...@@ -113,8 +112,8 @@ void VoutManager::restoreVoutConfig( bool b_success ) ...@@ -113,8 +112,8 @@ void VoutManager::restoreVoutConfig( bool b_success )
} }
// reattach vout(s) to Video Controls // reattach vout(s) to Video Controls
vector<SavedVout>::iterator it; vector<SavedWnd>::iterator it;
for( it = m_SavedVoutVec.begin(); it != m_SavedVoutVec.end(); it++ ) for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); it++ )
{ {
CtrlVideo* pCtrlVideo = getBestCtrlVideo(); CtrlVideo* pCtrlVideo = getBestCtrlVideo();
if( pCtrlVideo ) if( pCtrlVideo )
...@@ -128,8 +127,8 @@ void VoutManager::restoreVoutConfig( bool b_success ) ...@@ -128,8 +127,8 @@ void VoutManager::restoreVoutConfig( bool b_success )
void VoutManager::discardVout( CtrlVideo* pCtrlVideo ) void VoutManager::discardVout( CtrlVideo* pCtrlVideo )
{ {
vector<SavedVout>::iterator it; vector<SavedWnd>::iterator it;
for( it = m_SavedVoutVec.begin(); it != m_SavedVoutVec.end(); it++ ) for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); it++ )
{ {
if( (*it).pCtrlVideo == pCtrlVideo ) if( (*it).pCtrlVideo == pCtrlVideo )
{ {
...@@ -146,8 +145,8 @@ void VoutManager::discardVout( CtrlVideo* pCtrlVideo ) ...@@ -146,8 +145,8 @@ void VoutManager::discardVout( CtrlVideo* pCtrlVideo )
void VoutManager::requestVout( CtrlVideo* pCtrlVideo ) void VoutManager::requestVout( CtrlVideo* pCtrlVideo )
{ {
vector<SavedVout>::iterator it; vector<SavedWnd>::iterator it;
for( it = m_SavedVoutVec.begin(); it != m_SavedVoutVec.end(); it++ ) for( it = m_SavedWndVec.begin(); it != m_SavedWndVec.end(); it++ )
{ {
if( (*it).pCtrlVideo == NULL ) if( (*it).pCtrlVideo == NULL )
{ {
...@@ -177,10 +176,10 @@ CtrlVideo* VoutManager::getBestCtrlVideo( ) ...@@ -177,10 +176,10 @@ CtrlVideo* VoutManager::getBestCtrlVideo( )
} }
void* VoutManager::acceptVout( vout_thread_t* pVout, int width, int height ) void* VoutManager::acceptWnd( vout_window_t* pWnd, int width, int height )
{ {
// Creation of a dedicated Window per vout thread // Creation of a dedicated Window per vout thread
VoutWindow* pVoutWindow = new VoutWindow( getIntf(), pVout, width, height, VoutWindow* pVoutWindow = new VoutWindow( getIntf(), pWnd, width, height,
(GenericWindow*) m_pVoutMainWindow ); (GenericWindow*) m_pVoutMainWindow );
void* handle = pVoutWindow->getOSHandle(); void* handle = pVoutWindow->getOSHandle();
...@@ -195,10 +194,10 @@ void* VoutManager::acceptVout( vout_thread_t* pVout, int width, int height ) ...@@ -195,10 +194,10 @@ void* VoutManager::acceptVout( vout_thread_t* pVout, int width, int height )
} }
// save vout characteristics // save vout characteristics
m_SavedVoutVec.push_back( SavedVout( pVout, pVoutWindow, pCtrlVideo ) ); m_SavedWndVec.push_back( SavedWnd( pWnd, pVoutWindow, pCtrlVideo ) );
msg_Dbg( getIntf(), "New incoming vout=0x%p, handle=0x%p, VideoCtrl=0x%p", msg_Dbg( getIntf(), "New incoming vout=0x%p, handle=0x%p, VideoCtrl=0x%p",
pVout, handle, pCtrlVideo ); pWnd, handle, pCtrlVideo );
return handle; return handle;
} }
...@@ -215,13 +214,12 @@ void *VoutManager::getWindow( intf_thread_t *pIntf, vout_window_t *pWnd ) ...@@ -215,13 +214,12 @@ void *VoutManager::getWindow( intf_thread_t *pIntf, vout_window_t *pWnd )
VoutManager *pThis = pIntf->p_sys->p_voutManager; VoutManager *pThis = pIntf->p_sys->p_voutManager;
vout_thread_t* pVout = pWnd->vout; int width = (int)pWnd->cfg->width;
int width = (int)pWnd->width; int height = (int)pWnd->cfg->height;
int height = (int)pWnd->height;
pThis->lockVout(); pThis->lockVout();
void* handle = pThis->acceptVout( pVout, width, height ); void* handle = pThis->acceptWnd( pWnd, width, height );
pThis->unlockVout(); pThis->unlockVout();
...@@ -237,18 +235,16 @@ void VoutManager::releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd ) ...@@ -237,18 +235,16 @@ void VoutManager::releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd )
if( !pIntf->p_sys->p_theme ) if( !pIntf->p_sys->p_theme )
return; return;
vout_thread_t* pVout = pWnd->vout;
pThis->lockVout(); pThis->lockVout();
// remove vout thread from savedVec // remove vout thread from savedVec
vector<SavedVout>::iterator it; vector<SavedWnd>::iterator it;
for( it = pThis->m_SavedVoutVec.begin(); it != pThis->m_SavedVoutVec.end(); it++ ) for( it = pThis->m_SavedWndVec.begin(); it != pThis->m_SavedWndVec.end(); it++ )
{ {
if( (*it).pVout == pVout ) if( (*it).pWnd == pWnd )
{ {
msg_Dbg( pIntf, "vout released vout=0x%p, VideoCtrl=0x%p", msg_Dbg( pIntf, "vout released vout=0x%p, VideoCtrl=0x%p",
pVout, (*it).pCtrlVideo ); pWnd, (*it).pCtrlVideo );
// if a video control was being used, detach from it // if a video control was being used, detach from it
if( (*it).pCtrlVideo ) if( (*it).pCtrlVideo )
...@@ -258,7 +254,7 @@ void VoutManager::releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd ) ...@@ -258,7 +254,7 @@ void VoutManager::releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd )
// remove resources // remove resources
delete (*it).pVoutWindow; delete (*it).pVoutWindow;
pThis->m_SavedVoutVec.erase( it ); pThis->m_SavedWndVec.erase( it );
break; break;
} }
} }
...@@ -270,13 +266,12 @@ void VoutManager::releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd ) ...@@ -270,13 +266,12 @@ void VoutManager::releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd )
int VoutManager::controlWindow( struct vout_window_t *pWnd, int VoutManager::controlWindow( struct vout_window_t *pWnd,
int query, va_list args ) int query, va_list args )
{ {
intf_thread_t *pIntf = (intf_thread_t *)pWnd->p_private; intf_thread_t *pIntf = (intf_thread_t *)pWnd->sys;
VoutManager *pThis = pIntf->p_sys->p_voutManager; VoutManager *pThis = pIntf->p_sys->p_voutManager;
vout_thread_t* pVout = pWnd->vout;
switch( query ) switch( query )
{ {
case VOUT_SET_SIZE: case VOUT_WINDOW_SET_SIZE:
{ {
unsigned int i_width = va_arg( args, unsigned int ); unsigned int i_width = va_arg( args, unsigned int );
unsigned int i_height = va_arg( args, unsigned int ); unsigned int i_height = va_arg( args, unsigned int );
...@@ -285,17 +280,17 @@ int VoutManager::controlWindow( struct vout_window_t *pWnd, ...@@ -285,17 +280,17 @@ int VoutManager::controlWindow( struct vout_window_t *pWnd,
{ {
pThis->lockVout(); pThis->lockVout();
vector<SavedVout>::iterator it; vector<SavedWnd>::iterator it;
for( it = pThis->m_SavedVoutVec.begin(); for( it = pThis->m_SavedWndVec.begin();
it != pThis->m_SavedVoutVec.end(); it++ ) it != pThis->m_SavedWndVec.end(); it++ )
{ {
if( (*it).pVout == pVout ) if( (*it).pWnd == pWnd )
{ {
// Post a vout resize command // Post a vout resize command
CmdResizeVout *pCmd = CmdResizeVout *pCmd =
new CmdResizeVout( pThis->getIntf(), new CmdResizeVout( pThis->getIntf(),
(*it).pVoutWindow, (*it).pVoutWindow,
(int)i_width, (int)i_height ); i_width, i_height );
AsyncQueue *pQueue = AsyncQueue *pQueue =
AsyncQueue::instance( pThis->getIntf() ); AsyncQueue::instance( pThis->getIntf() );
pQueue->push( CmdGenericPtr( pCmd ) ); pQueue->push( CmdGenericPtr( pCmd ) );
...@@ -305,13 +300,12 @@ int VoutManager::controlWindow( struct vout_window_t *pWnd, ...@@ -305,13 +300,12 @@ int VoutManager::controlWindow( struct vout_window_t *pWnd,
pThis->unlockVout(); pThis->unlockVout();
} }
return VLC_SUCCESS;
} }
default: default:
msg_Dbg( pWnd, "control query not supported" ); msg_Dbg( pWnd, "control query not supported" );
break; return VLC_EGENERIC;
} }
return VLC_SUCCESS;
} }
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <vector> #include <vector>
#include <vlc_vout.h> #include <vlc_vout.h>
#include <vlc_window.h> #include <vlc_vout_window.h>
#include "../utils/position.hpp" #include "../utils/position.hpp"
#include "../commands/cmd_generic.hpp" #include "../commands/cmd_generic.hpp"
#include "../controls/ctrl_video.hpp" #include "../controls/ctrl_video.hpp"
...@@ -37,17 +37,17 @@ class GenericWindow; ...@@ -37,17 +37,17 @@ class GenericWindow;
#include <stdio.h> #include <stdio.h>
class SavedVout class SavedWnd
{ {
public: public:
SavedVout( vout_thread_t* pVout, VoutWindow* pVoutWindow = NULL, SavedWnd( vout_window_t* pWnd, VoutWindow* pVoutWindow = NULL,
CtrlVideo* pCtrlVideo = NULL, int height = 0, int width = 0 ) : CtrlVideo* pCtrlVideo = NULL, int height = 0, int width = 0 ) :
pVout( pVout ), pVoutWindow( pVoutWindow ), pCtrlVideo( pCtrlVideo ), pWnd( pWnd ), pVoutWindow( pVoutWindow ), pCtrlVideo( pCtrlVideo ),
height( height ), width( width ) {} height( height ), width( width ) {}
~SavedVout() {} ~SavedWnd() {}
vout_thread_t* pVout; vout_window_t* pWnd;
VoutWindow *pVoutWindow; VoutWindow *pVoutWindow;
CtrlVideo *pCtrlVideo; CtrlVideo *pCtrlVideo;
int height; int height;
...@@ -83,8 +83,8 @@ class VoutManager: public SkinObject ...@@ -83,8 +83,8 @@ class VoutManager: public SkinObject
/// Callback to request a vout window /// Callback to request a vout window
static void *getWindow( intf_thread_t *pIntf, vout_window_t *pWnd ); static void *getWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
/// Accept Vout /// Accept Wnd
void* acceptVout( vout_thread_t* pVout, int width, int height ); void* acceptWnd( vout_window_t* pWnd, int width, int height );
// Window provider (release) // Window provider (release)
static void releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd ); static void releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd );
...@@ -104,9 +104,6 @@ class VoutManager: public SkinObject ...@@ -104,9 +104,6 @@ class VoutManager: public SkinObject
void discardVout( CtrlVideo* pCtrlVideo ); void discardVout( CtrlVideo* pCtrlVideo );
void requestVout( CtrlVideo* pCtrlVideo ); void requestVout( CtrlVideo* pCtrlVideo );
// get a VoutWindow
void* getHandle( vout_thread_t* pVout, int width, int height );
// get a useable video Control // get a useable video Control
CtrlVideo* getBestCtrlVideo( ); CtrlVideo* getBestCtrlVideo( );
...@@ -114,7 +111,7 @@ class VoutManager: public SkinObject ...@@ -114,7 +111,7 @@ class VoutManager: public SkinObject
VoutMainWindow* getVoutMainWindow() { return m_pVoutMainWindow; } VoutMainWindow* getVoutMainWindow() { return m_pVoutMainWindow; }
// test if vout are running // test if vout are running
bool hasVout() { return ( m_SavedVoutVec.size() != 0 ) ; } bool hasVout() { return ( m_SavedWndVec.size() != 0 ) ; }
// (un)lock functions to protect vout sets // (un)lock functions to protect vout sets
void lockVout( ) { vlc_mutex_lock( &vout_lock ); } void lockVout( ) { vlc_mutex_lock( &vout_lock ); }
...@@ -129,7 +126,7 @@ class VoutManager: public SkinObject ...@@ -129,7 +126,7 @@ class VoutManager: public SkinObject
vector<CtrlVideo *> m_pCtrlVideoVec; vector<CtrlVideo *> m_pCtrlVideoVec;
vector<CtrlVideo *> m_pCtrlVideoVecBackup; vector<CtrlVideo *> m_pCtrlVideoVecBackup;
vector<SavedVout> m_SavedVoutVec; vector<SavedWnd> m_SavedWndVec;
VoutMainWindow* m_pVoutMainWindow; VoutMainWindow* m_pVoutMainWindow;
......
...@@ -31,17 +31,17 @@ ...@@ -31,17 +31,17 @@
int VoutWindow::count = 0; int VoutWindow::count = 0;
VoutWindow::VoutWindow( intf_thread_t *pIntf, vout_thread_t* pVout, VoutWindow::VoutWindow( intf_thread_t *pIntf, vout_window_t* pWnd,
int width, int height, GenericWindow* pParent ) : int width, int height, GenericWindow* pParent ) :
GenericWindow( pIntf, 0, 0, false, false, pParent ), GenericWindow( pIntf, 0, 0, false, false, pParent ),
m_pVout( pVout ), original_width( width ), original_height( height ), m_pWnd( pWnd ), original_width( width ), original_height( height ),
m_pParentWindow( pParent ), m_pImage( NULL ) m_pParentWindow( pParent ), m_pImage( NULL )
{ {
// counter for debug // counter for debug
count++; count++;
if( m_pVout ) if( m_pWnd )
vlc_object_hold( m_pVout ); vlc_object_hold( m_pWnd );
// needed on MS-Windows to prevent vlc hanging // needed on MS-Windows to prevent vlc hanging
show(); show();
...@@ -51,8 +51,8 @@ VoutWindow::VoutWindow( intf_thread_t *pIntf, vout_thread_t* pVout, ...@@ -51,8 +51,8 @@ VoutWindow::VoutWindow( intf_thread_t *pIntf, vout_thread_t* pVout,
VoutWindow::~VoutWindow() VoutWindow::~VoutWindow()
{ {
delete m_pImage; delete m_pImage;
if( m_pVout ) if( m_pWnd )
vlc_object_release( m_pVout ); vlc_object_release( m_pWnd );
count--; count--;
msg_Dbg( getIntf(), "VoutWindow count = %d", count ); msg_Dbg( getIntf(), "VoutWindow count = %d", count );
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#define VOUT_WINDOW_HPP #define VOUT_WINDOW_HPP
#include "generic_window.hpp" #include "generic_window.hpp"
#include <vlc_vout_window.h>
class OSGraphics; class OSGraphics;
class CtrlVideo; class CtrlVideo;
...@@ -35,7 +36,7 @@ class VoutWindow: private GenericWindow ...@@ -35,7 +36,7 @@ class VoutWindow: private GenericWindow
{ {
public: public:
VoutWindow( intf_thread_t *pIntf, vout_thread_t* pVout, VoutWindow( intf_thread_t *pIntf, vout_window_t* pWnd,
int width, int height, GenericWindow* pParent = NULL ); int width, int height, GenericWindow* pParent = NULL );
virtual ~VoutWindow(); virtual ~VoutWindow();
...@@ -79,7 +80,7 @@ class VoutWindow: private GenericWindow ...@@ -79,7 +80,7 @@ class VoutWindow: private GenericWindow
OSGraphics *m_pImage; OSGraphics *m_pImage;
/// vout thread /// vout thread
vout_thread_t* m_pVout; vout_window_t* m_pWnd;
/// original width and height /// original width and height
int original_width; int original_width;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment