Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for zero-length boxes #29

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ISOBMFF/include/ISOBMFF.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,13 @@
#include <ISOBMFF/STSD.hpp>
#include <ISOBMFF/STSS.hpp>
#include <ISOBMFF/STTS.hpp>
#include <ISOBMFF/CTTS.hpp>
#include <ISOBMFF/FRMA.hpp>
#include <ISOBMFF/SCHM.hpp>
#include <ISOBMFF/HVC1.hpp>
#include <ISOBMFF/AVC1.hpp>
#include <ISOBMFF/AV01.hpp>
#include <ISOBMFF/MP4A.hpp>

#ifdef _WIN32
#include <ISOBMFF/WIN32.hpp>
Expand Down
90 changes: 90 additions & 0 deletions ISOBMFF/include/ISOBMFF/AV01.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 DigiDNA - www.digidna.net
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/

/*!
* @header AV01.hpp
* @copyright (c) 2017, DigiDNA - www.digidna.net
* @author Jean-David Gadina - www.digidna.net
*/

#ifndef ISOBMFF_AV01_HPP
#define ISOBMFF_AV01_HPP

#include <memory>
#include <algorithm>
#include <ISOBMFF/Macros.hpp>
#include <ISOBMFF/FullBox.hpp>
#include <ISOBMFF/Container.hpp>
#include <cstdint>

namespace ISOBMFF
{
class ISOBMFF_EXPORT AV01: public FullBox, public Container
{
public:

AV01();
AV01( const AV01 & o );
AV01( AV01 && o ) noexcept;
virtual ~AV01() override;

AV01 & operator =( AV01 o );

void ReadData( Parser & parser, BinaryStream & stream ) override;
void WriteDescription( std::ostream & os, std::size_t indentLevel ) const override;

std::vector< std::pair< std::string, std::string > > GetDisplayableProperties() const override;

uint16_t GetDataReferenceIndex() const;
uint16_t GetWidth() const;
uint16_t GetHeight() const;
uint32_t GetHorizResolution() const;
uint32_t GetVertResolution() const;
uint16_t GetFrameCount() const;
std::string GetCompressorName() const;
uint16_t GetDepth() const;

void SetDataReferenceIndex( uint16_t value );
void SetWidth( uint16_t value );
void SetHeight( uint16_t value );
void SetHorizResolution( uint32_t value );
void SetVertResolution( uint32_t value );
void SetFrameCount( uint16_t value );
void SetCompressorName( std::string value );
void SetDepth( uint16_t value );

void AddBox( std::shared_ptr< Box > box ) override;
std::vector< std::shared_ptr< Box > > GetBoxes() const override;

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

private:

class IMPL;

std::unique_ptr< IMPL > impl;
};
}

#endif /* ISOBMFF_AV01_HPP */
1 change: 1 addition & 0 deletions ISOBMFF/include/ISOBMFF/BinaryStream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ namespace ISOBMFF
uint32_t ReadUInt32();
uint32_t ReadBigEndianUInt32();
uint32_t ReadLittleEndianUInt32();
int32_t ReadBigEndianInt32();

uint64_t ReadUInt64();
uint64_t ReadBigEndianUInt64();
Expand Down
70 changes: 70 additions & 0 deletions ISOBMFF/include/ISOBMFF/CTTS.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 DigiDNA - www.digidna.net
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/

/*!
* @header CTTS.hpp
* @copyright (c) 2017, DigiDNA - www.digidna.net
* @author Jean-David Gadina - www.digidna.net
*/

#ifndef ISOBMFF_CTTS_HPP
#define ISOBMFF_CTTS_HPP

#include <memory>
#include <algorithm>
#include <ISOBMFF/Macros.hpp>
#include <ISOBMFF/FullBox.hpp>
#include <string>

namespace ISOBMFF
{
class ISOBMFF_EXPORT CTTS: public FullBox
{
public:

CTTS();
CTTS( const CTTS & o );
CTTS( CTTS && o ) noexcept;
virtual ~CTTS() override;

CTTS & operator =( CTTS o );

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;
int32_t GetSampleOffset( size_t index ) const;

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

private:

class IMPL;

std::unique_ptr< IMPL > impl;
};
}

#endif /* ISOBMFF_CTTS_HPP */
80 changes: 80 additions & 0 deletions ISOBMFF/include/ISOBMFF/MP4A.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2017 DigiDNA - www.digidna.net
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/

/*!
* @header MP4A.hpp
* @copyright (c) 2017, DigiDNA - www.digidna.net
* @author https://github.com/leela9980
*/

#ifndef ISOBMFF_MP4A_HPP
#define ISOBMFF_MP4A_HPP

#include <memory>
#include <algorithm>
#include <ISOBMFF/Macros.hpp>
#include <ISOBMFF/FullBox.hpp>
#include <ISOBMFF/Container.hpp>
#include <string>
#include <cstdint>

namespace ISOBMFF
{
class ISOBMFF_EXPORT MP4A: public FullBox, public Container
{
public:

MP4A();
MP4A( const MP4A & o );
MP4A( MP4A && o ) noexcept;
virtual ~MP4A() override;

MP4A & operator =( MP4A o );

void ReadData( Parser & parser, BinaryStream & stream ) override;
void WriteDescription( std::ostream & os, std::size_t indentLevel ) const override;
std::vector< std::pair< std::string, std::string > > GetDisplayableProperties() const override;

uint16_t GetChannelCount() const;
uint16_t GetSampleSize() const;
uint32_t GetSampleRateRaw() const;
float GetSampleRate() const;

void SetChannelCount( uint16_t value );
void SetSampleSize( uint16_t value );
void SetSampleRateRaw( uint32_t value );

void AddBox( std::shared_ptr< Box > box ) override;
std::vector< std::shared_ptr< Box > > GetBoxes() const override;
ISOBMFF_EXPORT friend void swap( MP4A & o1, MP4A & o2 );

private:

class IMPL;

std::unique_ptr< IMPL > impl;
};
}

#endif /* ISOBMFF_MP4A_HPP */
Loading