]> git.sesse.net Git - vlc/blobdiff - src/input/decoder.c
sar_num needs to be adjusted as well
[vlc] / src / input / decoder.c
index 3d9276226c02284f0bf9d306f9705fcdc1981f11..f7694c5b046f9d517fc76e9739c286b5e581a7a5 100644 (file)
@@ -917,29 +917,38 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
             return NULL;
         }
 
+        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;
+        }
+
+        if( p_dec->fmt_out.video.i_visible_height == 1088 &&
+            var_CreateGetBool( p_dec, "hdtv-fix" ) )
+        {
+            p_dec->fmt_out.video.i_visible_height = 1080;
+            p_dec->fmt_out.video.i_sar_num *= 135; 
+            p_dec->fmt_out.video.i_sar_num /= 136; 
+            msg_Warn( p_dec, "Fixing broken HDTV stream (display_height=1088)");
+        }
+
         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_num = p_dec->fmt_out.video.i_aspect * 
+              p_dec->fmt_out.video.i_visible_height;
 
             p_dec->fmt_out.video.i_sar_den = VOUT_ASPECT_FACTOR *
-              p_dec->fmt_out.video.i_width;
+              p_dec->fmt_out.video.i_visible_width;
         }
 
         vlc_ureduce( &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_sar_den, 50000 );
 
         p_dec->fmt_out.video.i_chroma = p_dec->fmt_out.i_codec;
         p_sys->video = p_dec->fmt_out.video;