/***************************************************************************** * End: terminate Transform video thread output method *****************************************************************************/ static void End( vout_thread_t *p_vout ) { vout_sys_t *p_sys = p_vout->p_sys; vout_filter_DelChild( p_vout, p_sys->p_vout, MouseEvent ); vout_CloseAndRelease( p_sys->p_vout ); vout_filter_ReleaseDirectBuffers( p_vout ); }
/***************************************************************************** * Manage: handle Crop events ***************************************************************************** * This function should be called regularly by video output thread. It manages * console events. It returns a non null value on error. *****************************************************************************/ static int Manage( vout_thread_t *p_vout ) { video_format_t fmt; if( !p_vout->p_sys->b_changed ) { return VLC_SUCCESS; } memset( &fmt, 0, sizeof(video_format_t) ); #ifdef BEST_AUTOCROP /* XXX: not thread-safe with FilterCallback */ msg_Dbg( p_vout, "cropping at %ix%i+%i+%i, %sautocropping", p_vout->p_sys->i_width, p_vout->p_sys->i_height, p_vout->p_sys->i_x, p_vout->p_sys->i_y, p_vout->p_sys->b_autocrop ? "" : "not " ); msg_Info( p_vout, "ratio %d", p_vout->p_sys->i_aspect / 432); #endif if( p_vout->p_sys->p_vout ) { vout_filter_DelChild( p_vout, p_vout->p_sys->p_vout, MouseEvent ); vout_CloseAndRelease( 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; fmt.i_x_offset = fmt.i_y_offset = 0; fmt.i_chroma = p_vout->render.i_chroma; fmt.i_aspect = p_vout->p_sys->i_aspect; fmt.i_sar_num = p_vout->p_sys->i_aspect * fmt.i_height / fmt.i_width; fmt.i_sar_den = VOUT_ASPECT_FACTOR; p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt ); if( p_vout->p_sys->p_vout == NULL ) { msg_Err( p_vout, "failed to create vout" ); dialog_Fatal( p_vout, _("Cropping failed"), _("VLC could not open the video output module.") ); return VLC_EGENERIC; } vout_filter_AddChild( p_vout, p_vout->p_sys->p_vout, MouseEvent ); p_vout->p_sys->b_changed = false; vlc_mutex_lock( &p_vout->p_sys->lock ); p_vout->p_sys->i_lastchange = 0; vlc_mutex_unlock( &p_vout->p_sys->lock ); return VLC_SUCCESS; }
/***************************************************************************** * End: terminate Crop video thread output method *****************************************************************************/ static void End( vout_thread_t *p_vout ) { vout_sys_t *p_sys = p_vout->p_sys; if( p_sys->p_vout ) { vout_filter_DelChild( p_vout, p_sys->p_vout, MouseEvent ); vout_CloseAndRelease( p_sys->p_vout ); } vout_filter_ReleaseDirectBuffers( p_vout ); var_DelCallback( p_vout, "ratio-crop", FilterCallback, NULL ); vlc_mutex_destroy( &p_sys->lock ); }
/***************************************************************************** * End: terminate opencv_wrapper video thread output method *****************************************************************************/ static void End( vout_thread_t *p_vout ) { vout_sys_t *p_sys = p_vout->p_sys; vout_filter_DelChild( p_vout, p_sys->p_vout, NULL ); vout_CloseAndRelease( p_sys->p_vout ); vout_filter_ReleaseDirectBuffers( p_vout ); if( p_sys->p_opencv ) { //release the internal opencv filter if( p_sys->p_opencv->p_module ) module_unneed( p_sys->p_opencv, p_sys->p_opencv->p_module ); vlc_object_release( p_sys->p_opencv ); p_sys->p_opencv = NULL; } }