[Mplayer-cvslog] CVS: main/libmpdemux muxer_avi.c,1.19,1.20

Jindrich Makovicka CVS syncmail at mplayerhq.hu
Sun Mar 21 22:32:56 CET 2004


CVS change done by Jindrich Makovicka CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv10458/libmpdemux

Modified Files:
	muxer_avi.c 
Log Message:
explicit option for AVI PRP header

Index: muxer_avi.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/muxer_avi.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- muxer_avi.c	17 Mar 2004 15:36:33 -0000	1.19
+++ muxer_avi.c	21 Mar 2004 21:32:54 -0000	1.20
@@ -34,6 +34,8 @@
 #define ODML_NOTKEYFRAME 0x80000000U
 #define MOVIALIGN        0x00001000
 
+float avi_prp_aspect = -1.0;
+
 struct avi_odmlidx_entry {
 	uint64_t ofs;
 	uint32_t len;
@@ -223,12 +225,8 @@
 
 #define WFSIZE(wf) (sizeof(WAVEFORMATEX)+(wf)->cbSize)
 
-static unsigned int avi_aspect(sh_video_t *sh_video)
+static unsigned int avi_aspect(float aspect)
 {
-    float aspect = sh_video->aspect;
-    if (aspect <= 0.0) {
-        aspect = (float)sh_video->disp_w/(float)sh_video->disp_h;
-    }
     if (aspect >= 3.99/3.0 &&
         aspect <= 4.01/3.0) return MAKE_AVI_ASPECT(4,3);
     if (aspect >= 15.99/9.0 &&
@@ -247,6 +245,7 @@
   muxer_info_t info[16];
   FILE *f = muxer->file;
   VideoPropHeader vprp;
+
   off_t pos;
   int isodml = muxer->file_end > ODML_CHUNKLEN ? 1 : 0;
 
@@ -314,7 +313,9 @@
       switch(muxer->streams[i]->type){
       case MUXER_TYPE_VIDEO:
           hdrsize+=muxer->streams[i]->bih->biSize+8; // strf
-	  hdrsize+=8+4*(9+8*1); // vprp
+	  if (avi_prp_aspect > 0) {
+	      hdrsize+=8+4*(9+8*1); // vprp
+	  }
 	  break;
       case MUXER_TYPE_AUDIO:
           hdrsize+=WFSIZE(muxer->streams[i]->wf)+8; // strf
@@ -347,20 +348,22 @@
           s->h.fccHandler = s->bih->biCompression;
           s->h.rcFrame.right = s->bih->biWidth;
           s->h.rcFrame.bottom = s->bih->biHeight;
-	  // 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(s->source);
-	  vprp.dwFrameWidthInPixels = muxer->avih.dwWidth;
-	  vprp.dwFrameHeightInLines = muxer->avih.dwHeight;
-	  vprp.nbFieldPerFrame = 1;
-	  vprp.FieldInfo[0].CompressedBMHeight = muxer->avih.dwHeight;
-	  vprp.FieldInfo[0].CompressedBMWidth = muxer->avih.dwWidth;
-	  vprp.FieldInfo[0].ValidBMHeight = muxer->avih.dwHeight;
-	  vprp.FieldInfo[0].ValidBMWidth = muxer->avih.dwWidth;
-          hdrsize+=8+4*(9+8*1); // vprp
+	  if (avi_prp_aspect > 0) {
+	      // 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.dwFrameWidthInPixels = muxer->avih.dwWidth;
+	      vprp.dwFrameHeightInLines = muxer->avih.dwHeight;
+	      vprp.nbFieldPerFrame = 1;
+	      vprp.FieldInfo[0].CompressedBMHeight = muxer->avih.dwHeight;
+	      vprp.FieldInfo[0].CompressedBMWidth = muxer->avih.dwWidth;
+	      vprp.FieldInfo[0].ValidBMHeight = muxer->avih.dwHeight;
+	      vprp.FieldInfo[0].ValidBMWidth = muxer->avih.dwWidth;
+	      hdrsize+=8+4*(9+8*1); // vprp
+	  }
 	  break;
       case MUXER_TYPE_AUDIO:
           hdrsize+=WFSIZE(s->wf)+8; // strf
@@ -379,14 +382,16 @@
           int biSize=s->bih->biSize;
           le2me_BITMAPINFOHEADER(s->bih);
           write_avi_chunk(f,ckidSTREAMFORMAT,biSize,s->bih); /* BITMAPINFOHEADER */
-          le2me_BITMAPINFOHEADER(s->bih);
-	  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 */
+	  if (avi_prp_aspect > 0) {
+	      le2me_BITMAPINFOHEADER(s->bih);
+	      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 */
+	  }
 }
 	  break;
       case MUXER_TYPE_AUDIO:




More information about the MPlayer-cvslog mailing list