os/mm/mmplugins/lib3gp/impl/inc/mp4atom.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/mm/mmplugins/lib3gp/impl/inc/mp4atom.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,894 @@
     1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#ifndef _MP4ATOM_H
    1.20 +#define _MP4ATOM_H
    1.21 +
    1.22 +#include <3gplibrary/mp4config.h>
    1.23 +#include <3gplibrary/mp4lib.h>
    1.24 +#include "mp4list.h"
    1.25 +#include "filewriter.h" /* Async buffering filewriter */
    1.26 +#include "metadatafilewriter.h" /* Async buffering filewriter */
    1.27 +#include "asyncfileparser.h" /*Async file reader for parsing */
    1.28 +
    1.29 +#define ATOMTYPE_FTYP 0x66747970 /* 'ftyp' */
    1.30 +#define ATOMTYPE_MOOV 0x6d6f6f76 /* 'moov' */
    1.31 +#define ATOMTYPE_MDAT 0x6d646174 /* 'mdat' */
    1.32 +#define ATOMTYPE_FREE 0x66726565 /* 'free' */
    1.33 +#define ATOMTYPE_SKIP 0x736b6970 /* 'skip' */
    1.34 +#define ATOMTYPE_UDTA 0x75647461 /* 'udta' */
    1.35 +#define ATOMTYPE_MVHD 0x6d766864 /* 'mvhd' */
    1.36 +#define ATOMTYPE_IODS 0x696f6473 /* 'iods' */
    1.37 +#define ATOMTYPE_TRAK 0x7472616b /* 'trak' */
    1.38 +#define ATOMTYPE_TKHD 0x746b6864 /* 'tkhd' */
    1.39 +#define ATOMTYPE_MDIA 0x6d646961 /* 'mdia' */
    1.40 +#define ATOMTYPE_MDHD 0x6d646864 /* 'mdhd' */
    1.41 +#define ATOMTYPE_HDLR 0x68646c72 /* 'hdlr' */
    1.42 +#define ATOMTYPE_MINF 0x6d696e66 /* 'minf' */
    1.43 +#define ATOMTYPE_VMHD 0x766d6864 /* 'vmhd' */
    1.44 +#define ATOMTYPE_SMHD 0x736d6864 /* 'smhd' */
    1.45 +#define ATOMTYPE_DINF 0x64696e66 /* 'dinf' */
    1.46 +#define ATOMTYPE_DREF 0x64726566 /* 'dref' */
    1.47 +#define ATOMTYPE_TREF 0x74726566 /* 'tref' */
    1.48 +#define ATOMTYPE_STBL 0x7374626c /* 'stbl' */
    1.49 +#define ATOMTYPE_STTS 0x73747473 /* 'stts' */
    1.50 +#define ATOMTYPE_CTTS 0x63747473 /* 'ctts' */
    1.51 +#define ATOMTYPE_STSS 0x73747373 /* 'stss' */
    1.52 +#define ATOMTYPE_STSD 0x73747364 /* 'stsd' */
    1.53 +#define ATOMTYPE_STSZ 0x7374737a /* 'stsz' */
    1.54 +#define ATOMTYPE_STZ2 0x73747a32 /* 'stz2' */
    1.55 +#define ATOMTYPE_STSC 0x73747363 /* 'stsc' */
    1.56 +#define ATOMTYPE_STCO 0x7374636f /* 'stco' */
    1.57 +#define ATOMTYPE_CO64 0x636f3634 /* 'co64' */
    1.58 +#define ATOMTYPE_MP4V 0x6d703476 /* 'mp4v' */
    1.59 +#define ATOMTYPE_MP4A 0x6d703461 /* 'mp4a' */
    1.60 +#define ATOMTYPE_MP4S 0x6d703473 /* 'mp4s' */
    1.61 +#define ATOMTYPE_S263 0x73323633 /* 's263' */
    1.62 +#define ATOMTYPE_D263 0x64323633 /* 'd263' */
    1.63 +#define ATOMTYPE_BITR 0x62697472 /* 'bitr' */
    1.64 +#define ATOMTYPE_SAMR 0x73616d72 /* 'samr' */
    1.65 +#define ATOMTYPE_SAWB 0x73617762 /* 'sawb' */
    1.66 +#define ATOMTYPE_DAMR 0x64616d72 /* 'damr' */
    1.67 +#define ATOMTYPE_ESD  0x65736473 /* 'esds' */
    1.68 +#define ATOMTYPE_URL  0x75726c20 /* 'url ' */
    1.69 +#define ATOMTYPE_URN  0x75726e20 /* 'urn ' */
    1.70 +#define ATOMTYPE_UUID 0x75756964 /* 'uuid' */
    1.71 +#define ATOMTYPE_EDTS 0x65647473 /* 'edts' */
    1.72 +#define ATOMTYPE_META 0x6d657461 /* 'meta' */
    1.73 +/* AVC Additions */
    1.74 +#define ATOMTYPE_AVCC 0x61766343 /* 'avcC' */
    1.75 +#define ATOMTYPE_BTRT 0x62747274 /* 'btrt' */
    1.76 +#define ATOMTYPE_AVC1 0x61766331 /* 'avc1' */
    1.77 +#define ATOMTYPE_M4DS 0x6d346473 /* 'm4ds' */
    1.78 +#define ATOMTYPE_SDTP 0x73647470 /* 'sdtp' */
    1.79 +#define ATOMTYPE_AVCP 0x61766370 /* 'avcp' */
    1.80 +/* QCELP 13K Additions */
    1.81 +#define ATOMTYPE_SQCP 0x73716370 /* 'sqcp' */
    1.82 +#define ATOMTYPE_DQCP 0x64716370 /* 'dqcp' */
    1.83 +/* inline Addition */
    1.84 +#define ATOMTYPE_ID32 0x49443332 /* 'ID32' */
    1.85 +
    1.86 +#define HANDLERTYPE_ODSM 0x6f64736d /* 'odsm' */
    1.87 +#define HANDLERTYPE_VIDE 0x76696465 /* 'vide' */
    1.88 +#define HANDLERTYPE_SOUN 0x736f756e /* 'soun' */
    1.89 +
    1.90 +
    1.91 +
    1.92 +#define FTYP_SIZE    24     /* Size of FTYP box in bytes */
    1.93 +
    1.94 +#define READBUFSIZE  8192   /* Size of file reading buffer */
    1.95 +#define WRITEBUFSIZE 2048   /* Size of file writing buffer */
    1.96 +
    1.97 +#define BLOCK_LIMIT  200  /* Max number of metadata blocks to keep in memory */
    1.98 +
    1.99 +#define MAXSAMPLESPERSECOND  150 /* magic number used to try validate input data to parser from possibly corrupted file */
   1.100 +
   1.101 +
   1.102 +#define METADATAFILE_VIDEO_STTS_SAMPLE_COUNT     0
   1.103 +#define METADATAFILE_VIDEO_STTS_SAMPLE_DELTA     1
   1.104 +#define METADATAFILE_VIDEO_STSZ_ENTRY_SIZE       2
   1.105 +#define METADATAFILE_VIDEO_STCO_CHUNK_OFFSET     3
   1.106 +#define METADATAFILE_VIDEO_STSS_SAMPLE_NUMBER    4
   1.107 +#define METADATAFILE_AUDIO_STTS_SAMPLE_COUNT     5
   1.108 +#define METADATAFILE_AUDIO_STTS_SAMPLE_DELTA     6
   1.109 +#define METADATAFILE_AUDIO_STSZ_ENTRY_SIZE       7
   1.110 +#define METADATAFILE_AUDIO_STCO_CHUNK_OFFSET     8
   1.111 +#define METADATAFILE_VIDEO_SDTP_SAMPLE_DEPENDENCY 9
   1.112 +
   1.113 +/* Multiple Sample Entry Inclusion */
   1.114 +#define STSDMAXSAMPLEENTRYCOUNT 10   /* defined the maximum number of sample entried allowed in a Sample Description Box */
   1.115 +
   1.116 +
   1.117 +typedef struct atomHeader
   1.118 +{
   1.119 +  mp4_u32  size;
   1.120 +  mp4_u32  type;
   1.121 +  mp4_u64  largeSize;
   1.122 +  mp4_u8   extendedType[16];
   1.123 +  mp4_u8   version;
   1.124 +  mp4_u8   flags[3];
   1.125 +} atomHeader;
   1.126 +
   1.127 +
   1.128 +typedef struct fileTypeAtom
   1.129 +{
   1.130 +  atomHeader  *atomhdr;
   1.131 +  mp4_u32     majorBrand;
   1.132 +  mp4_u32     minorVersion;
   1.133 +  mp4_u32     *compatibleBrands;
   1.134 +} fileTypeAtom;
   1.135 +
   1.136 +
   1.137 +typedef struct movieHeaderAtom
   1.138 +{
   1.139 +  atomHeader      *atomhdr;
   1.140 +  mp4_u32         creationTime;
   1.141 +  mp4_u32         modificationTime;
   1.142 +  mp4_u32         timeScale;
   1.143 +  mp4_u32         duration;
   1.144 +  mp4_u32         nextTrackID;
   1.145 +  mp4_u64         creationTime64;
   1.146 +  mp4_u64         modificationTime64;
   1.147 +  mp4_u64         duration64;
   1.148 +} movieHeaderAtom;
   1.149 +
   1.150 +
   1.151 +typedef struct objectDescriptorAtom
   1.152 +{
   1.153 +  atomHeader      *atomhdr;
   1.154 +  mp4_u8          tag;
   1.155 +  mp4_u32         sizeOfInstance;
   1.156 +  mp4_u16         flags;
   1.157 +  mp4_u8          ODProfileLevelIndication;
   1.158 +  mp4_u8          SceneProfileLevelIndication;
   1.159 +  mp4_u8          AudioProfileLevelIndication;
   1.160 +  mp4_u8          VisualProfileLevelIndication;
   1.161 +  mp4_u8          GraphicsProfileLevelIndication;
   1.162 +} objectDescriptorAtom;
   1.163 +
   1.164 +
   1.165 +typedef struct trackHeaderAtom
   1.166 +{
   1.167 +  atomHeader      *atomhdr;
   1.168 +  mp4_u32         creationTime;
   1.169 +  mp4_u32         modificationTime;
   1.170 +  mp4_u32         trackID;
   1.171 +  mp4_u32         reserved;
   1.172 +  mp4_u32         duration;
   1.173 +  mp4_u64         creationTime64;
   1.174 +  mp4_u64         modificationTime64;
   1.175 +  mp4_u64         duration64;
   1.176 +  mp4_u16         width;
   1.177 +  mp4_u16         height;
   1.178 +  mp4_bool        isAudio;
   1.179 +  mp4_bool        isVisual;
   1.180 +} trackHeaderAtom;
   1.181 +
   1.182 +
   1.183 +typedef struct mediaHeaderAtom
   1.184 +{
   1.185 +  atomHeader  *atomhdr;
   1.186 +  mp4_u32     creationTime;
   1.187 +  mp4_u32     modificationTime;
   1.188 +  mp4_u32     timeScale;
   1.189 +  mp4_u32     duration;
   1.190 +  mp4_u64     creationTime64;
   1.191 +  mp4_u64     modificationTime64;
   1.192 +  mp4_u64     duration64;
   1.193 +} mediaHeaderAtom;
   1.194 +
   1.195 +
   1.196 +typedef struct handlerAtom
   1.197 +{
   1.198 +  atomHeader    *atomhdr;
   1.199 +  mp4_u32       handlerType;
   1.200 +  mp4_u8        *name;
   1.201 +} handlerAtom;
   1.202 +
   1.203 +
   1.204 +typedef struct dataEntryURLAtom
   1.205 +{
   1.206 +  atomHeader  *atomhdr;
   1.207 +} dataEntryURLAtom;
   1.208 +
   1.209 +
   1.210 +typedef struct dataEntryURNAtom
   1.211 +{
   1.212 +  atomHeader  *atomhdr;
   1.213 +} dataEntryURNAtom;
   1.214 +
   1.215 +
   1.216 +typedef struct dataReferenceAtom
   1.217 +{
   1.218 +  atomHeader        *atomhdr;
   1.219 +  mp4_u32           entryCount;
   1.220 +  dataEntryURLAtom  *url;
   1.221 +  dataEntryURNAtom  *urn;
   1.222 +} dataReferenceAtom;
   1.223 +
   1.224 +
   1.225 +typedef struct dataInformationAtom
   1.226 +{
   1.227 +  atomHeader         *atomhdr;
   1.228 +  dataReferenceAtom  *dref;
   1.229 +} dataInformationAtom;
   1.230 +
   1.231 +
   1.232 +typedef struct timeToSampleAtom
   1.233 +{
   1.234 +  atomHeader  *atomhdr;
   1.235 +  mp4_u32      entryCount;
   1.236 +  mp4_u32      *sampleCount;
   1.237 +  mp4_i32      *sampleDelta;
   1.238 +} timeToSampleAtom;
   1.239 +
   1.240 +
   1.241 +typedef struct compositionTimeToSampleAtom
   1.242 +{
   1.243 +  atomHeader      *atomhdr;
   1.244 +  mp4_u32         entryCount;
   1.245 +  mp4_u32         *sampleCount;
   1.246 +  mp4_u32         *sampleOffset;
   1.247 +} compositionTimeToSampleAtom;
   1.248 +
   1.249 +
   1.250 +typedef struct ESDAtom
   1.251 +{
   1.252 +  atomHeader  *atomhdr;
   1.253 +  mp4_u8      esDescrTag;
   1.254 +  mp4_u32     size;
   1.255 +  mp4_u16     ESID;
   1.256 +  mp4_u8      flags;
   1.257 +  mp4_u16     dependsOnESID;
   1.258 +  mp4_u8      URLLength;
   1.259 +  mp4_u8      *URLString;
   1.260 +  mp4_u16     OCRESID;
   1.261 +  mp4_u8      decConfDescrTag;
   1.262 +  mp4_u32     decConfDescrSize;
   1.263 +  mp4_u8      objectTypeIndication;
   1.264 +  mp4_u8      stream;
   1.265 +  mp4_u32     bufferSizeDB;
   1.266 +  mp4_u32     maxBitrate;
   1.267 +  mp4_u32     avgBitrate;
   1.268 +  mp4_u8      decSpecificInfoTag;
   1.269 +  mp4_u32     decSpecificInfoSize;
   1.270 +  mp4_u8      *decSpecificInfo;
   1.271 +} ESDAtom;
   1.272 +
   1.273 +
   1.274 +typedef struct visualSampleEntry
   1.275 +{
   1.276 +  atomHeader  *atomhdr;
   1.277 +  mp4_u16     dataReferenceIndex;
   1.278 +  mp4_u16     width;
   1.279 +  mp4_u16     height;
   1.280 +  ESDAtom     *esd;
   1.281 +} visualSampleEntry;
   1.282 +
   1.283 +
   1.284 +typedef struct audioSampleEntry
   1.285 +{
   1.286 +  atomHeader  *atomhdr;
   1.287 +  mp4_u16     dataReferenceIndex;
   1.288 +  mp4_u16     timeScale;
   1.289 +  ESDAtom     *esd;
   1.290 +} audioSampleEntry;
   1.291 +
   1.292 +
   1.293 +typedef struct mpegSampleEntry
   1.294 +{
   1.295 +  atomHeader  *atomhdr;
   1.296 +  mp4_u16     dataReferenceIndex;
   1.297 +  ESDAtom     *esd;
   1.298 +} mpegSampleEntry;
   1.299 +
   1.300 +
   1.301 +typedef struct bitrateAtom
   1.302 +{
   1.303 +  atomHeader  *atomhdr;
   1.304 +  mp4_u32     avgBitrate;
   1.305 +  mp4_u32     maxBitrate;
   1.306 +} bitrateAtom;
   1.307 +
   1.308 +
   1.309 +typedef struct h263SpecificAtom
   1.310 +{
   1.311 +  atomHeader  *atomhdr;
   1.312 +  mp4_u32     vendor;
   1.313 +  mp4_u8      decoderVersion;
   1.314 +  mp4_u8      h263Level;
   1.315 +  mp4_u8      h263Profile;
   1.316 +  bitrateAtom *bitr;
   1.317 +} h263SpecificAtom;
   1.318 +
   1.319 +
   1.320 +typedef struct h263SampleEntry
   1.321 +{
   1.322 +  atomHeader        *atomhdr;
   1.323 +  mp4_u16           dataReferenceIndex;
   1.324 +  mp4_u16           width;
   1.325 +  mp4_u16           height;
   1.326 +  h263SpecificAtom  *d263;
   1.327 +} h263SampleEntry;
   1.328 +
   1.329 +
   1.330 +typedef struct amrDecSpecStruc
   1.331 +{
   1.332 +  atomHeader  *atomhdr;
   1.333 +  mp4_u32     vendor;
   1.334 +  mp4_u8      decoderVersion;
   1.335 +  mp4_u16     modeSet;
   1.336 +  mp4_u8      modeChangePeriod;
   1.337 +  mp4_u8      framesPerSample;
   1.338 +} amrDecSpecStruc;
   1.339 +
   1.340 +
   1.341 +typedef struct amrSampleEntry
   1.342 +{
   1.343 +  atomHeader        *atomhdr;
   1.344 +  mp4_u16           dataReferenceIndex;
   1.345 +  mp4_u16           timeScale;
   1.346 +  amrDecSpecStruc   *damr;
   1.347 +} amrSampleEntry;
   1.348 +
   1.349 +typedef struct avcConfigurationAtom
   1.350 +{
   1.351 +  atomHeader		*atomhdr;
   1.352 +  mp4_u8				*avcConfig;
   1.353 +  mp4_u32				avcConfigSize;
   1.354 +} avcConfigurationAtom;
   1.355 +
   1.356 +typedef struct	mpeg4BitrateAtom
   1.357 +{
   1.358 +    atomHeader		*atomhdr;
   1.359 +	mp4_u32		bufferSizeDB;
   1.360 +	mp4_u32		maxBitRate;
   1.361 +	mp4_u32		avgBitrate;
   1.362 +} mpeg4BitrateAtom;
   1.363 +
   1.364 +typedef struct mpeg4ExtensionDescriptorsAtom
   1.365 +{
   1.366 +    atomHeader		*atomhdr;
   1.367 +	mp4_u8		*descr;
   1.368 +	mp4_u32		 descrSize;
   1.369 +} mpeg4ExtensionDescriptorsAtom;
   1.370 +
   1.371 +typedef struct avcSampleEntry
   1.372 +{
   1.373 +	atomHeader			*atomhdr;
   1.374 +    mp4_u16           dataReferenceIndex;
   1.375 +    mp4_u16           width;
   1.376 +    mp4_u16           height;
   1.377 +	avcConfigurationAtom	*avcc;
   1.378 +	mpeg4BitrateAtom			*btrt;
   1.379 +	mpeg4ExtensionDescriptorsAtom	*m4ds;
   1.380 +} avcSampleEntry;
   1.381 +
   1.382 +typedef struct qcelpDecSpecStruc
   1.383 +{
   1.384 +  atomHeader  *atomhdr;
   1.385 +  mp4_u32     vendor;
   1.386 +  mp4_u8      decoderVersion;
   1.387 +  mp4_u8      framesPerSample;
   1.388 +} qcelpDecSpecStruc;
   1.389 +
   1.390 +typedef struct qcelpSampleEntry
   1.391 +{
   1.392 +  atomHeader        *atomhdr;
   1.393 +  mp4_u16           dataReferenceIndex;
   1.394 +  mp4_u16           timeScale;
   1.395 +  qcelpDecSpecStruc   *dqcp;
   1.396 +} qcelpSampleEntry;
   1.397 +
   1.398 +typedef struct avcParameterSampleEntry
   1.399 +{
   1.400 +	
   1.401 +} avcParameterSampleEntry;
   1.402 +
   1.403 +typedef struct sampleDescriptionAtom
   1.404 +{
   1.405 +  atomHeader          *atomhdr;
   1.406 +  mp4_u32             entryCount;
   1.407 +  visualSampleEntry   *mp4v[STSDMAXSAMPLEENTRYCOUNT];
   1.408 +  audioSampleEntry    *mp4a[STSDMAXSAMPLEENTRYCOUNT];
   1.409 +  mpegSampleEntry     *mp4s[STSDMAXSAMPLEENTRYCOUNT];
   1.410 +  h263SampleEntry     *s263[STSDMAXSAMPLEENTRYCOUNT];
   1.411 +  amrSampleEntry      *samr[STSDMAXSAMPLEENTRYCOUNT];
   1.412 +  amrSampleEntry      *sawb[STSDMAXSAMPLEENTRYCOUNT];
   1.413 +  /* AVC addition */
   1.414 +  avcSampleEntry	*avc1[STSDMAXSAMPLEENTRYCOUNT];
   1.415 +  /* QCELP 13K addition */
   1.416 +  qcelpSampleEntry  *sqcp[STSDMAXSAMPLEENTRYCOUNT];
   1.417 +  avcParameterSampleEntry *avcp[STSDMAXSAMPLEENTRYCOUNT];
   1.418 +} sampleDescriptionAtom;
   1.419 +
   1.420 +
   1.421 +typedef struct sampleSizeAtom
   1.422 +{
   1.423 +  atomHeader  *atomhdr;
   1.424 +  mp4_u32     sampleSize;
   1.425 +  mp4_u32     sampleCount;
   1.426 +  mp4_u32     *entrySize;
   1.427 +} sampleSizeAtom;
   1.428 +
   1.429 +
   1.430 +typedef struct sampleToChunkAtom
   1.431 +{
   1.432 +  atomHeader  *atomhdr;
   1.433 +  mp4_u32     entryCount;
   1.434 +  mp4_u32     *firstChunk;
   1.435 +  mp4_u32     *samplesPerChunk;
   1.436 +  mp4_u32     *sampleDescriptionIndex;
   1.437 +} sampleToChunkAtom;
   1.438 +
   1.439 +
   1.440 +typedef struct chunkOffsetAtom
   1.441 +{
   1.442 +  atomHeader  *atomhdr;
   1.443 +  mp4_u32     entryCount;
   1.444 +  mp4_u32     *chunkOffset;
   1.445 +} chunkOffsetAtom;
   1.446 +
   1.447 +typedef struct chunkOffset64Atom
   1.448 +{
   1.449 +  atomHeader  *atomhdr;
   1.450 +  mp4_u32     entryCount;
   1.451 +  mp4_u64     *chunkOffset;
   1.452 +} chunkOffset64Atom;
   1.453 +
   1.454 +
   1.455 +typedef struct syncSampleAtom
   1.456 +{
   1.457 +  atomHeader  *atomhdr;
   1.458 +  mp4_u32     entryCount;
   1.459 +  mp4_u32     *sampleNumber;
   1.460 +} syncSampleAtom;
   1.461 +
   1.462 +
   1.463 +typedef struct shadowSyncSampleAtom
   1.464 +{
   1.465 +  atomHeader  *atomhdr;
   1.466 +} shadowSyncSampleAtom;
   1.467 +
   1.468 +typedef struct sampleDependency
   1.469 +{
   1.470 +	mp4_u8  sDependsOn;
   1.471 +	mp4_u8  sIsDependentOn;
   1.472 +	mp4_u8  sHasRedundancy;
   1.473 +} sampleDependency;
   1.474 +
   1.475 +typedef struct sampleDependencyAtom
   1.476 +{
   1.477 +	atomHeader        *atomhdr;
   1.478 +	mp4_u32           sampleCount;
   1.479 +	sampleDependency  *dep;
   1.480 +} sampleDependencyAtom;
   1.481 +
   1.482 +typedef struct sampleTableAtom
   1.483 +{
   1.484 +  atomHeader                    *atomhdr;
   1.485 +  timeToSampleAtom              *stts;
   1.486 +  compositionTimeToSampleAtom   *ctts;
   1.487 +  sampleDescriptionAtom         *stsd;
   1.488 +  sampleSizeAtom                *stsz;
   1.489 +  sampleToChunkAtom             *stsc;
   1.490 +  mp4_bool 						is32BitOffsets;
   1.491 +  union 
   1.492 +  {
   1.493 +  	chunkOffsetAtom             *stco;
   1.494 +  	chunkOffset64Atom           *stco64;
   1.495 +  };
   1.496 +  syncSampleAtom                *stss;
   1.497 +  shadowSyncSampleAtom          *stsh;
   1.498 +  sampleDependencyAtom          *sdtp;
   1.499 +} sampleTableAtom;
   1.500 +
   1.501 +
   1.502 +typedef struct videoMediaHeaderAtom
   1.503 +{
   1.504 +  atomHeader  *atomhdr;
   1.505 +} videoMediaHeaderAtom;
   1.506 +
   1.507 +
   1.508 +typedef struct soundMediaHeaderAtom
   1.509 +{
   1.510 +  atomHeader  *atomhdr;
   1.511 +} soundMediaHeaderAtom;
   1.512 +
   1.513 +
   1.514 +typedef struct mediaInformationAtom
   1.515 +{
   1.516 +  atomHeader            *atomhdr;
   1.517 +  videoMediaHeaderAtom  *vmhd;
   1.518 +  soundMediaHeaderAtom  *smhd;
   1.519 +  dataInformationAtom   *dinf;
   1.520 +  sampleTableAtom       *stbl;
   1.521 +} mediaInformationAtom;
   1.522 +
   1.523 +
   1.524 +typedef struct mediaAtom
   1.525 +{
   1.526 +  atomHeader            *atomhdr;
   1.527 +  mediaHeaderAtom       *mdhd;
   1.528 +  handlerAtom           *hdlr;
   1.529 +  mediaInformationAtom  *minf;
   1.530 +} mediaAtom;
   1.531 +
   1.532 +
   1.533 +typedef struct trackReferenceAtom
   1.534 +{
   1.535 +  atomHeader  *atomhdr;
   1.536 +} trackReferenceAtom;
   1.537 +
   1.538 +
   1.539 +typedef struct editListContainerAtom
   1.540 +{
   1.541 +  atomHeader  *atomhdr;
   1.542 +} editListContainerAtom;
   1.543 +
   1.544 +
   1.545 +typedef struct copyrightAtom
   1.546 +{
   1.547 +  void *p;
   1.548 +} copyrightAtom;
   1.549 +
   1.550 +typedef struct userDataAtom
   1.551 +{
   1.552 +  atomHeader    *atomhdr;
   1.553 +  mp4_u64       atomcontentloc;   //used for parsing
   1.554 +  mp4_u32       atomcontentsize;  //used for parsing and composing
   1.555 +  mp4_u8        *contentdata;     //used for composing
   1.556 +} userDataAtom;
   1.557 +
   1.558 +typedef struct trackAtom
   1.559 +{
   1.560 +  atomHeader             *atomhdr;
   1.561 +  trackHeaderAtom        *tkhd;
   1.562 +  trackReferenceAtom     *tref;
   1.563 +  editListContainerAtom  *edts;
   1.564 +  mediaAtom              *mdia;
   1.565 +  userDataAtom           *udta;
   1.566 +} trackAtom;
   1.567 +
   1.568 +typedef struct ID32Atom
   1.569 +{
   1.570 +  atomHeader *atomhdr;
   1.571 +  mp4_u64    atomcontentloc;
   1.572 +  mp4_u16    language; // top bit is padding, remaining 15 bits is Packed ISO-639-2/T language code 
   1.573 +} ID32Atom;
   1.574 +
   1.575 +typedef struct metaAtom
   1.576 +{
   1.577 +  atomHeader  *atomhdr;
   1.578 +  handlerAtom *hdlr;
   1.579 +  ID32Atom    *ID32;
   1.580 +} metaAtom;
   1.581 +
   1.582 +typedef struct movieAtom
   1.583 +{
   1.584 +  atomHeader            *atomhdr;
   1.585 +  movieHeaderAtom       *mvhd;
   1.586 +  trackAtom             *trakAudio; // audio
   1.587 +  trackAtom             *trakVideo; // video
   1.588 +  objectDescriptorAtom  *iods;
   1.589 +  userDataAtom          *udta;
   1.590 +  metaAtom              *meta;
   1.591 +} movieAtom;
   1.592 +
   1.593 +
   1.594 +typedef struct mediaDataAtom
   1.595 +{
   1.596 +  atomHeader  *atomhdr;
   1.597 +  mp4_u8      *data;
   1.598 +} mediaDataAtom;
   1.599 +
   1.600 +
   1.601 +typedef struct sampleTable
   1.602 +{
   1.603 +  mp4_u32    currentChunk;
   1.604 +
   1.605 +  /* Decoding time to sample */
   1.606 +  mp4_u32    sttsEntryCount;
   1.607 +  mp4_u32    *sttsSampleCount;
   1.608 +  mp4_u32    *sttsSampleDelta;
   1.609 +  mp4_u32    sttsMaxEntryCount;
   1.610 +  mp4_u32    sttsCurrentEntryCount;
   1.611 +
   1.612 +  /* Sample size */
   1.613 +  mp4_u32    stszSampleSize;
   1.614 +  mp4_u32    stszSampleCount;
   1.615 +  mp4_u32    *stszEntrySize;
   1.616 +  mp4_u32    stszMaxSampleCount;
   1.617 +  mp4_u32    stszCurrentSampleCount;
   1.618 +
   1.619 +  /* Sample to chunk */
   1.620 +  mp4_u32    stscEntryCount;
   1.621 +  mp4_u32    *stscFirstChunk;
   1.622 +  mp4_u32    *stscSamplesPerChunk;
   1.623 +  mp4_u32    *stscSampleDescriptionIndex;
   1.624 +  mp4_u32    stscMaxEntryCount;
   1.625 +  mp4_u32    stscCurrentEntryCount;
   1.626 +
   1.627 +  /* Chunk offset */
   1.628 +  mp4_u32    stcoEntryCount;
   1.629 +  mp4_u64    *stcoChunkOffset;
   1.630 +  mp4_u32    stcoMaxEntryCount;
   1.631 +  mp4_u32    stcoCurrentEntryCount;
   1.632 +  mp4_bool   stcoNeed64Bits;
   1.633 +    
   1.634 +  /* Sync sample */
   1.635 +  mp4_u32    stssEntryCount;
   1.636 +  mp4_u32    *stssSampleNumber;
   1.637 +  mp4_u32    stssMaxEntryCount;
   1.638 +  mp4_u32    stssCurrentEntryCount;
   1.639 +  /* Sample Dependency */
   1.640 +  mp4_u32    sdtpEntryCount;
   1.641 +  mp4_u8    *sdtpSampleDependency;
   1.642 +  mp4_u32    sdtpMaxEntryCount;
   1.643 +  mp4_u32    sdtpCurrentEntryCount;
   1.644 +} sampleTable;
   1.645 +
   1.646 +
   1.647 +typedef struct MP4HandleStruct
   1.648 +{
   1.649 +  mp4_u8        sourceType;                /* Determines the type of the source file (CAF or RFile64) */
   1.650 +  void          *file;                     /* FILE * of possible file */
   1.651 +  void          *fs;                       /* File server */
   1.652 +  void          *rfile;                    /* File handle */
   1.653 +  ContentAccess::CData *cfile;             /* used when reading via the CAF and not the file based interfaces */
   1.654 +  mp4_i32		cafError;				   /* variable to store possible CAF error to be reported to client */
   1.655 +  void          *tmpfile;                  /* FILE * of temporary output file */
   1.656 +  void          *metaDataFile[NUM_MDF];    /* File handles for metadata files */
   1.657 +  MP4FileName   metaDataFileName[NUM_MDF]; /* Names of the temporary meta data files */
   1.658 +  MP4FileName   fileName;                  /* Name of the file */
   1.659 +  MP4FileName   tmpFileName;               /* Name of the temporary file */
   1.660 +  mp4_u64       bytesInTmpFile;            /* Number of bytes in temporary file */
   1.661 +  mp4_u64       mediaDataBytes;            /* Number of media data bytes */
   1.662 +  mp4_bool      ftypWritten;               /* Has FTYP been written */
   1.663 +  mp4_u32       flags;                     /* Composing flags */
   1.664 +  mp4_u32       type;                      /* Type of audio/video */
   1.665 +  list_s        *mem;                      /* Memory list */
   1.666 +  mp4_u32       position;                  /* Current position in memory */
   1.667 +  mp4_u32       absPosition;               /* Current absolute position in memory */
   1.668 +  mp4_u64       lastAccessedPosInFile;     /* Last accessed position in a file */
   1.669 +  mp4_u8        *buf;                      /* Temporary buffer space */
   1.670 +  mp4_u8        *diskReadBuf;              /* Memory for file buffering */
   1.671 +  mp4_u32       diskReadPos;               /* Reading position in the file */
   1.672 +  mp4_u64       diskReadBufStart;          /* Position of the start of the buffer */
   1.673 +  mp4_u32       diskReadBufPos;            /* Reading position inside buffer */
   1.674 +  mp4_u32       diskReadSize;              /* Number of bytes in buffer */
   1.675 +  mp4_u8        *diskWriteBuf;             /* Memory for file buffering */
   1.676 +  mp4_bool      ftypRead;                  /* FTYP atom has been read */
   1.677 +  fileTypeAtom  *ftyp;                     /* Pointer to file type atom structure */
   1.678 +  mp4_bool      metaDataComplete;          /* Metadata has been completeley read */
   1.679 +  movieAtom     *moov;                     /* Pointer to movie atom structure */
   1.680 +  mp4_u32       videoSampleNum;            /* Current video sample number */
   1.681 +  mp4_u64       videoFrameOffset;          /* Absolute position of current video frame */
   1.682 +  mp4_u32       videoFrameSize;            /* Size of current video frame in bytes */
   1.683 +  mp4_bool      videoLast;                 /* Has last video sample been read */
   1.684 +  mp4_u32       videoTimeScale;            /* Video timescale */
   1.685 +  mp4_u64       videoDuration;             /* Duration of video when composing */
   1.686 +  mp4_u16       videoWidth;                /* Video image width */
   1.687 +  mp4_u16       videoHeight;               /* Video image height */
   1.688 +  mp4_u32       videoMaxBitrate;           /* MPEG-4 video maximum bitrate */
   1.689 +  mp4_u32       videoAvgBitrate;           /* MPEG-4 video average bitrate */
   1.690 +  mp4_u8        *videoDecSpecificInfo;     /* MPEG-4 video DecoderSpecificInfo */
   1.691 +  mp4_u32       videoDecSpecificInfoSize;  /* MPEG-4 video DecoderSpecificInfo size in bytes */
   1.692 +  sampleTable   *videoSampleTable;         /* Video sample table */
   1.693 +  mp4_u8        videoLevel;                /* Video codec level, default is H.263 level 10 */
   1.694 +  mp4_u32       audioSampleNum;            /* Current audio sample number */
   1.695 +  mp4_u32       audioSampleSize;           /* Size of current audio sample in bytes */
   1.696 +  mp4_u64       audioSampleOffset;         /* Absolute position of current audio frame (in MP4 file) */
   1.697 +  mp4_u32       audioFrameCount;           /* Number of audio frames when composing */
   1.698 +  mp4_u32       audioTimeScale;            /* Audio timescale */
   1.699 +  mp4_u64       audioDuration;             /* Duration of audio when composing */
   1.700 +  mp4_bool      audioLast;                 /* Has last audio sample been read */
   1.701 +  mp4_u8        *audioDecSpecificInfo;     /* MPEG audio DecoderSpecificInfo */
   1.702 +  mp4_u32       audioDecSpecificInfoSize;  /* MPEG audio DecoderSpecificInfo size in bytes */
   1.703 +  sampleTable   *audioSampleTable;         /* Audio sample table */
   1.704 +  mp4_u8        audioFramesPerSample;      /* AMR frames per sample value */
   1.705 +  mp4_u16       audioModeSet;              /* AMR mode set */
   1.706 +  mp4_u32       metaDataBlocks;            /* Number of metadata blocks in memory */
   1.707 +  mp4_bool      metaDataOnDisk;            /* Is (a part of) metadata on the disk */
   1.708 +  mp4_u32       metaDataSize;              /* Size of metadata */
   1.709 +  mp4_u32		videoSampleEntryIndex;	   /* SampleEntry index of the video frame being read */
   1.710 +  mp4_u32		audioSampleEntryIndex;     /* SampleEntry index of the audio frame being read */
   1.711 +  mp4_u8        avcNalUnitLengthSize;      /* byte size of the length field */
   1.712 +  mp4_bool      generate3G2;               /* 3GPP2 File Format Generation is Selected: default:FALSE (Generate 3GP)*/
   1.713 +  mp4_bool      generateMP4;               /* MPEG-4 File Format Generation is Selected: defailt:FALSE (Generate 3GP)*/
   1.714 +  mp4_bool      qcelpStoredAsMPEGAudio;    /* QCELP 13K is registered as MPEG4 Audio: default: FALSE (in QCELPSampleEntry)*/
   1.715 +  mp4_u64       audioMediaDataSize;        /* Total byte size of the written audio data. This is used to calculate the max and avg bitrates */
   1.716 +  mp4_u32       ES_DescriptorSize;         /* size of the ES_Descriptor inside the ESDS box */ 
   1.717 +
   1.718 +  // composeToBuffer:
   1.719 +  mp4_u8 *composeBuffer;
   1.720 +  mp4_bool bufferWrite;
   1.721 +  mp4_u32 bytesProgressed;
   1.722 +  mp4_u32 ftypdelta;
   1.723 +  mp4_u32 *composedSize;
   1.724 +
   1.725 +  CFileWriter*  filewriter;                /* Async buffering filewriter */
   1.726 +  CMetaDataFileWriter* metadatafilewriter;  /* Async buffering metadata temp file writer */
   1.727 +
   1.728 +  mp4_bool      LastWriteDataCalled;       /* When TRUE, it indicates that ParseWriteData() function is called for the last time */ 
   1.729 +  mp4_bool      FileHandleFromOutside;     /* When TRUE file handle is passed to library instead of file name, don't close file in end */
   1.730 +
   1.731 +  mp4_bool      metaDataFileEmpty[NUM_MDF]; /* when TRUE it indicates that metadata file has been read and rest of data is in readbuffer of metadatafilewriter */
   1.732 +  
   1.733 +  userDataAtom* moovUDTA;   // used to compose MOOV UDTA (User Data) 
   1.734 +  userDataAtom* audioUDTA;  // used to compose AudioTrack UDTA (User Data) 
   1.735 +  userDataAtom* videoUDTA;  // used to compose VideoTrack UDTA (User Data)
   1.736 +  
   1.737 +  TDriveNumber   fileHandleDrive;  /* Used when we get file handle to library from outside. Used to indicate which drive are metadata temp files written.*/
   1.738 +  
   1.739 +  // Custom buffer size additions:
   1.740 +  mp4_u32 mediaWriteBufferSize;
   1.741 +  mp4_u32 metaWriteBufferSize;
   1.742 +  mp4_u32 writeBufferMaxCount;
   1.743 +  mp4_u32 readBufferSize;
   1.744 +  
   1.745 +  // Async parsing observer
   1.746 +  M3GPMP4LibAsyncObserver* asyncObserver;
   1.747 +  CFileAsyncParser* asyncReader;
   1.748 +  M3GPMP4LibAsyncTempFileRemoverObserver* tempFileRemoverObserver;
   1.749 +  
   1.750 +  void *file32Duplicate; //this is a RFile64 duplicate of the RFile used in Open 
   1.751 +} MP4HandleStruct;
   1.752 +
   1.753 +
   1.754 +typedef MP4HandleStruct *MP4HandleImp;
   1.755 +
   1.756 +
   1.757 +mp4_i32 metaDataAvailable(MP4HandleImp handle);
   1.758 +mp4_i32 readFTYP(MP4HandleImp handle, fileTypeAtom *ftyp);
   1.759 +mp4_i32 readMetaData(MP4HandleImp handle);
   1.760 +mp4_i32 readMoov(MP4HandleImp handle, movieAtom *moov);
   1.761 +mp4_i32 readAtomHeader(MP4HandleImp handle, atomHeader *ah);
   1.762 +mp4_i32 readFullAtomHeader(MP4HandleImp handle, atomHeader *ah);
   1.763 +mp4_i32 readMVHD(MP4HandleImp handle, movieHeaderAtom *mvhd);
   1.764 +mp4_i32 readIODS(MP4HandleImp handle, objectDescriptorAtom *iods);
   1.765 +mp4_i32 readTRAK(MP4HandleImp handle, trackAtom *trak);
   1.766 +mp4_i32 readUnknown(MP4HandleImp handle);
   1.767 +mp4_i32 readTKHD(MP4HandleImp handle, trackHeaderAtom *tkhd);
   1.768 +mp4_i32 readTREF(MP4HandleImp handle, trackReferenceAtom *tref);
   1.769 +mp4_i32 readEDTS(MP4HandleImp handle, editListContainerAtom *edts);
   1.770 +mp4_i32 readMDIA(MP4HandleImp handle, mediaAtom *mdia);
   1.771 +mp4_i32 readMDHD(MP4HandleImp handle, mediaHeaderAtom *mdhd);
   1.772 +mp4_i32 readHDLR(MP4HandleImp handle, handlerAtom *hdlr);
   1.773 +mp4_i32 readMINF(MP4HandleImp handle, mediaInformationAtom *minf);
   1.774 +mp4_i32 readVMHD(MP4HandleImp handle, videoMediaHeaderAtom *vmhd);
   1.775 +mp4_i32 readSMHD(MP4HandleImp handle, soundMediaHeaderAtom *smhd);
   1.776 +mp4_i32 readDINF(MP4HandleImp handle, dataInformationAtom *dinf);
   1.777 +mp4_i32 readDREF(MP4HandleImp handle, dataReferenceAtom *dref);
   1.778 +mp4_i32 readURL(MP4HandleImp handle, dataEntryURLAtom *url);
   1.779 +mp4_i32 readURN(MP4HandleImp handle, dataEntryURNAtom *urn);
   1.780 +mp4_i32 readSTBL(MP4HandleImp handle, sampleTableAtom *stbl);
   1.781 +mp4_i32 readSTTS(MP4HandleImp handle, timeToSampleAtom *stts);
   1.782 +mp4_i32 readCTTS(MP4HandleImp handle, compositionTimeToSampleAtom *ctts);
   1.783 +mp4_i32 readSTSS(MP4HandleImp handle, syncSampleAtom *stss);
   1.784 +mp4_i32 readSTSD(MP4HandleImp handle, sampleDescriptionAtom *stsd);
   1.785 +mp4_i32 readSTSZ(MP4HandleImp handle, sampleSizeAtom *stsz);
   1.786 +mp4_i32 readSTZ2(MP4HandleImp handle, sampleSizeAtom *stsz);
   1.787 +mp4_i32 readSTSC(MP4HandleImp handle, sampleToChunkAtom *stsc);
   1.788 +mp4_i32 readSTCO(MP4HandleImp handle, chunkOffsetAtom *stco);
   1.789 +mp4_i32 readCO64(MP4HandleImp handle, chunkOffset64Atom *stco64);
   1.790 +mp4_i32 readMP4V(MP4HandleImp handle, visualSampleEntry *mp4v);
   1.791 +mp4_i32 readMP4A(MP4HandleImp handle, audioSampleEntry *mp4a);
   1.792 +mp4_i32 readMP4S(MP4HandleImp handle, mpegSampleEntry *mp4s);
   1.793 +mp4_i32 readS263(MP4HandleImp handle, h263SampleEntry *s263);
   1.794 +mp4_i32 readSAMR(MP4HandleImp handle, amrSampleEntry *samr);
   1.795 +mp4_i32 readSAWB(MP4HandleImp handle, amrSampleEntry *sawb);
   1.796 +mp4_i32 readESD(MP4HandleImp handle, ESDAtom *esd);
   1.797 +mp4_i32 readD263(MP4HandleImp handle, h263SpecificAtom *d263);
   1.798 +mp4_i32 readBITR(MP4HandleImp handle, bitrateAtom *bitr);
   1.799 +mp4_i32 readDAMR(MP4HandleImp handle, amrDecSpecStruc *damr);
   1.800 +mp4_i32 readMeta(MP4HandleImp handle, metaAtom *meta);
   1.801 +/* avc inclusions*/
   1.802 +mp4_i32 readAVC1(MP4HandleImp handle, avcSampleEntry *avc1);
   1.803 +mp4_i32 readSDTP(MP4HandleImp handle, sampleDependencyAtom *sdtp,  mp4_i32 sample_count);
   1.804 +/* QCELP 13k inclusions */
   1.805 +mp4_i32 readSQCP(MP4HandleImp handle, qcelpSampleEntry *sqcp);
   1.806 +mp4_i32 readDQCP(MP4HandleImp handle, qcelpDecSpecStruc *dqcp);
   1.807 +/* inline related */
   1.808 +mp4_i32 readID32(MP4HandleImp handle, ID32Atom *ID32);
   1.809 +
   1.810 +mp4_i32 freeFTYP(fileTypeAtom *ftyp);
   1.811 +mp4_i32 freeMOOV(movieAtom *moov);
   1.812 +mp4_i32 freeAtomHeader(atomHeader *atomhdr);
   1.813 +mp4_i32 freeMVHD(movieHeaderAtom *mvhd);
   1.814 +mp4_i32 freeTRAK(trackAtom *trak);
   1.815 +mp4_i32 freeTKHD(trackHeaderAtom *tkhd);
   1.816 +mp4_i32 freeTREF(trackReferenceAtom *tref);
   1.817 +mp4_i32 freeEDTS(editListContainerAtom *edts);
   1.818 +mp4_i32 freeMDIA(mediaAtom *mdia);
   1.819 +mp4_i32 freeMDHD(mediaHeaderAtom *mdhd);
   1.820 +mp4_i32 freeHDLR(handlerAtom *hdlr);
   1.821 +mp4_i32 freeMINF(mediaInformationAtom *minf);
   1.822 +mp4_i32 freeVMHD(videoMediaHeaderAtom *vmhd);
   1.823 +mp4_i32 freeSMHD(soundMediaHeaderAtom *smhd);
   1.824 +mp4_i32 freeDINF(dataInformationAtom *dinf);
   1.825 +mp4_i32 freeDREF(dataReferenceAtom *dref);
   1.826 +mp4_i32 freeURL(dataEntryURLAtom *url);
   1.827 +mp4_i32 freeURN(dataEntryURNAtom *urn);
   1.828 +mp4_i32 freeSTBL(sampleTableAtom *stbl);
   1.829 +mp4_i32 freeSTTS(timeToSampleAtom *stts);
   1.830 +mp4_i32 freeCTTS(compositionTimeToSampleAtom *ctts);
   1.831 +mp4_i32 freeSTSD(sampleDescriptionAtom *stsd);
   1.832 +mp4_i32 freeMP4V(visualSampleEntry *mp4v);
   1.833 +mp4_i32 freeESD(ESDAtom *esd);
   1.834 +mp4_i32 freeMP4A(audioSampleEntry *mp4a);
   1.835 +mp4_i32 freeMP4S(mpegSampleEntry *mp4s);
   1.836 +mp4_i32 freeS263(h263SampleEntry *s263);
   1.837 +mp4_i32 freeD263(h263SpecificAtom *d263);
   1.838 +mp4_i32 freeBITR(bitrateAtom *bitr);
   1.839 +mp4_i32 freeSAMR(amrSampleEntry *samr);
   1.840 +mp4_i32 freeSAWB(amrSampleEntry *sawb);
   1.841 +mp4_i32 freeDAMR(amrDecSpecStruc *damr);
   1.842 +mp4_i32 freeSTSZ(sampleSizeAtom *stsz);
   1.843 +mp4_i32 freeSTSC(sampleToChunkAtom *stsc);
   1.844 +mp4_i32 freeSTCO(chunkOffsetAtom *stco);
   1.845 +mp4_i32 freeSTCO64(chunkOffset64Atom *stco64);
   1.846 +mp4_i32 freeSTSS(syncSampleAtom *stss);
   1.847 +mp4_i32 freeSTSH(shadowSyncSampleAtom *stsh);
   1.848 +mp4_i32 freeIODS(objectDescriptorAtom *iods);
   1.849 +mp4_i32 readUDTA(MP4HandleImp handle, userDataAtom *udta);
   1.850 +mp4_i32 freeUDTA(userDataAtom *udta);
   1.851 +mp4_i32 freeSDTP(sampleDependencyAtom* sdtp);
   1.852 +mp4_i32 freeMETA(metaAtom *meta);
   1.853 +/* The following and AVC related */
   1.854 +mp4_i32 freeAVC1(avcSampleEntry *avc1);
   1.855 +mp4_i32 freeM4DS(mpeg4ExtensionDescriptorsAtom *m4ds);
   1.856 +mp4_i32 freeBTRT(mpeg4BitrateAtom *btrt);
   1.857 +mp4_i32 freeAVCC(avcConfigurationAtom *avcc);
   1.858 +/* QCELP 13K related */
   1.859 +mp4_i32 freeSQCP(qcelpSampleEntry *sqcp);
   1.860 +mp4_i32 freeDQCP(qcelpDecSpecStruc *dqcp);
   1.861 +/* inline related */
   1.862 +mp4_i32 freeID32(ID32Atom *ID32);
   1.863 +
   1.864 +mp4_i32 determineVideoLength(MP4HandleImp handle, mp4_u32 *videolength);
   1.865 +mp4_i32 determineFrameRate(MP4HandleImp handle, mp4_double *framerate);
   1.866 +mp4_i32 determineVideoType(MP4HandleImp handle, mp4_u32 *videotype);
   1.867 +mp4_i32 determineVideoResolution(MP4HandleImp handle, mp4_u32 *videowidth, mp4_u32 *videoheight);
   1.868 +mp4_i32 determineVideoTimeScale(MP4HandleImp handle, mp4_u32 *timescale);
   1.869 +mp4_i32 determineAudioLength(MP4HandleImp handle, mp4_u32 *audiolength);
   1.870 +mp4_i32 determineAudioType(MP4HandleImp handle, mp4_u32 *audiotype);
   1.871 +mp4_i32 determineAudioFramesPerSample(MP4HandleImp handle, mp4_u8 *framespersample);
   1.872 +mp4_i32 determineAudioTimeScale(MP4HandleImp handle, mp4_u32 *timescale);
   1.873 +mp4_i32 determineAudioAverageBitRate(MP4HandleImp handle, mp4_u32 *averagebitrate);
   1.874 +mp4_i32 determineStreamSize(MP4HandleImp handle, mp4_u32 *streamsize);
   1.875 +mp4_i32 determineStreamAverageBitRate(MP4HandleImp handle, mp4_u32 *streamaveragebitrate, mp4_u32 streamsize);
   1.876 +mp4_i32 advanceVideoFrame(MP4HandleImp handle, trackAtom *trak);
   1.877 +mp4_i32 resolveVideoSampleOffset(MP4HandleImp handle, sampleTableAtom *stbl);
   1.878 +mp4_i32 resolveVideoSampleSize(MP4HandleImp handle, sampleSizeAtom *stsz);
   1.879 +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);
   1.880 +mp4_i32 isVideoFrameKeyFrame(MP4HandleImp handle, trackAtom *trak, mp4_bool *keyframe);
   1.881 +mp4_i32 convertVideoSampleToTime(MP4HandleImp handle, mediaAtom *mdia, mp4_u32 *framenumber, mp4_u32 *timestamp2);
   1.882 +mp4_i32 advanceAudioSample(MP4HandleImp handle, trackAtom *trak);
   1.883 +mp4_i32 resolveAudioSampleOffset(MP4HandleImp handle, sampleTableAtom *stbl);
   1.884 +mp4_i32 resolveAudioSampleSize(MP4HandleImp handle, sampleSizeAtom *stsz);
   1.885 +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);
   1.886 +mp4_i32 convertAudioSampleToTime(MP4HandleImp handle, mediaAtom *mdia, mp4_u32 *timestamp, mp4_u32 *timestamp2);
   1.887 +mp4_i32 convertTimeToSample(MP4HandleImp handle, trackAtom *trak, mp4_u32 position, mp4_u32 *sample);
   1.888 +mp4_i32 goToVideoSample(MP4HandleImp handle, trackAtom *trak, mp4_u32 sample);
   1.889 +mp4_i32 goToAudioSample(MP4HandleImp handle, trackAtom *trak, mp4_u32 sample);
   1.890 +mp4_i32 findVideoKeyFrame(MP4HandleImp handle, trackAtom *trak, mp4_u32 sample, mp4_u32 *newsample);
   1.891 +mp4_i32 fetchAudioSampleAsync(MP4HandleImp handle, trackAtom *trak, mp4_u8 *buffer, mp4_u32* buffersize);
   1.892 +mp4_i32 fetchVideoFrameAsync(MP4HandleImp handle, trackAtom *trak, mp4_u8 *buffer, mp4_u32* buffersize);
   1.893 +mp4_i64 getChunkOffset(sampleTableAtom *stbl, mp4_u32 index); 
   1.894 +#endif
   1.895 +
   1.896 + 
   1.897 +// End of File