- p_sys->b_header = false;
- p_sys->p_fd = NULL;
-
- p_sys->b_yuv4mpeg2 = var_CreateGetBool( p_this, CFG_PREFIX "yuv4mpeg2" );
- p_sys->i_chroma = VLC_CODEC_I420;
-
- p_sys->psz_file =
- var_CreateGetString( p_this, CFG_PREFIX "file" );
- p_sys->p_fd = utf8_fopen( p_sys->psz_file, "wb" );
- if( !p_sys->p_fd )
- {
- free( p_sys->psz_file );
- free( p_sys );
- return VLC_EGENERIC;
- }
-
- psz_fcc = var_CreateGetNonEmptyString( p_this, CFG_PREFIX "chroma" );
- const vlc_fourcc_t i_requested_chroma =
- vlc_fourcc_GetCodecFromString( VIDEO_ES, psz_fcc );
- if( i_requested_chroma )
- p_sys->i_chroma = i_requested_chroma;
- free( psz_fcc );
-
- if( p_sys->b_yuv4mpeg2 )
- {
- switch( p_sys->i_chroma )
- {
- case VLC_CODEC_YV12:
- case VLC_CODEC_I420:
- case VLC_CODEC_J420:
- break;
- default:
- msg_Err( p_this,
- "YUV4MPEG2 mode needs chroma YV12 not %4s as requested",
- (char *)&(p_sys->i_chroma) );
- fclose( p_vout->p_sys->p_fd );
- free( p_vout->p_sys->psz_file );
- free( p_vout->p_sys );
- return VLC_EGENERIC;
- }
- }
-
- msg_Dbg( p_this, "using chroma %4s", (char *)&(p_sys->i_chroma) );
-
- p_vout->pf_init = Init;
- p_vout->pf_end = End;
- p_vout->pf_manage = NULL;
- p_vout->pf_render = NULL;
- p_vout->pf_display = Display;
-
- return VLC_SUCCESS;
-}
-
-/*****************************************************************************
- * Init: initialize video thread
- *****************************************************************************/
-static int Init( vout_thread_t *p_vout )
-{
- vout_sys_t *p_sys = (vout_sys_t *) p_vout->p_sys;
- int i_index;
- picture_t *p_pic;
-
- /* Initialize the output structure */
- if( p_vout->render.i_chroma != p_sys->i_chroma )
- p_vout->output.i_chroma = p_vout->fmt_out.i_chroma = p_sys->i_chroma;
- else
- p_vout->output.i_chroma = p_vout->render.i_chroma;
-
- p_vout->output.pf_setpalette = NULL;
- p_vout->output.i_width = p_vout->render.i_width;
- p_vout->output.i_height = p_vout->render.i_height;
- p_vout->output.i_aspect = p_vout->output.i_width
- * VOUT_ASPECT_FACTOR / p_vout->output.i_height;
-
- p_vout->output.i_rmask = 0xff0000;
- p_vout->output.i_gmask = 0x00ff00;
- p_vout->output.i_bmask = 0x0000ff;
-
- /* Try to initialize 1 direct buffer */
- p_pic = NULL;
-
- /* Find an empty picture slot */
- for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
- {
- if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
- {
- p_pic = p_vout->p_picture + i_index;