Skip to content

Commit

Permalink
MVHD atom is now complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-David Gadina committed Mar 30, 2011
1 parent 77f33c0 commit 870cd44
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
33 changes: 32 additions & 1 deletion source/MP4.MVHD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,36 @@ std::string MVHD::description( void )

void MVHD::processData( MP4::BinaryStream * stream, size_t length )
{
stream->ignore( length );
FullBox::processData( stream, length );

if( this->_version == 1 )
{
this->_creationTime = stream->readBigEndianUnsignedLong();
this->_modificationTime = stream->readBigEndianUnsignedLong();
this->_timeScale = stream->readBigEndianUnsignedInteger();
this->_duration = stream->readBigEndianUnsignedLong();
this->_rate = stream->readBigEndianFixedPoint( 16, 16 );
this->_volume = stream->readBigEndianFixedPoint( 8, 8 );

stream->ignore( 10 );
stream->readMatrix( &( this->_matrix ) );
stream->ignore( 24 );

this->_nextTrackId = stream->readBigEndianUnsignedInteger();
}
else
{
this->_creationTime = stream->readBigEndianUnsignedInteger();
this->_modificationTime = stream->readBigEndianUnsignedInteger();
this->_timeScale = stream->readBigEndianUnsignedInteger();
this->_duration = stream->readBigEndianUnsignedInteger();
this->_rate = stream->readBigEndianFixedPoint( 16, 16 );
this->_volume = stream->readBigEndianFixedPoint( 8, 8 );

stream->ignore( 10 );
stream->readMatrix( &( this->_matrix ) );
stream->ignore( 24 );

this->_nextTrackId = stream->readBigEndianUnsignedInteger();
}
}
11 changes: 10 additions & 1 deletion source/include/MP4.MVHD.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,25 @@
#include "mp4.h"
#include "MP4.DataAtom.h"
#include "MP4.BinaryStream.h"
#include "MP4.FullBox.h"

namespace MP4
{
class MVHD : DataAtom
class MVHD : FullBox
{
private:


protected:

uint64_t _creationTime;
uint64_t _modificationTime;
uint32_t _timeScale;
uint64_t _duration;
float _rate;
float _volume;
matrix _matrix;
uint32_t _nextTrackId;

public:

Expand Down

0 comments on commit 870cd44

Please sign in to comment.