[Mplayer-cvslog] CVS: main/libmpdemux aviheader.c, 1.52, 1.53 muxer_avi.c, 1.20, 1.21

Tobias Diedrich CVS syncmail at mplayerhq.hu
Mon Mar 22 02:42:45 CET 2004


CVS change done by Tobias Diedrich CVS

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

Modified Files:
	aviheader.c muxer_avi.c 
Log Message:
Better vprp aspect fix

Index: aviheader.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/aviheader.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -r1.52 -r1.53
--- aviheader.c	17 Mar 2004 14:50:36 -0000	1.52
+++ aviheader.c	22 Mar 2004 01:42:43 -0000	1.53
@@ -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);

Index: muxer_avi.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/muxer_avi.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- muxer_avi.c	21 Mar 2004 21:32:54 -0000	1.20
+++ muxer_avi.c	22 Mar 2004 01:42:43 -0000	1.21
@@ -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;




More information about the MPlayer-cvslog mailing list