# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_vout.h>
#include <vlc_interface.h>
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
- {
- msg_Err( p_vout, "out of memory" );
return VLC_ENOMEM;
- }
p_vout->pf_init = Init;
p_vout->pf_end = End;
return VLC_EGENERIC;
}
- ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
-
- ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
-
#ifdef BEST_AUTOCROP
var_AddCallback( p_vout, "ratio-crop", FilterCallback, NULL );
#endif
+ ALLOCATE_DIRECTBUFFERS( VOUT_MAX_PICTURES );
+
+ ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+
ADD_PARENT_CALLBACKS( SendEventsToChild );
return VLC_SUCCESS;
{
int i_index;
+ DEL_PARENT_CALLBACKS( SendEventsToChild );
+ if( p_vout->p_sys->p_vout )
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+
/* Free the fake output buffers we allocated */
for( i_index = I_OUTPUTPICTURES ; i_index ; )
{
i_index--;
free( PP_OUTPUTPICTURE[ i_index ]->p_data_orig );
}
+
+ if( p_vout->p_sys->p_vout )
+ vout_Destroy( p_vout->p_sys->p_vout );
}
/*****************************************************************************
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
- if( p_vout->p_sys->p_vout )
- {
- DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
- vlc_object_detach( p_vout->p_sys->p_vout );
- vout_Destroy( p_vout->p_sys->p_vout );
- }
-
- DEL_PARENT_CALLBACKS( SendEventsToChild );
-
free( p_vout->p_sys );
}
msg_Info( p_vout, "ratio %d", p_vout->p_sys->i_aspect / 432);
#endif
- vout_Destroy( p_vout->p_sys->p_vout );
+ if( p_vout->p_sys->p_vout )
+ {
+ DEL_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
+ vout_Destroy( p_vout->p_sys->p_vout );
+ }
fmt.i_width = fmt.i_visible_width = p_vout->p_sys->i_width;
fmt.i_height = fmt.i_visible_height = p_vout->p_sys->i_height;
_("VLC could not open the video output module.") );
return VLC_EGENERIC;
}
+ ADD_CALLBACKS( p_vout->p_sys->p_vout, SendEvents );
p_vout->p_sys->b_changed = false;
p_vout->p_sys->i_lastchange = 0;
vout_CreatePicture( p_vout->p_sys->p_vout, 0, 0, 0 )
) == NULL )
{
- if( p_vout->b_die || p_vout->b_error )
+ if( !vlc_object_alive (p_vout) || p_vout->b_error )
{
vout_DestroyPicture( p_vout->p_sys->p_vout, p_outpic );
return;