[MPlayer-dev-eng] Re: [PATCH] Allow aspect change in TS and DVB

Carl Eugen Hoyos cehoyos at ag.or.at
Thu May 4 15:38:11 CEST 2006


Hi Nico!

Nico Sabbi <nicola_sabbi <at> fastwebnet.it> writes:

> Updated  patch attached.
> 
>     Nico

If I play an avi file containing MPEG2 with mplayer and your patch, I get the
following output:

...
Starting playback...
Detected unknown aspect_ratio_information in mpeg sequence header.
Please report the aspect value (0) 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!
Assuming 1:1 aspect for now.
...

That's because you disabled property reading for AVI MPEG1/2 files on January
12th (it always worked for me as long as no aspect change was expected).

So I would suggest once again to test the demuxer type: Does it make sense to
check for aspect ration change in another medium than TS/DVB?

Thanks to Reimars patch for vo_xv, aspect ratio change now also works for
fullscreen;-)

Any chance to get this one committed? I think it's very useful to people using
mplayer to watch DVB.

Carl Eugen

Index: libmpdemux/video.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/video.c,v
retrieving revision 1.62
diff -u -r1.62 video.c
--- libmpdemux/video.c  23 Apr 2006 12:29:10 -0000      1.62
+++ libmpdemux/video.c  27 Apr 2006 21:33:31 -0000
@@ -42,6 +42,46 @@
 static int telecine=0;
 static float telecine_cnt=-2.5;

+void fill_mpeg12_aspect_info (float * aspect){
+    float par[] = {
+                   0, 1, 0.6735, 0.7031, 0.7615, 0.8055, 0.8437, 0.8935,
+                  0.9375, 0.9815, 1.0255, 1.0695, 1.1250, 1.1575, 1.2015
+    };
+
+    if(picture.mpeg1) {
+        if(picture.aspect_ratio_information > 0 &&
picture.aspect_ratio_information < 15)
+           *aspect = picture.display_picture_width /
(par[picture.aspect_ratio_information] * picture.display_picture_height);
+       else
+           *aspect = 0.0;
+    } else // MPEG2
+    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 9: // Movie Type ??? / 640x480
+            *aspect=0.0;
+        break;
+        default:
+            mp_msg(MSGT_DECVIDEO,MSGL_ERR,"Detected
unknownaspect_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:1aspect for now.\n",
+               picture.aspect_ratio_information);
+        case 1:  // VGA 1:1 - do not prescale
+            *aspect=0.0;
+        break;
+    }
+}
+
 int video_read_properties(sh_video_t *sh_video){
 demux_stream_t *d_video=sh_video->ds;

@@ -326,34 +366,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;
-   }
+   fill_mpeg12_aspect_info(&sh_video->aspect);
    // display info:
    sh_video->format=picture.mpeg1?0x10000001:0x10000002; // mpeg video
    sh_video->fps=picture.fps;
Index: libmpcodecs/vd_libmpeg2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_libmpeg2.c,v
retrieving revision 1.40
diff -u -r1.40 vd_libmpeg2.c
--- libmpcodecs/vd_libmpeg2.c   18 Nov 2005 14:39:22 -0000      1.40
+++ libmpcodecs/vd_libmpeg2.c   27 Apr 2006 21:33:31 -0000
@@ -29,6 +29,8 @@

 #include "cpudetect.h"

+extern void fill_mpeg12_aspect_info (float * aspect);
+
 // to set/get/query special features/parameters
 static int control(sh_video_t *sh,int cmd,void* arg,...){
     mpeg2dec_t * mpeg2dec = sh->context;
@@ -156,6 +158,7 @@
            // video parameters inited/changed, (re)init libvo:
            if (info->sequence->width >> 1 == info->sequence->chroma_width &&
                info->sequence->height >> 1 == info->sequence->chroma_height) {
+               if (sh->ds->demuxer->file_format == DEMUXER_TYPE_MPEG_TS)
+                       fill_mpeg12_aspect_info(&sh->aspect);
                if(!mpcodecs_config_vo(sh,
                                       info->sequence->picture_width,
                                       info->sequence->picture_height,
IMGFMT_YV12)) return 0;





More information about the MPlayer-dev-eng mailing list