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