Skip to content

Commit

Permalink
chore: Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
macmade committed Jul 3, 2024
1 parent ffdc285 commit 5b8c416
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 38 deletions.
8 changes: 4 additions & 4 deletions ISOBMFF/include/ISOBMFF/MDHD.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ namespace ISOBMFF
uint64_t GetModificationTime() const;
uint32_t GetTimescale() const;
uint64_t GetDuration() const;
uint8_t GetPad() const;
uint8_t GetLanguage0() const;
uint8_t GetLanguage1() const;
uint8_t GetLanguage2() const;
uint8_t GetPad() const;
uint8_t GetLanguage0() const;
uint8_t GetLanguage1() const;
uint8_t GetLanguage2() const;
uint16_t GetPredefined() const;

void SetCreationTime( uint64_t value );
Expand Down
6 changes: 3 additions & 3 deletions ISOBMFF/include/ISOBMFF/STTS.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ namespace ISOBMFF
void ReadData( Parser & parser, BinaryStream & stream ) override;
std::vector< std::pair< std::string, std::string > > GetDisplayableProperties() const override;

size_t GetEntryCount() const;
uint32_t GetSampleCount(size_t index) const;
uint32_t GetSampleOffset(size_t index) const;
size_t GetEntryCount() const;
uint32_t GetSampleCount( size_t index ) const;
uint32_t GetSampleOffset( size_t index ) const;

ISOBMFF_EXPORT friend void swap( STTS & o1, STTS & o2 );

Expand Down
1 change: 0 additions & 1 deletion ISOBMFF/source/BinaryDataStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
*/

#include <string.h>

#include <fstream>
#include <cmath>
#include <vector>
Expand Down
36 changes: 21 additions & 15 deletions ISOBMFF/source/MDHD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ namespace ISOBMFF
uint64_t _modificationTime;
uint32_t _timescale;
uint64_t _duration;
uint8_t _pad;
uint8_t _language0;
uint8_t _language1;
uint8_t _language2;
uint8_t _pad;
uint8_t _language0;
uint8_t _language1;
uint8_t _language2;
uint16_t _predefined;
};

Expand Down Expand Up @@ -103,6 +103,7 @@ namespace ISOBMFF
{
u64 = stream.ReadBigEndianUInt32();
}

this->SetCreationTime( u64 );

if( this->GetVersion() == 1 )
Expand All @@ -113,9 +114,11 @@ namespace ISOBMFF
{
u64 = stream.ReadBigEndianUInt32();
}

this->SetModificationTime( u64 );

u32 = stream.ReadBigEndianUInt32();

this->SetTimescale( u32 );

if( this->GetVersion() == 1 )
Expand All @@ -126,15 +129,18 @@ namespace ISOBMFF
{
u64 = stream.ReadBigEndianUInt32();
}

this->SetDuration( u64 );

u16 = stream.ReadBigEndianUInt16();

this->SetPad( u16 >> 15 );
this->SetLanguage0( (u16 >> 10) & 0b11111 );
this->SetLanguage1( (u16 >> 5) & 0b11111 );
this->SetLanguage2( (u16 >> 0) & 0b11111 );
this->SetLanguage0( ( u16 >> 10 ) & 0b11111 );
this->SetLanguage1( ( u16 >> 5 ) & 0b11111 );
this->SetLanguage2( ( u16 >> 0 ) & 0b11111 );

u16 = stream.ReadBigEndianUInt16();

this->SetPredefined( u16 );
}

Expand All @@ -154,14 +160,14 @@ namespace ISOBMFF
auto props( FullBox::GetDisplayableProperties() );

props.push_back( { "Creation time", std::to_string( this->GetCreationTime() ) } );
props.push_back( { "Modification time", std::to_string( this->GetModificationTime() ) } );
props.push_back( { "Timescale", std::to_string( this->GetTimescale() ) } );
props.push_back( { "Duration", std::to_string( this->GetDuration() ) } );
props.push_back( { "Pad", std::to_string( this->GetPad() ) } );
props.push_back( { "Language0", std::to_string( this->GetLanguage0() ) } );
props.push_back( { "Language1", std::to_string( this->GetLanguage1() ) } );
props.push_back( { "Language2", std::to_string( this->GetLanguage2() ) } );
props.push_back( { "Predefined", std::to_string( this->GetPredefined() ) } );
props.push_back( { "Modification time", std::to_string( this->GetModificationTime() ) } );
props.push_back( { "Timescale", std::to_string( this->GetTimescale() ) } );
props.push_back( { "Duration", std::to_string( this->GetDuration() ) } );
props.push_back( { "Pad", std::to_string( this->GetPad() ) } );
props.push_back( { "Language0", std::to_string( this->GetLanguage0() ) } );
props.push_back( { "Language1", std::to_string( this->GetLanguage1() ) } );
props.push_back( { "Language2", std::to_string( this->GetLanguage2() ) } );
props.push_back( { "Predefined", std::to_string( this->GetPredefined() ) } );

return props;
}
Expand Down
33 changes: 18 additions & 15 deletions ISOBMFF/source/STTS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ namespace ISOBMFF
IMPL( const IMPL & o );
~IMPL();

std::vector<uint32_t> _sample_count;
std::vector<uint32_t> _sample_offset;
std::vector< uint32_t > _sample_count;
std::vector< uint32_t > _sample_offset;
};

STTS::STTS():
Expand Down Expand Up @@ -88,18 +88,22 @@ namespace ISOBMFF
FullBox::ReadData( parser, stream );

uint32_t entry_count = stream.ReadBigEndianUInt32();
for (uint32_t i = 0; i < entry_count; i++) {
this->impl->_sample_count.push_back(stream.ReadBigEndianUInt32());
this->impl->_sample_offset.push_back(stream.ReadBigEndianUInt32());

for( uint32_t i = 0; i < entry_count; i++ )
{
this->impl->_sample_count.push_back( stream.ReadBigEndianUInt32() );
this->impl->_sample_offset.push_back( stream.ReadBigEndianUInt32() );
}
}

std::vector< std::pair< std::string, std::string > > STTS::GetDisplayableProperties() const
{
auto props( FullBox::GetDisplayableProperties() );
for (unsigned int index = 0; index < this->GetEntryCount(); index++) {
props.push_back( { "Sample Count", std::to_string( this->GetSampleCount(index) ) } );
props.push_back( { "Sample Offset", std::to_string( this->GetSampleOffset(index) ) } );

for( unsigned int index = 0; index < this->GetEntryCount(); index++ )
{
props.push_back( { "Sample Count", std::to_string( this->GetSampleCount( index) ) } );
props.push_back( { "Sample Offset", std::to_string( this->GetSampleOffset( index) ) } );
}

return props;
Expand All @@ -110,23 +114,22 @@ namespace ISOBMFF
return this->impl->_sample_count.size();
}

uint32_t STTS::GetSampleCount(size_t index) const
uint32_t STTS::GetSampleCount( size_t index ) const
{
return this->impl->_sample_count[index];
return this->impl->_sample_count[ index ];
}

uint32_t STTS::GetSampleOffset(size_t index) const
uint32_t STTS::GetSampleOffset( size_t index ) const
{
return this->impl->_sample_offset[index];
return this->impl->_sample_offset[ index ];
}

STTS::IMPL::IMPL()
{
}
{}

STTS::IMPL::IMPL( const IMPL & o )
{
this->_sample_count = o._sample_count;
this->_sample_count = o._sample_count;
this->_sample_offset = o._sample_offset;
}

Expand Down

0 comments on commit 5b8c416

Please sign in to comment.