picture_heap_t output; /**< direct buffers */
vlc_bool_t b_direct; /**< rendered are like direct ? */
vout_chroma_t chroma; /**< translation tables */
+
+ video_format_t fmt_render; /* render format (from the decoder) */
+ video_format_t fmt_in; /* input (modified render) format */
+ video_format_t fmt_out; /* output format (for the video output) */
/**@}*/
/* Picture heap */
/*****************************************************************************
* Prototypes
*****************************************************************************/
-#define vout_Request(a,b,c,d,e,f) __vout_Request(VLC_OBJECT(a),b,c,d,e,f)
-VLC_EXPORT( vout_thread_t *, __vout_Request, ( vlc_object_t *, vout_thread_t *, unsigned int, unsigned int, uint32_t, unsigned int ) );
-#define vout_Create(a,b,c,d,e) __vout_Create(VLC_OBJECT(a),b,c,d,e)
-VLC_EXPORT( vout_thread_t *, __vout_Create, ( vlc_object_t *, unsigned int, unsigned int, uint32_t, unsigned int ) );
+#define vout_Request(a,b,c) __vout_Request(VLC_OBJECT(a),b,c)
+VLC_EXPORT( vout_thread_t *, __vout_Request, ( vlc_object_t *, vout_thread_t *, video_format_t * ) );
+#define vout_Create(a,b) __vout_Create(VLC_OBJECT(a),b)
+VLC_EXPORT( vout_thread_t *, __vout_Create, ( vlc_object_t *, video_format_t * ) );
VLC_EXPORT( void, vout_Destroy, ( vout_thread_t * ) );
VLC_EXPORT( int, vout_VarCallback, ( vlc_object_t *, const char *, vlc_value_t, vlc_value_t, void * ) );
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * ( av_q2d(p_context->sample_aspect_ratio) *
p_context->width / p_context->height );
+ p_dec->fmt_out.video.i_sar_num = p_context->sample_aspect_ratio.num;
+ p_dec->fmt_out.video.i_sar_den = p_context->sample_aspect_ratio.den;
#else
p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * p_context->aspect_ratio;
{
int i_index;
picture_t *p_pic;
+ video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
+ fmt.i_width = fmt.i_visible_width = p_vout->render.i_width;
+ fmt.i_height = fmt.i_visible_height = p_vout->render.i_height;
+ fmt.i_x_offset = fmt.i_y_offset = 0;
+ fmt.i_chroma = p_vout->render.i_chroma;
+ fmt.i_aspect = p_vout->render.i_aspect;
+ fmt.i_sar_num = p_vout->render.i_aspect * fmt.i_height / fmt.i_width;
+ fmt.i_sar_den = VOUT_ASPECT_FACTOR;
+
/* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" );
- p_vout->p_sys->p_vout = vout_Create( p_vout,
- p_vout->render.i_width, p_vout->render.i_height,
- p_vout->render.i_chroma, p_vout->render.i_aspect );
+ p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt );
/* Everything failed */
if( p_vout->p_sys->p_vout == NULL )
int i_index, i_vout;
picture_t *p_pic;
char *psz_default_vout;
+ video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
+ fmt.i_width = fmt.i_visible_width = p_vout->render.i_width;
+ fmt.i_height = fmt.i_visible_height = p_vout->render.i_height;
+ fmt.i_x_offset = fmt.i_y_offset = 0;
+ fmt.i_chroma = p_vout->render.i_chroma;
+ fmt.i_aspect = p_vout->render.i_aspect;
+ fmt.i_sar_num = p_vout->render.i_aspect * fmt.i_height / fmt.i_width;
+ fmt.i_sar_den = VOUT_ASPECT_FACTOR;
+
/* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video outputs" );
"default", 8 ) ) )
{
p_vout->p_sys->pp_vout[i_vout] =
- vout_Create( p_vout, p_vout->render.i_width,
- p_vout->render.i_height, p_vout->render.i_chroma,
- p_vout->render.i_aspect );
+ vout_Create( p_vout, &fmt );
}
else
{
config_PutPsz( p_vout, "vout",
p_vout->p_sys->ppsz_vout_list[i_vout] );
p_vout->p_sys->pp_vout[i_vout] =
- vout_Create( p_vout, p_vout->render.i_width,
- p_vout->render.i_height, p_vout->render.i_chroma,
- p_vout->render.i_aspect );
+ vout_Create( p_vout, &fmt );
/* Reset the default value */
config_PutPsz( p_vout, "vout", psz_default_vout );
int i_index;
char *psz_var;
picture_t *p_pic;
+ video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
* p_vout->output.i_height / p_vout->p_sys->i_height
* p_vout->p_sys->i_width / p_vout->output.i_width;
+ 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;
+
/* Try to open the real video output */
- p_vout->p_sys->p_vout = vout_Create( p_vout,
- p_vout->p_sys->i_width, p_vout->p_sys->i_height,
- p_vout->render.i_chroma, p_vout->p_sys->i_aspect );
+ 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" );
*****************************************************************************/
static int Manage( vout_thread_t *p_vout )
{
+ video_format_t fmt = {0};
+
if( !p_vout->p_sys->b_changed )
{
return VLC_SUCCESS;
vout_Destroy( p_vout->p_sys->p_vout );
- p_vout->p_sys->p_vout = vout_Create( p_vout,
- p_vout->p_sys->i_width, p_vout->p_sys->i_height,
- p_vout->render.i_chroma, p_vout->p_sys->i_aspect );
+ 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" );
static vout_thread_t *SpawnRealVout( vout_thread_t *p_vout )
{
vout_thread_t *p_real_vout = NULL;
+ video_format_t fmt = {0};
msg_Dbg( p_vout, "spawning the real video output" );
+ fmt.i_width = fmt.i_visible_width = p_vout->output.i_width;
+ fmt.i_height = fmt.i_visible_height = p_vout->output.i_height;
+ fmt.i_x_offset = fmt.i_y_offset = 0;
+ fmt.i_chroma = p_vout->output.i_chroma;
+ fmt.i_aspect = p_vout->output.i_aspect;
+ fmt.i_sar_num = p_vout->output.i_aspect * fmt.i_height / fmt.i_width;
+ fmt.i_sar_den = VOUT_ASPECT_FACTOR;
+
switch( p_vout->render.i_chroma )
{
case VLC_FOURCC('I','4','2','0'):
{
case DEINTERLACE_MEAN:
case DEINTERLACE_DISCARD:
- p_real_vout =
- vout_Create( p_vout,
- p_vout->output.i_width, p_vout->output.i_height / 2,
- p_vout->output.i_chroma, p_vout->output.i_aspect );
+ fmt.i_height = fmt.i_visible_height = p_vout->output.i_height / 2;
+ p_real_vout = vout_Create( p_vout, &fmt );
break;
case DEINTERLACE_BOB:
case DEINTERLACE_BLEND:
case DEINTERLACE_LINEAR:
- p_real_vout =
- vout_Create( p_vout,
- p_vout->output.i_width, p_vout->output.i_height,
- p_vout->output.i_chroma, p_vout->output.i_aspect );
+ p_real_vout = vout_Create( p_vout, &fmt );
break;
}
break;
case VLC_FOURCC('I','4','2','2'):
- p_real_vout =
- vout_Create( p_vout,
- p_vout->output.i_width, p_vout->output.i_height,
- VLC_FOURCC('I','4','2','0'), p_vout->output.i_aspect );
+ fmt.i_chroma = VLC_FOURCC('I','4','2','0');
+ p_real_vout = vout_Create( p_vout, &fmt );
break;
default:
{
int i_index;
picture_t *p_pic;
+ video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
+ fmt.i_width = fmt.i_visible_width = p_vout->render.i_width;
+ fmt.i_height = fmt.i_visible_height = p_vout->render.i_height;
+ fmt.i_x_offset = fmt.i_y_offset = 0;
+ fmt.i_chroma = p_vout->render.i_chroma;
+ fmt.i_aspect = p_vout->render.i_aspect;
+ fmt.i_sar_num = p_vout->render.i_aspect * fmt.i_height / fmt.i_width;
+ fmt.i_sar_den = VOUT_ASPECT_FACTOR;
+
/* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" );
- p_vout->p_sys->p_vout = vout_Create( p_vout,
- p_vout->render.i_width, p_vout->render.i_height,
- p_vout->render.i_chroma, p_vout->render.i_aspect );
+ p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt );
/* Everything failed */
if( p_vout->p_sys->p_vout == NULL )
{
int i_index;
picture_t *p_pic;
+ video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
+ fmt.i_width = fmt.i_visible_width = p_vout->render.i_width;
+ fmt.i_height = fmt.i_visible_height = p_vout->render.i_height;
+ fmt.i_x_offset = fmt.i_y_offset = 0;
+ fmt.i_chroma = p_vout->render.i_chroma;
+ fmt.i_aspect = p_vout->render.i_aspect;
+ fmt.i_sar_num = p_vout->render.i_aspect * fmt.i_height / fmt.i_width;
+ fmt.i_sar_den = VOUT_ASPECT_FACTOR;
+
/* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" );
- p_vout->p_sys->p_vout = vout_Create( p_vout,
- p_vout->render.i_width, p_vout->render.i_height,
- p_vout->render.i_chroma, p_vout->render.i_aspect );
+ p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt );
/* Everything failed */
if( p_vout->p_sys->p_vout == NULL )
vout_sys_t *p_sys = p_vout->p_sys;
picture_t *p_pic;
int i_index;
+ video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
+ fmt.i_width = fmt.i_visible_width = p_vout->render.i_width;
+ fmt.i_height = fmt.i_visible_height = p_vout->render.i_height;
+ fmt.i_x_offset = fmt.i_y_offset = 0;
+ fmt.i_chroma = p_vout->render.i_chroma;
+ fmt.i_aspect = p_vout->render.i_aspect;
+ fmt.i_sar_num = p_vout->render.i_aspect * fmt.i_height / fmt.i_width;
+ fmt.i_sar_den = VOUT_ASPECT_FACTOR;
+
/* Load the video blending filter */
p_sys->p_blend = vlc_object_create( p_vout, sizeof(filter_t) );
vlc_object_attach( p_sys->p_blend, p_vout );
/* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" );
- p_sys->p_vout =
- vout_Create( p_vout, p_vout->render.i_width, p_vout->render.i_height,
- p_vout->render.i_chroma, p_vout->render.i_aspect );
+ p_sys->p_vout = vout_Create( p_vout, &fmt );
/* Everything failed */
if( p_sys->p_vout == NULL )
{
int i_index;
picture_t *p_pic;
+ video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
msg_Dbg( p_vout, "spawning the real video output" );
+ fmt.i_width = fmt.i_visible_width = p_vout->output.i_width;
+ fmt.i_height = fmt.i_visible_height = p_vout->output.i_height;
+ fmt.i_x_offset = fmt.i_y_offset = 0;
+ fmt.i_chroma = p_vout->output.i_chroma;
+ fmt.i_aspect = p_vout->output.i_aspect;
+ fmt.i_sar_num = p_vout->output.i_aspect * fmt.i_height / fmt.i_width;
+ fmt.i_sar_den = VOUT_ASPECT_FACTOR;
+
switch( p_vout->render.i_chroma )
{
case VLC_FOURCC('I','4','2','0'):
case VLC_FOURCC('I','Y','U','V'):
case VLC_FOURCC('Y','V','1','2'):
- p_vout->p_sys->p_vout = vout_Create( p_vout,
- p_vout->output.i_width, p_vout->output.i_height,
- p_vout->output.i_chroma, p_vout->output.i_aspect );
+ p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt );
break;
default:
break;
{
int i_index;
picture_t *p_pic;
+ video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
+ fmt.i_width = fmt.i_visible_width = p_vout->render.i_width;
+ fmt.i_height = fmt.i_visible_height = p_vout->render.i_height;
+ fmt.i_x_offset = fmt.i_y_offset = 0;
+ fmt.i_chroma = p_vout->render.i_chroma;
+ fmt.i_aspect = p_vout->render.i_aspect;
+ fmt.i_sar_num = p_vout->render.i_aspect * fmt.i_height / fmt.i_width;
+ fmt.i_sar_den = VOUT_ASPECT_FACTOR;
+
/* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" );
- p_vout->p_sys->p_vout = vout_Create( p_vout,
- p_vout->render.i_width, p_vout->render.i_height,
- p_vout->render.i_chroma, p_vout->render.i_aspect );
+ p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt );
/* Everything failed */
if( p_vout->p_sys->p_vout == NULL )
{
int i_index;
picture_t *p_pic;
+ video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
p_vout->output.i_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect;
+ fmt.i_width = fmt.i_visible_width = p_vout->render.i_width;
+ fmt.i_height = fmt.i_visible_height = p_vout->render.i_height;
+ fmt.i_x_offset = fmt.i_y_offset = 0;
+ fmt.i_chroma = p_vout->render.i_chroma;
+ fmt.i_aspect = p_vout->render.i_aspect;
+ fmt.i_sar_num = p_vout->render.i_aspect * fmt.i_height / fmt.i_width;
+ fmt.i_sar_den = VOUT_ASPECT_FACTOR;
+
/* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" );
if( p_vout->p_sys->b_rotation )
{
- p_vout->p_sys->p_vout = vout_Create( p_vout,
- p_vout->render.i_height, p_vout->render.i_width,
- p_vout->render.i_chroma,
- (uint64_t)VOUT_ASPECT_FACTOR
- * (uint64_t)VOUT_ASPECT_FACTOR
- / (uint64_t)p_vout->render.i_aspect );
+ fmt.i_width = fmt.i_visible_width = p_vout->render.i_height;
+ fmt.i_height = fmt.i_visible_height = p_vout->render.i_width;
+ fmt.i_aspect = VOUT_ASPECT_FACTOR *
+ (uint64_t)VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
+ fmt.i_sar_num = VOUT_ASPECT_FACTOR;
+ fmt.i_sar_den = p_vout->render.i_aspect * fmt.i_height / fmt.i_width;
+
+ p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt );
}
else
{
- p_vout->p_sys->p_vout = vout_Create( p_vout,
- p_vout->render.i_width, p_vout->render.i_height,
- p_vout->render.i_chroma, p_vout->render.i_aspect );
+ p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt );
}
/* Everything failed */
int i_index, i_row, i_col, i_width, i_height, i_left, i_top;
unsigned int i_target_width,i_target_height;
picture_t *p_pic;
+ video_format_t fmt = {0};
int i_aspect = 4*VOUT_ASPECT_FACTOR/3;
int i_align = 0;
unsigned int i_hstart, i_hend, i_vstart, i_vend;
p_vout->output.i_aspect = p_vout->render.i_aspect;
var_Create( p_vout, "align", VLC_VAR_INTEGER );
+ fmt.i_width = fmt.i_visible_width = p_vout->render.i_width;
+ fmt.i_height = fmt.i_visible_height = p_vout->render.i_height;
+ fmt.i_x_offset = fmt.i_y_offset = 0;
+ fmt.i_chroma = p_vout->render.i_chroma;
+ fmt.i_aspect = p_vout->render.i_aspect;
+ fmt.i_sar_num = p_vout->render.i_aspect * fmt.i_height / fmt.i_width;
+ fmt.i_sar_den = VOUT_ASPECT_FACTOR;
+
w1 = p_vout->output.i_width / p_vout->p_sys->i_col;
w1 &= ~1;
h1 = w1 * VOUT_ASPECT_FACTOR / i_aspect&~1;
var_SetInteger( p_vout, "video-x", i_left + i_xpos - i_width);
var_SetInteger( p_vout, "video-y", i_top + i_ypos );
+ fmt.i_width = fmt.i_visible_width = i_width;
+ fmt.i_height = fmt.i_visible_height = i_height;
+ fmt.i_aspect = i_aspect * i_target_height / i_height *
+ i_width / i_target_width;
+
p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout =
- vout_Create( p_vout, i_width, i_height,
- p_vout->render.i_chroma,
- i_aspect * i_target_height / i_height *
- i_width / i_target_width );
- if( p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout == NULL )
+ vout_Create( p_vout, &fmt );
+ if( !p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout )
{
msg_Err( p_vout, "failed to get %ix%i vout threads",
p_vout->p_sys->i_col, p_vout->p_sys->i_row );
aout_filter_sys_t *p_sys;
goom_thread_t *p_thread;
vlc_value_t width, height;
+ video_format_t fmt = {0};
if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' )
|| p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
var_Create( p_thread, "goom-height", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Get( p_thread, "goom-height", &height );
- p_thread->p_vout =
- vout_Request( p_filter, NULL, width.i_int, height.i_int,
- VLC_FOURCC('R','V','3','2'),
- VOUT_ASPECT_FACTOR * width.i_int/height.i_int );
+ fmt.i_width = fmt.i_visible_width = width.i_int;
+ fmt.i_height = fmt.i_visible_height = height.i_int;
+ fmt.i_chroma = VLC_FOURCC('R','V','3','2');
+ fmt.i_aspect = VOUT_ASPECT_FACTOR * width.i_int/height.i_int;
+ fmt.i_sar_num = fmt.i_sar_den = 1;
+
+ p_thread->p_vout = vout_Request( p_filter, NULL, &fmt );
if( p_thread->p_vout == NULL )
{
msg_Err( p_filter, "no suitable vout module" );
vlc_thread_join( p_sys->p_thread );
/* Free data */
- vout_Request( p_filter, p_sys->p_thread->p_vout, 0, 0, 0, 0 );
+ vout_Request( p_filter, p_sys->p_thread->p_vout, 0 );
vlc_mutex_destroy( &p_sys->p_thread->lock );
vlc_cond_destroy( &p_sys->p_thread->wait );
vlc_object_detach( p_sys->p_thread );
vlc_value_t val;
char *psz_effects, *psz_parser;
+ video_format_t fmt = {0};
if( ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2') &&
p_filter->input.i_format != VLC_FOURCC('f','i','3','2') ) )
}
/* Open the video output */
- p_sys->p_vout =
- vout_Request( p_filter, NULL,
- p_sys->i_width, p_sys->i_height,
- VLC_FOURCC('I','4','2','0'),
- VOUT_ASPECT_FACTOR * p_sys->i_width/p_sys->i_height );
+ fmt.i_width = fmt.i_visible_width = p_sys->i_width;
+ fmt.i_height = fmt.i_visible_height = p_sys->i_height;
+ fmt.i_chroma = VLC_FOURCC('I','4','2','0');
+ fmt.i_aspect = VOUT_ASPECT_FACTOR * p_sys->i_width/p_sys->i_height;
+ fmt.i_sar_num = fmt.i_sar_den = 1;
+ p_sys->p_vout = vout_Request( p_filter, NULL, &fmt );
if( p_sys->p_vout == NULL )
{
msg_Err( p_filter, "no suitable vout module" );
if( p_filter->p_sys->p_vout )
{
- vout_Request( p_filter, p_filter->p_sys->p_vout, 0, 0, 0, 0 );
+ vout_Request( p_filter, p_filter->p_sys->p_vout, 0 );
}
/* Free the list */
#undef p_pic
/* We are about to die. Reattach video output to p_vlc. */
- vout_Request( p_dec, p_dec->p_owner->p_vout, 0, 0, 0, 0 );
+ vout_Request( p_dec, p_dec->p_owner->p_vout, 0 );
}
if( p_dec->p_owner->p_sout_input )
return NULL;
}
+ if( !p_dec->fmt_out.video.i_sar_num ||
+ !p_dec->fmt_out.video.i_sar_den )
+ {
+ p_dec->fmt_out.video.i_sar_num =
+ p_dec->fmt_out.video.i_aspect * p_dec->fmt_out.video.i_height;
+
+ p_dec->fmt_out.video.i_sar_den = VOUT_ASPECT_FACTOR *
+ p_dec->fmt_out.video.i_width;
+ }
+
+ vlc_reduce( &p_dec->fmt_out.video.i_sar_num,
+ &p_dec->fmt_out.video.i_sar_den,
+ p_dec->fmt_out.video.i_sar_num,
+ p_dec->fmt_out.video.i_sar_den, 0 );
+
+ if( !p_dec->fmt_out.video.i_visible_width ||
+ !p_dec->fmt_out.video.i_visible_height )
+ {
+ p_dec->fmt_out.video.i_visible_width =
+ p_dec->fmt_out.video.i_width;
+ p_dec->fmt_out.video.i_visible_height =
+ p_dec->fmt_out.video.i_height;
+ }
+
p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
p_sys->video = p_dec->fmt_out.video;
p_sys->p_vout = vout_Request( p_dec, p_sys->p_vout,
- p_sys->video.i_width,
- p_sys->video.i_height,
- p_sys->video.i_chroma,
- p_sys->video.i_aspect );
-
+ &p_dec->fmt_out.video );
if( p_sys->p_vout == NULL )
{
msg_Err( p_dec, "failed to create video output" );
* $Id$
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
+ * Gildas Bazin <gbazin@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* 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,
- unsigned int i_width, unsigned int i_height,
- vlc_fourcc_t i_chroma, unsigned int i_aspect )
+vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
+ video_format_t *p_fmt )
{
- if( !i_width || !i_height || !i_chroma )
+ if( !p_fmt )
{
/* Reattach video output to input before bailing out */
if( p_vout )
if( psz_filter_chain ) free( psz_filter_chain );
}
- if( ( p_vout->render.i_width != i_width ) ||
- ( p_vout->render.i_height != i_height ) ||
- ( p_vout->render.i_chroma != i_chroma ) ||
- ( p_vout->render.i_aspect != i_aspect
+ if( ( p_vout->fmt_render.i_width != p_fmt->i_width ) ||
+ ( p_vout->fmt_render.i_height != p_fmt->i_height ) ||
+ ( p_vout->fmt_render.i_chroma != p_fmt->i_chroma ) ||
+ ( p_vout->fmt_render.i_aspect != p_fmt->i_aspect
&& !p_vout->b_override_aspect ) ||
p_vout->b_filter_change )
{
{
msg_Dbg( p_this, "no usable vout present, spawning one" );
- p_vout = vout_Create( p_this, i_width, i_height, i_chroma, i_aspect );
+ p_vout = vout_Create( p_this, p_fmt );
}
return p_vout;
* This function creates a new video output thread, and returns a pointer
* to its description. On error, it returns NULL.
*****************************************************************************/
-vout_thread_t * __vout_Create( vlc_object_t *p_parent,
- unsigned int i_width, unsigned int i_height,
- vlc_fourcc_t i_chroma, unsigned int i_aspect )
+vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
{
vout_thread_t * p_vout; /* thread descriptor */
input_thread_t * p_input_thread;
char * psz_plugin;
vlc_value_t val, text;
+ unsigned int i_width = p_fmt->i_width;
+ unsigned int i_height = p_fmt->i_height;
+ vlc_fourcc_t i_chroma = p_fmt->i_chroma;
+ unsigned int i_aspect = p_fmt->i_aspect;
+
/* Allocate descriptor */
p_vout = vlc_object_create( p_parent, VLC_OBJECT_VOUT );
if( p_vout == NULL )
/* Initialize the rendering heap */
I_RENDERPICTURES = 0;
+ p_vout->fmt_render = *p_fmt; /* FIXME palette */
+ p_vout->fmt_in = *p_fmt; /* FIXME palette */
p_vout->render.i_width = i_width;
p_vout->render.i_height = i_height;
p_vout->render.i_chroma = i_chroma;
msg_Dbg( p_vout, "got %i direct buffer(s)", I_OUTPUTPICTURES );
- AspectRatio( p_vout->render.i_aspect, &i_aspect_x, &i_aspect_y );
- msg_Dbg( p_vout,
- "picture in %ix%i, chroma 0x%.8x (%4.4s), aspect ratio %i:%i",
- p_vout->render.i_width, p_vout->render.i_height,
- p_vout->render.i_chroma, (char*)&p_vout->render.i_chroma,
- i_aspect_x, i_aspect_y );
+ AspectRatio( p_vout->fmt_render.i_aspect, &i_aspect_x, &i_aspect_y );
+
+ msg_Dbg( p_vout, "picture in %ix%i (%i,%i,%ix%i), "
+ "chroma %4.4s, ar %i:%i, sar %i:%i",
+ p_vout->fmt_render.i_width, p_vout->fmt_render.i_height,
+ p_vout->fmt_render.i_x_offset, p_vout->fmt_render.i_y_offset,
+ p_vout->fmt_render.i_visible_width,
+ p_vout->fmt_render.i_visible_height,
+ (char*)&p_vout->fmt_render.i_chroma,
+ i_aspect_x, i_aspect_y,
+ p_vout->fmt_render.i_sar_num, p_vout->fmt_render.i_sar_den );
+
+ AspectRatio( p_vout->fmt_in.i_aspect, &i_aspect_x, &i_aspect_y );
+
+ msg_Dbg( p_vout, "picture user %ix%i (%i,%i,%ix%i), "
+ "chroma %4.4s, ar %i:%i, sar %i:%i",
+ p_vout->fmt_in.i_width, p_vout->fmt_in.i_height,
+ p_vout->fmt_in.i_x_offset, p_vout->fmt_in.i_y_offset,
+ p_vout->fmt_in.i_visible_width,
+ p_vout->fmt_in.i_visible_height,
+ (char*)&p_vout->fmt_in.i_chroma,
+ i_aspect_x, i_aspect_y,
+ p_vout->fmt_in.i_sar_num, p_vout->fmt_in.i_sar_den );
+
+ if( !p_vout->fmt_out.i_width || !p_vout->fmt_out.i_height )
+ {
+ p_vout->fmt_out.i_width = p_vout->fmt_out.i_visible_width =
+ p_vout->output.i_width;
+ p_vout->fmt_out.i_height = p_vout->fmt_out.i_visible_height =
+ p_vout->output.i_height;
+ p_vout->fmt_out.i_x_offset = p_vout->fmt_out.i_y_offset = 0;
+
+ p_vout->fmt_out.i_aspect = p_vout->output.i_aspect;
+ p_vout->fmt_out.i_chroma = p_vout->output.i_chroma;
+ }
+ if( !p_vout->fmt_out.i_sar_num || !p_vout->fmt_out.i_sar_num )
+ {
+ p_vout->fmt_out.i_sar_num = p_vout->fmt_out.i_aspect *
+ p_vout->fmt_out.i_height;
+ p_vout->fmt_out.i_sar_den = VOUT_ASPECT_FACTOR *
+ p_vout->fmt_out.i_width;
+ }
+
+ vlc_reduce( &p_vout->fmt_out.i_sar_num, &p_vout->fmt_out.i_sar_den,
+ p_vout->fmt_out.i_sar_num, p_vout->fmt_out.i_sar_den, 0 );
+
+ AspectRatio( p_vout->fmt_out.i_aspect, &i_aspect_x, &i_aspect_y );
- AspectRatio( p_vout->output.i_aspect, &i_aspect_x, &i_aspect_y );
- msg_Dbg( p_vout,
- "picture out %ix%i, chroma 0x%.8x (%4.4s), aspect ratio %i:%i",
+ msg_Dbg( p_vout, "picture out %ix%i, chroma %4.4s, ar %i:%i, sar %i:%i",
p_vout->output.i_width, p_vout->output.i_height,
- p_vout->output.i_chroma, (char*)&p_vout->output.i_chroma,
- i_aspect_x, i_aspect_y );
+ (char*)&p_vout->output.i_chroma,
+ i_aspect_x, i_aspect_y,
+ p_vout->fmt_out.i_sar_num, p_vout->fmt_out.i_sar_den );
/* Calculate shifts from system-updated masks */
MaskToShift( &p_vout->output.i_lrshift, &p_vout->output.i_rrshift,
picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
subpicture_t *p_subpic )
{
- video_format_t fmt;
int i_scale_width, i_scale_height;
if( p_pic == NULL )
{
/* XXX: subtitles */
-
return NULL;
}
- fmt.i_aspect = p_vout->output.i_aspect;
- fmt.i_chroma = p_vout->output.i_chroma;
- fmt.i_width = p_vout->output.i_width;
- fmt.i_height = p_vout->output.i_height;
- fmt.i_sar_num = p_vout->output.i_aspect * fmt.i_height / fmt.i_width;
- fmt.i_sar_den = VOUT_ASPECT_FACTOR;
- i_scale_width = p_vout->output.i_width * 1000 / p_vout->render.i_width;
- i_scale_height = p_vout->output.i_height * 1000 / p_vout->render.i_height;
+ i_scale_width = p_vout->fmt_out.i_visible_width * 1000 /
+ p_vout->fmt_in.i_visible_width;
+ i_scale_height = p_vout->fmt_out.i_visible_height * 1000 /
+ p_vout->fmt_in.i_visible_height;
if( p_pic->i_type == DIRECT_PICTURE )
{
* subtitles. */
vout_CopyPicture( p_vout, PP_OUTPUTPICTURE[0], p_pic );
- spu_RenderSubpictures( p_vout->p_spu, &fmt,
+ spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
PP_OUTPUTPICTURE[0], p_pic, p_subpic,
i_scale_width, i_scale_height );
/* Picture is in a direct buffer but isn't used by the
* decoder. We can safely render subtitles on it and
* display it. */
- spu_RenderSubpictures( p_vout->p_spu, &fmt, p_pic, p_pic, p_subpic,
- i_scale_width, i_scale_height );
+ spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out, p_pic, p_pic,
+ p_subpic, i_scale_width, i_scale_height );
return p_pic;
}
return NULL;
vout_CopyPicture( p_vout, PP_OUTPUTPICTURE[0], p_pic );
- spu_RenderSubpictures( p_vout->p_spu, &fmt, PP_OUTPUTPICTURE[0],
- p_pic, p_subpic, i_scale_width, i_scale_height);
+ spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
+ PP_OUTPUTPICTURE[0], p_pic,
+ p_subpic, i_scale_width, i_scale_height );
if( PP_OUTPUTPICTURE[0]->pf_unlock )
PP_OUTPUTPICTURE[0]->pf_unlock( p_vout, PP_OUTPUTPICTURE[0] );
if( p_tmp_pic->i_status == FREE_PICTURE )
{
vout_AllocatePicture( VLC_OBJECT(p_vout),
- p_tmp_pic, p_vout->output.i_chroma,
- p_vout->output.i_width,
- p_vout->output.i_height,
- p_vout->output.i_aspect );
+ p_tmp_pic, p_vout->fmt_out.i_chroma,
+ p_vout->fmt_out.i_width,
+ p_vout->fmt_out.i_height,
+ p_vout->fmt_out.i_aspect );
p_tmp_pic->i_type = MEMORY_PICTURE;
p_tmp_pic->i_status = RESERVED_PICTURE;
}
p_vout->chroma.pf_convert( p_vout, p_pic, p_tmp_pic );
/* Render subpictures on the first direct buffer */
- spu_RenderSubpictures( p_vout->p_spu, &fmt, p_tmp_pic,
+ spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out, p_tmp_pic,
p_tmp_pic, p_subpic,
i_scale_width, i_scale_height );
p_vout->chroma.pf_convert( p_vout, p_pic, &p_vout->p_picture[0] );
/* Render subpictures on the first direct buffer */
- spu_RenderSubpictures( p_vout->p_spu, &fmt, &p_vout->p_picture[0],
- &p_vout->p_picture[0], p_subpic,
- i_scale_width, i_scale_height );
+ spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
+ &p_vout->p_picture[0], &p_vout->p_picture[0],
+ p_subpic, i_scale_width, i_scale_height );
}
if( p_vout->p_picture[0].pf_unlock )
if( (i_width <= 0) || (i_height <=0) )
{
*pi_width = *pi_height = *pi_x = *pi_y = 0;
-
return;
}