[MPlayer-cvslog] r21828 - trunk/libmpdemux/muxer_lavf.c

reimar subversion at mplayerhq.hu
Fri Jan 5 16:41:00 CET 2007


Author: reimar
Date: Fri Jan  5 16:41:00 2007
New Revision: 21828

Modified:
   trunk/libmpdemux/muxer_lavf.c

Log:
sizeof() is long, thus %d format in error message is wrong.
Fix by assigning extradata_size before and printing that, since
this also removes a bit of code duplication.


Modified: trunk/libmpdemux/muxer_lavf.c
==============================================================================
--- trunk/libmpdemux/muxer_lavf.c	(original)
+++ trunk/libmpdemux/muxer_lavf.c	Fri Jan  5 16:41:00 2007
@@ -251,15 +251,16 @@
 		ctx->time_base.num = stream->h.dwScale;
 		if(stream->bih+1 && (stream->bih->biSize > sizeof(BITMAPINFOHEADER)))
 		{
-			ctx->extradata = av_malloc(stream->bih->biSize - sizeof(BITMAPINFOHEADER));
+			ctx->extradata_size = stream->bih->biSize - sizeof(BITMAPINFOHEADER);
+			ctx->extradata = av_malloc(ctx->extradata_size);
 			if(ctx->extradata != NULL)
-			{
-				ctx->extradata_size = stream->bih->biSize - sizeof(BITMAPINFOHEADER);
 				memcpy(ctx->extradata, stream->bih+1, ctx->extradata_size);
-			}
 			else
+			{
 				mp_msg(MSGT_MUXER, MSGL_ERR, "MUXER_LAVF(video stream) error! couldn't allocate %d bytes for extradata\n",
-					stream->bih->biSize - sizeof(BITMAPINFOHEADER));
+					ctx->extradata_size);
+				ctx->extradata_size = 0;
+			}
 		}
 	}
 }



More information about the MPlayer-cvslog mailing list