Mercurial > mplayer.hg
changeset 12053:cdf62dc6d6a0
Better vprp aspect fix
author | ranma |
---|---|
date | Mon, 22 Mar 2004 01:42:43 +0000 |
parents | 69cf59bb739d |
children | 30d292e0beb7 |
files | DOCS/man/en/mplayer.1 cfg-common.h cfg-mencoder.h libmpdemux/aviheader.c libmpdemux/muxer_avi.c |
diffstat | 5 files changed, 26 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1 Sun Mar 21 22:50:49 2004 +0000 +++ b/DOCS/man/en/mplayer.1 Mon Mar 22 01:42:43 2004 +0000 @@ -366,6 +366,10 @@ .TP .B \-v, \-verbose Increment verbose level (more \-v means more verbosity). +.TP +.B \-useaviaspect +With this option MPlayer and MEncoder will read and write the aspect setting +from the OpenDML Video Property Header. . .PD 0 .RSs
--- a/cfg-common.h Sun Mar 21 22:50:49 2004 +0000 +++ b/cfg-common.h Mon Mar 22 01:42:43 2004 +0000 @@ -119,6 +119,8 @@ {"dvbin", dvbin_opts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL}, #endif + {"useaviaspect", &avi_use_vprp_aspect, CONF_TYPE_FLAG, 0, 0, 1, NULL}, + {"nouseaviaspect", &avi_use_vprp_aspect, CONF_TYPE_FLAG, 0, 1, 0, NULL}, // ------------------------- a-v sync options -------------------- @@ -317,6 +319,8 @@ extern int ts_keep_broken; extern off_t ts_probe; +extern int avi_use_vprp_aspect; /* defined in aviheader.c */ + #include "libmpdemux/tv.h" #ifdef USE_EDL
--- a/cfg-mencoder.h Sun Mar 21 22:50:49 2004 +0000 +++ b/cfg-mencoder.h Mon Mar 22 01:42:43 2004 +0000 @@ -58,8 +58,6 @@ extern m_option_t xvidencopts_conf[]; #endif -extern float avi_prp_aspect; - extern m_option_t nuvopts_conf[]; m_option_t ovc_conf[]={ @@ -194,9 +192,6 @@ // override FOURCC in output file {"ffourcc", &force_fourcc, CONF_TYPE_STRING, 0, 4, 4, NULL}, - // avi muxer - include prp header with aspect ratio - {"aviaspect", &avi_prp_aspect, CONF_TYPE_FLOAT, CONF_RANGE, 0.2, 3.0, NULL}, - {"pass", "The -pass option is obsolete. Use -lavcopts vpass=n or -divx4opts pass=n!\nRTFM!\n", CONF_TYPE_PRINT, CONF_NOCFG, 0, 0, NULL}, {"passlogfile", &passtmpfile, CONF_TYPE_STRING, 0, 0, 0, NULL},
--- a/libmpdemux/aviheader.c Sun Mar 21 22:50:49 2004 +0000 +++ b/libmpdemux/aviheader.c Mon Mar 22 01:42:43 2004 +0000 @@ -28,6 +28,8 @@ extern void print_avistdindex_chunk(avistdindex_chunk *h); extern void print_avisuperindex_chunk(avisuperindex_chunk *h); +int avi_use_vprp_aspect = 0; + static int odml_get_vstream_id(int id, unsigned char res[]) { unsigned char *p = (unsigned char *)&id; @@ -343,7 +345,7 @@ for (i=0; i<vprp->nbFieldPerFrame; i++) { le2me_VIDEO_FIELD_DESC(&vprp->FieldInfo[i]); } - if (sh_video) { + if (avi_use_vprp_aspect && sh_video) { sh_video->aspect = GET_AVI_ASPECT(vprp->dwFrameAspectRatio); } if(verbose>=1) print_vprp(vprp);
--- a/libmpdemux/muxer_avi.c Sun Mar 21 22:50:49 2004 +0000 +++ b/libmpdemux/muxer_avi.c Mon Mar 22 01:42:43 2004 +0000 @@ -34,7 +34,7 @@ #define ODML_NOTKEYFRAME 0x80000000U #define MOVIALIGN 0x00001000 -float avi_prp_aspect = -1.0; +extern int avi_use_vprp_aspect; struct avi_odmlidx_entry { uint64_t ofs; @@ -227,6 +227,9 @@ static unsigned int avi_aspect(float aspect) { + if (aspect <= 0.0) { + aspect = 4.0/3.0; + } if (aspect >= 3.99/3.0 && aspect <= 4.01/3.0) return MAKE_AVI_ASPECT(4,3); if (aspect >= 15.99/9.0 && @@ -313,7 +316,7 @@ switch(muxer->streams[i]->type){ case MUXER_TYPE_VIDEO: hdrsize+=muxer->streams[i]->bih->biSize+8; // strf - if (avi_prp_aspect > 0) { + if (avi_use_vprp_aspect) { hdrsize+=8+4*(9+8*1); // vprp } break; @@ -348,13 +351,14 @@ s->h.fccHandler = s->bih->biCompression; s->h.rcFrame.right = s->bih->biWidth; s->h.rcFrame.bottom = s->bih->biHeight; - if (avi_prp_aspect > 0) { + if (avi_use_vprp_aspect) { + sh_video_t *sh_video = s->source; // fill out vprp info memset(&vprp, 0, sizeof(vprp)); vprp.dwVerticalRefreshRate = (s->h.dwRate+s->h.dwScale-1)/s->h.dwScale; vprp.dwHTotalInT = muxer->avih.dwWidth; vprp.dwVTotalInLines = muxer->avih.dwHeight; - vprp.dwFrameAspectRatio = avi_aspect(avi_prp_aspect); + vprp.dwFrameAspectRatio = avi_aspect(sh_video->aspect); vprp.dwFrameWidthInPixels = muxer->avih.dwWidth; vprp.dwFrameHeightInLines = muxer->avih.dwHeight; vprp.nbFieldPerFrame = 1; @@ -382,15 +386,17 @@ int biSize=s->bih->biSize; le2me_BITMAPINFOHEADER(s->bih); write_avi_chunk(f,ckidSTREAMFORMAT,biSize,s->bih); /* BITMAPINFOHEADER */ - if (avi_prp_aspect > 0) { - le2me_BITMAPINFOHEADER(s->bih); + le2me_BITMAPINFOHEADER(s->bih); + + if (avi_use_vprp_aspect) { + int fields = vprp.nbFieldPerFrame; le2me_VideoPropHeader(&vprp); le2me_VIDEO_FIELD_DESC(&vprp.FieldInfo[0]); le2me_VIDEO_FIELD_DESC(&vprp.FieldInfo[1]); write_avi_chunk(f,mmioFOURCC('v','p','r','p'), - sizeof(VideoPropHeader) - - sizeof(VIDEO_FIELD_DESC)*(2-vprp.nbFieldPerFrame), - &vprp); /* Video Properties Header */ + sizeof(VideoPropHeader) - + sizeof(VIDEO_FIELD_DESC)*(2-fields), + &vprp); /* Video Properties Header */ } } break;