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

Nico Sabbi nicola_sabbi at fastwebnet.it
Tue Apr 25 11:04:32 CEST 2006


Carl Eugen Hoyos wrote:

>Hi!
>
>I posted a bug report last week on users that aspect changes in dvb are not
>supported by mplayer.
>
>Following fix allows MPEG2 transport streams to change aspect when using -vc
>libmpeg2. Tested with the file I uploaded to incoming/aspect.ts and DVB.
>
>Hope the patch is correct, Carl Eugen Hoyos
>
>
>
>Index: libmpdemux/demuxer.h
>===================================================================
>RCS file: /cvsroot/mplayer/main/libmpdemux/demuxer.h,v
>retrieving revision 1.93
>diff -u -r1.93 demuxer.h
>--- libmpdemux/demuxer.h        24 Apr 2006 10:58:40 -0000      1.93
>+++ libmpdemux/demuxer.h        25 Apr 2006 01:45:25 -0000
>@@ -319,6 +319,7 @@
> char* demux_info_get(demuxer_t *demuxer, char *opt);
> int demux_info_print(demuxer_t *demuxer);
> int demux_control(demuxer_t *demuxer, int cmd, void *arg);
>+void fill_aspect_info (float * aspect);
>
> #ifdef HAVE_OGGVORBIS
> /* Found in demux_ogg.c */
>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 01:45:26 -0000
>@@ -328,32 +328,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 +362,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){
>Index: libmpcodecs/vd.c
>===================================================================
>RCS file: /cvsroot/mplayer/main/libmpcodecs/vd.c,v
>retrieving revision 1.84
>diff -u -r1.84 vd.c
>--- libmpcodecs/vd.c    24 Mar 2006 08:12:02 -0000      1.84
>+++ libmpcodecs/vd.c    25 Apr 2006 01:45:26 -0000
>@@ -289,6 +289,8 @@
>     }
>     if(sh->aspect>0.01){
>       int w;
>+      if (sh->ds->demuxer->file_format == DEMUXER_TYPE_MPEG_TS && sh->format ==
>0x10000002)
>+        fill_aspect_info(&sh->aspect);
>       mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_MovieAspectIsSet,sh->aspect);
>       w=(int)((float)screen_size_y*sh->aspect); w+=w%2; // round
>       // we don't like horizontal downscale || user forced width:
>
>
>  
>

there's no need to check the demuxer type here




More information about the MPlayer-dev-eng mailing list