* picture.c:
*****************************************************************************
* Copyright (C) 2004-2005 VideoLAN
- * $Id: picture.c 10081 2005-03-01 15:33:51Z dionoea $
+ * $Id$
*
* Authors: Antoine Cellerier <dionoea@videolan.org>
* Christophe Massiot <massiot@via.ecp.fr>
picture_t *p_new_pic2;
#endif
- fmt_in.i_chroma = p_vout->render.i_chroma;
- fmt_in.i_width = p_vout->render.i_width;
- fmt_in.i_height = p_vout->render.i_height;
+ fmt_in = p_vout->fmt_in;
#ifdef IMAGE_2PASSES
fmt_middle.i_chroma = p_vout->render.i_chroma;
void (*pf_release)( picture_t * );
picture_t *p_pif;
+ if( !p_fmt_out->i_width && !p_fmt_out->i_height &&
+ p_fmt_out->i_sar_num && p_fmt_out->i_sar_den &&
+ p_fmt_out->i_sar_num * p_fmt_in->i_sar_den !=
+ p_fmt_out->i_sar_den * p_fmt_in->i_sar_num )
+ {
+ p_fmt_out->i_width =
+ p_fmt_in->i_sar_num * (int64_t)p_fmt_out->i_sar_den *
+ p_fmt_in->i_width / p_fmt_in->i_sar_den / p_fmt_out->i_sar_num;
+ p_fmt_out->i_visible_width =
+ p_fmt_in->i_sar_num * (int64_t)p_fmt_out->i_sar_den *
+ p_fmt_in->i_visible_width / p_fmt_in->i_sar_den /
+ p_fmt_out->i_sar_num;
+ }
+
if( !p_fmt_out->i_chroma ) p_fmt_out->i_chroma = p_fmt_in->i_chroma;
- if( !p_fmt_out->i_width ) p_fmt_out->i_width = p_fmt_in->i_width;
- if( !p_fmt_out->i_height ) p_fmt_out->i_height = p_fmt_in->i_height;
+ if( !p_fmt_out->i_width )
+ p_fmt_out->i_width = p_fmt_out->i_visible_width = p_fmt_in->i_width;
+ if( !p_fmt_out->i_height )
+ p_fmt_out->i_height = p_fmt_out->i_visible_height = p_fmt_in->i_height;
+ if( !p_fmt_out->i_sar_num ) p_fmt_out->i_sar_num = p_fmt_in->i_sar_num;
+ if( !p_fmt_out->i_sar_den ) p_fmt_out->i_sar_den = p_fmt_in->i_sar_den;
+ if( !p_fmt_out->i_aspect ) p_fmt_out->i_aspect = p_fmt_in->i_aspect;
if( p_image->p_filter )
if( p_image->p_filter->fmt_in.video.i_chroma != p_fmt_in->i_chroma ||
{
p_enc->fmt_in.video.i_width = fmt_out->i_width;
p_enc->fmt_in.video.i_height = fmt_out->i_height;
+
+ if( fmt_out->i_visible_width > 0 &&
+ fmt_out->i_visible_height > 0 )
+ {
+ p_enc->fmt_in.video.i_visible_width = fmt_out->i_visible_width;
+ p_enc->fmt_in.video.i_visible_height = fmt_out->i_visible_height;
+ }
+ else
+ {
+ p_enc->fmt_in.video.i_visible_width = fmt_out->i_width;
+ p_enc->fmt_in.video.i_visible_height = fmt_out->i_height;
+ }
}
else if( fmt_out->i_sar_num && fmt_out->i_sar_den &&
- fmt_out->i_sar_num * fmt_in->i_sar_den !=
+ fmt_out->i_sar_num * fmt_in->i_sar_den !=
fmt_out->i_sar_den * fmt_in->i_sar_num )
{
p_enc->fmt_in.video.i_width =
- fmt_in->i_sar_num * (int64_t)fmt_out->i_sar_den * fmt_in->i_width /
+ fmt_in->i_sar_num * (int64_t)fmt_out->i_sar_den * fmt_in->i_width /
fmt_in->i_sar_den / fmt_out->i_sar_num;
+ p_enc->fmt_in.video.i_visible_width =
+ fmt_in->i_sar_num * (int64_t)fmt_out->i_sar_den *
+ fmt_in->i_visible_width / fmt_in->i_sar_den / fmt_out->i_sar_num;
}
p_enc->fmt_in.video.i_frame_rate = 25;
free( format.psz_string );
/* Save the snapshot */
- fmt_in.i_chroma = p_vout->render.i_chroma;
- fmt_in.i_width = p_vout->render.i_width;
- fmt_in.i_height = p_vout->render.i_height;
- fmt_in.i_sar_num = p_vout->fmt_render.i_sar_num;
- fmt_in.i_sar_den = p_vout->fmt_render.i_sar_den;
+ fmt_in = p_vout->fmt_in;
fmt_out.i_sar_num = fmt_out.i_sar_den = 1;
i_ret = image_WriteUrl( p_image, p_pic, &fmt_in, &fmt_out, psz_filename );
if( i_ret != VLC_SUCCESS )
free( psz_filename );
/* Inject a subpicture with the snapshot */
+ memset( &fmt_out, 0, sizeof(fmt_out) );
fmt_out.i_chroma = VLC_FOURCC('Y','U','V','A');
- fmt_out.i_width = fmt_out.i_visible_width = p_vout->render.i_width;
- fmt_out.i_height = fmt_out.i_visible_height = p_vout->render.i_height;
- fmt_out.i_aspect = VOUT_ASPECT_FACTOR;
p_pif = image_Convert( p_image, p_pic, &fmt_in, &fmt_out );
image_HandlerDelete( p_image );
if( !p_pif ) return VLC_EGENERIC;