changeset 5257:1823c7dff423

Add Parsing off ftyp box and some more docs ref
author atmos4
date Fri, 22 Mar 2002 00:54:10 +0000
parents 76f0ff2269a1
children c9ccddcbdd81
files libmpdemux/demux_mov.c
diffstat 1 files changed, 31 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mov.c	Thu Mar 21 22:51:44 2002 +0000
+++ b/libmpdemux/demux_mov.c	Fri Mar 22 00:54:10 2002 +0000
@@ -12,6 +12,8 @@
 //  aswell as .mov specific stuff.
 //  All sort of Stuff about MPEG4:
 //  http://www.cmlab.csie.ntu.edu.tw/~pkhsiao/thesis.html
+//  I really recommend N4270-1.doc and N4270-2.doc which are exact specs
+//  of the MP4-File Format and the MPEG4 Specific extensions. ::atmos
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -248,15 +250,35 @@
 	else if(len<8) break; // invalid chunk
 
 	switch(id){
-	case MOV_FOURCC('f','t','y','p'):
-	  // skip over the file type chunk
-	  // Here are my guesses on it's format (atmos):
-	  // char[4]  majorBrand   (eg. 'isom')
-	  // int      minorVersion (eg. 0x00000000)
-	  // char[4]  mediaType(?) (eg. 'mp41')
-	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: Skipping unsupported Filetype chunk (len: %d)!\n",
-	      len);
-	  break;
+	case MOV_FOURCC('f','t','y','p'): {
+	  int i;					      
+	  unsigned int tmp;
+	  // File Type Box (ftyp): 
+	  // char[4]  major_brand	   (eg. 'isom')
+	  // int      minor_version	   (eg. 0x00000000)
+	  // char[4]  compatible_brands[]  (eg. 'mp41')
+	  // compatible_brands list spans to the end of box
+#if 1
+	  tmp = stream_read_dword(demuxer->stream);
+	  switch(tmp) {
+	    case MOV_FOURCC('i','s','o','m'):
+	      mp_msg(MSGT_DEMUX,MSGL_V,"MOV: File-Type Major-Brand: ISO Media File\n");
+     	      break;
+	    default:
+	      tmp = be2me_32(tmp);  
+	      mp_msg(MSGT_DEMUX,MSGL_WARN,"MOV: File-Type unknown Major-Brand: %.4s\n",&tmp);
+	  }
+	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: File-Type Minor-Version: %d\n",
+	      stream_read_dword(demuxer->stream));
+	  skipped += 8;
+	  // List all compatible brands
+	  for(i = 0; i < ((len-16)/4); i++) {
+	    tmp = be2me_32(stream_read_dword(demuxer->stream));
+	    mp_msg(MSGT_DEMUX,MSGL_V,"MOV: File-Type Compatible-Brands #%d: %.4s\n",i,&tmp);
+	    skipped += 4;
+	  }
+#endif	  
+	  } break;
 	case MOV_FOURCC('m','o','o','v'):
 //	case MOV_FOURCC('c','m','o','v'):
 	  mp_msg(MSGT_DEMUX,MSGL_V,"MOV: Movie header found!\n");