Commit a231a873 authored by Olivier Teulière's avatar Olivier Teulière

* skins2: Fixed 2 bugs related with embedded vout and skins switching:

    - win32: fixed the 'vout_directx private error: out of memory' error
      (thanks to Trax` for pointing it out)
    - x11: it's now possible to use the embedded vout after changing skin
parent 9be4d7c0
......@@ -60,8 +60,7 @@ void VlcProc::destroy( intf_thread_t *pIntf )
}
VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
m_pVoutWindow( NULL ), m_pVout( NULL )
VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ), m_pVout( NULL )
{
// Create a timer to poll the status of the vlc
OSFactory *pOsFactory = OSFactory::instance( pIntf );
......@@ -160,9 +159,9 @@ VlcProc::~VlcProc()
}
void VlcProc::setVoutWindow( void *pVoutWindow )
void VlcProc::registerVoutWindow( void *pVoutWindow )
{
m_pVoutWindow = pVoutWindow;
m_handleSet.insert( pVoutWindow );
// Reparent the vout window
if( m_pVout )
{
......@@ -172,6 +171,12 @@ void VlcProc::setVoutWindow( void *pVoutWindow )
}
void VlcProc::unregisterVoutWindow( void *pVoutWindow )
{
m_handleSet.erase( pVoutWindow );
}
void VlcProc::dropVout()
{
if( m_pVout )
......@@ -423,7 +428,14 @@ void *VlcProc::getWindow( intf_thread_t *pIntf, vout_thread_t *pVout,
{
VlcProc *pThis = pIntf->p_sys->p_vlcProc;
pThis->m_pVout = pVout;
return pThis->m_pVoutWindow;
if( pThis->m_handleSet.empty() )
{
return NULL;
}
else
{
return *pThis->m_handleSet.begin();
}
}
......
......@@ -25,6 +25,8 @@
#ifndef VLCPROC_HPP
#define VLCPROC_HPP
#include <set>
#include "../vars/playlist.hpp"
#include "../vars/time.hpp"
#include "../vars/volume.hpp"
......@@ -63,7 +65,10 @@ class VlcProc: public SkinObject
{ return *((VarText*)(m_cVarStreamURI.get())); }
/// Set the vout window handle
void setVoutWindow( void *pVoutWindow );
void registerVoutWindow( void *pVoutWindow );
/// Unset the vout window handle
void unregisterVoutWindow( void *pVoutWindow );
/// Indicate whether the embedded video output is currently used
bool isVoutUsed() const { return m_pVout; }
......@@ -99,16 +104,23 @@ class VlcProc: public SkinObject
VariablePtr m_cVarStopped;
VariablePtr m_cVarPaused;
VariablePtr m_cVarSeekable;
/// Vout window handle
void *m_pVoutWindow;
/// Set of handles of vout windows
/**
* When changing the skin, the handles of the 2 skins coexist in the
* set (but this is temporary, until the old theme is destroyed).
*/
set<void *> m_handleSet;
/// Vout thread
vout_thread_t *m_pVout;
/// Poll VLC internals to update the status (volume, current time in
/// the stream, current filename, play/pause/stop status, ...)
/// This function should be called regurlarly, since there is no
/// callback mechanism (yet?) to automatically update a variable when
/// the internal status changes
/**
* Poll VLC internals to update the status (volume, current time in
* the stream, current filename, play/pause/stop status, ...)
* This function should be called regurlarly, since there is no
* callback mechanism (yet?) to automatically update a variable when
* the internal status changes
*/
void manage();
/// Update the stream name variable
......
......@@ -42,7 +42,8 @@ Win32Window::Win32Window( intf_thread_t *pIntf, GenericWindow &rWindow,
HINSTANCE hInst, HWND hParentWindow,
bool dragDrop, bool playOnDrop,
Win32Window *pParentWindow ):
OSWindow( pIntf ), m_dragDrop( dragDrop ), m_isLayered( false )
OSWindow( pIntf ), m_dragDrop( dragDrop ), m_isLayered( false ),
m_pParent( pParentWindow )
{
// Create the window
if( pParentWindow )
......@@ -81,16 +82,21 @@ Win32Window::Win32Window( intf_thread_t *pIntf, GenericWindow &rWindow,
RegisterDragDrop( m_hWnd, m_pDropTarget );
}
// XXX Set this window as the vout
if( pParentWindow )
// Set this window as a vout
if( m_pParent )
{
VlcProc::instance( getIntf() )->setVoutWindow( (void*)m_hWnd );
VlcProc::instance( getIntf() )->registerVoutWindow( (void*)m_hWnd );
}
}
Win32Window::~Win32Window()
{
if( m_pParent )
{
VlcProc::instance( getIntf() )->unregisterVoutWindow( (void*)m_hWnd );
}
Win32Factory *pFactory = (Win32Factory*)Win32Factory::instance( getIntf() );
pFactory->m_windowMap[m_hWnd] = NULL;
......
......@@ -71,6 +71,8 @@ class Win32Window: public OSWindow
LPDROPTARGET m_pDropTarget;
/// Indicates whether the window is layered
mutable bool m_isLayered;
/// Parent window
Win32Window *m_pParent;
};
......
......@@ -109,10 +109,10 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
// Associate the window to the main "parent" window
XSetTransientForHint( XDISPLAY, m_wnd, m_rDisplay.getMainWindow() );
// XXX Set this window as the vout
// Set this window as a vout
if( m_pParent )
{
VlcProc::instance( getIntf() )->setVoutWindow( (void*)m_wnd );
VlcProc::instance( getIntf() )->registerVoutWindow( (void*)m_wnd );
}
}
......@@ -120,10 +120,9 @@ X11Window::X11Window( intf_thread_t *pIntf, GenericWindow &rWindow,
X11Window::~X11Window()
{
// XXX This window is no more the vout
if( m_pParent )
{
VlcProc::instance( getIntf() )->setVoutWindow( NULL );
VlcProc::instance( getIntf() )->unregisterVoutWindow( (void*)m_wnd );
}
X11Factory *pFactory = (X11Factory*)X11Factory::instance( getIntf() );
......
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