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:
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
Nico Sabbi wrote:
Carl Eugen Hoyos wrote:
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
and, btw the same applies to 0x1000001 (mpeg1) and to all other ids/fourccs assigned to mpeg1 and mpeg2. For a list see libmpdemux/muxer_mpeg.c function is_mpeg12(). btw2, this patch should also work for ffmpeg12. Does it?
2006/4/25, Nico Sabbi <nicola_sabbi@fastwebnet.it>:
Nico Sabbi wrote:
Carl Eugen Hoyos wrote:
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
and, btw the same applies to 0x1000001 (mpeg1) and to all other ids/fourccs assigned to mpeg1 and mpeg2. For a list see libmpdemux/muxer_mpeg.c function is_mpeg12().
btw2, this patch should also work for ffmpeg12. Does it?
The right place to fix this bug is in vd_mpeg12.c or libmpeg2. ffmpeg12 already detects and re-initializes the video system on aspect change.
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){
Carl Eugen Hoyos wrote:
For me, ffmpeg12 never re-initialized the video system;-(
not even for me, at least when playing mpeg12 video
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
your patch doesn't apply in my tree; attached is a slightly different version. If no one objects I'll commit it tomorrow. Nico
2006/4/25, Carl Eugen Hoyos <cehoyos@ag.or.at>:
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.
Use the CVS not the antient release. It was especially requested for DVB aspect changes.
The right place to fix this bug is in vd_mpeg12.c or libmpeg2.
Thanks for the suggestion. New patch below.
Rejected. You should not fill video.c with (lib)mpeg12 specific stuff. Try again.
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).
Hum. The ffmpeg12 decoder does reinitliaze itself and call pix_format (or whatever functions there was for quering supported pixel format). It seems that vf_ffmpeg doesn't notice the aspect change and doesn't care why all buffers are freed and allocated again ;)
Ivan Kalvachev wrote:
The right place to fix this bug is in vd_mpeg12.c or libmpeg2.
Thanks for the suggestion. New patch below.
Rejected. You should not fill video.c with (lib)mpeg12 specific stuff. Try again.
video.c is already full of mpeg12 specific stuff: all the headers (sequence/extension/frame) are already parsed in it, frame boundaries are in it, soft-ivtc is done in it. His code doesn't add anything new: it just moves in a function few lines of code (as should have been done from the very beginning). So what's wrong with it? -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Telefonare all'estero risparmiando fino all'80%? Con Email.it Phone Card puoi, clicca e scopri tutti i vantaggi Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2683&d=27-4
2006/4/27, Nico Sabbi <nsabbi@email.it>:
Ivan Kalvachev wrote:
The right place to fix this bug is in vd_mpeg12.c or libmpeg2.
Thanks for the suggestion. New patch below.
Rejected. You should not fill video.c with (lib)mpeg12 specific stuff. Try again.
video.c is already full of mpeg12 specific stuff: all the headers (sequence/extension/frame) are already parsed in it, frame boundaries are in it, soft-ivtc is done in it. His code doesn't add anything new: it just moves in a function few lines of code (as should have been done from the very beginning). So what's wrong with it?
My bad. OK to commit.
My bad. OK to commit.
by bad. Please before commit, check if mpeg1 and mpeg2 have different aspect codes. I can't do it atm.
Ivan Kalvachev wrote:
My bad. OK to commit.
by bad. Please before commit, check if mpeg1 and mpeg2 have different aspect codes. I can't do it atm.
they are different (and mplayer is buggy): IIUC mpeg1 defines A/R codes as pixel_aspect_ratio while mpeg2 defines display_aspect_ratio, so in mpeg1 PAR = width / (DAR * height), correct? The code in video.c seems to correctly handle mpeg2's dar (always) and mpeg1's par only at prefixed resolution (now I remember that vlc sometimes shows a different A/R than expected when playing mpeg1 video, maybe rightfully so). If what I wrote is correct (someone confirm or deny, please) when playing mpeg1 sh_video->aspect (DAR) should be set to width / (PAR_float_code * height). Michael and Ivan, please comment. Updated patch attached. Nico
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;
Carl Eugen Hoyos wrote:
... 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).
it was done in a very very ugly and hackish way that also made mplayer crash in some cases
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?
yes, ever heard of dvd?
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.
not in this form. The time for hackish tricks to make mplayer "just work in some way" is hopefully over (because it leads to nasty problems that are hard to track and fix). Work is ongoing to fix many if the worst parts of mplayer. As for the A/R function Ivan and I think that video.c is not really the best place for it; maybe mpeg_hdr.c. Opinions?
+ if (sh->ds->demuxer->file_format == DEMUXER_TYPE_MPEG_TS) + fill_mpeg12_aspect_info(&sh->aspect); if(!mpcodecs_config_vo(sh,
very bad, see above.
Hi Nico! Nico Sabbi <nicola_sabbi <at> fastwebnet.it> writes:
Carl Eugen Hoyos wrote:
[...]
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?
yes, ever heard of dvd?
There are really DVDs with aspect change? I didn't know... [...]
As for the A/R function Ivan and I think that video.c is not really the best place for it; maybe mpeg_hdr.c. Opinions?
AFAICT, the information has to get from a frame, decoded in mpeg_hdr.c, into the sh_video data structure, which is not present in mpeg_hdr.c, so I don't see how this could be done without changing video.c a bit. One line patch attached. I hope it's clean enough now, Carl Eugen Hoyos Index: libmpdemux/video.c =================================================================== RCS file: /cvsroot/mplayer/main/libmpdemux/video.c,v retrieving revision 1.64 diff -u -r1.64 video.c --- libmpdemux/video.c 7 May 2006 16:05:38 -0000 1.64 +++ libmpdemux/video.c 9 May 2006 00:17:07 -0000 @@ -440,7 +440,9 @@ //printf("read packet 0x%X, len=%d\n",i,videobuf_len); // process headers: switch(i){ - case 0x1B3: mp_header_process_sequence_header (&picture, &videobuffer[start]);break; + case 0x1B3: mp_header_process_sequence_header (&picture, &videobuffer[start]); + sh_video->aspect = mpeg12_aspect_info(&picture); + break; case 0x1B5: mp_header_process_extension (&picture, &videobuffer[start]);break; case 0x1B2: process_userdata (&videobuffer[start], videobuf_len-start);break; case 0x100: picture_coding_type=(videobuffer[start+1] >> 3) & 7;break;
Dnia wtorek, 9 maja 2006 02:18, Carl Eugen Hoyos napisał:
There are really DVDs with aspect change? I didn't know...
Sorry, but... no comment... -- Piotr Stachura
Piotr Stachura wrote:
Dnia wtorek, 9 maja 2006 02:18, Carl Eugen Hoyos napisał:
There are really DVDs with aspect change? I didn't know...
Sorry, but... no comment...
What is this answer supposed to mean? Maybe the are not allowed in the same titleset (I'm not sure), but if you play in sequence the menu vob (_0.VOB) and the movie ones there is often an A/R change -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Best Western: scegli il fiore e vinci! In palio fantastici week end Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=5095&d=9-5
Carl Eugen Hoyos wrote:
Hi Nico!
Nico Sabbi <nicola_sabbi <at> fastwebnet.it> writes:
Carl Eugen Hoyos wrote:
[...]
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?
yes, ever heard of dvd?
There are really DVDs with aspect change? I didn't know...
[...]
As for the A/R function Ivan and I think that video.c is not really the best place for it; maybe mpeg_hdr.c. Opinions?
AFAICT, the information has to get from a frame, decoded in mpeg_hdr.c, into the sh_video data structure, which is not present in mpeg_hdr.c, so I don't see how this could be done without changing video.c a bit. One line patch attached.
no, it's in the sequence header, not in the picture header
I hope it's clean enough now, Carl Eugen Hoyos
Index: libmpdemux/video.c =================================================================== RCS file: /cvsroot/mplayer/main/libmpdemux/video.c,v retrieving revision 1.64 diff -u -r1.64 video.c --- libmpdemux/video.c 7 May 2006 16:05:38 -0000 1.64 +++ libmpdemux/video.c 9 May 2006 00:17:07 -0000 @@ -440,7 +440,9 @@ //printf("read packet 0x%X, len=%d\n",i,videobuf_len); // process headers: switch(i){ - case 0x1B3: mp_header_process_sequence_header (&picture, &videobuffer[start]);break; + case 0x1B3: mp_header_process_sequence_header (&picture, &videobuffer[start]); + sh_video->aspect = mpeg12_aspect_info(&picture); + break; case 0x1B5: mp_header_process_extension (&picture, &videobuffer[start]);break; case 0x1B2: process_userdata (&videobuffer[start], videobuf_len-start);break; case 0x100: picture_coding_type=(videobuffer[start+1] >> 3) & 7;break;
wrong: you can't determine the correct A/R before first knowing if you are dealing with mpeg1 or mpeg2 (part of the patch I posted previously). In practice you have to move or copy sh_video->aspect = mpeg12_aspect_info(&picture); to the bottom of video_read_frame() -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: DA NON PERDERE: Prova gratis per 15 giorni DVDNet Rent e ricevi a casa tua i migliori film! * Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=4634&d=9-5
Carl Eugen Hoyos wrote:
AFAICT, the information has to get from a frame, decoded in mpeg_hdr.c, into the sh_video data structure, which is not present in mpeg_hdr.c, so I don't see how this could be done without changing video.c a bit. One line patch attached.
I hope it's clean enough now, Carl Eugen Hoyos
please, try the patch attached instead, and report if it works correctly (including with mpeg2 in avi) -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Trova la tua anima gemella con Meetic. Iscriviti subito gratis: potrai trovare migliaia di single in linea e chattare con loro! Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=4048&d=9-5
Nico Sabbi <nsabbi <at> email.it> writes:
please, try the patch attached instead, and report if it works correctly (including with mpeg2 in avi)
I successfully tested your patch with DVB, .ts and .avi files on xv, sdl and xvidix (-fs only). The debug messages show the correct new aspect ratio and the window resolution changes as expected. Can I do anything else for this patch? I think it's very useful. Thank you for your work, Carl Eugen Hoyos
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);
this is unacceptable: demuxers have nothing to do with aspect ratio. Find a better place, please
participants (5)
-
Carl Eugen Hoyos -
Ivan Kalvachev -
Nico Sabbi -
Nico Sabbi -
Piotr Stachura