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

Carl Eugen Hoyos cehoyos at ag.or.at
Tue Apr 25 17:43:17 CEST 2006


Ivan Kalvachev <ikalvachev <at> gmail.com> writes:

> 
> 2006/4/25, Nico Sabbi <nicola_sabbi <at> fastwebnet.it>:
> > Nico Sabbi wrote:
> >

[...]

> >
> > btw2, this patch should also work for ffmpeg12. Does it?

No, because for my samples (DVB and TS), ffmpeg12 never changes the output
windows resolution or position. It simply ignores aspect change.

> 
> The right place to fix this bug is in vd_mpeg12.c or libmpeg2.

Thanks for the suggestion. New patch below.

> 
> ffmpeg12 already detects and re-initializes the video system on aspect change.

For me, ffmpeg12 never re-initialized the video system;-(
And I thougth it's a feature of ffmpeg12: Never change users changes!
Libmpeg2, on the other hand, re-initializes the video on aspect change, but
always uses the former aspect. That's what the patch fixes (now without demuxer
check).

Carl Eugen

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   25 Apr 2006 15:36:38 -0000
@@ -29,6 +29,8 @@

 #include "cpudetect.h"

+extern void fill_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) {
+               fill_aspect_info(&sh->aspect);
                if(!mpcodecs_config_vo(sh,
                                       info->sequence->picture_width,
                                       info->sequence->picture_height,
IMGFMT_YV12)) return 0;
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  25 Apr 2006 15:36:38 -0000
@@ -42,6 +42,8 @@
 static int telecine=0;
 static float telecine_cnt=-2.5;

+void fill_aspect_info (float * aspect);
+
 int video_read_properties(sh_video_t *sh_video){
 demux_stream_t *d_video=sh_video->ds;

@@ -328,32 +330,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_aspect_info (&sh_video->aspect);
    // display info:
    sh_video->format=picture.mpeg1?0x10000001:0x10000002; // mpeg video
    sh_video->fps=picture.fps;
@@ -387,6 +364,35 @@
 return 1;
 }

+void fill_aspect_info (float * aspect){
+    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 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
+            *aspect=0.0;
+        break;
+    }
+}
+
 void ty_processuserdata( unsigned char* buf, int len );

 static void process_userdata(unsigned char* buf,int len){






More information about the MPlayer-dev-eng mailing list