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 ...@@ -121,6 +121,10 @@ struct vout_thread_t
picture_heap_t output; /**< direct buffers */ picture_heap_t output; /**< direct buffers */
vlc_bool_t b_direct; /**< rendered are like direct ? */ vlc_bool_t b_direct; /**< rendered are like direct ? */
vout_chroma_t chroma; /**< translation tables */ 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 */ /* Picture heap */
...@@ -194,10 +198,10 @@ struct vout_thread_t ...@@ -194,10 +198,10 @@ struct vout_thread_t
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
#define vout_Request(a,b,c,d,e,f) __vout_Request(VLC_OBJECT(a),b,c,d,e,f) #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 *, unsigned int, unsigned int, uint32_t, unsigned int ) ); VLC_EXPORT( vout_thread_t *, __vout_Request, ( vlc_object_t *, vout_thread_t *, video_format_t * ) );
#define vout_Create(a,b,c,d,e) __vout_Create(VLC_OBJECT(a),b,c,d,e) #define vout_Create(a,b) __vout_Create(VLC_OBJECT(a),b)
VLC_EXPORT( vout_thread_t *, __vout_Create, ( vlc_object_t *, unsigned int, unsigned int, uint32_t, unsigned int ) ); VLC_EXPORT( vout_thread_t *, __vout_Create, ( vlc_object_t *, video_format_t * ) );
VLC_EXPORT( void, vout_Destroy, ( vout_thread_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 * ) ); 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, ...@@ -169,6 +169,8 @@ static inline picture_t *ffmpeg_NewPictBuf( decoder_t *p_dec,
p_dec->fmt_out.video.i_aspect = p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * ( av_q2d(p_context->sample_aspect_ratio) * VOUT_ASPECT_FACTOR * ( av_q2d(p_context->sample_aspect_ratio) *
p_context->width / p_context->height ); 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 #else
p_dec->fmt_out.video.i_aspect = p_dec->fmt_out.video.i_aspect =
VOUT_ASPECT_FACTOR * p_context->aspect_ratio; VOUT_ASPECT_FACTOR * p_context->aspect_ratio;
......
...@@ -150,6 +150,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -150,6 +150,7 @@ static int Init( vout_thread_t *p_vout )
{ {
int i_index; int i_index;
picture_t *p_pic; picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0; I_OUTPUTPICTURES = 0;
...@@ -159,12 +160,18 @@ static int Init( vout_thread_t *p_vout ) ...@@ -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_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect; 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 */ /* Try to open the real video output */
msg_Dbg( p_vout, "spawning 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->p_sys->p_vout = vout_Create( p_vout, &fmt );
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
/* Everything failed */ /* Everything failed */
if( p_vout->p_sys->p_vout == NULL ) if( p_vout->p_sys->p_vout == NULL )
......
...@@ -205,6 +205,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -205,6 +205,7 @@ static int Init( vout_thread_t *p_vout )
int i_index, i_vout; int i_index, i_vout;
picture_t *p_pic; picture_t *p_pic;
char *psz_default_vout; char *psz_default_vout;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0; I_OUTPUTPICTURES = 0;
...@@ -214,6 +215,14 @@ static int Init( vout_thread_t *p_vout ) ...@@ -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_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect; 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 */ /* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video outputs" ); msg_Dbg( p_vout, "spawning the real video outputs" );
...@@ -227,9 +236,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -227,9 +236,7 @@ static int Init( vout_thread_t *p_vout )
"default", 8 ) ) ) "default", 8 ) ) )
{ {
p_vout->p_sys->pp_vout[i_vout] = p_vout->p_sys->pp_vout[i_vout] =
vout_Create( p_vout, p_vout->render.i_width, vout_Create( p_vout, &fmt );
p_vout->render.i_height, p_vout->render.i_chroma,
p_vout->render.i_aspect );
} }
else else
{ {
...@@ -237,9 +244,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -237,9 +244,7 @@ static int Init( vout_thread_t *p_vout )
config_PutPsz( p_vout, "vout", config_PutPsz( p_vout, "vout",
p_vout->p_sys->ppsz_vout_list[i_vout] ); p_vout->p_sys->ppsz_vout_list[i_vout] );
p_vout->p_sys->pp_vout[i_vout] = p_vout->p_sys->pp_vout[i_vout] =
vout_Create( p_vout, p_vout->render.i_width, vout_Create( p_vout, &fmt );
p_vout->render.i_height, p_vout->render.i_chroma,
p_vout->render.i_aspect );
/* Reset the default value */ /* Reset the default value */
config_PutPsz( p_vout, "vout", psz_default_vout ); config_PutPsz( p_vout, "vout", psz_default_vout );
......
...@@ -134,6 +134,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -134,6 +134,7 @@ static int Init( vout_thread_t *p_vout )
int i_index; int i_index;
char *psz_var; char *psz_var;
picture_t *p_pic; picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0; I_OUTPUTPICTURES = 0;
...@@ -247,10 +248,16 @@ static int Init( vout_thread_t *p_vout ) ...@@ -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->output.i_height / p_vout->p_sys->i_height
* p_vout->p_sys->i_width / p_vout->output.i_width; * 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 */ /* Try to open the real video output */
p_vout->p_sys->p_vout = vout_Create( p_vout, p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt );
p_vout->p_sys->i_width, p_vout->p_sys->i_height,
p_vout->render.i_chroma, p_vout->p_sys->i_aspect );
if( p_vout->p_sys->p_vout == NULL ) if( p_vout->p_sys->p_vout == NULL )
{ {
msg_Err( p_vout, "failed to create vout" ); msg_Err( p_vout, "failed to create vout" );
...@@ -310,6 +317,8 @@ static void Destroy( vlc_object_t *p_this ) ...@@ -310,6 +317,8 @@ static void Destroy( vlc_object_t *p_this )
*****************************************************************************/ *****************************************************************************/
static int Manage( vout_thread_t *p_vout ) static int Manage( vout_thread_t *p_vout )
{ {
video_format_t fmt = {0};
if( !p_vout->p_sys->b_changed ) if( !p_vout->p_sys->b_changed )
{ {
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -317,9 +326,15 @@ static int Manage( vout_thread_t *p_vout ) ...@@ -317,9 +326,15 @@ static int Manage( vout_thread_t *p_vout )
vout_Destroy( p_vout->p_sys->p_vout ); vout_Destroy( p_vout->p_sys->p_vout );
p_vout->p_sys->p_vout = vout_Create( p_vout, fmt.i_width = fmt.i_visible_width = p_vout->p_sys->i_width;
p_vout->p_sys->i_width, p_vout->p_sys->i_height, fmt.i_height = fmt.i_visible_height = p_vout->p_sys->i_height;
p_vout->render.i_chroma, p_vout->p_sys->i_aspect ); 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 ) if( p_vout->p_sys->p_vout == NULL )
{ {
msg_Err( p_vout, "failed to create vout" ); msg_Err( p_vout, "failed to create vout" );
......
...@@ -320,9 +320,18 @@ static int Init( vout_thread_t *p_vout ) ...@@ -320,9 +320,18 @@ static int Init( vout_thread_t *p_vout )
static vout_thread_t *SpawnRealVout( vout_thread_t *p_vout ) static vout_thread_t *SpawnRealVout( vout_thread_t *p_vout )
{ {
vout_thread_t *p_real_vout = NULL; vout_thread_t *p_real_vout = NULL;
video_format_t fmt = {0};
msg_Dbg( p_vout, "spawning the real video output" ); 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 ) switch( p_vout->render.i_chroma )
{ {
case VLC_FOURCC('I','4','2','0'): case VLC_FOURCC('I','4','2','0'):
...@@ -332,28 +341,21 @@ static vout_thread_t *SpawnRealVout( vout_thread_t *p_vout ) ...@@ -332,28 +341,21 @@ static vout_thread_t *SpawnRealVout( vout_thread_t *p_vout )
{ {
case DEINTERLACE_MEAN: case DEINTERLACE_MEAN:
case DEINTERLACE_DISCARD: case DEINTERLACE_DISCARD:
p_real_vout = fmt.i_height = fmt.i_visible_height = p_vout->output.i_height / 2;
vout_Create( p_vout, p_real_vout = vout_Create( p_vout, &fmt );
p_vout->output.i_width, p_vout->output.i_height / 2,
p_vout->output.i_chroma, p_vout->output.i_aspect );
break; break;
case DEINTERLACE_BOB: case DEINTERLACE_BOB:
case DEINTERLACE_BLEND: case DEINTERLACE_BLEND:
case DEINTERLACE_LINEAR: case DEINTERLACE_LINEAR:
p_real_vout = p_real_vout = vout_Create( p_vout, &fmt );
vout_Create( p_vout,
p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_chroma, p_vout->output.i_aspect );
break; break;
} }
break; break;
case VLC_FOURCC('I','4','2','2'): case VLC_FOURCC('I','4','2','2'):
p_real_vout = fmt.i_chroma = VLC_FOURCC('I','4','2','0');
vout_Create( p_vout, p_real_vout = vout_Create( p_vout, &fmt );
p_vout->output.i_width, p_vout->output.i_height,
VLC_FOURCC('I','4','2','0'), p_vout->output.i_aspect );
break; break;
default: default:
......
...@@ -165,6 +165,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -165,6 +165,7 @@ static int Init( vout_thread_t *p_vout )
{ {
int i_index; int i_index;
picture_t *p_pic; picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0; I_OUTPUTPICTURES = 0;
...@@ -174,12 +175,18 @@ static int Init( vout_thread_t *p_vout ) ...@@ -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_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect; 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 */ /* Try to open the real video output */
msg_Dbg( p_vout, "spawning 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->p_sys->p_vout = vout_Create( p_vout, &fmt );
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
/* Everything failed */ /* Everything failed */
if( p_vout->p_sys->p_vout == NULL ) if( p_vout->p_sys->p_vout == NULL )
......
...@@ -111,6 +111,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -111,6 +111,7 @@ static int Init( vout_thread_t *p_vout )
{ {
int i_index; int i_index;
picture_t *p_pic; picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0; I_OUTPUTPICTURES = 0;
...@@ -120,12 +121,18 @@ static int Init( vout_thread_t *p_vout ) ...@@ -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_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect; 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 */ /* Try to open the real video output */
msg_Dbg( p_vout, "spawning 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->p_sys->p_vout = vout_Create( p_vout, &fmt );
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
/* Everything failed */ /* Everything failed */
if( p_vout->p_sys->p_vout == NULL ) if( p_vout->p_sys->p_vout == NULL )
......
...@@ -211,6 +211,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -211,6 +211,7 @@ static int Init( vout_thread_t *p_vout )
vout_sys_t *p_sys = p_vout->p_sys; vout_sys_t *p_sys = p_vout->p_sys;
picture_t *p_pic; picture_t *p_pic;
int i_index; int i_index;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0; I_OUTPUTPICTURES = 0;
...@@ -220,6 +221,14 @@ static int Init( vout_thread_t *p_vout ) ...@@ -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_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect; 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 */ /* Load the video blending filter */
p_sys->p_blend = vlc_object_create( p_vout, sizeof(filter_t) ); p_sys->p_blend = vlc_object_create( p_vout, sizeof(filter_t) );
vlc_object_attach( p_sys->p_blend, p_vout ); vlc_object_attach( p_sys->p_blend, p_vout );
...@@ -280,9 +289,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -280,9 +289,7 @@ static int Init( vout_thread_t *p_vout )
/* Try to open the real video output */ /* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" ); msg_Dbg( p_vout, "spawning the real video output" );
p_sys->p_vout = p_sys->p_vout = vout_Create( p_vout, &fmt );
vout_Create( p_vout, p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
/* Everything failed */ /* Everything failed */
if( p_sys->p_vout == NULL ) if( p_sys->p_vout == NULL )
......
...@@ -129,6 +129,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -129,6 +129,7 @@ static int Init( vout_thread_t *p_vout )
{ {
int i_index; int i_index;
picture_t *p_pic; picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0; I_OUTPUTPICTURES = 0;
...@@ -153,14 +154,20 @@ static int Init( vout_thread_t *p_vout ) ...@@ -153,14 +154,20 @@ static int Init( vout_thread_t *p_vout )
msg_Dbg( p_vout, "spawning the real video output" ); 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 ) switch( p_vout->render.i_chroma )
{ {
case VLC_FOURCC('I','4','2','0'): case VLC_FOURCC('I','4','2','0'):
case VLC_FOURCC('I','Y','U','V'): case VLC_FOURCC('I','Y','U','V'):
case VLC_FOURCC('Y','V','1','2'): case VLC_FOURCC('Y','V','1','2'):
p_vout->p_sys->p_vout = vout_Create( p_vout, p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt );
p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_chroma, p_vout->output.i_aspect );
break; break;
default: default:
break; break;
......
...@@ -211,6 +211,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -211,6 +211,7 @@ static int Init( vout_thread_t *p_vout )
{ {
int i_index; int i_index;
picture_t *p_pic; picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0; I_OUTPUTPICTURES = 0;
...@@ -220,12 +221,18 @@ static int Init( vout_thread_t *p_vout ) ...@@ -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_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect; 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 */ /* Try to open the real video output */
msg_Dbg( p_vout, "spawning 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->p_sys->p_vout = vout_Create( p_vout, &fmt );
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
/* Everything failed */ /* Everything failed */
if( p_vout->p_sys->p_vout == NULL ) if( p_vout->p_sys->p_vout == NULL )
......
...@@ -180,6 +180,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -180,6 +180,7 @@ static int Init( vout_thread_t *p_vout )
{ {
int i_index; int i_index;
picture_t *p_pic; picture_t *p_pic;
video_format_t fmt = {0};
I_OUTPUTPICTURES = 0; I_OUTPUTPICTURES = 0;
...@@ -189,23 +190,31 @@ static int Init( vout_thread_t *p_vout ) ...@@ -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_height = p_vout->render.i_height;
p_vout->output.i_aspect = p_vout->render.i_aspect; 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 */ /* Try to open the real video output */
msg_Dbg( p_vout, "spawning the real video output" ); msg_Dbg( p_vout, "spawning the real video output" );
if( p_vout->p_sys->b_rotation ) if( p_vout->p_sys->b_rotation )
{ {
p_vout->p_sys->p_vout = vout_Create( p_vout, fmt.i_width = fmt.i_visible_width = p_vout->render.i_height;
p_vout->render.i_height, p_vout->render.i_width, fmt.i_height = fmt.i_visible_height = p_vout->render.i_width;
p_vout->render.i_chroma, fmt.i_aspect = VOUT_ASPECT_FACTOR *
(uint64_t)VOUT_ASPECT_FACTOR (uint64_t)VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
* (uint64_t)VOUT_ASPECT_FACTOR fmt.i_sar_num = VOUT_ASPECT_FACTOR;
/ (uint64_t)p_vout->render.i_aspect ); 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 else
{ {
p_vout->p_sys->p_vout = vout_Create( p_vout, p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt );
p_vout->render.i_width, p_vout->render.i_height,
p_vout->render.i_chroma, p_vout->render.i_aspect );
} }
/* Everything failed */ /* Everything failed */
......
...@@ -229,6 +229,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -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; int i_index, i_row, i_col, i_width, i_height, i_left, i_top;
unsigned int i_target_width,i_target_height; unsigned int i_target_width,i_target_height;
picture_t *p_pic; picture_t *p_pic;
video_format_t fmt = {0};
int i_aspect = 4*VOUT_ASPECT_FACTOR/3; int i_aspect = 4*VOUT_ASPECT_FACTOR/3;
int i_align = 0; int i_align = 0;
unsigned int i_hstart, i_hend, i_vstart, i_vend; unsigned int i_hstart, i_hend, i_vstart, i_vend;
...@@ -269,6 +270,14 @@ static int Init( vout_thread_t *p_vout ) ...@@ -269,6 +270,14 @@ static int Init( vout_thread_t *p_vout )
p_vout->output.i_aspect = p_vout->render.i_aspect; p_vout->output.i_aspect = p_vout->render.i_aspect;
var_Create( p_vout, "align", VLC_VAR_INTEGER ); 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 = p_vout->output.i_width / p_vout->p_sys->i_col;
w1 &= ~1; w1 &= ~1;
h1 = w1 * VOUT_ASPECT_FACTOR / i_aspect&~1; h1 = w1 * VOUT_ASPECT_FACTOR / i_aspect&~1;
...@@ -394,12 +403,14 @@ static int Init( vout_thread_t *p_vout ) ...@@ -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-x", i_left + i_xpos - i_width);
var_SetInteger( p_vout, "video-y", i_top + i_ypos ); 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 = p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout =
vout_Create( p_vout, i_width, i_height, vout_Create( p_vout, &fmt );
p_vout->render.i_chroma, if( !p_vout->p_sys->pp_vout[ p_vout->p_sys->i_vout ].p_vout )
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 )
{ {
msg_Err( p_vout, "failed to get %ix%i vout threads", msg_Err( p_vout, "failed to get %ix%i vout threads",
p_vout->p_sys->i_col, p_vout->p_sys->i_row ); p_vout->p_sys->i_col, p_vout->p_sys->i_row );
......
...@@ -131,6 +131,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -131,6 +131,7 @@ static int Open( vlc_object_t *p_this )
aout_filter_sys_t *p_sys; aout_filter_sys_t *p_sys;
goom_thread_t *p_thread; goom_thread_t *p_thread;
vlc_value_t width, height; vlc_value_t width, height;
video_format_t fmt = {0};
if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' ) if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2' )
|| p_filter->output.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 ) ...@@ -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_Create( p_thread, "goom-height", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
var_Get( p_thread, "goom-height", &height ); var_Get( p_thread, "goom-height", &height );
p_thread->p_vout = fmt.i_width = fmt.i_visible_width = width.i_int;
vout_Request( p_filter, NULL, width.i_int, height.i_int, fmt.i_height = fmt.i_visible_height = height.i_int;
VLC_FOURCC('R','V','3','2'), fmt.i_chroma = VLC_FOURCC('R','V','3','2');
VOUT_ASPECT_FACTOR * width.i_int/height.i_int ); 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 ) if( p_thread->p_vout == NULL )
{ {
msg_Err( p_filter, "no suitable vout module" ); msg_Err( p_filter, "no suitable vout module" );
...@@ -386,7 +390,7 @@ static void Close( vlc_object_t *p_this ) ...@@ -386,7 +390,7 @@ static void Close( vlc_object_t *p_this )
vlc_thread_join( p_sys->p_thread ); vlc_thread_join( p_sys->p_thread );
/* Free data */ /* 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_mutex_destroy( &p_sys->p_thread->lock );
vlc_cond_destroy( &p_sys->p_thread->wait ); vlc_cond_destroy( &p_sys->p_thread->wait );
vlc_object_detach( p_sys->p_thread ); vlc_object_detach( p_sys->p_thread );
......
...@@ -132,6 +132,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -132,6 +132,7 @@ static int Open( vlc_object_t *p_this )
vlc_value_t val; vlc_value_t val;
char *psz_effects, *psz_parser; char *psz_effects, *psz_parser;
video_format_t fmt = {0};
if( ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2') && if( ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2') &&
p_filter->input.i_format != VLC_FOURCC('f','i','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 ) ...@@ -246,12 +247,13 @@ static int Open( vlc_object_t *p_this )
} }
/* Open the video output */ /* Open the video output */
p_sys->p_vout = fmt.i_width = fmt.i_visible_width = p_sys->i_width;
vout_Request( p_filter, NULL, fmt.i_height = fmt.i_visible_height = p_sys->i_height;
p_sys->i_width, p_sys->i_height, fmt.i_chroma = VLC_FOURCC('I','4','2','0');
VLC_FOURCC('I','4','2','0'), fmt.i_aspect = VOUT_ASPECT_FACTOR * p_sys->i_width/p_sys->i_height;
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 ) if( p_sys->p_vout == NULL )
{ {
msg_Err( p_filter, "no suitable vout module" ); msg_Err( p_filter, "no suitable vout module" );
...@@ -329,7 +331,7 @@ static void Close( vlc_object_t *p_this ) ...@@ -329,7 +331,7 @@ static void Close( vlc_object_t *p_this )
if( p_filter->p_sys->p_vout ) 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 */ /* Free the list */
......
...@@ -779,7 +779,7 @@ static void DeleteDecoder( decoder_t * p_dec ) ...@@ -779,7 +779,7 @@ static void DeleteDecoder( decoder_t * p_dec )
#undef p_pic #undef p_pic
/* We are about to die. Reattach video output to p_vlc. */ /* 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 ) if( p_dec->p_owner->p_sout_input )
...@@ -885,15 +885,35 @@ static picture_t *vout_new_buffer( decoder_t *p_dec ) ...@@ -885,15 +885,35 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
return NULL; 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_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
p_sys->video = p_dec->fmt_out.video; p_sys->video = p_dec->fmt_out.video;
p_sys->p_vout = vout_Request( p_dec, p_sys->p_vout, p_sys->p_vout = vout_Request( p_dec, p_sys->p_vout,
p_sys->video.i_width, &p_dec->fmt_out.video );
p_sys->video.i_height,
p_sys->video.i_chroma,
p_sys->video.i_aspect );
if( p_sys->p_vout == NULL ) if( p_sys->p_vout == NULL )
{ {
msg_Err( p_dec, "failed to create video output" ); msg_Err( p_dec, "failed to create video output" );
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* $Id$ * $Id$
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Gildas Bazin <gbazin@videolan.org>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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 * ); ...@@ -74,11 +75,10 @@ int vout_Snapshot( vout_thread_t *, picture_t * );
* This function looks for a video output thread matching the current * This function looks for a video output thread matching the current
* properties. If not found, it spawns a new one. * properties. If not found, it spawns a new one.
*****************************************************************************/ *****************************************************************************/
vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout, vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
unsigned int i_width, unsigned int i_height, video_format_t *p_fmt )
vlc_fourcc_t i_chroma, unsigned int i_aspect )
{ {
if( !i_width || !i_height || !i_chroma ) if( !p_fmt )
{ {
/* Reattach video output to input before bailing out */ /* Reattach video output to input before bailing out */
if( p_vout ) if( p_vout )
...@@ -168,10 +168,10 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *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( psz_filter_chain ) free( psz_filter_chain );
} }
if( ( p_vout->render.i_width != i_width ) || if( ( p_vout->fmt_render.i_width != p_fmt->i_width ) ||
( p_vout->render.i_height != i_height ) || ( p_vout->fmt_render.i_height != p_fmt->i_height ) ||
( p_vout->render.i_chroma != i_chroma ) || ( p_vout->fmt_render.i_chroma != p_fmt->i_chroma ) ||
( p_vout->render.i_aspect != i_aspect ( p_vout->fmt_render.i_aspect != p_fmt->i_aspect
&& !p_vout->b_override_aspect ) || && !p_vout->b_override_aspect ) ||
p_vout->b_filter_change ) p_vout->b_filter_change )
{ {
...@@ -195,7 +195,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout, ...@@ -195,7 +195,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
{ {
msg_Dbg( p_this, "no usable vout present, spawning one" ); 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; return p_vout;
...@@ -207,9 +207,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout, ...@@ -207,9 +207,7 @@ vout_thread_t * __vout_Request ( vlc_object_t *p_this, vout_thread_t *p_vout,
* This function creates a new video output thread, and returns a pointer * This function creates a new video output thread, and returns a pointer
* to its description. On error, it returns NULL. * to its description. On error, it returns NULL.
*****************************************************************************/ *****************************************************************************/
vout_thread_t * __vout_Create( vlc_object_t *p_parent, vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
unsigned int i_width, unsigned int i_height,
vlc_fourcc_t i_chroma, unsigned int i_aspect )
{ {
vout_thread_t * p_vout; /* thread descriptor */ vout_thread_t * p_vout; /* thread descriptor */
input_thread_t * p_input_thread; input_thread_t * p_input_thread;
...@@ -217,6 +215,11 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, ...@@ -217,6 +215,11 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
char * psz_plugin; char * psz_plugin;
vlc_value_t val, text; 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 */ /* Allocate descriptor */
p_vout = vlc_object_create( p_parent, VLC_OBJECT_VOUT ); p_vout = vlc_object_create( p_parent, VLC_OBJECT_VOUT );
if( p_vout == NULL ) if( p_vout == NULL )
...@@ -241,6 +244,8 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, ...@@ -241,6 +244,8 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent,
/* Initialize the rendering heap */ /* Initialize the rendering heap */
I_RENDERPICTURES = 0; 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_width = i_width;
p_vout->render.i_height = i_height; p_vout->render.i_height = i_height;
p_vout->render.i_chroma = i_chroma; p_vout->render.i_chroma = i_chroma;
...@@ -558,19 +563,59 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -558,19 +563,59 @@ static int InitThread( vout_thread_t *p_vout )
msg_Dbg( p_vout, "got %i direct buffer(s)", I_OUTPUTPICTURES ); msg_Dbg( p_vout, "got %i direct buffer(s)", I_OUTPUTPICTURES );
AspectRatio( p_vout->render.i_aspect, &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, chroma 0x%.8x (%4.4s), aspect ratio %i:%i", msg_Dbg( p_vout, "picture in %ix%i (%i,%i,%ix%i), "
p_vout->render.i_width, p_vout->render.i_height, "chroma %4.4s, ar %i:%i, sar %i:%i",
p_vout->render.i_chroma, (char*)&p_vout->render.i_chroma, p_vout->fmt_render.i_width, p_vout->fmt_render.i_height,
i_aspect_x, i_aspect_y ); 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 %4.4s, ar %i:%i, sar %i:%i",
msg_Dbg( p_vout,
"picture out %ix%i, chroma 0x%.8x (%4.4s), aspect ratio %i:%i",
p_vout->output.i_width, p_vout->output.i_height, p_vout->output.i_width, p_vout->output.i_height,
p_vout->output.i_chroma, (char*)&p_vout->output.i_chroma, (char*)&p_vout->output.i_chroma,
i_aspect_x, i_aspect_y ); 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 */ /* Calculate shifts from system-updated masks */
MaskToShift( &p_vout->output.i_lrshift, &p_vout->output.i_rrshift, MaskToShift( &p_vout->output.i_lrshift, &p_vout->output.i_rrshift,
......
...@@ -286,24 +286,18 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -286,24 +286,18 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
subpicture_t *p_subpic ) subpicture_t *p_subpic )
{ {
video_format_t fmt;
int i_scale_width, i_scale_height; int i_scale_width, i_scale_height;
if( p_pic == NULL ) if( p_pic == NULL )
{ {
/* XXX: subtitles */ /* XXX: subtitles */
return NULL; return NULL;
} }
fmt.i_aspect = p_vout->output.i_aspect; i_scale_width = p_vout->fmt_out.i_visible_width * 1000 /
fmt.i_chroma = p_vout->output.i_chroma; p_vout->fmt_in.i_visible_width;
fmt.i_width = p_vout->output.i_width; i_scale_height = p_vout->fmt_out.i_visible_height * 1000 /
fmt.i_height = p_vout->output.i_height; p_vout->fmt_in.i_visible_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;
if( p_pic->i_type == DIRECT_PICTURE ) if( p_pic->i_type == DIRECT_PICTURE )
{ {
...@@ -320,7 +314,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -320,7 +314,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
* subtitles. */ * subtitles. */
vout_CopyPicture( p_vout, PP_OUTPUTPICTURE[0], p_pic ); 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, PP_OUTPUTPICTURE[0], p_pic, p_subpic,
i_scale_width, i_scale_height ); i_scale_width, i_scale_height );
...@@ -336,8 +330,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -336,8 +330,8 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
/* Picture is in a direct buffer but isn't used by the /* Picture is in a direct buffer but isn't used by the
* decoder. We can safely render subtitles on it and * decoder. We can safely render subtitles on it and
* display it. */ * display it. */
spu_RenderSubpictures( p_vout->p_spu, &fmt, p_pic, p_pic, p_subpic, spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out, p_pic, p_pic,
i_scale_width, i_scale_height ); p_subpic, i_scale_width, i_scale_height );
return p_pic; return p_pic;
} }
...@@ -355,8 +349,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -355,8 +349,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
return NULL; return NULL;
vout_CopyPicture( p_vout, PP_OUTPUTPICTURE[0], p_pic ); vout_CopyPicture( p_vout, PP_OUTPUTPICTURE[0], p_pic );
spu_RenderSubpictures( p_vout->p_spu, &fmt, PP_OUTPUTPICTURE[0], spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
p_pic, p_subpic, i_scale_width, i_scale_height); PP_OUTPUTPICTURE[0], p_pic,
p_subpic, i_scale_width, i_scale_height );
if( PP_OUTPUTPICTURE[0]->pf_unlock ) if( PP_OUTPUTPICTURE[0]->pf_unlock )
PP_OUTPUTPICTURE[0]->pf_unlock( p_vout, PP_OUTPUTPICTURE[0] ); PP_OUTPUTPICTURE[0]->pf_unlock( p_vout, PP_OUTPUTPICTURE[0] );
...@@ -378,10 +373,10 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -378,10 +373,10 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
if( p_tmp_pic->i_status == FREE_PICTURE ) if( p_tmp_pic->i_status == FREE_PICTURE )
{ {
vout_AllocatePicture( VLC_OBJECT(p_vout), vout_AllocatePicture( VLC_OBJECT(p_vout),
p_tmp_pic, p_vout->output.i_chroma, p_tmp_pic, p_vout->fmt_out.i_chroma,
p_vout->output.i_width, p_vout->fmt_out.i_width,
p_vout->output.i_height, p_vout->fmt_out.i_height,
p_vout->output.i_aspect ); p_vout->fmt_out.i_aspect );
p_tmp_pic->i_type = MEMORY_PICTURE; p_tmp_pic->i_type = MEMORY_PICTURE;
p_tmp_pic->i_status = RESERVED_PICTURE; p_tmp_pic->i_status = RESERVED_PICTURE;
} }
...@@ -390,7 +385,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -390,7 +385,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
p_vout->chroma.pf_convert( p_vout, p_pic, p_tmp_pic ); p_vout->chroma.pf_convert( p_vout, p_pic, p_tmp_pic );
/* Render subpictures on the first direct buffer */ /* 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, p_tmp_pic, p_subpic,
i_scale_width, i_scale_height ); i_scale_width, i_scale_height );
...@@ -410,9 +405,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, ...@@ -410,9 +405,9 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
p_vout->chroma.pf_convert( p_vout, p_pic, &p_vout->p_picture[0] ); p_vout->chroma.pf_convert( p_vout, p_pic, &p_vout->p_picture[0] );
/* Render subpictures on the first direct buffer */ /* Render subpictures on the first direct buffer */
spu_RenderSubpictures( p_vout->p_spu, &fmt, &p_vout->p_picture[0], spu_RenderSubpictures( p_vout->p_spu, &p_vout->fmt_out,
&p_vout->p_picture[0], p_subpic, &p_vout->p_picture[0], &p_vout->p_picture[0],
i_scale_width, i_scale_height ); p_subpic, i_scale_width, i_scale_height );
} }
if( p_vout->p_picture[0].pf_unlock ) if( p_vout->p_picture[0].pf_unlock )
...@@ -435,7 +430,6 @@ void vout_PlacePicture( vout_thread_t *p_vout, ...@@ -435,7 +430,6 @@ void vout_PlacePicture( vout_thread_t *p_vout,
if( (i_width <= 0) || (i_height <=0) ) if( (i_width <= 0) || (i_height <=0) )
{ {
*pi_width = *pi_height = *pi_x = *pi_y = 0; *pi_width = *pi_height = *pi_x = *pi_y = 0;
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment