]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/src/vout_manager.cpp
cosmetic: remove nullity test on free() and delete
[vlc] / modules / gui / skins2 / src / vout_manager.cpp
index fd0242d5705be1d988d97f3e5ee05463a4599658..400743187d1a7e34354bb7ce483235f96a14d2ae 100644 (file)
@@ -50,11 +50,8 @@ VoutManager *VoutManager::instance( intf_thread_t *pIntf )
 
 void VoutManager::destroy( intf_thread_t *pIntf )
 {
-    if( pIntf->p_sys->p_voutManager )
-    {
-        delete pIntf->p_sys->p_voutManager;
-        pIntf->p_sys->p_voutManager = NULL;
-    }
+    delete pIntf->p_sys->p_voutManager;
+    pIntf->p_sys->p_voutManager = NULL;
 }
 
 
@@ -154,7 +151,8 @@ void VoutManager::requestVout( CtrlVideo* pCtrlVideo )
     {
         if( (*it).pCtrlVideo == NULL )
         {
-            pCtrlVideo->attachVoutWindow( (*it).pVoutWindow );
+            pCtrlVideo->attachVoutWindow( (*it).pVoutWindow,
+                                          (*it).width, (*it).height );
             (*it).pCtrlVideo = pCtrlVideo;
             break;
         }
@@ -199,7 +197,7 @@ void* VoutManager::acceptVout( vout_thread_t* pVout, int width, int height )
     // save vout characteristics
     m_SavedVoutVec.push_back( SavedVout( pVout, pVoutWindow, pCtrlVideo ) );
 
-    msg_Dbg( getIntf(), "New incoming vout=0x%x, handle=0x%x, VideoCtrl=0x%x",
+    msg_Dbg( getIntf(), "New incoming vout=0x%p, handle=0x%p, VideoCtrl=0x%p",
                         pVout, handle, pCtrlVideo );
 
     return handle;
@@ -249,7 +247,7 @@ void VoutManager::releaseWindow( intf_thread_t *pIntf, vout_window_t *pWnd )
     {
         if( (*it).pVout == pVout )
         {
-            msg_Dbg( pIntf, "vout released vout=0x%x, VideoCtrl=0x%x",
+            msg_Dbg( pIntf, "vout released vout=0x%p, VideoCtrl=0x%p",
                              pVout, (*it).pCtrlVideo );
 
             // if a video control was being used, detach from it
@@ -274,6 +272,7 @@ int VoutManager::controlWindow( struct vout_window_t *pWnd,
 {
     intf_thread_t *pIntf = (intf_thread_t *)pWnd->p_private;
     VoutManager *pThis = pIntf->p_sys->p_voutManager;
+    vout_thread_t* pVout = pWnd->vout;
 
     switch( query )
     {
@@ -284,12 +283,27 @@ int VoutManager::controlWindow( struct vout_window_t *pWnd,
 
             if( i_width && i_height )
             {
-                // Post a resize vout command
-                CmdResizeVout *pCmd =
-                    new CmdResizeVout( pThis->getIntf(), pWnd->handle.hwnd,
-                                       i_width, i_height );
-                AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
-                pQueue->push( CmdGenericPtr( pCmd ) );
+                pThis->lockVout();
+
+                vector<SavedVout>::iterator it;
+                for( it = pThis->m_SavedVoutVec.begin();
+                     it != pThis->m_SavedVoutVec.end(); it++ )
+                {
+                    if( (*it).pVout == pVout )
+                    {
+                        // Post a vout resize command
+                        CmdResizeVout *pCmd =
+                            new CmdResizeVout( pThis->getIntf(),
+                                               (*it).pVoutWindow,
+                                               (int)i_width, (int)i_height );
+                        AsyncQueue *pQueue =
+                            AsyncQueue::instance( pThis->getIntf() );
+                        pQueue->push( CmdGenericPtr( pCmd ) );
+                        break;
+                    }
+                }
+
+                pThis->unlockVout();
             }
         }