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