[MPlayer-dev-eng] PATCH 2: large (.mov) files

Chris Bednar cjb at AdvancedDataSolutions.com
Sat Jan 5 07:44:15 CET 2002


On Fri, 4 Jan 2002, Chris Bednar wrote:

>      Actually, the problem is in the .mov code. An atom can
> have a size bigger than 4GB, in which case, the size is set
> to 1, and a 64-bit number follows. Also, the big file I have

   <snip some nonsense; sorry>

   OK; here's a patch to the .mov code that handles atoms with 64-bit
sizes. I'm not sure if it's pretty, and you may not want my initials
in there, but it does work, and I can watch/encode huge QT movies.

   Enjoy


---- ``Windows: It does that sometimes.''  -mattdm
Chris J. Bednar
Director, Distributed Computing Product Group
http://AdvancedDataSolutions.com/

    ------------------------------
--- MPlayer-0.60/libmpdemux/stream.h.extendedsize	Sat Jan  5 00:04:07 2002
+++ MPlayer-0.60/libmpdemux/stream.h	Sat Jan  5 00:04:07 2002
@@ -80,6 +80,19 @@
   return y;
 }
 
+inline static uint64_t stream_read_qword(stream_t *s){
+  uint64_t y;
+  y=stream_read_char(s);
+  y=(y<<8)|stream_read_char(s);
+  y=(y<<8)|stream_read_char(s);
+  y=(y<<8)|stream_read_char(s);
+  y=(y<<8)|stream_read_char(s);
+  y=(y<<8)|stream_read_char(s);
+  y=(y<<8)|stream_read_char(s);
+  y=(y<<8)|stream_read_char(s);
+  return y;
+}
+
 inline static unsigned int stream_read_word_le(stream_t *s){
   int x,y;
   x=stream_read_char(s);
--- MPlayer-0.60/libmpdemux/demux_mov.c.extendedsize	Fri Dec 21 18:33:35 2001
+++ MPlayer-0.60/libmpdemux/demux_mov.c	Sat Jan  5 00:11:47 2002
@@ -200,19 +200,25 @@
     while(1){
 	off_t len=stream_read_dword(demuxer->stream);
 	unsigned int id=stream_read_dword(demuxer->stream);
-	if(stream_eof(demuxer->stream)) break; // EOF
-	if(len<8) break; // invalid chunk
+	int scoot = 8;
+	if(stream_eof(demuxer->stream)) break; //EOF
+	if (len == 1) /* Real size is 64 bits - cjb */
+	{
+	  len = stream_read_qword (demuxer->stream);
+	  scoot += 8;
+	}
+	else if(len<8) break; //Actually, 0 has a meaning; ``This is the last chunk'' - cjb
 	switch(id){
 	case MOV_FOURCC('m','o','o','v'):
 	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: Movie header found!\n");
 	  priv->moov_start=stream_tell(demuxer->stream);
-	  priv->moov_end=priv->moov_start+len-8;
+	  priv->moov_end=priv->moov_start+len-scoot;
 	  flags|=1;
 	  break;
 	case MOV_FOURCC('m','d','a','t'):
 	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: Movie DATA found!\n");
 	  priv->mdat_start=stream_tell(demuxer->stream);
-	  priv->mdat_end=priv->mdat_start+len-8;
+	  priv->mdat_end=priv->mdat_start+len-scoot;
 	  flags|=2;
 	  break;
 	case MOV_FOURCC('f','r','e','e'):
@@ -226,7 +232,7 @@
 	  id = bswap_32(id);
 	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: unknown chunk: %.4s %d\n",&id,(int)len);
 	}
-	if(!stream_skip(demuxer->stream,len-8)) break;
+	if(!stream_skip(demuxer->stream,len-scoot)) break;
 	++no;
     }
     




More information about the MPlayer-dev-eng mailing list