Author: wim Date: 2010-06-27 10:40:54 +0200 (Sun, 27 Jun 2010) New Revision: 37273 Changeset: http://dev.haiku-os.org/changeset/37273/haiku Modified: haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Atom.cpp haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Atom.h haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Parser.cpp haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Parser.h haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4TrakAtom.cpp Log: Compiler warning and code style fixes. No functional change. Modified: haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Atom.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Atom.cpp 2010-06-27 06:20:23 UTC (rev 37272) +++ haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Atom.cpp 2010-06-27 08:40:54 UTC (rev 37273) @@ -22,11 +22,15 @@ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <stdio.h> + #include "MP4Atom.h" -AtomBase::AtomBase(BPositionIO *pStream, off_t pstreamOffset, uint32 patomType, uint64 patomSize) +#include <stdio.h> + + +AtomBase::AtomBase(BPositionIO *pStream, off_t pstreamOffset, uint32 patomType, + uint64 patomSize) { theStream = pStream; streamOffset = pstreamOffset; @@ -35,13 +39,16 @@ parentAtom = NULL; } + AtomBase::~AtomBase() { theStream = NULL; parentAtom = NULL; } -char *AtomBase::GetAtomTypeAsFourcc() + +char * +AtomBase::GetAtomTypeAsFourcc() { fourcc[0] = (char)((atomType >> 24) & 0xff); fourcc[1] = (char)((atomType >> 16) & 0xff); @@ -52,9 +59,11 @@ return fourcc; } -char *AtomBase::GetAtomName() + +const char * +AtomBase::GetAtomName() { - char *_result; + const char *_result; _result = OnGetAtomName(); if (_result) { return _result; @@ -69,12 +78,16 @@ return fourcc; } -char *AtomBase::OnGetAtomName() + +const char * +AtomBase::OnGetAtomName() { return NULL; } -void AtomBase::ProcessMetaData() + +void +AtomBase::ProcessMetaData() // ProcessMetaData() - Reads in the basic Atom Meta Data // - Calls OnProcessMetaData() // - Calls ProcessMetaData on each child atom @@ -87,12 +100,16 @@ MoveToEnd(); } -void AtomBase::OnProcessMetaData() + +void +AtomBase::OnProcessMetaData() { MoveToEnd(); } -bool AtomBase::MoveToEnd() + +bool +AtomBase::MoveToEnd() { off_t NewPosition = streamOffset + atomSize; @@ -102,60 +119,79 @@ return true; } -uint64 AtomBase::GetBytesRemaining() + +uint64 +AtomBase::GetBytesRemaining() { off_t EndPosition = streamOffset + atomSize; off_t CurrPosition = GetStream()->Position(); if (CurrPosition > EndPosition) { - printf("ERROR: Read past atom boundary by %Ld bytes\n",CurrPosition - EndPosition); + printf("ERROR: Read past atom boundary by %Ld bytes\n", + CurrPosition - EndPosition); return 0; } return (EndPosition - CurrPosition); } -void AtomBase::DisplayAtoms() + +void +AtomBase::DisplayAtoms() { uint32 aindent = 0; DisplayAtoms(aindent); } -void AtomBase::DisplayAtoms(uint32 pindent) + +void +AtomBase::DisplayAtoms(uint32 pindent) { Indent(pindent); printf("(%s)\n",GetAtomName()); } -void AtomBase::Indent(uint32 pindent) + +void +AtomBase::Indent(uint32 pindent) { for (uint32 i=0;i<pindent;i++) { printf("-"); } } -bool AtomBase::IsKnown() + +bool +AtomBase::IsKnown() { return (OnGetAtomName() != NULL); } -void AtomBase::ReadArrayHeader(array_header *pHeader) + +void +AtomBase::ReadArrayHeader(array_header *pHeader) { Read(&pHeader->NoEntries); } -BPositionIO *AtomBase::OnGetStream() + +BPositionIO * +AtomBase::OnGetStream() { // default implementation return theStream; } -BPositionIO *AtomBase::GetStream() + +BPositionIO * +AtomBase::GetStream() { return OnGetStream(); } -void AtomBase::Read(uint64 *value) + +void +AtomBase::Read(uint64 *value) { uint32 bytes_read; @@ -166,7 +202,9 @@ *value = B_BENDIAN_TO_HOST_INT64(*value); } -void AtomBase::Read(uint32 *value) + +void +AtomBase::Read(uint32 *value) { uint32 bytes_read; @@ -177,7 +215,9 @@ *value = B_BENDIAN_TO_HOST_INT32(*value); } -void AtomBase::Read(int32 *value) + +void +AtomBase::Read(int32 *value) { uint32 bytes_read; @@ -188,7 +228,9 @@ *value = B_BENDIAN_TO_HOST_INT32(*value); } -void AtomBase::Read(uint16 *value) + +void +AtomBase::Read(uint16 *value) { uint32 bytes_read; @@ -199,7 +241,9 @@ *value = B_BENDIAN_TO_HOST_INT16(*value); } -void AtomBase::Read(uint8 *value) + +void +AtomBase::Read(uint8 *value) { uint32 bytes_read; @@ -208,7 +252,9 @@ // Assert((bytes_read == sizeof(uint8),"Read Error"); } -void AtomBase::Read(char *value, uint32 maxread) + +void +AtomBase::Read(char *value, uint32 maxread) { uint32 bytes_read; @@ -217,7 +263,9 @@ // Assert((bytes_read == maxread,"Read Error"); } -void AtomBase::Read(uint8 *value, uint32 maxread) + +void +AtomBase::Read(uint8 *value, uint32 maxread) { uint32 bytes_read; @@ -226,10 +274,13 @@ // Assert((bytes_read == maxread,"Read Error"); } -uint64 AtomBase::GetBits(uint64 buffer, uint8 startBit, uint8 totalBits) + +uint64 +AtomBase::GetBits(uint64 buffer, uint8 startBit, uint8 totalBits) { // startBit should range from 0-63, totalBits should range from 1-64 - if ((startBit < 64) && (totalBits > 0) && (totalBits <= 64) && (startBit + totalBits <= 64)) { + if ((startBit < 64) && (totalBits > 0) && (totalBits <= 64) + && (startBit + totalBits <= 64)) { // Ok pull from the buffer the bits wanted. buffer = buffer << startBit; buffer = buffer >> (64 - (totalBits + startBit) + startBit); @@ -240,10 +291,13 @@ return 0L; } -uint32 AtomBase::GetBits(uint32 buffer, uint8 startBit, uint8 totalBits) + +uint32 +AtomBase::GetBits(uint32 buffer, uint8 startBit, uint8 totalBits) { // startBit should range from 0-31, totalBits should range from 1-32 - if ((startBit < 32) && (totalBits > 0) && (totalBits <= 32) && (startBit + totalBits <= 32)) { + if ((startBit < 32) && (totalBits > 0) && (totalBits <= 32) + && (startBit + totalBits <= 32)) { // Ok pull from the buffer the bits wanted. buffer = buffer << startBit; buffer = buffer >> (32 - (startBit + totalBits) + startBit); @@ -254,15 +308,22 @@ return 0; } -FullAtom::FullAtom(BPositionIO *pStream, off_t pstreamOffset, uint32 patomType, uint64 patomSize) : AtomBase(pStream, pstreamOffset, patomType, patomSize) + +FullAtom::FullAtom(BPositionIO *pStream, off_t pstreamOffset, uint32 patomType, + uint64 patomSize) + : + AtomBase(pStream, pstreamOffset, patomType, patomSize) { } + FullAtom::~FullAtom() { } -void FullAtom::OnProcessMetaData() + +void +FullAtom::OnProcessMetaData() { Read(&Version); Read(&Flags1); @@ -270,16 +331,23 @@ Read(&Flags3); } -AtomContainer::AtomContainer(BPositionIO *pStream, off_t pstreamOffset, uint32 patomType, uint64 patomSize) : AtomBase(pStream, pstreamOffset, patomType, patomSize) + +AtomContainer::AtomContainer(BPositionIO *pStream, off_t pstreamOffset, + uint32 patomType, uint64 patomSize) + : + AtomBase(pStream, pstreamOffset, patomType, patomSize) { TotalChildren = 0; } + AtomContainer::~AtomContainer() { } -void AtomContainer::DisplayAtoms(uint32 pindent) + +void +AtomContainer::DisplayAtoms(uint32 pindent) { Indent(pindent); printf("%ld:(%s)\n",TotalChildren,GetAtomName()); @@ -291,7 +359,9 @@ } -void AtomContainer::ProcessMetaData() + +void +AtomContainer::ProcessMetaData() { SetAtomOffset(GetStream()->Position()); @@ -310,7 +380,9 @@ MoveToEnd(); } -bool AtomContainer::AddChild(AtomBase *pChildAtom) + +bool +AtomContainer::AddChild(AtomBase *pChildAtom) { if (pChildAtom) { pChildAtom->SetParent(this); @@ -321,6 +393,7 @@ return false; } + AtomBase *AtomContainer::GetChildAtom(uint32 patomType, uint32 offset) { for (uint32 i=0;i<TotalChildren;i++) { @@ -334,7 +407,8 @@ } else { if (atomChildren[i]->IsContainer()) { // search container - AtomBase *aAtomBase = (dynamic_cast<AtomContainer *>(atomChildren[i])->GetChildAtom(patomType, offset)); + AtomBase *aAtomBase = dynamic_cast<AtomContainer *> + (atomChildren[i])->GetChildAtom(patomType, offset); if (aAtomBase) { // found in container return aAtomBase; @@ -346,6 +420,8 @@ return NULL; } -void AtomContainer::OnProcessMetaData() + +void +AtomContainer::OnProcessMetaData() { } Modified: haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Atom.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Atom.h 2010-06-27 06:20:23 UTC (rev 37272) +++ haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Atom.h 2010-06-27 08:40:54 UTC (rev 37273) @@ -25,6 +25,7 @@ #ifndef _MP4_ATOM_H #define _MP4_ATOM_H + #include "MP4Structs.h" #include <File.h> @@ -57,151 +58,154 @@ GetTypeAsString() - returns the type as something the user can read*/ + class AtomBase; + typedef AtomBase* AtomBasePtr; typedef std::vector<AtomBasePtr> AtomArray; + class AtomBase { - /* - This is the basic or standard atom. It contains data describing some aspect of the file/stream - */ - private: - off_t streamOffset; - off_t atomOffset; - uint32 atomType; - uint64 atomSize; - char fourcc[5]; // make this an alias to atomType - AtomBase *parentAtom; + off_t streamOffset; + off_t atomOffset; + uint32 atomType; + uint64 atomSize; + char fourcc[5]; // make this an alias to atomType + AtomBase* parentAtom; protected: - BPositionIO *theStream; - void Indent(uint32 pindent); - + BPositionIO *theStream; + void Indent(uint32 pindent); + public: - AtomBase(BPositionIO *pStream, off_t pstreamOffset, uint32 patomType, uint64 patomSize); - virtual ~AtomBase(); + AtomBase(BPositionIO *pStream, off_t pstreamOffset, + uint32 patomType, uint64 patomSize); + virtual ~AtomBase(); - virtual bool IsContainer() {return false;}; + virtual bool IsContainer() {return false;}; - virtual BPositionIO *OnGetStream(); - BPositionIO *GetStream(); + virtual BPositionIO *OnGetStream(); + BPositionIO *GetStream(); - bool IsExtended() {return false;}; - bool IsEndOfAtom() {return (GetStream()->Position() >= off_t(streamOffset + atomSize));}; + bool IsExtended() {return false;}; + bool IsEndOfAtom() {return (GetStream()->Position() >= + off_t(streamOffset + atomSize));}; // Is this a known atom type - bool IsKnown(); + bool IsKnown(); - virtual void DisplayAtoms(uint32 pindent); + virtual void DisplayAtoms(uint32 pindent); - uint64 GetAtomSize() {return atomSize;}; - uint32 GetAtomType() {return atomType;}; - char *GetAtomTypeAsFourcc(); - off_t GetAtomOffset() { return atomOffset; }; - off_t GetStreamOffset() { return streamOffset; }; + uint64 GetAtomSize() {return atomSize;}; + uint32 GetAtomType() {return atomType;}; + char* GetAtomTypeAsFourcc(); + off_t GetAtomOffset() { return atomOffset; }; + off_t GetStreamOffset() { return streamOffset; }; - uint64 GetDataSize() { return atomSize - 8;}; + uint64 GetDataSize() { return atomSize - 8;}; - uint64 GetBytesRemaining(); + uint64 GetBytesRemaining(); - bool IsType(uint32 patomType) { return patomType == atomType; }; + bool IsType(uint32 patomType) { return patomType == atomType; }; - void SetAtomOffset(off_t patomOffset) { atomOffset = patomOffset; }; - void SetStreamOffset(off_t pstreamOffset) { streamOffset = pstreamOffset; }; + void SetAtomOffset(off_t patomOffset) { atomOffset = patomOffset; }; + void SetStreamOffset(off_t pstreamOffset) { streamOffset = pstreamOffset; }; - char *GetAtomName(); + const char *GetAtomName(); - virtual char *OnGetAtomName(); + virtual const char *OnGetAtomName(); // ProcessMetaData() - Reads in the basic Atom Meta Data // - Calls OnProcessMetaData() - virtual void ProcessMetaData(); + virtual void ProcessMetaData(); // OnProcessMetaData() - Subclass override to read/set meta data - virtual void OnProcessMetaData(); + virtual void OnProcessMetaData(); // Move stream ptr to where atom ends in stream (return false on failure) - bool MoveToEnd(); + bool MoveToEnd(); - void DisplayAtoms(); + void DisplayAtoms(); // Many atoms use an array header - void ReadArrayHeader(array_header *pHeader); + void ReadArrayHeader(array_header *pHeader); - void SetParent(AtomBase *pParent) {parentAtom = pParent;}; - AtomBase *GetParent() { return parentAtom;}; + void SetParent(AtomBase *pParent) {parentAtom = pParent;}; + AtomBase* GetParent() { return parentAtom;}; - void Read(uint64 *value); - void Read(uint32 *value); - void Read(int32 *value); - void Read(uint16 *value); - void Read(uint8 *value); - void Read(char *value, uint32 maxread); - void Read(uint8 *value, uint32 maxread); + void Read(uint64 *value); + void Read(uint32 *value); + void Read(int32 *value); + void Read(uint16 *value); + void Read(uint8 *value); + void Read(char *value, uint32 maxread); + void Read(uint8 *value, uint32 maxread); - uint64 GetBits(uint64 buffer, uint8 startBit, uint8 totalBits); - uint32 GetBits(uint32 buffer, uint8 startBit, uint8 totalBits); + uint64 GetBits(uint64 buffer, uint8 startBit, uint8 totalBits); + uint32 GetBits(uint32 buffer, uint8 startBit, uint8 totalBits); }; + class FullAtom : public AtomBase { public: - FullAtom(BPositionIO *pStream, off_t pstreamOffset, uint32 patomType, uint64 patomSize); - virtual ~FullAtom(); + FullAtom(BPositionIO *pStream, off_t pstreamOffset, + uint32 patomType, uint64 patomSize); + virtual ~FullAtom(); - virtual void OnProcessMetaData(); - uint8 GetVersion() {return Version;}; - uint8 GetFlags1() {return Flags1;}; - uint8 GetFlags2() {return Flags2;}; - uint8 GetFlags3() {return Flags3;}; - + virtual void OnProcessMetaData(); + uint8 GetVersion() {return Version;}; + uint8 GetFlags1() {return Flags1;}; + uint8 GetFlags2() {return Flags2;}; + uint8 GetFlags3() {return Flags3;}; + private: - uint8 Version; - uint8 Flags1; - uint8 Flags2; - uint8 Flags3; + uint8 Version; + uint8 Flags1; + uint8 Flags2; + uint8 Flags3; }; + class AtomContainer : public AtomBase { - /* - This is an Atom that contains other atoms. It has children that may be Container Atoms or Standard Atoms - */ - private: - AtomArray atomChildren; - uint32 TotalChildren; + AtomArray atomChildren; + uint32 TotalChildren; - virtual void DisplayAtoms(uint32 pindent); + virtual void DisplayAtoms(uint32 pindent); public: - AtomContainer(BPositionIO *pStream, off_t pstreamOffset, uint32 patomType, uint64 patomSize); - virtual ~AtomContainer(); + AtomContainer(BPositionIO *pStream, off_t pstreamOffset, + uint32 patomType, uint64 patomSize); + virtual ~AtomContainer(); - virtual bool IsContainer() {return true;}; - AtomBase *GetChildAtom(uint32 patomType, uint32 offset=0); - uint32 CountChildAtoms(uint32 patomType); + virtual bool IsContainer() {return true;}; + AtomBase *GetChildAtom(uint32 patomType, uint32 offset=0); + uint32 CountChildAtoms(uint32 patomType); // ProcessMetaData() - Reads in the basic Atom Meta Data // - Calls OnProcessMetaData() // - Calls ProcessMetaData on each child atom // (ensures stream is correct for child via offset) - virtual void ProcessMetaData(); + virtual void ProcessMetaData(); // Add a atom to the children array (return false on failure) - bool AddChild(AtomBase *pChildAtom); + bool AddChild(AtomBase *pChildAtom); // OnProcessMetaData() - Subclass override to read/set meta data - virtual void OnProcessMetaData(); - virtual void OnChildProcessingComplete() {}; + virtual void OnProcessMetaData(); + virtual void OnChildProcessingComplete() {}; }; + extern AtomBase *GetAtom(BPositionIO *pStream); + #endif // _MP4_ATOM_H Modified: haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Parser.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Parser.cpp 2010-06-27 06:20:23 UTC (rev 37272) +++ haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Parser.cpp 2010-06-27 08:40:54 UTC (rev 37273) @@ -22,19 +22,23 @@ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ + + +#include "MP4Parser.h" + #include <stdio.h> #include <DataIO.h> +#include <MediaFormats.h> #include <SupportKit.h> -#include <MediaFormats.h> #include <zlib.h> -#include "MP4Parser.h" #include "BitParser.h" -//static -AtomBase *GetAtom(BPositionIO *pStream) + +AtomBase * +GetAtom(BPositionIO *pStream) { uint32 aAtomType; uint32 aAtomSize; @@ -62,193 +66,171 @@ aRealAtomSize = aAtomSize; } - if (aAtomType == uint32('moov')) { + if (aAtomType == uint32('moov')) return new MOOVAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('mvhd')) { + if (aAtomType == uint32('mvhd')) return new MVHDAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('trak')) { + if (aAtomType == uint32('trak')) return new TRAKAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('tkhd')) { + if (aAtomType == uint32('tkhd')) return new TKHDAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('free')) { + if (aAtomType == uint32('free')) return new FREEAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('skip')) { + if (aAtomType == uint32('skip')) return new SKIPAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('wide')) { + if (aAtomType == uint32('wide')) return new WIDEAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('mdat')) { + if (aAtomType == uint32('mdat')) return new MDATAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('mdia')) { + if (aAtomType == uint32('mdia')) return new MDIAAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('mdhd')) { + if (aAtomType == uint32('mdhd')) return new MDHDAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('hdlr')) { + if (aAtomType == uint32('hdlr')) return new HDLRAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('minf')) { + if (aAtomType == uint32('minf')) return new MINFAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('vmhd')) { + if (aAtomType == uint32('vmhd')) return new VMHDAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('smhd')) { + if (aAtomType == uint32('smhd')) return new SMHDAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('dinf')) { + if (aAtomType == uint32('dinf')) return new DINFAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('stbl')) { + if (aAtomType == uint32('stbl')) return new STBLAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('stsd')) { + if (aAtomType == uint32('stsd')) return new STSDAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('tmcd')) { + if (aAtomType == uint32('tmcd')) return new TMCDAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('stts')) { + if (aAtomType == uint32('stts')) return new STTSAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('pnot')) { + if (aAtomType == uint32('pnot')) return new PNOTAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('stsc')) { + if (aAtomType == uint32('stsc')) return new STSCAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('stco')) { + if (aAtomType == uint32('stco')) return new STCOAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('stss')) { + if (aAtomType == uint32('stss')) return new STSSAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('ctts')) { + if (aAtomType == uint32('ctts')) return new CTTSAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('stsz')) { + if (aAtomType == uint32('stsz')) return new STSZAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('stz2')) { + if (aAtomType == uint32('stz2')) return new STZ2Atom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('ftyp')) { + if (aAtomType == uint32('ftyp')) return new FTYPAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('cmov')) { + if (aAtomType == uint32('cmov')) return new CMOVAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('dcom')) { + if (aAtomType == uint32('dcom')) return new DCOMAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('cmvd')) { + if (aAtomType == uint32('cmvd')) return new CMVDAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('esds')) { + if (aAtomType == uint32('esds')) return new ESDSAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('alac')) { + if (aAtomType == uint32('alac')) return new ALACAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('wave')) { + if (aAtomType == uint32('wave')) return new WAVEAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('dac3')) { + if (aAtomType == uint32('dac3')) return new DAC3Atom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('dec3')) { + if (aAtomType == uint32('dec3')) return new DEC3Atom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } - if (aAtomType == uint32('avcC')) { - return new DecoderConfigAtom(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } + if (aAtomType == uint32('avcC')) + return new DecoderConfigAtom(pStream, aStreamOffset, aAtomType, + aRealAtomSize); return new AtomBase(pStream, aStreamOffset, aAtomType, aRealAtomSize); - } -MOOVAtom::MOOVAtom(BPositionIO *pStream, off_t pStreamOffset, uint32 pAtomType, uint64 pAtomSize) : AtomContainer(pStream, pStreamOffset, pAtomType, pAtomSize) + +MOOVAtom::MOOVAtom(BPositionIO *pStream, off_t pStreamOffset, uint32 pAtomType, + uint64 pAtomSize) : AtomContainer(pStream, pStreamOffset, pAtomType, + pAtomSize) { theMVHDAtom = NULL; } + MOOVAtom::~MOOVAtom() { theMVHDAtom = NULL; } -void MOOVAtom::OnProcessMetaData() + +void +MOOVAtom::OnProcessMetaData() { } -char *MOOVAtom::OnGetAtomName() +const char * +MOOVAtom::OnGetAtomName() { return "MPEG-4 Movie"; } -CMOVAtom::CMOVAtom(BPositionIO *pStream, off_t pStreamOffset, uint32 pAtomType, uint64 pAtomSize) : AtomContainer(pStream, pStreamOffset, pAtomType, pAtomSize) + +CMOVAtom::CMOVAtom(BPositionIO *pStream, off_t pStreamOffset, uint32 pAtomType, + uint64 pAtomSize) : AtomContainer(pStream, pStreamOffset, pAtomType, + pAtomSize) { theUncompressedStream = NULL; } + CMOVAtom::~CMOVAtom() { } -BPositionIO *CMOVAtom::OnGetStream() + +BPositionIO * +CMOVAtom::OnGetStream() { // Use the decompressed stream instead of file stream - if (theUncompressedStream) { + if (theUncompressedStream) return theUncompressedStream; - } return theStream; } -void CMOVAtom::OnProcessMetaData() + +void +CMOVAtom::OnProcessMetaData() { BMallocIO *theUncompressedData; uint8 *outBuffer; @@ -327,7 +309,9 @@ } -void CMOVAtom::OnChildProcessingComplete() + +void +CMOVAtom::OnChildProcessingComplete() { // revert back to file stream once all children have finished if (theUncompressedStream) { @@ -336,44 +320,61 @@ theUncompressedStream = NULL; } -char *CMOVAtom::OnGetAtomName() + +const char * +CMOVAtom::OnGetAtomName() { return "Compressed MPEG-4 Movie"; } -DCOMAtom::DCOMAtom(BPositionIO *pStream, off_t pStreamOffset, uint32 pAtomType, uint64 pAtomSize) : AtomBase(pStream, pStreamOffset, pAtomType, pAtomSize) + +DCOMAtom::DCOMAtom(BPositionIO *pStream, off_t pStreamOffset, uint32 pAtomType, + uint64 pAtomSize) + : + AtomBase(pStream, pStreamOffset, pAtomType, pAtomSize) { } + DCOMAtom::~DCOMAtom() { } -void DCOMAtom::OnProcessMetaData() + +void +DCOMAtom::OnProcessMetaData() { Read(&compressionID); } -char *DCOMAtom::OnGetAtomName() + +const char * +DCOMAtom::OnGetAtomName() { return "Decompression Atom"; } -CMVDAtom::CMVDAtom(BPositionIO *pStream, off_t pStreamOffset, uint32 pAtomType, uint64 pAtomSize) : AtomBase(pStream, pStreamOffset, pAtomType, pAtomSize) + +CMVDAtom::CMVDAtom(BPositionIO *pStream, off_t pStreamOffset, uint32 pAtomType, + uint64 pAtomSize) + : + AtomBase(pStream, pStreamOffset, pAtomType, pAtomSize) { Buffer = NULL; UncompressedSize = 0; BufferSize = 0; } + CMVDAtom::~CMVDAtom() { - if (Buffer) { + if (Buffer) free(Buffer); - } } -void CMVDAtom::OnProcessMetaData() + +void +CMVDAtom::OnProcessMetaData() { Read(&UncompressedSize); @@ -384,20 +385,29 @@ } } -char *CMVDAtom::OnGetAtomName() [... truncated: 3081 lines follow ...]