Commit 29b12104 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: keep the vout thread, not its ID

The window is always created with a pre-existing video output,
and destroyed before the video outout.

Besides, using object IDs is not safe.
parent fff7615f
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i ) VideoWidget::VideoWidget( intf_thread_t *_p_i ) : QFrame( NULL ), p_intf( _p_i )
{ {
/* Init */ /* Init */
i_vout = 0; p_vout = NULL;
videoSize.rwidth() = -1; videoSize.rwidth() = -1;
videoSize.rheight() = -1; videoSize.rheight() = -1;
...@@ -109,15 +109,10 @@ void VideoWidget::paintEvent(QPaintEvent *ev) ...@@ -109,15 +109,10 @@ void VideoWidget::paintEvent(QPaintEvent *ev)
/* Kill the vout at Destruction */ /* Kill the vout at Destruction */
VideoWidget::~VideoWidget() VideoWidget::~VideoWidget()
{ {
vout_thread_t *p_vout = i_vout ? if( !p_vout )
(vout_thread_t *)vlc_object_get( p_intf->p_libvlc, i_vout ) : NULL; return;
if( p_vout )
{
if( vout_Control( p_vout, VOUT_CLOSE ) != VLC_SUCCESS ) if( vout_Control( p_vout, VOUT_CLOSE ) != VLC_SUCCESS )
vout_Control( p_vout, VOUT_REPARENT ); vout_Control( p_vout, VOUT_REPARENT );
vlc_object_release( p_vout );
}
} }
/** /**
...@@ -128,12 +123,12 @@ void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y, ...@@ -128,12 +123,12 @@ void *VideoWidget::request( vout_thread_t *p_nvout, int *pi_x, int *pi_y,
{ {
msg_Dbg( p_intf, "Video was requested %i, %i", *pi_x, *pi_y ); msg_Dbg( p_intf, "Video was requested %i, %i", *pi_x, *pi_y );
emit askVideoWidgetToShow( *pi_width, *pi_height ); emit askVideoWidgetToShow( *pi_width, *pi_height );
if( i_vout ) if( p_vout )
{ {
msg_Dbg( p_intf, "embedded video already in use" ); msg_Dbg( p_intf, "embedded video already in use" );
return NULL; return NULL;
} }
i_vout = p_nvout->i_object_id; p_vout = p_nvout;
#ifndef NDEBUG #ifndef NDEBUG
msg_Dbg( p_intf, "embedded video ready (handle %p)", winId() ); msg_Dbg( p_intf, "embedded video ready (handle %p)", winId() );
#endif #endif
...@@ -155,7 +150,7 @@ void VideoWidget::SetSizing( unsigned int w, unsigned int h ) ...@@ -155,7 +150,7 @@ void VideoWidget::SetSizing( unsigned int w, unsigned int h )
void VideoWidget::release( void *p_win ) void VideoWidget::release( void *p_win )
{ {
msg_Dbg( p_intf, "Video is not needed anymore" ); msg_Dbg( p_intf, "Video is not needed anymore" );
i_vout = 0; p_vout = NULL;
videoSize.rwidth() = 0; videoSize.rwidth() = 0;
videoSize.rheight() = 0; videoSize.rheight() = 0;
updateGeometry(); updateGeometry();
......
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
virtual QSize sizeHint() const; virtual QSize sizeHint() const;
private: private:
intf_thread_t *p_intf; intf_thread_t *p_intf;
int i_vout; vout_thread_t *p_vout;
QSize videoSize; QSize videoSize;
......
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