- p_filter->pf_video_buffer_new = video_new_buffer_filter;
- p_filter->pf_video_buffer_del = video_del_buffer_filter;
- p_filter->p_owner = p_data; /* p_vout */
- return VLC_SUCCESS;
-}
-
-#undef vout_Request
-/*****************************************************************************
- * vout_Request: find a video output thread, create one, or destroy one.
- *****************************************************************************
- * This function looks for a video output thread matching the current
- * properties. If not found, it spawns a new one.
- *****************************************************************************/
-vout_thread_t *vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
- video_format_t *p_fmt )
-{
- if( !p_fmt )
- {
- /* Video output is no longer used.
- * TODO: support for reusing video outputs with proper _thread-safe_
- * reference handling. */
- if( p_vout )
- vout_CloseAndRelease( p_vout );
- return NULL;
- }
-
- /* If a video output was provided, lock it, otherwise look for one. */
- if( p_vout )
- {
- vlc_object_hold( p_vout );
- }
-
- /* TODO: find a suitable unused video output */
-
- /* If we now have a video output, check it has the right properties */
- if( p_vout )
- {
- vlc_mutex_lock( &p_vout->p->change_lock );
-
- /* We don't directly check for the "vout-filter" variable for obvious
- * performance reasons. */
- if( p_vout->p->b_filter_change )
- {
- char *psz_filter_chain = var_GetString( p_vout, "vout-filter" );
-
- if( psz_filter_chain && !*psz_filter_chain )
- {
- free( psz_filter_chain );
- psz_filter_chain = NULL;
- }
- if( p_vout->p->psz_filter_chain && !*p_vout->p->psz_filter_chain )
- {
- free( p_vout->p->psz_filter_chain );
- p_vout->p->psz_filter_chain = NULL;
- }
-
- if( !psz_filter_chain && !p_vout->p->psz_filter_chain )
- {
- p_vout->p->b_filter_change = false;
- }
-
- free( psz_filter_chain );
- }
-
-#warning "FIXME: Check RGB masks in vout_Request"
- /* FIXME: check RGB masks */
- if( p_vout->fmt_render.i_chroma != vlc_fourcc_GetCodec( VIDEO_ES, p_fmt->i_chroma ) ||
- p_vout->fmt_render.i_width != p_fmt->i_width ||
- p_vout->fmt_render.i_height != p_fmt->i_height ||
- p_vout->p->b_filter_change )
- {
- vlc_mutex_unlock( &p_vout->p->change_lock );
-
- /* We are not interested in this format, close this vout */
- vout_CloseAndRelease( p_vout );
- vlc_object_release( p_vout );
- p_vout = NULL;
- }
- else
- {
- /* This video output is cool! Hijack it. */
- /* Correct aspect ratio on change
- * FIXME factorize this code with other aspect ration related code */
- unsigned int i_sar_num;
- unsigned int i_sar_den;
- vlc_ureduce( &i_sar_num, &i_sar_den,
- p_fmt->i_sar_num, p_fmt->i_sar_den, 50000 );
-#if 0
- /* What's that, it does not seems to be used correcly everywhere */
- if( p_vout->i_par_num > 0 && p_vout->i_par_den > 0 )
- {
- i_sar_num *= p_vout->i_par_den;
- i_sar_den *= p_vout->i_par_num;
- }
-#endif
-
- if( i_sar_num > 0 && i_sar_den > 0 &&
- ( i_sar_num != p_vout->fmt_render.i_sar_num ||
- i_sar_den != p_vout->fmt_render.i_sar_den ) )
- {
- p_vout->fmt_in.i_sar_num = i_sar_num;
- p_vout->fmt_in.i_sar_den = i_sar_den;
-
- p_vout->fmt_render.i_sar_num = i_sar_num;
- p_vout->fmt_render.i_sar_den = i_sar_den;
- p_vout->p->i_changes |= VOUT_ASPECT_CHANGE;
- }
- vlc_mutex_unlock( &p_vout->p->change_lock );
-
- vlc_object_release( p_vout );
- }
-
- if( p_vout )
- {
- msg_Dbg( p_this, "reusing provided vout" );
-
- spu_Attach( p_vout->p->p_spu, VLC_OBJECT(p_vout), false );
- vlc_object_detach( p_vout );
-
- vlc_object_attach( p_vout, p_this );
- spu_Attach( p_vout->p->p_spu, VLC_OBJECT(p_vout), true );
- }
- }
-
- if( !p_vout )
- {
- msg_Dbg( p_this, "no usable vout present, spawning one" );