#include "menus.hpp" /* Popup menu on bgWidget */
-#include <vlc_vout.h>
-
#include <QLabel>
#include <QToolButton>
#include <QPalette>
#include <math.h>
#include <assert.h>
+#include <vlc_vout.h>
+#include <vlc_vout_window.h>
+
/**********************************************************************
* Video Widget. A simple frame on which video is drawn
* This class handles resize issues
layout = new QHBoxLayout( this );
layout->setContentsMargins( 0, 0, 0, 0 );
stable = NULL;
+ p_window = NULL;
show();
}
{
/* Ensure we are not leaking the video output. This would crash. */
assert( !stable );
+ assert( !p_window );
}
void VideoWidget::sync( void )
/**
* Request the video to avoid the conflicts
**/
-WId VideoWidget::request( unsigned int *pi_width, unsigned int *pi_height,
- bool b_keep_size )
+WId VideoWidget::request( struct vout_window_t *p_wnd, unsigned int *pi_width,
+ unsigned int *pi_height, bool b_keep_size )
{
if( stable )
{
msg_Dbg( p_intf, "embedded video already in use" );
return 0;
}
+ assert( !p_window );
+
if( b_keep_size )
{
*pi_width = size().width();
XSelectInput( dpy, w, attr.your_event_mask );
#endif
sync();
+ p_window = p_wnd;
return stable->winId();
}
sync();
}
+void VideoWidget::resizeEvent( QResizeEvent *event )
+{
+ if( p_window != NULL )
+ vout_window_ReportSize( p_window, event->size().width(),
+ event->size().height() );
+
+ QWidget::resizeEvent( event );
+}
+
void VideoWidget::release( void )
{
msg_Dbg( p_intf, "Video is not needed anymore" );
layout->removeWidget( stable );
stable->deleteLater();
stable = NULL;
+ p_window = NULL;
}
updateGeometry();
class QHBoxLayout;
class QMenu;
class QSlider;
+struct vout_window_t;
/******************** Video Widget ****************/
class VideoWidget : public QFrame
VideoWidget( intf_thread_t * );
virtual ~VideoWidget();
- WId request( unsigned int *, unsigned int *, bool );
+ WId request( struct vout_window_t *, unsigned int *, unsigned int *, bool );
void release( void );
void sync( void );
return NULL;
}
+ virtual void resizeEvent(QResizeEvent *);
+
private:
intf_thread_t *p_intf;
+ vout_window_t *p_window;
QWidget *stable;
QLayout *layout;
/* VideoWidget connects for asynchronous calls */
b_videoFullScreen = false;
- connect( this, SIGNAL(askGetVideo(WId*,unsigned*,unsigned *)),
- this, SLOT(getVideoSlot(WId*,unsigned*,unsigned*)),
+ connect( this, SIGNAL(askGetVideo(WId*,struct vout_window_t*,unsigned*,unsigned *)),
+ this, SLOT(getVideoSlot(WId*,struct vout_window_t*,unsigned*,unsigned*)),
Qt::BlockingQueuedConnection );
connect( this, SIGNAL(askReleaseVideo( void )),
this, SLOT(releaseVideoSlot( void )),
* All window provider queries must be handled through signals or events.
* That's why we have all those emit statements...
*/
-WId MainInterface::getVideo( unsigned int *pi_width, unsigned int *pi_height )
+WId MainInterface::getVideo( struct vout_window_t *p_wnd,
+ unsigned int *pi_width, unsigned int *pi_height )
{
if( !videoWidget )
return 0;
/* This is a blocking call signal. Results are returned through pointers.
* Beware of deadlocks! */
WId id;
- emit askGetVideo( &id, pi_width, pi_height );
+ emit askGetVideo( &id, p_wnd, pi_width, pi_height );
return id;
}
-void MainInterface::getVideoSlot( WId *p_id,
+void MainInterface::getVideoSlot( WId *p_id, struct vout_window_t *p_wnd,
unsigned *pi_width, unsigned *pi_height )
{
/* Hidden or minimized, activate */
toggleUpdateSystrayMenu();
/* Request the videoWidget */
- WId ret = videoWidget->request( pi_width, pi_height, !b_autoresize );
+ WId ret = videoWidget->request( p_wnd, pi_width, pi_height, !b_autoresize );
*p_id = ret;
if( ret ) /* The videoWidget is available */
{
class QMenu;
class QSize;
class StandardPLPanel;
+struct vout_window_t;
class MainInterface : public QVLCMW
{
static const QEvent::Type ToolbarsNeedRebuild;
/* Video requests from core */
- WId getVideo( unsigned int *pi_width, unsigned int *pi_height );
+ WId getVideo( struct vout_window_t *,
+ unsigned int *pi_width, unsigned int *pi_height );
void releaseVideo( void );
int controlVideo( int i_query, va_list args );
#endif
/* Manage the Video Functions from the vout threads */
- void getVideoSlot( WId *p_id, unsigned *pi_width, unsigned *pi_height );
+ void getVideoSlot( WId *p_id, struct vout_window_t *,
+ unsigned *pi_width, unsigned *pi_height );
void releaseVideoSlot( void );
void emitBoss();
void continuePlayback();
signals:
- void askGetVideo( WId *p_id, unsigned *pi_width, unsigned *pi_height );
+ void askGetVideo( WId *, struct vout_window_t *, unsigned *, unsigned * );
void askReleaseVideo( );
void askVideoToResize( unsigned int, unsigned int );
void askVideoSetFullScreen( bool );
unsigned i_width = cfg->width;
unsigned i_height = cfg->height;
- WId wid = p_mi->getVideo( &i_width, &i_height );
+ WId wid = p_mi->getVideo( p_wnd, &i_width, &i_height );
if( !wid )
return VLC_EGENERIC;