Commit fecefe0b authored by Steve Lhomme's avatar Steve Lhomme

display: apply the same source aspect ratio cleaning on init and source update

In push we still need to clean the format every time the source changes. Before
it was done before the display pool was allocated and kept all along.
parent 3b35572d
...@@ -588,18 +588,28 @@ static int vout_SetSourceAspect(vout_display_t *vd, ...@@ -588,18 +588,28 @@ static int vout_SetSourceAspect(vout_display_t *vd,
return ret; return ret;
} }
void VoutFixFormatAR(video_format_t *fmt)
{
vlc_ureduce( &fmt->i_sar_num, &fmt->i_sar_den,
fmt->i_sar_num, fmt->i_sar_den, 50000 );
if (fmt->i_sar_num <= 0 || fmt->i_sar_den <= 0) {
fmt->i_sar_num = 1;
fmt->i_sar_den = 1;
}
}
void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *source) void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *source)
{ {
vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display); vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
int err1 = 0, err2 = 0; int err1 = 0, err2 = 0;
if (source->i_sar_num * osys->source.i_sar_den != video_format_t fixed_src = *source;
source->i_sar_den * osys->source.i_sar_num) { VoutFixFormatAR( &fixed_src );
if (fixed_src.i_sar_num * osys->source.i_sar_den !=
fixed_src.i_sar_den * osys->source.i_sar_num) {
osys->source.i_sar_num = source->i_sar_num; osys->source.i_sar_num = fixed_src.i_sar_num;
osys->source.i_sar_den = source->i_sar_den; osys->source.i_sar_den = fixed_src.i_sar_den;
vlc_ureduce(&osys->source.i_sar_num, &osys->source.i_sar_den,
osys->source.i_sar_num, osys->source.i_sar_den, 0);
/* FIXME it will override any AR that the user would have forced */ /* FIXME it will override any AR that the user would have forced */
err1 = vout_SetSourceAspect(vd, osys->source.i_sar_num, err1 = vout_SetSourceAspect(vd, osys->source.i_sar_num,
......
...@@ -23,3 +23,4 @@ ...@@ -23,3 +23,4 @@
#include "vout_wrapper.h" #include "vout_wrapper.h"
void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *); void vout_UpdateDisplaySourceProperties(vout_display_t *vd, const video_format_t *);
void VoutFixFormatAR(video_format_t *);
...@@ -87,12 +87,7 @@ static void VoutFixFormat(video_format_t *dst, const video_format_t *src) ...@@ -87,12 +87,7 @@ static void VoutFixFormat(video_format_t *dst, const video_format_t *src)
{ {
video_format_Copy(dst, src); video_format_Copy(dst, src);
dst->i_chroma = vlc_fourcc_GetCodec(VIDEO_ES, src->i_chroma); dst->i_chroma = vlc_fourcc_GetCodec(VIDEO_ES, src->i_chroma);
vlc_ureduce( &dst->i_sar_num, &dst->i_sar_den, VoutFixFormatAR( dst );
src->i_sar_num, src->i_sar_den, 50000 );
if (dst->i_sar_num <= 0 || dst->i_sar_den <= 0) {
dst->i_sar_num = 1;
dst->i_sar_den = 1;
}
video_format_FixRgb(dst); video_format_FixRgb(dst);
} }
......
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