patch for MPEG1 aspect ratio interpretation

Vladimir Chernyshov greengrass at writeme.com
Sat Dec 8 13:03:14 CET 2001


Hi folks,

I have a small patch for vlc to make it display most MPEG-1 video 
streams with correct aspect ratio. Hope you will find it useful.

VLC is a great program, keep going!

regards,
Vladimir



-- Attached file included as plaintext by Listar --
-- File: vlc-mpeg1-aspect.diff

diff -u --recursive vlc-snapshot-20011208.orig/plugins/mpeg_vdec/vpar_headers.c vlc-snapshot-20011208/plugins/mpeg_vdec/vpar_headers.c
--- vlc-snapshot-20011208.orig/plugins/mpeg_vdec/vpar_headers.c	Sat Dec  8 01:02:08 2001
+++ vlc-snapshot-20011208/plugins/mpeg_vdec/vpar_headers.c	Sat Dec  8 13:25:34 2001
@@ -382,6 +382,33 @@
     else
     {
         /* It's an MPEG-1 stream. Put adequate parameters. */
+	int xyratio;
+	static int mpeg1ratio[15]={10000,
+			    10000,
+			     6735,
+			     7031,
+			     7615,
+			     8055,
+			     8437,
+			     8935,
+			     9157,
+			     9815,
+			    10255,
+			    10695,
+			    10950,
+			    11575,
+			    12015};
+	if(p_vpar->sequence.i_aspect_ratio>1) {
+		xyratio=p_vpar->sequence.i_height*
+			mpeg1ratio[p_vpar->sequence.i_aspect_ratio]/
+			p_vpar->sequence.i_width;
+		if(7450<xyratio && xyratio<7550)
+			p_vpar->sequence.i_aspect_ratio=2;
+		else if(5575<xyratio && xyratio<5675)
+			p_vpar->sequence.i_aspect_ratio=3;
+		else if(4475<xyratio && xyratio<4575)
+			p_vpar->sequence.i_aspect_ratio=4;
+	}
 
         p_vpar->sequence.b_mpeg2 = 0;
         p_vpar->sequence.b_progressive = 1;





More information about the vlc mailing list