Commit 3f6f97f1 authored by Gildas Bazin's avatar Gildas Bazin

* include/video_output.h, ALL: changed api for vout_Request()/vout_Create() to be more flexible.

parent 286a9420
......@@ -121,6 +121,10 @@ struct vout_thread_t
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 */
......@@ -194,10 +198,10 @@ struct vout_thread_t
/*****************************************************************************
* 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 * ) );
......
......@@ -169,6 +169,8 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
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;
......
......@@ -150,6 +150,7 @@ static int Init( vout_thread_t *p_vout )
{
int i_index;
picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
......@@ -159,12 +160,18 @@ static int Init( vout_thread_t *p_vout )
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 )
......
......@@ -205,6 +205,7 @@ static int Init( vout_thread_t *p_vout )
int i_index, i_vout;
picture_t *p_pic;
char *psz_default_vout;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
......@@ -214,6 +215,14 @@ static int Init( vout_thread_t *p_vout )
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" );
......@@ -227,9 +236,7 @@ static int Init( vout_thread_t *p_vout )
"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
{
......@@ -237,9 +244,7 @@ static int Init( vout_thread_t *p_vout )
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 );
......
......@@ -134,6 +134,7 @@ static int Init( vout_thread_t *p_vout )
int i_index;
char *psz_var;
picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
......@@ -247,10 +248,16 @@ static int Init( vout_thread_t *p_vout )
* 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" );
......@@ -310,6 +317,8 @@ static void Destroy( vlc_object_t *p_this )
*****************************************************************************/
static int Manage( vout_thread_t *p_vout )
{
video_format_t fmt = {0};
if( !p_vout->p_sys->b_changed )
{
return VLC_SUCCESS;
......@@ -317,9 +326,15 @@ static int Manage( vout_thread_t *p_vout )
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" );
......
......@@ -320,9 +320,18 @@ static int Init( vout_thread_t *p_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'):
......@@ -332,28 +341,21 @@ static vout_thread_t *SpawnRealVout( vout_thread_t *p_vout )
{
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:
......
......@@ -165,6 +165,7 @@ static int Init( vout_thread_t *p_vout )
{
int i_index;
picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
......@@ -174,12 +175,18 @@ static int Init( vout_thread_t *p_vout )
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 )
......
......@@ -111,6 +111,7 @@ static int Init( vout_thread_t *p_vout )
{
int i_index;
picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
......@@ -120,12 +121,18 @@ static int Init( vout_thread_t *p_vout )
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 )
......
......@@ -211,6 +211,7 @@ static int Init( vout_thread_t *p_vout )
vout_sys_t *p_sys = p_vout->p_sys;
picture_t *p_pic;
int i_index;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
......@@ -220,6 +221,14 @@ static int Init( vout_thread_t *p_vout )
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 );
......@@ -280,9 +289,7 @@ static int Init( vout_thread_t *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 )
......
......@@ -129,6 +129,7 @@ static int Init( vout_thread_t *p_vout )
{
int i_index;
picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
......@@ -153,14 +154,20 @@ static int Init( vout_thread_t *p_vout )
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;
......
......@@ -211,6 +211,7 @@ static int Init( vout_thread_t *p_vout )
{
int i_index;
picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
......@@ -220,12 +221,18 @@ static int Init( vout_thread_t *p_vout )
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 )
......
......@@ -180,6 +180,7 @@ static int Init( vout_thread_t *p_vout )
{
int i_index;
picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0;
......@@ -189,23 +190,31 @@ static int Init( vout_thread_t *p_vout )
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 */
......
......@@ -229,6 +229,7 @@ static int Init( vout_thread_t *p_vout )
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;
......@@ -269,6 +270,14 @@ static int Init( vout_thread_t *p_vout )
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;
......@@ -394,12 +403,14 @@ static int Init( vout_thread_t *p_vout )
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 );
......
......@@ -131,6 +131,7 @@ static int Open( vlc_object_t *p_this )
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') )
......@@ -160,10 +161,13 @@ static int Open( vlc_object_t *p_this )
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" );
......@@ -386,7 +390,7 @@ static void Close( vlc_object_t *p_this )
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 );
......
......@@ -132,6 +132,7 @@ static int Open( vlc_object_t *p_this )
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') ) )
......@@ -246,12 +247,13 @@ static int Open( vlc_object_t *p_this )
}
/* 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" );
......@@ -329,7 +331,7 @@ static void Close( vlc_object_t *p_this )
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 */
......
......@@ -779,7 +779,7 @@ static void DeleteDecoder( decoder_t * p_dec )
#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 )
......@@ -885,15 +885,35 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
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" );
......
......@@ -9,6 +9,7 @@
* $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
......@@ -74,11 +75,10 @@ int vout_Snapshot( vout_thread_t *, picture_t * );
* 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 )
......@@ -168,10 +168,10 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *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