[MPlayer-cvslog] CVS: main/libmpdemux mpeg_hdr.c, 1.18, 1.19 mpeg_hdr.h, 1.6, 1.7 video.c, 1.63, 1.64

Nico Sabbi CVS syncmail at mplayerhq.hu
Sun May 7 18:05:40 CEST 2006


CVS change done by Nico Sabbi CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv9859

Modified Files:
	mpeg_hdr.c mpeg_hdr.h video.c 
Log Message:
COSMETICS: moved code to parse mpeg1/2 A/R to mpeg_hdr.c

Index: mpeg_hdr.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/mpeg_hdr.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- mpeg_hdr.c	25 Mar 2006 23:07:28 -0000	1.18
+++ mpeg_hdr.c	7 May 2006 16:05:38 -0000	1.19
@@ -8,6 +8,8 @@
 #include "config.h"
 #include "mpeg_hdr.h"
 
+#include "mp_msg.h"
+
 static float frameratecode2framerate[16] = {
   0,
   // Official mpeg1/2 framerates: (1-8)
@@ -102,6 +104,37 @@
     return 0;
 }
 
+float mpeg12_aspect_info(mp_mpeg_header_t *picture)
+{
+    float aspect = 0.0;
+    
+    switch(picture->aspect_ratio_information) {
+      case 2:  // PAL/NTSC SVCD/DVD 4:3
+      case 8:  // PAL VCD 4:3
+      case 12: // NTSC VCD 4:3
+        aspect=4.0/3.0;
+        break;
+      case 3:  // PAL/NTSC Widescreen SVCD/DVD 16:9
+      case 6:  // (PAL?)/NTSC Widescreen SVCD 16:9
+        aspect=16.0/9.0;
+        break;
+      case 4:  // according to ISO-138182-2 Table 6.3
+        aspect=2.21;
+        break;
+      case 1:  // VGA 1:1 - do not prescale
+      case 9: // Movie Type ??? / 640x480
+        aspect=0.0;
+        break;
+      default:
+        mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Detected unknown aspect_ratio_information in mpeg sequence header.\n"
+               "Please report the aspect value (%i) along with the movie type (VGA,PAL,NTSC,"
+               "SECAM) and the movie resolution (720x576,352x240,480x480,...) to the MPlayer"
+               " developers, so that we can add support for it!\nAssuming 1:1 aspect for now.\n",
+               picture->aspect_ratio_information);
+    }
+    
+    return aspect;
+}
 
 //MPEG4 HEADERS
 unsigned char mp_getbits(unsigned char *buffer, unsigned int from, unsigned char len)

Index: mpeg_hdr.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/mpeg_hdr.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- mpeg_hdr.h	6 Aug 2005 16:15:07 -0000	1.6
+++ mpeg_hdr.h	7 May 2006 16:05:38 -0000	1.7
@@ -22,6 +22,7 @@
 
 int mp_header_process_sequence_header (mp_mpeg_header_t * picture, unsigned char * buffer);
 int mp_header_process_extension (mp_mpeg_header_t * picture, unsigned char * buffer);
+float mpeg12_aspect_info(mp_mpeg_header_t *picture);
 int mp4_header_process_vol(mp_mpeg_header_t * picture, unsigned char * buffer);
 void mp4_header_process_vop(mp_mpeg_header_t * picture, unsigned char * buffer);
 int h264_parse_sps(mp_mpeg_header_t * picture, unsigned char * buf, int len);

Index: video.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/video.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- video.c	6 May 2006 07:31:49 -0000	1.63
+++ video.c	7 May 2006 16:05:38 -0000	1.64
@@ -326,34 +326,7 @@
    }
    
 //   printf("picture.fps=%d\n",picture.fps);
-   
-   // fill aspect info:
-   switch(picture.aspect_ratio_information){
-     case 2:  // PAL/NTSC SVCD/DVD 4:3
-     case 8:  // PAL VCD 4:3
-     case 12: // NTSC VCD 4:3
-       sh_video->aspect=4.0/3.0;
-     break;
-     case 3:  // PAL/NTSC Widescreen SVCD/DVD 16:9
-     case 6:  // (PAL?)/NTSC Widescreen SVCD 16:9
-       sh_video->aspect=16.0/9.0;
-     break;
-     case 4:  // according to ISO-138182-2 Table 6.3
-       sh_video->aspect=2.21;
-       break;
-     case 9: // Movie Type ??? / 640x480
-       sh_video->aspect=0.0;
-     break;
-     default:
-       mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Detected unknown aspect_ratio_information in mpeg sequence header.\n"
-               "Please report the aspect value (%i) along with the movie type (VGA,PAL,NTSC,"
-               "SECAM) and the movie resolution (720x576,352x240,480x480,...) to the MPlayer"
-               " developers, so that we can add support for it!\nAssuming 1:1 aspect for now.\n",
-               picture.aspect_ratio_information);
-     case 1:  // VGA 1:1 - do not prescale
-       sh_video->aspect=0.0;
-     break;
-   }
+   sh_video->aspect = mpeg12_aspect_info(&picture);
    // display info:
    sh_video->format=picture.mpeg1?0x10000001:0x10000002; // mpeg video
    sh_video->fps=picture.fps;




More information about the MPlayer-cvslog mailing list