qtatoms.h
上传用户:dangjiwu
上传日期:2013-07-19
资源大小:42019k
文件大小:48k
- /* ***** BEGIN LICENSE BLOCK *****
- * Version: RCSL 1.0/RPSL 1.0
- *
- * Portions Copyright (c) 1995-2002 RealNetworks, Inc. All Rights Reserved.
- *
- * The contents of this file, and the files included with this file, are
- * subject to the current version of the RealNetworks Public Source License
- * Version 1.0 (the "RPSL") available at
- * http://www.helixcommunity.org/content/rpsl unless you have licensed
- * the file under the RealNetworks Community Source License Version 1.0
- * (the "RCSL") available at http://www.helixcommunity.org/content/rcsl,
- * in which case the RCSL will apply. You may also obtain the license terms
- * directly from RealNetworks. You may not use this file except in
- * compliance with the RPSL or, if you have a valid RCSL with RealNetworks
- * applicable to this file, the RCSL. Please see the applicable RPSL or
- * RCSL for the rights, obligations and limitations governing use of the
- * contents of the file.
- *
- * This file is part of the Helix DNA Technology. RealNetworks is the
- * developer of the Original Code and owns the copyrights in the portions
- * it created.
- *
- * This file, and the files included with this file, is distributed and made
- * available on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
- * EXPRESS OR IMPLIED, AND REALNETWORKS HEREBY DISCLAIMS ALL SUCH WARRANTIES,
- * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS
- * FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- *
- * Technology Compatibility Kit Test Suite(s) Location:
- * http://www.helixcommunity.org/content/tck
- *
- * Contributor(s):
- *
- * ***** END LICENSE BLOCK ***** */
- #ifndef _QTATOMS_H_
- #define _QTATOMS_H_
- /****************************************************************************
- * Defines
- */
- #ifdef QTCONFIG_SPEED_OVER_SIZE
- #define QTATOMS_INLINE inline
- #else // QTCONFIG_SPEED_OVER_SIZE
- #define QTATOMS_INLINE /**/
- #endif // QTCONFIG_SPEED_OVER_SIZE
- /****************************************************************************
- * Includes
- */
- #include "qtbatom.h"
- #include "mempager.h"
- #define QT_BAD_SAMPLE_SIZE 0xFFFFFFFF
- // /26245-013R6.doc says the unity matrix in the track header is:
- // { 0x00010000,0,0,0,0x00010000,0,tx,ty,0x40000000 }, so (tx,ty) is here:
- #define TKHD_MATRIX_TX_LOCATION (sizeof(UINT32) * 6)
- #define TKHD_MATRIX_TY_LOCATION (sizeof(UINT32) * 7)
- #if defined(_SYMBIAN) && !defined(__WINS__)
- # define PACKING __attribute__ ((packed))
- #else
- # define PACKING
- #endif
- /****************************************************************************
- * Atom Type definitions
- */
- typedef enum
- {
- QT_HXROOT = 0, // RN data type
- QT_mdat = QT_ENCODE_TYPE('m', 'd', 'a', 't'),
- QT_moov = QT_ENCODE_TYPE('m', 'o', 'o', 'v'),
- QT_mvhd = QT_ENCODE_TYPE('m', 'v', 'h', 'd'),
- QT_trak = QT_ENCODE_TYPE('t', 'r', 'a', 'k'),
- QT_tkhd = QT_ENCODE_TYPE('t', 'k', 'h', 'd'),
- QT_mdia = QT_ENCODE_TYPE('m', 'd', 'i', 'a'),
- QT_mdhd = QT_ENCODE_TYPE('m', 'd', 'h', 'd'),
- QT_hdlr = QT_ENCODE_TYPE('h', 'd', 'l', 'r'),
- QT_minf = QT_ENCODE_TYPE('m', 'i', 'n', 'f'),
- QT_vmhd = QT_ENCODE_TYPE('v', 'm', 'h', 'd'),
- QT_dinf = QT_ENCODE_TYPE('d', 'i', 'n', 'f'),
- QT_dref = QT_ENCODE_TYPE('d', 'r', 'e', 'f'),
- QT_stbl = QT_ENCODE_TYPE('s', 't', 'b', 'l'),
- QT_stts = QT_ENCODE_TYPE('s', 't', 't', 's'),
- QT_ctts = QT_ENCODE_TYPE('c', 't', 't', 's'),
- QT_stss = QT_ENCODE_TYPE('s', 't', 's', 's'),
- QT_stsd = QT_ENCODE_TYPE('s', 't', 's', 'd'),
- QT_stsz = QT_ENCODE_TYPE('s', 't', 's', 'z'),
- QT_stsc = QT_ENCODE_TYPE('s', 't', 's', 'c'),
- QT_stco = QT_ENCODE_TYPE('s', 't', 'c', 'o'),
- QT_smhd = QT_ENCODE_TYPE('s', 'm', 'h', 'd'),
- QT_hint = QT_ENCODE_TYPE('h', 'i', 'n', 't'),
- QT_mhlr = QT_ENCODE_TYPE('m', 'h', 'l', 'r'),
- QT_alis = QT_ENCODE_TYPE('a', 'l', 'i', 's'),
- QT_rsrc = QT_ENCODE_TYPE('r', 's', 'r', 'c'),
- QT_name = QT_ENCODE_TYPE('n', 'a', 'm', 'e'),
- QT_hinf = QT_ENCODE_TYPE('h', 'i', 'n', 'f'),
- QT_hnti = QT_ENCODE_TYPE('h', 'n', 't', 'i'),
- QT_sdp = QT_ENCODE_TYPE('s', 'd', 'p', ' '),
- QT_trpy = QT_ENCODE_TYPE('t', 'r', 'p', 'y'),
- QT_nump = QT_ENCODE_TYPE('n', 'u', 'm', 'p'),
- QT_tpyl = QT_ENCODE_TYPE('t', 'p', 'y', 'l'),
- QT_payt = QT_ENCODE_TYPE('p', 'a', 'y', 't'),
- QT_udta = QT_ENCODE_TYPE('u', 'd', 't', 'a'),
- QT_edts = QT_ENCODE_TYPE('e', 'd', 't', 's'),
- QT_elst = QT_ENCODE_TYPE('e', 'l', 's', 't'),
- QT_tref = QT_ENCODE_TYPE('t', 'r', 'e', 'f'),
- QT_tims = QT_ENCODE_TYPE('t', 'i', 'm', 's'),
- QT_tsro = QT_ENCODE_TYPE('t', 's', 'r', 'o'),
- QT_snro = QT_ENCODE_TYPE('s', 'n', 'r', 'o'),
- QT_rtp = QT_ENCODE_TYPE('r', 't', 'p', ' '),
- QT_rtpo = QT_ENCODE_TYPE('r', 't', 'p', 'o'),
- QT_iods = QT_ENCODE_TYPE('i', 'o', 'd', 's'),
- QT_vide = QT_ENCODE_TYPE('v', 'i', 'd', 'e'),
- QT_soun = QT_ENCODE_TYPE('s', 'o', 'u', 'n'),
- QT_mp4v = QT_ENCODE_TYPE('m', 'p', '4', 'v'),
- QT_mp4a = QT_ENCODE_TYPE('m', 'p', '4', 'a'),
- QT_ftyp = QT_ENCODE_TYPE('f', 't', 'y', 'p'),
- QT_isom = QT_ENCODE_TYPE('i', 's', 'o', 'm'),
- QT_3gp4 = QT_ENCODE_TYPE('3', 'g', 'p', '4'),
- QT_3gp5 = QT_ENCODE_TYPE('3', 'g', 'p', '5'),
- QT_mp41 = QT_ENCODE_TYPE('m', 'p', '4', '1'),
- QT_mp42 = QT_ENCODE_TYPE('m', 'p', '4', '2'),
- QT_mmp4 = QT_ENCODE_TYPE('m', 'm', 'p', '4'),
- QT_m4a = QT_ENCODE_TYPE('M', '4', 'A', ' '),
- QT_samr = QT_ENCODE_TYPE('s', 'a', 'm', 'r'),
- QT_s263 = QT_ENCODE_TYPE('s', '2', '6', '3'),
- QT_sawb = QT_ENCODE_TYPE('s', 'a', 'w', 'b'),
- QT_alac = QT_ENCODE_TYPE('a', 'l', 'a', 'c')
- // /-->> 3GPP Timed Text box types:
- , QT_text = QT_ENCODE_TYPE('t', 'e', 'x', 't')
- , QT_tx3g = QT_ENCODE_TYPE('t', 'x', '3', 'g')
- , QT_ftab = QT_ENCODE_TYPE('f', 't', 'a', 'b')
- , QT_styl = QT_ENCODE_TYPE('s', 't', 'y', 'l')
- , QT_hlit = QT_ENCODE_TYPE('h', 'l', 'i', 't')
- , QT_hclr = QT_ENCODE_TYPE('h', 'c', 'l', 'r')
- , QT_krok = QT_ENCODE_TYPE('k', 'r', 'o', 'k')
- , QT_href = QT_ENCODE_TYPE('h', 'r', 'e', 'f')
- , QT_tbox = QT_ENCODE_TYPE('t', 'b', 'o', 'x')
- , QT_blnk = QT_ENCODE_TYPE('b', 'l', 'n', 'k')
- // /<<-- end 3GPP Timed Text box types.
- } QTKnownAtomType;
- /****************************************************************************
- * Atom factory
- */
- extern CQTAtom* CreateQTAtom (QTAtomType AtomType,
- ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent,
- ULONG32 ulAtomID = 0,
- UINT16 uChildCount = 0);
- /****************************************************************************
- * Atom Classes
- */
- /****************************************************************************
- * Root Atom Class - RN Data Type
- */
- class CQTRootAtom : public CQTAtom
- {
- public:
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return FALSE; }
- virtual QTAtomType GetType(void) { return QT_HXROOT; }
- };
- /****************************************************************************
- * moov Atom Class
- */
- class CQT_moov_Atom : public CQTAtom
- {
- public:
- /*
- * Constructor/Destructor
- */
- CQT_moov_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return FALSE; }
- virtual QTAtomType GetType(void) { return QT_moov; }
- };
- /****************************************************************************
- * mvhd Atom Class
- */
- class CQT_mvhd_Atom : public CQTAtom
- {
- public:
- /*
- * Leaf Data Format
- */
- struct Data
- {
- UINT8 pVersion[1];
- UINT8 pFlags[3];
- UINT8 pCreatTime[4];
- UINT8 pModifTime[4];
- UINT8 pTimeScale[4];
- UINT8 pDuration[4];
- UINT8 pPrefRate[4];
- UINT8 pPrefVolume[2];
- UINT8 pReserved[10];
- UINT8 pMatrix[36];
- UINT8 pPrevTime[4];
- UINT8 pPrevDuration[4];
- UINT8 pPosterTime[4];
- UINT8 pSelectionTime[4];
- UINT8 pSelectionDuration[4];
- UINT8 pCurrentTime[4];
- UINT8 pNextTrackID[4];
- } PACKING;
- /*
- * Constructor/Destructor
- */
- CQT_mvhd_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return TRUE; }
- virtual QTAtomType GetType(void) { return QT_mvhd; }
- /*
- * Data Access Methods
- */
- ULONG32 Get_TimeScale(void)
- {
- HX_ASSERT(m_pData);
- return GetUL32(((Data*) m_pData)->pTimeScale);
- }
- ULONG32 Get_Duration(void)
- {
- HX_ASSERT(m_pData);
- return GetUL32(((Data*) m_pData)->pDuration);
- }
- };
- /****************************************************************************
- * udta Atom Class
- */
- #define QT_UDTA_TERMINATOR_LENGTH 4
- class CQT_udta_Atom : public CQTAtom
- {
- public:
- /*
- * Constructor/Destructor
- */
- CQT_udta_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return FALSE; }
- virtual QTAtomType GetType(void) { return QT_udta; }
- };
- /****************************************************************************
- * name Atom Class
- */
- class CQT_name_Atom : public CQTAtom
- {
- public:
- /*
- * Leaf Data Format
- */
- struct Data
- {
- UINT8 pName[1];
- } PACKING;
- /*
- * Constructor/Destructor
- */
- CQT_name_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return TRUE; }
- virtual QTAtomType GetType(void) { return QT_name; }
- };
- /****************************************************************************
- * hinf Atom Class
- */
- class CQT_hinf_Atom : public CQTAtom
- {
- public:
- /*
- * Constructor/Destructor
- */
- CQT_hinf_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return FALSE; }
- virtual QTAtomType GetType(void) { return QT_hinf; }
- };
- /****************************************************************************
- * trpy Atom Class
- */
- class CQT_trpy_Atom : public CQTAtom
- {
- public:
- /*
- * Leaf Data Format
- */
- struct Data
- {
- UINT8 pBytesToSendHi[4]; // not including Net. headers
- UINT8 pBytesToSendLo[4]; // not including Net. headers
- } PACKING;
- /*
- * Constructor/Destructor
- */
- CQT_trpy_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return TRUE; }
- virtual QTAtomType GetType(void) { return QT_trpy; }
- /*
- * Data Access Methods
- */
- ULONG32 Get_BytesToSend(void)
- {
- HX_ASSERT(m_pData);
- return GetUL32(((Data*) m_pData)->pBytesToSendLo);
- }
- };
- /****************************************************************************
- * nump Atom Class
- */
- class CQT_nump_Atom : public CQTAtom
- {
- public:
- /*
- * Leaf Data Format
- */
- struct Data
- {
- UINT8 pPacketsToSendHi[4];
- UINT8 pPacketsToSendLo[4];
- } PACKING;
- /*
- * Constructor/Destructor
- */
- CQT_nump_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return TRUE; }
- virtual QTAtomType GetType(void) { return QT_nump; }
- /*
- * Data Access Methods
- */
- ULONG32 Get_PacketsToSend(void)
- {
- HX_ASSERT(m_pData);
- return GetUL32(((Data*) m_pData)->pPacketsToSendLo);
- }
- };
- /****************************************************************************
- * tpyl Atom Class
- */
- class CQT_tpyl_Atom : public CQTAtom
- {
- public:
- /*
- * Leaf Data Format
- */
- struct Data
- {
- UINT8 pBytesToSendHi[4]; // not including RTP or Net. headers
- UINT8 pBytesToSendLo[4]; // not including RTP or Net. headers
- } PACKING;
- /*
- * Constructor/Destructor
- */
- CQT_tpyl_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return TRUE; }
- virtual QTAtomType GetType(void) { return QT_tpyl; }
- /*
- * Data Access Methods
- */
- ULONG32 Get_BytesToSend(void)
- {
- HX_ASSERT(m_pData);
- return GetUL32(((Data*) m_pData)->pBytesToSendLo);
- }
- };
- /****************************************************************************
- * payt Atom Class
- */
- class CQT_payt_Atom : public CQTAtom
- {
- public:
- /*
- * Leaf Data Format
- */
- struct Data
- {
- UINT8 pPayloadType[4];
- UINT8 pPayloadString[1]; // Pascal String
- } PACKING;
- /*
- * Constructor/Destructor
- */
- CQT_payt_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return TRUE; }
- virtual QTAtomType GetType(void) { return QT_payt; }
- /*
- * Data Access Methods
- */
- ULONG32 Get_PayloadType(void)
- {
- HX_ASSERT(m_pData);
- return GetUL32(((Data*) m_pData)->pPayloadType);
- }
- UINT8* Get_PayloadString(void)
- {
- HX_ASSERT(m_pData);
- return (((Data*) m_pData)->pPayloadString);
- }
- };
- /****************************************************************************
- * hnti Atom Class
- */
- class CQT_hnti_Atom : public CQTAtom
- {
- public:
- /*
- * Constructor/Destructor
- */
- CQT_hnti_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return FALSE; }
- virtual QTAtomType GetType(void) { return QT_hnti; }
- };
- /****************************************************************************
- * sdp Atom Class
- */
- class CQT_sdp_Atom : public CQTAtom
- {
- public:
- /*
- * Leaf Data Format
- */
- struct Data
- {
- UINT8 pDesc[1];
- } PACKING;
- /*
- * Constructor/Destructor
- */
- CQT_sdp_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return TRUE; }
- virtual QTAtomType GetType(void) { return QT_sdp; }
- };
- /****************************************************************************
- * rtp Atom Class
- */
- class CQT_rtp_Atom : public CQTAtom
- {
- public:
- /*
- * Leaf Data Format
- */
- struct Data
- {
- UINT8 pSubType[4];
- UINT8 pData[1];
- } PACKING;
- /*
- * Constructor/Destructor
- */
- CQT_rtp_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Data Access Methods
- */
- ULONG32 Get_SubType(void)
- {
- HX_ASSERT(m_pData);
- return GetUL32(((Data*) m_pData)->pSubType);
- }
- UINT8* Get_Data(void)
- {
- HX_ASSERT(m_pData);
- return ((Data*) m_pData)->pData;
- }
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return TRUE; }
- virtual QTAtomType GetType(void) { return QT_rtp; }
- };
- /****************************************************************************
- * trak Atom Class
- */
- class CQT_trak_Atom : public CQTAtom
- {
- public:
- /*
- * Constructor/Destructor
- */
- CQT_trak_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return FALSE; }
- virtual QTAtomType GetType(void) { return QT_trak; }
- };
- /****************************************************************************
- * tkhd Atom Class
- */
- class CQT_tkhd_Atom : public CQTAtom
- {
- public:
- /*
- * Leaf Data Format
- */
- struct Data
- {
- UINT8 pVersion[1];
- UINT8 pFlags[3];
- UINT8 pCreatTime[4];
- UINT8 pModifTime[4];
- UINT8 pTrackID[4];
- UINT8 pReserved1[4];
- UINT8 pDuration[4];
- UINT8 pReserved2[8];
- UINT8 pLayer[2];
- UINT8 pAltGroup[2];
- UINT8 pVolume[2];
- UINT8 pReserved3[2];
- UINT8 Matrix[36];
- UINT8 pTrackWidth[4];
- UINT8 pTrackHeight[4];
- } PACKING;
- /*
- * Constructor/Destructor
- */
- CQT_tkhd_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return TRUE; }
- virtual QTAtomType GetType(void) { return QT_tkhd; }
- /*
- * Data Access Methods
- */
- ULONG32 Get_TrackID(void)
- {
- HX_ASSERT(m_pData);
- return GetUL32(((Data*) m_pData)->pTrackID);
- }
- ULONG32 Get_Duration(void)
- {
- HX_ASSERT(m_pData);
- return GetUL32(((Data*) m_pData)->pDuration);
- }
- double Get_TrackWidth(void)
- {
- HX_ASSERT(m_pData);
- return GetFixed32(((Data*) m_pData)->pTrackWidth);
- }
- double Get_TrackHeight(void)
- {
- HX_ASSERT(m_pData);
- return GetFixed32(((Data*) m_pData)->pTrackHeight);
- }
- double Get_TrackMatrixTx(void)
- {
- HX_ASSERT(m_pData);
- return GetFixed32((UINT8*)(((Data*) m_pData)->Matrix) +
- TKHD_MATRIX_TX_LOCATION);
- }
- double Get_TrackMatrixTy(void)
- {
- HX_ASSERT(m_pData);
- return GetFixed32((UINT8*)(((Data*) m_pData)->Matrix) +
- TKHD_MATRIX_TY_LOCATION);
- }
- };
- /****************************************************************************
- * mdia Atom Class
- */
- class CQT_mdia_Atom : public CQTAtom
- {
- public:
- /*
- * Constructor/Destructor
- */
- CQT_mdia_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return FALSE; }
- virtual QTAtomType GetType(void) { return QT_mdia; }
- };
- /****************************************************************************
- * mdhd Atom Class
- */
- class CQT_mdhd_Atom : public CQTAtom
- {
- public:
- /*
- * Leaf Data Format
- */
- struct Data
- {
- UINT8 pVersion[1];
- UINT8 pFlags[3];
- UINT8 pCreatTime[4];
- UINT8 pModifTime[4];
- UINT8 pTimeScale[4];
- UINT8 pDuration[4];
- UINT8 pLangCode[2];
- UINT8 pQuality[2];
- } PACKING;
- /*
- * Constructor/Destructor
- */
- CQT_mdhd_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return TRUE; }
- virtual QTAtomType GetType(void) { return QT_mdhd; }
- /*
- * Data Access Methods
- */
- ULONG32 Get_TimeScale(void)
- {
- HX_ASSERT(m_pData);
- return GetUL32(((Data*) m_pData)->pTimeScale);
- }
- };
- /****************************************************************************
- * hdlr Atom Class
- */
- class CQT_hdlr_Atom : public CQTAtom
- {
- public:
- /*
- * Leaf Data Format
- */
- struct Data
- {
- UINT8 pVersion[1];
- UINT8 pFlags[3];
- UINT8 pCompType[4];
- UINT8 pCompSubtype[4];
- UINT8 pCompManufacturer[4];
- UINT8 pCompFlags[4];
- UINT8 pCompFlagsMask[4];
- UINT8 pName[1]; // Pascal String
- } PACKING;
- /*
- * Constructor/Destructor
- */
- CQT_hdlr_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return TRUE; }
- virtual QTAtomType GetType(void) { return QT_hdlr; }
- /*
- * Data Access Methods
- */
- ULONG32 Get_CompType(void)
- {
- HX_ASSERT(m_pData);
- return GetUL32(((Data*) m_pData)->pCompType);
- }
- ULONG32 Get_CompSubtype(void)
- {
- HX_ASSERT(m_pData);
- return GetUL32(((Data*) m_pData)->pCompSubtype);
- }
- };
- /****************************************************************************
- * minf Atom Class
- */
- class CQT_minf_Atom : public CQTAtom
- {
- public:
- /*
- * Constructor/Destructor
- */
- CQT_minf_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return FALSE; }
- virtual QTAtomType GetType(void) { return QT_minf; }
- };
- /****************************************************************************
- * dinf Atom Class
- */
- class CQT_dinf_Atom : public CQTAtom
- {
- public:
- /*
- * Constructor/Destructor
- */
- CQT_dinf_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return FALSE; }
- virtual QTAtomType GetType(void) { return QT_dinf; }
- };
- /****************************************************************************
- * dref Atom Class
- */
- #define QT_SELFREF_FLAG 0x00000001
- #define QT_ALIS_END -1 /* Last Marker */
- #define QT_ALIS_ABSPATH 2 /* Absolute path name marker */
- #define QT_ALIS_MAXCOUNT 10 /* Maximum number of Markers */
- class CQT_dref_Atom : public CQTAtom
- {
- public:
- /*
- * Leaf Data Format
- */
- struct ItemEntry
- {
- UINT8 pType[2]; // type of information
- UINT8 pSize[2]; // size of variable data
- UINT8 pData[1]; // actual data
- } varInfo;
-
- struct DataRef
- {
- UINT8 pReserved1[130];
- UINT8 pNLvlFrom[2]; // # of levels from fromFile/toFile until
- UINT8 pNLvlTo[2]; // a common ancestor directory is found
- UINT8 pReserved2[16];
- UINT8 pArray[1]; // variable length info
- } PACKING;
- struct ArrayEntry
- {
- UINT8 pSize[4];
- UINT8 pType[4];
- UINT8 pVersion[1];
- UINT8 pFlags[3];
- UINT8 pDataRef[1];
- } PACKING;
- struct Data
- {
- UINT8 pVersion[1];
- UINT8 pFlags[3];
- UINT8 pNumEntries[4];
- UINT8 pArray[1];
- } PACKING;
- /*
- * Constructor/Destructor
- */
- CQT_dref_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return TRUE; }
- virtual QTAtomType GetType(void) { return QT_dref; }
- /*
- * Data Access Methods
- */
- ULONG32 Get_NumEntries(void)
- {
- HX_ASSERT(m_pData);
- return GetUL32(((Data*) m_pData)->pNumEntries);
- }
- CQT_dref_Atom::ArrayEntry* GetRefEntry(ULONG32 ulArrayIdx)
- {
- HX_ASSERT(m_pData);
- HX_ASSERT(ulArrayIdx < Get_NumEntries());
- return (ArrayEntry*) FindArrayEntry(((Data*) m_pData)->pArray,
- ulArrayIdx);
- }
- ULONG32 Get_RefType(ULONG32 ulArrayIdx)
- {
- HX_ASSERT(m_pData);
- HX_ASSERT(ulArrayIdx < Get_NumEntries());
- return GetUL32(((ArrayEntry*) FindArrayEntry(
- ((Data*) m_pData)->pArray,
- ulArrayIdx))->pType);
- }
- ULONG32 Get_RefFlags(ULONG32 ulArrayIdx)
- {
- HX_ASSERT(m_pData);
- HX_ASSERT(ulArrayIdx < Get_NumEntries());
- return GetFlags(((ArrayEntry*) FindArrayEntry(
- ((Data*) m_pData)->pArray,
- ulArrayIdx))->pFlags);
- }
- ULONG32 Get_RefType(CQT_dref_Atom::ArrayEntry* pRefEntry)
- {
- HX_ASSERT(pRefEntry);
- return GetUL32(pRefEntry->pType);
- }
- ULONG32 Get_RefFlags(CQT_dref_Atom::ArrayEntry* pRefEntry)
- {
- HX_ASSERT(pRefEntry);
- return GetFlags(pRefEntry->pFlags);
- }
- CQT_dref_Atom::DataRef* Get_RefData
- (
- CQT_dref_Atom::ArrayEntry* pRefEntry
- )
- {
- HX_ASSERT(pRefEntry);
- return (CQT_dref_Atom::DataRef*) pRefEntry->pDataRef;
- }
- ULONG32 Get_RefDataLen(CQT_dref_Atom::ArrayEntry* pRefEntry)
- {
- HX_ASSERT(pRefEntry);
- return (GetUL32(pRefEntry->pSize) - sizeof(ArrayEntry) + 1);
- }
- };
- /****************************************************************************
- * stbl Atom Class
- */
- class CQT_stbl_Atom : public CQTAtom
- {
- public:
- /*
- * Constructor/Destructor
- */
- CQT_stbl_Atom(ULONG32 ulOffset,
- ULONG32 ulSize,
- CQTAtom *pParent) : CQTAtom(ulOffset,
- ulSize,
- pParent) {;}
- /*
- * Required Virtual Methods
- */
- virtual BOOL IsLeafType(void) { return FALSE; }
- virtual QTAtomType GetType(void) { return QT_stbl; }
- };
- /****************************************************************************
- * stsd Atom Class
- */
- class CQT_stsd_Atom : public CQTAtom
- {
- public:
- /*
- * Leaf Data Format
- */
- struct TaggedEntry
- {
- UINT8 pSize[4];
- UINT8 pTag[4];
- UINT8 pData[1];
- } PACKING;
- class ArrayEntry
- {
- public:
- UINT8 pSize[4];
- UINT8 pDataFormat[4];
- UINT8 pReserved[6];
- UINT8 pDataRefIdx[2];
- } PACKING;
- class HintArrayEntry : public ArrayEntry
- {
- public:
- UINT8 pHintTrakVersion[2];
- UINT8 pLastCompHintTrakVersion[2];
- UINT8 pMaxPacketSize[4];
- UINT8 pTaggedArray[1];
- } PACKING;
- class AudioArrayEntry : public ArrayEntry // just a space holder in MP4
- {
- public:
- UINT8 pVersion[2];
- UINT8 pRevLevel[2];
- UINT8 pVendor[4];
- UINT8 pNumChannels[2];
- UINT8 pSampleSize[2];
- UINT8 pCompressionID[2];
- UINT8 pPacketSize[2];
- UINT8 pSampleRate[4];
- } PACKING;
- class VideoArrayEntry : public ArrayEntry
- {
- public:
- UINT8 pVersion[2];
- UINT8 pRevision[2];
- UINT8 pVendor[4];
- UINT8 pTemporalQuality[4];
- UINT8 pSpatialQuality[4];
- UINT8 pWidth[2];
- UINT8 pHeight[2];
- UINT8 pHRes[4];
- UINT8 pVRes[4];
- UINT8 pDataSize[4];
- UINT8 pFrameCount[2];
- UINT8 pName[32];
- UINT8 pDepth[2];
- UINT8 pClutID[2];
- } PACKING;
- class AudioMP4ArrayEntry : public AudioArrayEntry
- {
- public:
- UINT8 pSize[4];
- UINT8 pType[4];
- UINT8 pVersion[1];
- UINT8 pFlags[3];
- UINT8 pESDescriptor[1];
- } PACKING;
- class VideoMP4ArrayEntry : public VideoArrayEntry
- {
- public:
- UINT8 pSize[4];
- UINT8 pType[4];
- UINT8 pVersion[1];
- UINT8 pFlags[3];
- UINT8 pESDescriptor[1];
- } PACKING;
- class AudioSAMRArrayEntry : public AudioArrayEntry
- {
- public:
- UINT8 pDecoderSpecificInfo[1];
- } PACKING;
- class AudioSAWBArrayEntry : public AudioArrayEntry
- {
- public:
- UINT8 pDecoderSpecificInfo[1];
- } PACKING;
- class VideoS263ArrayEntry : public VideoArrayEntry
- {
- public:
- UINT8 pDecoderSpecificInfo[1];
- } PACKING;
- class AudioALACArrayEntry : public AudioArrayEntry
- {
- public:
- UINT8 pDecoderSpecificInfo[1];
- } PACKING;
- ////////////////////////////////
- // / 3GPP Timed Text structs:
- ///
- class BoxRecord
- {
- public:
- INT16 top;
- INT16 left;
- INT16 bottom;
- INT16 right;
- } PACKING;
- class StyleRecord
- {
- public:
- UINT16 startChar;
- UINT16 endChar;
- UINT16 fontID;
- UINT8 faceStyleFlags;
- UINT8 fontSize;
- UINT8 textColorRGBA[4];
- } PACKING;
- class FontRecord
- {
- public:
- UINT16 fontID;
- UINT8 fontNameLength;
- UINT8* pFont; // /There are [fontNameLength] bytes in the string;
- } PACKING;
- class FontTableBox // / 慺tab