mmplugins/lib3gp/impl/inc/mp4atom.h
changeset 0 40261b775718
child 23 545d349d14da
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef _MP4ATOM_H
       
    17 #define _MP4ATOM_H
       
    18 
       
    19 #include <3gplibrary/mp4config.h>
       
    20 #include <3gplibrary/mp4lib.h>
       
    21 #include "mp4list.h"
       
    22 #include "filewriter.h" /* Async buffering filewriter */
       
    23 #include "metadatafilewriter.h" /* Async buffering filewriter */
       
    24 #include "asyncfileparser.h" /*Async file reader for parsing */
       
    25 
       
    26 #define ATOMTYPE_FTYP 0x66747970 /* 'ftyp' */
       
    27 #define ATOMTYPE_MOOV 0x6d6f6f76 /* 'moov' */
       
    28 #define ATOMTYPE_MDAT 0x6d646174 /* 'mdat' */
       
    29 #define ATOMTYPE_FREE 0x66726565 /* 'free' */
       
    30 #define ATOMTYPE_SKIP 0x736b6970 /* 'skip' */
       
    31 #define ATOMTYPE_UDTA 0x75647461 /* 'udta' */
       
    32 #define ATOMTYPE_MVHD 0x6d766864 /* 'mvhd' */
       
    33 #define ATOMTYPE_IODS 0x696f6473 /* 'iods' */
       
    34 #define ATOMTYPE_TRAK 0x7472616b /* 'trak' */
       
    35 #define ATOMTYPE_TKHD 0x746b6864 /* 'tkhd' */
       
    36 #define ATOMTYPE_MDIA 0x6d646961 /* 'mdia' */
       
    37 #define ATOMTYPE_MDHD 0x6d646864 /* 'mdhd' */
       
    38 #define ATOMTYPE_HDLR 0x68646c72 /* 'hdlr' */
       
    39 #define ATOMTYPE_MINF 0x6d696e66 /* 'minf' */
       
    40 #define ATOMTYPE_VMHD 0x766d6864 /* 'vmhd' */
       
    41 #define ATOMTYPE_SMHD 0x736d6864 /* 'smhd' */
       
    42 #define ATOMTYPE_DINF 0x64696e66 /* 'dinf' */
       
    43 #define ATOMTYPE_DREF 0x64726566 /* 'dref' */
       
    44 #define ATOMTYPE_TREF 0x74726566 /* 'tref' */
       
    45 #define ATOMTYPE_STBL 0x7374626c /* 'stbl' */
       
    46 #define ATOMTYPE_STTS 0x73747473 /* 'stts' */
       
    47 #define ATOMTYPE_CTTS 0x63747473 /* 'ctts' */
       
    48 #define ATOMTYPE_STSS 0x73747373 /* 'stss' */
       
    49 #define ATOMTYPE_STSD 0x73747364 /* 'stsd' */
       
    50 #define ATOMTYPE_STSZ 0x7374737a /* 'stsz' */
       
    51 #define ATOMTYPE_STZ2 0x73747a32 /* 'stz2' */
       
    52 #define ATOMTYPE_STSC 0x73747363 /* 'stsc' */
       
    53 #define ATOMTYPE_STCO 0x7374636f /* 'stco' */
       
    54 #define ATOMTYPE_CO64 0x636f3634 /* 'co64' */
       
    55 #define ATOMTYPE_MP4V 0x6d703476 /* 'mp4v' */
       
    56 #define ATOMTYPE_MP4A 0x6d703461 /* 'mp4a' */
       
    57 #define ATOMTYPE_MP4S 0x6d703473 /* 'mp4s' */
       
    58 #define ATOMTYPE_S263 0x73323633 /* 's263' */
       
    59 #define ATOMTYPE_D263 0x64323633 /* 'd263' */
       
    60 #define ATOMTYPE_BITR 0x62697472 /* 'bitr' */
       
    61 #define ATOMTYPE_SAMR 0x73616d72 /* 'samr' */
       
    62 #define ATOMTYPE_SAWB 0x73617762 /* 'sawb' */
       
    63 #define ATOMTYPE_DAMR 0x64616d72 /* 'damr' */
       
    64 #define ATOMTYPE_ESD  0x65736473 /* 'esds' */
       
    65 #define ATOMTYPE_URL  0x75726c20 /* 'url ' */
       
    66 #define ATOMTYPE_URN  0x75726e20 /* 'urn ' */
       
    67 #define ATOMTYPE_UUID 0x75756964 /* 'uuid' */
       
    68 #define ATOMTYPE_EDTS 0x65647473 /* 'edts' */
       
    69 /* AVC Additions */
       
    70 #define ATOMTYPE_AVCC 0x61766343 /* 'avcC' */
       
    71 #define ATOMTYPE_BTRT 0x62747274 /* 'btrt' */
       
    72 #define ATOMTYPE_AVC1 0x61766331 /* 'avc1' */
       
    73 #define ATOMTYPE_M4DS 0x6d346473 /* 'm4ds' */
       
    74 #define ATOMTYPE_SDTP 0x73647470 /* 'sdtp' */
       
    75 #define ATOMTYPE_AVCP 0x61766370 /* 'avcp' */
       
    76 /* QCELP 13K Additions */
       
    77 #define ATOMTYPE_SQCP 0x73716370 /* 'sqcp' */
       
    78 #define ATOMTYPE_DQCP 0x64716370 /* 'dqcp' */
       
    79 
       
    80 
       
    81 #define HANDLERTYPE_ODSM 0x6f64736d /* 'odsm' */
       
    82 #define HANDLERTYPE_VIDE 0x76696465 /* 'vide' */
       
    83 #define HANDLERTYPE_SOUN 0x736f756e /* 'soun' */
       
    84 
       
    85 
       
    86 
       
    87 #define FTYP_SIZE    24     /* Size of FTYP box in bytes */
       
    88 
       
    89 #define READBUFSIZE  8192   /* Size of file reading buffer */
       
    90 #define WRITEBUFSIZE 2048   /* Size of file writing buffer */
       
    91 
       
    92 #define BLOCK_LIMIT  200  /* Max number of metadata blocks to keep in memory */
       
    93 
       
    94 #define MAXSAMPLESPERSECOND  150 /* magic number used to try validate input data to parser from possibly corrupted file */
       
    95 
       
    96 
       
    97 #define METADATAFILE_VIDEO_STTS_SAMPLE_COUNT     0
       
    98 #define METADATAFILE_VIDEO_STTS_SAMPLE_DELTA     1
       
    99 #define METADATAFILE_VIDEO_STSZ_ENTRY_SIZE       2
       
   100 #define METADATAFILE_VIDEO_STCO_CHUNK_OFFSET     3
       
   101 #define METADATAFILE_VIDEO_STSS_SAMPLE_NUMBER    4
       
   102 #define METADATAFILE_AUDIO_STTS_SAMPLE_COUNT     5
       
   103 #define METADATAFILE_AUDIO_STTS_SAMPLE_DELTA     6
       
   104 #define METADATAFILE_AUDIO_STSZ_ENTRY_SIZE       7
       
   105 #define METADATAFILE_AUDIO_STCO_CHUNK_OFFSET     8
       
   106 #define METADATAFILE_VIDEO_SDTP_SAMPLE_DEPENDENCY 9
       
   107 
       
   108 /* Multiple Sample Entry Inclusion */
       
   109 #define STSDMAXSAMPLEENTRYCOUNT 10   /* defined the maximum number of sample entried allowed in a Sample Description Box */
       
   110 
       
   111 
       
   112 typedef struct atomHeader
       
   113 {
       
   114   mp4_u32  size;
       
   115   mp4_u32  type;
       
   116   mp4_u64  largeSize;
       
   117   mp4_u8   extendedType[16];
       
   118   mp4_u8   version;
       
   119   mp4_u8   flags[3];
       
   120 } atomHeader;
       
   121 
       
   122 
       
   123 typedef struct fileTypeAtom
       
   124 {
       
   125   atomHeader  *atomhdr;
       
   126   mp4_u32     majorBrand;
       
   127   mp4_u32     minorVersion;
       
   128   mp4_u32     *compatibleBrands;
       
   129 } fileTypeAtom;
       
   130 
       
   131 
       
   132 typedef struct movieHeaderAtom
       
   133 {
       
   134   atomHeader      *atomhdr;
       
   135   mp4_u32         creationTime;
       
   136   mp4_u32         modificationTime;
       
   137   mp4_u32         timeScale;
       
   138   mp4_u32         duration;
       
   139   mp4_u32         nextTrackID;
       
   140   mp4_u64         creationTime64;
       
   141   mp4_u64         modificationTime64;
       
   142   mp4_u64         duration64;
       
   143 } movieHeaderAtom;
       
   144 
       
   145 
       
   146 typedef struct objectDescriptorAtom
       
   147 {
       
   148   atomHeader      *atomhdr;
       
   149   mp4_u8          tag;
       
   150   mp4_u32         sizeOfInstance;
       
   151   mp4_u16         flags;
       
   152   mp4_u8          ODProfileLevelIndication;
       
   153   mp4_u8          SceneProfileLevelIndication;
       
   154   mp4_u8          AudioProfileLevelIndication;
       
   155   mp4_u8          VisualProfileLevelIndication;
       
   156   mp4_u8          GraphicsProfileLevelIndication;
       
   157 } objectDescriptorAtom;
       
   158 
       
   159 
       
   160 typedef struct trackHeaderAtom
       
   161 {
       
   162   atomHeader      *atomhdr;
       
   163   mp4_u32         creationTime;
       
   164   mp4_u32         modificationTime;
       
   165   mp4_u32         trackID;
       
   166   mp4_u32         reserved;
       
   167   mp4_u32         duration;
       
   168   mp4_u64         creationTime64;
       
   169   mp4_u64         modificationTime64;
       
   170   mp4_u64         duration64;
       
   171   mp4_u16         width;
       
   172   mp4_u16         height;
       
   173   mp4_bool        isAudio;
       
   174   mp4_bool        isVisual;
       
   175 } trackHeaderAtom;
       
   176 
       
   177 
       
   178 typedef struct mediaHeaderAtom
       
   179 {
       
   180   atomHeader  *atomhdr;
       
   181   mp4_u32     creationTime;
       
   182   mp4_u32     modificationTime;
       
   183   mp4_u32     timeScale;
       
   184   mp4_u32     duration;
       
   185   mp4_u64     creationTime64;
       
   186   mp4_u64     modificationTime64;
       
   187   mp4_u64     duration64;
       
   188 } mediaHeaderAtom;
       
   189 
       
   190 
       
   191 typedef struct handlerAtom
       
   192 {
       
   193   atomHeader    *atomhdr;
       
   194   mp4_u32       handlerType;
       
   195   mp4_u8        *name;
       
   196 } handlerAtom;
       
   197 
       
   198 
       
   199 typedef struct dataEntryURLAtom
       
   200 {
       
   201   atomHeader  *atomhdr;
       
   202 } dataEntryURLAtom;
       
   203 
       
   204 
       
   205 typedef struct dataEntryURNAtom
       
   206 {
       
   207   atomHeader  *atomhdr;
       
   208 } dataEntryURNAtom;
       
   209 
       
   210 
       
   211 typedef struct dataReferenceAtom
       
   212 {
       
   213   atomHeader        *atomhdr;
       
   214   mp4_u32           entryCount;
       
   215   dataEntryURLAtom  *url;
       
   216   dataEntryURNAtom  *urn;
       
   217 } dataReferenceAtom;
       
   218 
       
   219 
       
   220 typedef struct dataInformationAtom
       
   221 {
       
   222   atomHeader         *atomhdr;
       
   223   dataReferenceAtom  *dref;
       
   224 } dataInformationAtom;
       
   225 
       
   226 
       
   227 typedef struct timeToSampleAtom
       
   228 {
       
   229   atomHeader  *atomhdr;
       
   230   mp4_u32      entryCount;
       
   231   mp4_u32      *sampleCount;
       
   232   mp4_i32      *sampleDelta;
       
   233 } timeToSampleAtom;
       
   234 
       
   235 
       
   236 typedef struct compositionTimeToSampleAtom
       
   237 {
       
   238   atomHeader      *atomhdr;
       
   239   mp4_u32         entryCount;
       
   240   mp4_u32         *sampleCount;
       
   241   mp4_u32         *sampleOffset;
       
   242 } compositionTimeToSampleAtom;
       
   243 
       
   244 
       
   245 typedef struct ESDAtom
       
   246 {
       
   247   atomHeader  *atomhdr;
       
   248   mp4_u8      esDescrTag;
       
   249   mp4_u32     size;
       
   250   mp4_u16     ESID;
       
   251   mp4_u8      flags;
       
   252   mp4_u16     dependsOnESID;
       
   253   mp4_u8      URLLength;
       
   254   mp4_u8      *URLString;
       
   255   mp4_u16     OCRESID;
       
   256   mp4_u8      decConfDescrTag;
       
   257   mp4_u32     decConfDescrSize;
       
   258   mp4_u8      objectTypeIndication;
       
   259   mp4_u8      stream;
       
   260   mp4_u32     bufferSizeDB;
       
   261   mp4_u32     maxBitrate;
       
   262   mp4_u32     avgBitrate;
       
   263   mp4_u8      decSpecificInfoTag;
       
   264   mp4_u32     decSpecificInfoSize;
       
   265   mp4_u8      *decSpecificInfo;
       
   266 } ESDAtom;
       
   267 
       
   268 
       
   269 typedef struct visualSampleEntry
       
   270 {
       
   271   atomHeader  *atomhdr;
       
   272   mp4_u16     dataReferenceIndex;
       
   273   mp4_u16     width;
       
   274   mp4_u16     height;
       
   275   ESDAtom     *esd;
       
   276 } visualSampleEntry;
       
   277 
       
   278 
       
   279 typedef struct audioSampleEntry
       
   280 {
       
   281   atomHeader  *atomhdr;
       
   282   mp4_u16     dataReferenceIndex;
       
   283   mp4_u16     timeScale;
       
   284   ESDAtom     *esd;
       
   285 } audioSampleEntry;
       
   286 
       
   287 
       
   288 typedef struct mpegSampleEntry
       
   289 {
       
   290   atomHeader  *atomhdr;
       
   291   mp4_u16     dataReferenceIndex;
       
   292   ESDAtom     *esd;
       
   293 } mpegSampleEntry;
       
   294 
       
   295 
       
   296 typedef struct bitrateAtom
       
   297 {
       
   298   atomHeader  *atomhdr;
       
   299   mp4_u32     avgBitrate;
       
   300   mp4_u32     maxBitrate;
       
   301 } bitrateAtom;
       
   302 
       
   303 
       
   304 typedef struct h263SpecificAtom
       
   305 {
       
   306   atomHeader  *atomhdr;
       
   307   mp4_u32     vendor;
       
   308   mp4_u8      decoderVersion;
       
   309   mp4_u8      h263Level;
       
   310   mp4_u8      h263Profile;
       
   311   bitrateAtom *bitr;
       
   312 } h263SpecificAtom;
       
   313 
       
   314 
       
   315 typedef struct h263SampleEntry
       
   316 {
       
   317   atomHeader        *atomhdr;
       
   318   mp4_u16           dataReferenceIndex;
       
   319   mp4_u16           width;
       
   320   mp4_u16           height;
       
   321   h263SpecificAtom  *d263;
       
   322 } h263SampleEntry;
       
   323 
       
   324 
       
   325 typedef struct amrDecSpecStruc
       
   326 {
       
   327   atomHeader  *atomhdr;
       
   328   mp4_u32     vendor;
       
   329   mp4_u8      decoderVersion;
       
   330   mp4_u16     modeSet;
       
   331   mp4_u8      modeChangePeriod;
       
   332   mp4_u8      framesPerSample;
       
   333 } amrDecSpecStruc;
       
   334 
       
   335 
       
   336 typedef struct amrSampleEntry
       
   337 {
       
   338   atomHeader        *atomhdr;
       
   339   mp4_u16           dataReferenceIndex;
       
   340   mp4_u16           timeScale;
       
   341   amrDecSpecStruc   *damr;
       
   342 } amrSampleEntry;
       
   343 
       
   344 typedef struct avcConfigurationAtom
       
   345 {
       
   346   atomHeader		*atomhdr;
       
   347   mp4_u8				*avcConfig;
       
   348   mp4_u32				avcConfigSize;
       
   349 } avcConfigurationAtom;
       
   350 
       
   351 typedef struct	mpeg4BitrateAtom
       
   352 {
       
   353     atomHeader		*atomhdr;
       
   354 	mp4_u32		bufferSizeDB;
       
   355 	mp4_u32		maxBitRate;
       
   356 	mp4_u32		avgBitrate;
       
   357 } mpeg4BitrateAtom;
       
   358 
       
   359 typedef struct mpeg4ExtensionDescriptorsAtom
       
   360 {
       
   361     atomHeader		*atomhdr;
       
   362 	mp4_u8		*descr;
       
   363 	mp4_u32		 descrSize;
       
   364 } mpeg4ExtensionDescriptorsAtom;
       
   365 
       
   366 typedef struct avcSampleEntry
       
   367 {
       
   368 	atomHeader			*atomhdr;
       
   369     mp4_u16           dataReferenceIndex;
       
   370     mp4_u16           width;
       
   371     mp4_u16           height;
       
   372 	avcConfigurationAtom	*avcc;
       
   373 	mpeg4BitrateAtom			*btrt;
       
   374 	mpeg4ExtensionDescriptorsAtom	*m4ds;
       
   375 } avcSampleEntry;
       
   376 
       
   377 typedef struct qcelpDecSpecStruc
       
   378 {
       
   379   atomHeader  *atomhdr;
       
   380   mp4_u32     vendor;
       
   381   mp4_u8      decoderVersion;
       
   382   mp4_u8      framesPerSample;
       
   383 } qcelpDecSpecStruc;
       
   384 
       
   385 typedef struct qcelpSampleEntry
       
   386 {
       
   387   atomHeader        *atomhdr;
       
   388   mp4_u16           dataReferenceIndex;
       
   389   mp4_u16           timeScale;
       
   390   qcelpDecSpecStruc   *dqcp;
       
   391 } qcelpSampleEntry;
       
   392 
       
   393 typedef struct avcParameterSampleEntry
       
   394 {
       
   395 	
       
   396 } avcParameterSampleEntry;
       
   397 
       
   398 typedef struct sampleDescriptionAtom
       
   399 {
       
   400   atomHeader          *atomhdr;
       
   401   mp4_u32             entryCount;
       
   402   visualSampleEntry   *mp4v[STSDMAXSAMPLEENTRYCOUNT];
       
   403   audioSampleEntry    *mp4a[STSDMAXSAMPLEENTRYCOUNT];
       
   404   mpegSampleEntry     *mp4s[STSDMAXSAMPLEENTRYCOUNT];
       
   405   h263SampleEntry     *s263[STSDMAXSAMPLEENTRYCOUNT];
       
   406   amrSampleEntry      *samr[STSDMAXSAMPLEENTRYCOUNT];
       
   407   amrSampleEntry      *sawb[STSDMAXSAMPLEENTRYCOUNT];
       
   408   /* AVC addition */
       
   409   avcSampleEntry	*avc1[STSDMAXSAMPLEENTRYCOUNT];
       
   410   /* QCELP 13K addition */
       
   411   qcelpSampleEntry  *sqcp[STSDMAXSAMPLEENTRYCOUNT];
       
   412   avcParameterSampleEntry *avcp[STSDMAXSAMPLEENTRYCOUNT];
       
   413 } sampleDescriptionAtom;
       
   414 
       
   415 
       
   416 typedef struct sampleSizeAtom
       
   417 {
       
   418   atomHeader  *atomhdr;
       
   419   mp4_u32     sampleSize;
       
   420   mp4_u32     sampleCount;
       
   421   mp4_u32     *entrySize;
       
   422 } sampleSizeAtom;
       
   423 
       
   424 
       
   425 typedef struct sampleToChunkAtom
       
   426 {
       
   427   atomHeader  *atomhdr;
       
   428   mp4_u32     entryCount;
       
   429   mp4_u32     *firstChunk;
       
   430   mp4_u32     *samplesPerChunk;
       
   431   mp4_u32     *sampleDescriptionIndex;
       
   432 } sampleToChunkAtom;
       
   433 
       
   434 
       
   435 typedef struct chunkOffsetAtom
       
   436 {
       
   437   atomHeader  *atomhdr;
       
   438   mp4_u32     entryCount;
       
   439   mp4_u32     *chunkOffset;
       
   440 } chunkOffsetAtom;
       
   441 
       
   442 typedef struct chunkOffset64Atom
       
   443 {
       
   444   atomHeader  *atomhdr;
       
   445   mp4_u32     entryCount;
       
   446   mp4_u64     *chunkOffset;
       
   447 } chunkOffset64Atom;
       
   448 
       
   449 
       
   450 typedef struct syncSampleAtom
       
   451 {
       
   452   atomHeader  *atomhdr;
       
   453   mp4_u32     entryCount;
       
   454   mp4_u32     *sampleNumber;
       
   455 } syncSampleAtom;
       
   456 
       
   457 
       
   458 typedef struct shadowSyncSampleAtom
       
   459 {
       
   460   atomHeader  *atomhdr;
       
   461 } shadowSyncSampleAtom;
       
   462 
       
   463 typedef struct sampleDependency
       
   464 {
       
   465 	mp4_u8  sDependsOn;
       
   466 	mp4_u8  sIsDependentOn;
       
   467 	mp4_u8  sHasRedundancy;
       
   468 } sampleDependency;
       
   469 
       
   470 typedef struct sampleDependencyAtom
       
   471 {
       
   472 	atomHeader        *atomhdr;
       
   473 	mp4_u32           sampleCount;
       
   474 	sampleDependency  *dep;
       
   475 } sampleDependencyAtom;
       
   476 
       
   477 typedef struct sampleTableAtom
       
   478 {
       
   479   atomHeader                    *atomhdr;
       
   480   timeToSampleAtom              *stts;
       
   481   compositionTimeToSampleAtom   *ctts;
       
   482   sampleDescriptionAtom         *stsd;
       
   483   sampleSizeAtom                *stsz;
       
   484   sampleToChunkAtom             *stsc;
       
   485   mp4_bool 						is32BitOffsets;
       
   486   union 
       
   487   {
       
   488   	chunkOffsetAtom             *stco;
       
   489   	chunkOffset64Atom           *stco64;
       
   490   };
       
   491   syncSampleAtom                *stss;
       
   492   shadowSyncSampleAtom          *stsh;
       
   493   sampleDependencyAtom          *sdtp;
       
   494 } sampleTableAtom;
       
   495 
       
   496 
       
   497 typedef struct videoMediaHeaderAtom
       
   498 {
       
   499   atomHeader  *atomhdr;
       
   500 } videoMediaHeaderAtom;
       
   501 
       
   502 
       
   503 typedef struct soundMediaHeaderAtom
       
   504 {
       
   505   atomHeader  *atomhdr;
       
   506 } soundMediaHeaderAtom;
       
   507 
       
   508 
       
   509 typedef struct mediaInformationAtom
       
   510 {
       
   511   atomHeader            *atomhdr;
       
   512   videoMediaHeaderAtom  *vmhd;
       
   513   soundMediaHeaderAtom  *smhd;
       
   514   dataInformationAtom   *dinf;
       
   515   sampleTableAtom       *stbl;
       
   516 } mediaInformationAtom;
       
   517 
       
   518 
       
   519 typedef struct mediaAtom
       
   520 {
       
   521   atomHeader            *atomhdr;
       
   522   mediaHeaderAtom       *mdhd;
       
   523   handlerAtom           *hdlr;
       
   524   mediaInformationAtom  *minf;
       
   525 } mediaAtom;
       
   526 
       
   527 
       
   528 typedef struct trackReferenceAtom
       
   529 {
       
   530   atomHeader  *atomhdr;
       
   531 } trackReferenceAtom;
       
   532 
       
   533 
       
   534 typedef struct editListContainerAtom
       
   535 {
       
   536   atomHeader  *atomhdr;
       
   537 } editListContainerAtom;
       
   538 
       
   539 
       
   540 typedef struct copyrightAtom
       
   541 {
       
   542   void *p;
       
   543 } copyrightAtom;
       
   544 
       
   545 typedef struct userDataAtom
       
   546 {
       
   547   atomHeader    *atomhdr;
       
   548   mp4_u64       atomcontentloc;   //used for parsing
       
   549   mp4_u32       atomcontentsize;  //used for parsing and composing
       
   550   mp4_u8        *contentdata;     //used for composing
       
   551 } userDataAtom;
       
   552 
       
   553 typedef struct trackAtom
       
   554 {
       
   555   atomHeader             *atomhdr;
       
   556   trackHeaderAtom        *tkhd;
       
   557   trackReferenceAtom     *tref;
       
   558   editListContainerAtom  *edts;
       
   559   mediaAtom              *mdia;
       
   560   userDataAtom           *udta;
       
   561 } trackAtom;
       
   562 
       
   563 typedef struct movieAtom
       
   564 {
       
   565   atomHeader            *atomhdr;
       
   566   movieHeaderAtom       *mvhd;
       
   567   trackAtom             *trakAudio; // audio
       
   568   trackAtom             *trakVideo; // video
       
   569   objectDescriptorAtom  *iods;
       
   570   userDataAtom          *udta;
       
   571 } movieAtom;
       
   572 
       
   573 
       
   574 typedef struct mediaDataAtom
       
   575 {
       
   576   atomHeader  *atomhdr;
       
   577   mp4_u8      *data;
       
   578 } mediaDataAtom;
       
   579 
       
   580 
       
   581 typedef struct sampleTable
       
   582 {
       
   583   mp4_u32    currentChunk;
       
   584 
       
   585   /* Decoding time to sample */
       
   586   mp4_u32    sttsEntryCount;
       
   587   mp4_u32    *sttsSampleCount;
       
   588   mp4_u32    *sttsSampleDelta;
       
   589   mp4_u32    sttsMaxEntryCount;
       
   590   mp4_u32    sttsCurrentEntryCount;
       
   591 
       
   592   /* Sample size */
       
   593   mp4_u32    stszSampleSize;
       
   594   mp4_u32    stszSampleCount;
       
   595   mp4_u32    *stszEntrySize;
       
   596   mp4_u32    stszMaxSampleCount;
       
   597   mp4_u32    stszCurrentSampleCount;
       
   598 
       
   599   /* Sample to chunk */
       
   600   mp4_u32    stscEntryCount;
       
   601   mp4_u32    *stscFirstChunk;
       
   602   mp4_u32    *stscSamplesPerChunk;
       
   603   mp4_u32    *stscSampleDescriptionIndex;
       
   604   mp4_u32    stscMaxEntryCount;
       
   605   mp4_u32    stscCurrentEntryCount;
       
   606 
       
   607   /* Chunk offset */
       
   608   mp4_u32    stcoEntryCount;
       
   609   mp4_u64    *stcoChunkOffset;
       
   610   mp4_u32    stcoMaxEntryCount;
       
   611   mp4_u32    stcoCurrentEntryCount;
       
   612   mp4_bool   stcoNeed64Bits;
       
   613     
       
   614   /* Sync sample */
       
   615   mp4_u32    stssEntryCount;
       
   616   mp4_u32    *stssSampleNumber;
       
   617   mp4_u32    stssMaxEntryCount;
       
   618   mp4_u32    stssCurrentEntryCount;
       
   619   /* Sample Dependency */
       
   620   mp4_u32    sdtpEntryCount;
       
   621   mp4_u8    *sdtpSampleDependency;
       
   622   mp4_u32    sdtpMaxEntryCount;
       
   623   mp4_u32    sdtpCurrentEntryCount;
       
   624 } sampleTable;
       
   625 
       
   626 
       
   627 typedef struct MP4HandleStruct
       
   628 {
       
   629   mp4_u8        sourceType;                /* Determines the type of the source file (CAF or RFile64) */
       
   630   void          *file;                     /* FILE * of possible file */
       
   631   void          *fs;                       /* File server */
       
   632   void          *rfile;                    /* File handle */
       
   633   ContentAccess::CData *cfile;             /* used when reading via the CAF and not the file based interfaces */
       
   634   mp4_i32		cafError;				   /* variable to store possible CAF error to be reported to client */
       
   635   void          *tmpfile;                  /* FILE * of temporary output file */
       
   636   void          *metaDataFile[NUM_MDF];    /* File handles for metadata files */
       
   637   MP4FileName   metaDataFileName[NUM_MDF]; /* Names of the temporary meta data files */
       
   638   MP4FileName   fileName;                  /* Name of the file */
       
   639   MP4FileName   tmpFileName;               /* Name of the temporary file */
       
   640   mp4_u64       bytesInTmpFile;            /* Number of bytes in temporary file */
       
   641   mp4_u64       mediaDataBytes;            /* Number of media data bytes */
       
   642   mp4_bool      ftypWritten;               /* Has FTYP been written */
       
   643   mp4_u32       flags;                     /* Composing flags */
       
   644   mp4_u32       type;                      /* Type of audio/video */
       
   645   list_s        *mem;                      /* Memory list */
       
   646   mp4_u32       position;                  /* Current position in memory */
       
   647   mp4_u32       absPosition;               /* Current absolute position in memory */
       
   648   mp4_u64       lastAccessedPosInFile;     /* Last accessed position in a file */
       
   649   mp4_u8        *buf;                      /* Temporary buffer space */
       
   650   mp4_u8        *diskReadBuf;              /* Memory for file buffering */
       
   651   mp4_u32       diskReadPos;               /* Reading position in the file */
       
   652   mp4_u64       diskReadBufStart;          /* Position of the start of the buffer */
       
   653   mp4_u32       diskReadBufPos;            /* Reading position inside buffer */
       
   654   mp4_u32       diskReadSize;              /* Number of bytes in buffer */
       
   655   mp4_u8        *diskWriteBuf;             /* Memory for file buffering */
       
   656   mp4_bool      ftypRead;                  /* FTYP atom has been read */
       
   657   fileTypeAtom  *ftyp;                     /* Pointer to file type atom structure */
       
   658   mp4_bool      metaDataComplete;          /* Metadata has been completeley read */
       
   659   movieAtom     *moov;                     /* Pointer to movie atom structure */
       
   660   mp4_u32       videoSampleNum;            /* Current video sample number */
       
   661   mp4_u64       videoFrameOffset;          /* Absolute position of current video frame */
       
   662   mp4_u32       videoFrameSize;            /* Size of current video frame in bytes */
       
   663   mp4_bool      videoLast;                 /* Has last video sample been read */
       
   664   mp4_u32       videoTimeScale;            /* Video timescale */
       
   665   mp4_u64       videoDuration;             /* Duration of video when composing */
       
   666   mp4_u16       videoWidth;                /* Video image width */
       
   667   mp4_u16       videoHeight;               /* Video image height */
       
   668   mp4_u32       videoMaxBitrate;           /* MPEG-4 video maximum bitrate */
       
   669   mp4_u32       videoAvgBitrate;           /* MPEG-4 video average bitrate */
       
   670   mp4_u8        *videoDecSpecificInfo;     /* MPEG-4 video DecoderSpecificInfo */
       
   671   mp4_u32       videoDecSpecificInfoSize;  /* MPEG-4 video DecoderSpecificInfo size in bytes */
       
   672   sampleTable   *videoSampleTable;         /* Video sample table */
       
   673   mp4_u8        videoLevel;                /* Video codec level, default is H.263 level 10 */
       
   674   mp4_u32       audioSampleNum;            /* Current audio sample number */
       
   675   mp4_u32       audioSampleSize;           /* Size of current audio sample in bytes */
       
   676   mp4_u64       audioSampleOffset;         /* Absolute position of current audio frame (in MP4 file) */
       
   677   mp4_u32       audioFrameCount;           /* Number of audio frames when composing */
       
   678   mp4_u32       audioTimeScale;            /* Audio timescale */
       
   679   mp4_u64       audioDuration;             /* Duration of audio when composing */
       
   680   mp4_bool      audioLast;                 /* Has last audio sample been read */
       
   681   mp4_u8        *audioDecSpecificInfo;     /* MPEG audio DecoderSpecificInfo */
       
   682   mp4_u32       audioDecSpecificInfoSize;  /* MPEG audio DecoderSpecificInfo size in bytes */
       
   683   sampleTable   *audioSampleTable;         /* Audio sample table */
       
   684   mp4_u8        audioFramesPerSample;      /* AMR frames per sample value */
       
   685   mp4_u16       audioModeSet;              /* AMR mode set */
       
   686   mp4_u32       metaDataBlocks;            /* Number of metadata blocks in memory */
       
   687   mp4_bool      metaDataOnDisk;            /* Is (a part of) metadata on the disk */
       
   688   mp4_u32       metaDataSize;              /* Size of metadata */
       
   689   mp4_u32		videoSampleEntryIndex;	   /* SampleEntry index of the video frame being read */
       
   690   mp4_u32		audioSampleEntryIndex;     /* SampleEntry index of the audio frame being read */
       
   691   mp4_u8        avcNalUnitLengthSize;      /* byte size of the length field */
       
   692   mp4_bool      generate3G2;               /* 3GPP2 File Format Generation is Selected: default:FALSE (Generate 3GP)*/
       
   693   mp4_bool      generateMP4;               /* MPEG-4 File Format Generation is Selected: defailt:FALSE (Generate 3GP)*/
       
   694   mp4_bool      qcelpStoredAsMPEGAudio;    /* QCELP 13K is registered as MPEG4 Audio: default: FALSE (in QCELPSampleEntry)*/
       
   695   mp4_u64       audioMediaDataSize;        /* Total byte size of the written audio data. This is used to calculate the max and avg bitrates */
       
   696   mp4_u32       ES_DescriptorSize;         /* size of the ES_Descriptor inside the ESDS box */ 
       
   697 
       
   698   // composeToBuffer:
       
   699   mp4_u8 *composeBuffer;
       
   700   mp4_bool bufferWrite;
       
   701   mp4_u32 bytesProgressed;
       
   702   mp4_u32 ftypdelta;
       
   703   mp4_u32 *composedSize;
       
   704 
       
   705   CFileWriter*  filewriter;                /* Async buffering filewriter */
       
   706   CMetaDataFileWriter* metadatafilewriter;  /* Async buffering metadata temp file writer */
       
   707 
       
   708   mp4_bool      LastWriteDataCalled;       /* When TRUE, it indicates that ParseWriteData() function is called for the last time */ 
       
   709   mp4_bool      FileHandleFromOutside;     /* When TRUE file handle is passed to library instead of file name, don't close file in end */
       
   710 
       
   711   mp4_bool      metaDataFileEmpty[NUM_MDF]; /* when TRUE it indicates that metadata file has been read and rest of data is in readbuffer of metadatafilewriter */
       
   712   
       
   713   userDataAtom* moovUDTA;   // used to compose MOOV UDTA (User Data) 
       
   714   userDataAtom* audioUDTA;  // used to compose AudioTrack UDTA (User Data) 
       
   715   userDataAtom* videoUDTA;  // used to compose VideoTrack UDTA (User Data)
       
   716   
       
   717   TDriveNumber   fileHandleDrive;  /* Used when we get file handle to library from outside. Used to indicate which drive are metadata temp files written.*/
       
   718   
       
   719   // Custom buffer size additions:
       
   720   mp4_u32 mediaWriteBufferSize;
       
   721   mp4_u32 metaWriteBufferSize;
       
   722   mp4_u32 writeBufferMaxCount;
       
   723   mp4_u32 readBufferSize;
       
   724   
       
   725   // Async parsing observer
       
   726   M3GPMP4LibAsyncObserver* asyncObserver;
       
   727   CFileAsyncParser* asyncReader;
       
   728   M3GPMP4LibAsyncTempFileRemoverObserver* tempFileRemoverObserver;
       
   729   
       
   730   void *file32Duplicate; //this is a RFile64 duplicate of the RFile used in Open 
       
   731 } MP4HandleStruct;
       
   732 
       
   733 
       
   734 typedef MP4HandleStruct *MP4HandleImp;
       
   735 
       
   736 
       
   737 mp4_i32 metaDataAvailable(MP4HandleImp handle);
       
   738 mp4_i32 readFTYP(MP4HandleImp handle, fileTypeAtom *ftyp);
       
   739 mp4_i32 readMetaData(MP4HandleImp handle);
       
   740 mp4_i32 readMoov(MP4HandleImp handle, movieAtom *moov);
       
   741 mp4_i32 readAtomHeader(MP4HandleImp handle, atomHeader *ah);
       
   742 mp4_i32 readFullAtomHeader(MP4HandleImp handle, atomHeader *ah);
       
   743 mp4_i32 readMVHD(MP4HandleImp handle, movieHeaderAtom *mvhd);
       
   744 mp4_i32 readIODS(MP4HandleImp handle, objectDescriptorAtom *iods);
       
   745 mp4_i32 readTRAK(MP4HandleImp handle, trackAtom *trak);
       
   746 mp4_i32 readUnknown(MP4HandleImp handle);
       
   747 mp4_i32 readTKHD(MP4HandleImp handle, trackHeaderAtom *tkhd);
       
   748 mp4_i32 readTREF(MP4HandleImp handle, trackReferenceAtom *tref);
       
   749 mp4_i32 readEDTS(MP4HandleImp handle, editListContainerAtom *edts);
       
   750 mp4_i32 readMDIA(MP4HandleImp handle, mediaAtom *mdia);
       
   751 mp4_i32 readMDHD(MP4HandleImp handle, mediaHeaderAtom *mdhd);
       
   752 mp4_i32 readHDLR(MP4HandleImp handle, handlerAtom *hdlr);
       
   753 mp4_i32 readMINF(MP4HandleImp handle, mediaInformationAtom *minf);
       
   754 mp4_i32 readVMHD(MP4HandleImp handle, videoMediaHeaderAtom *vmhd);
       
   755 mp4_i32 readSMHD(MP4HandleImp handle, soundMediaHeaderAtom *smhd);
       
   756 mp4_i32 readDINF(MP4HandleImp handle, dataInformationAtom *dinf);
       
   757 mp4_i32 readDREF(MP4HandleImp handle, dataReferenceAtom *dref);
       
   758 mp4_i32 readURL(MP4HandleImp handle, dataEntryURLAtom *url);
       
   759 mp4_i32 readURN(MP4HandleImp handle, dataEntryURNAtom *urn);
       
   760 mp4_i32 readSTBL(MP4HandleImp handle, sampleTableAtom *stbl);
       
   761 mp4_i32 readSTTS(MP4HandleImp handle, timeToSampleAtom *stts);
       
   762 mp4_i32 readCTTS(MP4HandleImp handle, compositionTimeToSampleAtom *ctts);
       
   763 mp4_i32 readSTSS(MP4HandleImp handle, syncSampleAtom *stss);
       
   764 mp4_i32 readSTSD(MP4HandleImp handle, sampleDescriptionAtom *stsd);
       
   765 mp4_i32 readSTSZ(MP4HandleImp handle, sampleSizeAtom *stsz);
       
   766 mp4_i32 readSTZ2(MP4HandleImp handle, sampleSizeAtom *stsz);
       
   767 mp4_i32 readSTSC(MP4HandleImp handle, sampleToChunkAtom *stsc);
       
   768 mp4_i32 readSTCO(MP4HandleImp handle, chunkOffsetAtom *stco);
       
   769 mp4_i32 readCO64(MP4HandleImp handle, chunkOffset64Atom *stco64);
       
   770 mp4_i32 readMP4V(MP4HandleImp handle, visualSampleEntry *mp4v);
       
   771 mp4_i32 readMP4A(MP4HandleImp handle, audioSampleEntry *mp4a);
       
   772 mp4_i32 readMP4S(MP4HandleImp handle, mpegSampleEntry *mp4s);
       
   773 mp4_i32 readS263(MP4HandleImp handle, h263SampleEntry *s263);
       
   774 mp4_i32 readSAMR(MP4HandleImp handle, amrSampleEntry *samr);
       
   775 mp4_i32 readSAWB(MP4HandleImp handle, amrSampleEntry *sawb);
       
   776 mp4_i32 readESD(MP4HandleImp handle, ESDAtom *esd);
       
   777 mp4_i32 readD263(MP4HandleImp handle, h263SpecificAtom *d263);
       
   778 mp4_i32 readBITR(MP4HandleImp handle, bitrateAtom *bitr);
       
   779 mp4_i32 readDAMR(MP4HandleImp handle, amrDecSpecStruc *damr);
       
   780 /* avc inclusions*/
       
   781 mp4_i32 readAVC1(MP4HandleImp handle, avcSampleEntry *avc1);
       
   782 mp4_i32 readSDTP(MP4HandleImp handle, sampleDependencyAtom *sdtp,  mp4_i32 sample_count);
       
   783 /* QCELP 13k inclusions */
       
   784 mp4_i32 readSQCP(MP4HandleImp handle, qcelpSampleEntry *sqcp);
       
   785 mp4_i32 readDQCP(MP4HandleImp handle, qcelpDecSpecStruc *dqcp);
       
   786 
       
   787 mp4_i32 freeFTYP(fileTypeAtom *ftyp);
       
   788 mp4_i32 freeMOOV(movieAtom *moov);
       
   789 mp4_i32 freeAtomHeader(atomHeader *atomhdr);
       
   790 mp4_i32 freeMVHD(movieHeaderAtom *mvhd);
       
   791 mp4_i32 freeTRAK(trackAtom *trak);
       
   792 mp4_i32 freeTKHD(trackHeaderAtom *tkhd);
       
   793 mp4_i32 freeTREF(trackReferenceAtom *tref);
       
   794 mp4_i32 freeEDTS(editListContainerAtom *edts);
       
   795 mp4_i32 freeMDIA(mediaAtom *mdia);
       
   796 mp4_i32 freeMDHD(mediaHeaderAtom *mdhd);
       
   797 mp4_i32 freeHDLR(handlerAtom *hdlr);
       
   798 mp4_i32 freeMINF(mediaInformationAtom *minf);
       
   799 mp4_i32 freeVMHD(videoMediaHeaderAtom *vmhd);
       
   800 mp4_i32 freeSMHD(soundMediaHeaderAtom *smhd);
       
   801 mp4_i32 freeDINF(dataInformationAtom *dinf);
       
   802 mp4_i32 freeDREF(dataReferenceAtom *dref);
       
   803 mp4_i32 freeURL(dataEntryURLAtom *url);
       
   804 mp4_i32 freeURN(dataEntryURNAtom *urn);
       
   805 mp4_i32 freeSTBL(sampleTableAtom *stbl);
       
   806 mp4_i32 freeSTTS(timeToSampleAtom *stts);
       
   807 mp4_i32 freeCTTS(compositionTimeToSampleAtom *ctts);
       
   808 mp4_i32 freeSTSD(sampleDescriptionAtom *stsd);
       
   809 mp4_i32 freeMP4V(visualSampleEntry *mp4v);
       
   810 mp4_i32 freeESD(ESDAtom *esd);
       
   811 mp4_i32 freeMP4A(audioSampleEntry *mp4a);
       
   812 mp4_i32 freeMP4S(mpegSampleEntry *mp4s);
       
   813 mp4_i32 freeS263(h263SampleEntry *s263);
       
   814 mp4_i32 freeD263(h263SpecificAtom *d263);
       
   815 mp4_i32 freeBITR(bitrateAtom *bitr);
       
   816 mp4_i32 freeSAMR(amrSampleEntry *samr);
       
   817 mp4_i32 freeSAWB(amrSampleEntry *sawb);
       
   818 mp4_i32 freeDAMR(amrDecSpecStruc *damr);
       
   819 mp4_i32 freeSTSZ(sampleSizeAtom *stsz);
       
   820 mp4_i32 freeSTSC(sampleToChunkAtom *stsc);
       
   821 mp4_i32 freeSTCO(chunkOffsetAtom *stco);
       
   822 mp4_i32 freeSTCO64(chunkOffset64Atom *stco64);
       
   823 mp4_i32 freeSTSS(syncSampleAtom *stss);
       
   824 mp4_i32 freeSTSH(shadowSyncSampleAtom *stsh);
       
   825 mp4_i32 freeIODS(objectDescriptorAtom *iods);
       
   826 mp4_i32 readUDTA(MP4HandleImp handle, userDataAtom *udta);
       
   827 mp4_i32 freeUDTA(userDataAtom *udta);
       
   828 mp4_i32 freeSDTP(sampleDependencyAtom* sdtp);
       
   829 /* The following and AVC related */
       
   830 mp4_i32 freeAVC1(avcSampleEntry *avc1);
       
   831 mp4_i32 freeM4DS(mpeg4ExtensionDescriptorsAtom *m4ds);
       
   832 mp4_i32 freeBTRT(mpeg4BitrateAtom *btrt);
       
   833 mp4_i32 freeAVCC(avcConfigurationAtom *avcc);
       
   834 /* QCELP 13K related */
       
   835 mp4_i32 freeSQCP(qcelpSampleEntry *sqcp);
       
   836 mp4_i32 freeDQCP(qcelpDecSpecStruc *dqcp);
       
   837 
       
   838 mp4_i32 determineVideoLength(MP4HandleImp handle, mp4_u32 *videolength);
       
   839 mp4_i32 determineFrameRate(MP4HandleImp handle, mp4_double *framerate);
       
   840 mp4_i32 determineVideoType(MP4HandleImp handle, mp4_u32 *videotype);
       
   841 mp4_i32 determineVideoResolution(MP4HandleImp handle, mp4_u32 *videowidth, mp4_u32 *videoheight);
       
   842 mp4_i32 determineVideoTimeScale(MP4HandleImp handle, mp4_u32 *timescale);
       
   843 mp4_i32 determineAudioLength(MP4HandleImp handle, mp4_u32 *audiolength);
       
   844 mp4_i32 determineAudioType(MP4HandleImp handle, mp4_u32 *audiotype);
       
   845 mp4_i32 determineAudioFramesPerSample(MP4HandleImp handle, mp4_u8 *framespersample);
       
   846 mp4_i32 determineAudioTimeScale(MP4HandleImp handle, mp4_u32 *timescale);
       
   847 mp4_i32 determineAudioAverageBitRate(MP4HandleImp handle, mp4_u32 *averagebitrate);
       
   848 mp4_i32 determineStreamSize(MP4HandleImp handle, mp4_u32 *streamsize);
       
   849 mp4_i32 determineStreamAverageBitRate(MP4HandleImp handle, mp4_u32 *streamaveragebitrate, mp4_u32 streamsize);
       
   850 mp4_i32 advanceVideoFrame(MP4HandleImp handle, trackAtom *trak);
       
   851 mp4_i32 resolveVideoSampleOffset(MP4HandleImp handle, sampleTableAtom *stbl);
       
   852 mp4_i32 resolveVideoSampleSize(MP4HandleImp handle, sampleSizeAtom *stsz);
       
   853 mp4_i32 fetchVideoFrame(MP4HandleImp handle, trackAtom *trak, mp4_u8 *buffer, mp4_u32 buffersize, mp4_u32 *framesize, mp4_u32 *framenumber, mp4_bool *keyframe, mp4_u32 *timestamp2);
       
   854 mp4_i32 isVideoFrameKeyFrame(MP4HandleImp handle, trackAtom *trak, mp4_bool *keyframe);
       
   855 mp4_i32 convertVideoSampleToTime(MP4HandleImp handle, mediaAtom *mdia, mp4_u32 *framenumber, mp4_u32 *timestamp2);
       
   856 mp4_i32 advanceAudioSample(MP4HandleImp handle, trackAtom *trak);
       
   857 mp4_i32 resolveAudioSampleOffset(MP4HandleImp handle, sampleTableAtom *stbl);
       
   858 mp4_i32 resolveAudioSampleSize(MP4HandleImp handle, sampleSizeAtom *stsz);
       
   859 mp4_i32 fetchAudioSample(MP4HandleImp handle, trackAtom *trak, mp4_u8 *buffer, mp4_u32 buffersize, mp4_u32 *framesize, mp4_u32 *timestamp, mp4_u32 *returnedframes, mp4_u32 *timestamp2);
       
   860 mp4_i32 convertAudioSampleToTime(MP4HandleImp handle, mediaAtom *mdia, mp4_u32 *timestamp, mp4_u32 *timestamp2);
       
   861 mp4_i32 convertTimeToSample(MP4HandleImp handle, trackAtom *trak, mp4_u32 position, mp4_u32 *sample);
       
   862 mp4_i32 goToVideoSample(MP4HandleImp handle, trackAtom *trak, mp4_u32 sample);
       
   863 mp4_i32 goToAudioSample(MP4HandleImp handle, trackAtom *trak, mp4_u32 sample);
       
   864 mp4_i32 findVideoKeyFrame(MP4HandleImp handle, trackAtom *trak, mp4_u32 sample, mp4_u32 *newsample);
       
   865 mp4_i32 fetchAudioSampleAsync(MP4HandleImp handle, trackAtom *trak, mp4_u8 *buffer, mp4_u32* buffersize);
       
   866 mp4_i32 fetchVideoFrameAsync(MP4HandleImp handle, trackAtom *trak, mp4_u8 *buffer, mp4_u32* buffersize);
       
   867 mp4_i64 getChunkOffset(sampleTableAtom *stbl, mp4_u32 index); 
       
   868 #endif
       
   869 
       
   870  
       
   871 // End of File