# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
#include <stdlib.h> /* free() */
#include <string.h>
p_vout->i_par_num = p_vout->i_par_den = 1;
/* Initialize locks */
- vlc_mutex_init( p_vout, &p_vout->picture_lock );
- vlc_mutex_init( p_vout, &p_vout->change_lock );
- vlc_mutex_init( p_vout, &p_vout->vfilter_lock );
+ vlc_mutex_init( &p_vout->picture_lock );
+ vlc_mutex_init( &p_vout->change_lock );
+ vlc_mutex_init( &p_vout->vfilter_lock );
/* Mouse coordinates */
var_Create( p_vout, "mouse-x", VLC_VAR_INTEGER );
#ifndef __APPLE__
vout_thread_t *p_another_vout;
- playlist_t *p_playlist = pl_Get( p_vout );
- if( p_playlist->b_die ) return;
- vlc_object_yield( p_playlist );
-/* This is a dirty hack for mostly Linux, where there is no way to get the GUI
- back if you closed it while playing video. This is solved in Mac OS X,
- where we have this novelty called menubar, that will always allow you access
- to the applications main functionality. They should try that on linux sometime */
- p_another_vout = vlc_object_find( p_this->p_libvlc,
- VLC_OBJECT_VOUT, FIND_ANYWHERE );
- if( p_another_vout == NULL )
- {
- vlc_value_t val;
- val.b_bool = true;
- var_Set( p_playlist, "intf-show", val );
- }
+ playlist_t *p_playlist = pl_Yield( p_this );
+ if( !p_playlist )
+ return;
+
+ /* This is a dirty hack mostly for Linux, where there is no way to get the
+ * GUI back if you closed it while playing video. This is solved in
+ * Mac OS X, where we have this novelty called menubar, that will always
+ * allow you access to the applications main functionality. They should try
+ * that on linux sometime. */
+ p_another_vout = vlc_object_find( p_this->p_libvlc,
+ VLC_OBJECT_VOUT, FIND_ANYWHERE );
+ if( p_another_vout == NULL )
+ var_SetBool( p_playlist, "intf-show", true );
else
- {
vlc_object_release( p_another_vout );
- }
- vlc_object_release( p_playlist );
+ pl_Release( p_playlist );
#endif
}
if( p_vout->b_error )
return;
+ vlc_object_lock( p_vout );
+
if( p_vout->b_title_show )
DisplayTitleOnOSD( p_vout );
* Main loop - it is not executed if an error occurred during
* initialization
*/
- while( (!p_vout->b_die) && (!p_vout->b_error) )
+ while( (vlc_object_alive( p_vout )) && (!p_vout->b_error) )
{
/* Initialize loop variables */
p_picture = NULL;
p_picture->i_status = DESTROYED_PICTURE;
p_vout->i_heap_size--;
}
- msg_Warn( p_vout, "late picture skipped ("I64Fd")",
+ msg_Warn( p_vout, "late picture skipped (%"PRId64")",
current_date - display_date );
i_lost++;
vlc_mutex_unlock( &p_vout->picture_lock );
}
i_lost++;
msg_Warn( p_vout, "vout warning: early picture skipped "
- "("I64Fd")", display_date - current_date
+ "(%"PRId64")", display_date - current_date
- p_vout->i_pts_delay );
vlc_mutex_unlock( &p_vout->picture_lock );
/* Give back change lock */
vlc_mutex_unlock( &p_vout->change_lock );
+ vlc_object_unlock( p_vout );
+
/* Sleep a while or until a given date */
if( display_date != 0 )
{
/* On awakening, take back lock and send immediately picture
* to display. */
+ vlc_object_lock( p_vout );
+ /* Note: vlc_object_alive() could be false here, and we
+ * could be dead */
vlc_mutex_lock( &p_vout->change_lock );
/*
}
}
+
if( p_input )
{
vlc_object_release( p_input );
/* End of thread */
EndThread( p_vout );
+ vlc_object_unlock( p_vout );
}
/*****************************************************************************