Skip to content

Commit

Permalink
Merge pull request #28 from chemag/main
Browse files Browse the repository at this point in the history
AVC support
  • Loading branch information
macmade authored Nov 21, 2024
2 parents c34ade3 + 6173649 commit 622fe44
Show file tree
Hide file tree
Showing 7 changed files with 940 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ISOBMFF/include/ISOBMFF.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include <ISOBMFF/INFE.hpp>
#include <ISOBMFF/IROT.hpp>
#include <ISOBMFF/HVCC.hpp>
#include <ISOBMFF/AVCC.hpp>
#include <ISOBMFF/SingleItemTypeReferenceBox.hpp>
#include <ISOBMFF/DIMG.hpp>
#include <ISOBMFF/THMB.hpp>
Expand All @@ -77,6 +78,7 @@
#include <ISOBMFF/FRMA.hpp>
#include <ISOBMFF/SCHM.hpp>
#include <ISOBMFF/HVC1.hpp>
#include <ISOBMFF/AVC1.hpp>

#ifdef _WIN32
#include <ISOBMFF/WIN32.hpp>
Expand Down
90 changes: 90 additions & 0 deletions ISOBMFF/include/ISOBMFF/AVC1.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 AVC1.hpp
* @copyright (c) 2017, DigiDNA - www.digidna.net
* @author Jean-David Gadina - www.digidna.net
*/

#ifndef ISOBMFF_AVC1_HPP
#define ISOBMFF_AVC1_HPP

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

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

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

AVC1 & operator =( AVC1 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( AVC1 & o1, AVC1 & o2 );

private:

class IMPL;

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

#endif /* ISOBMFF_AVC1_HPP */
125 changes: 125 additions & 0 deletions ISOBMFF/include/ISOBMFF/AVCC.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/*******************************************************************************
* 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 AVCC.hpp
* @copyright (c) 2017, DigiDNA - www.digidna.net
* @author Jean-David Gadina - www.digidna.net
*/

#ifndef ISOBMFF_AVCC_HPP
#define ISOBMFF_AVCC_HPP

#include <memory>
#include <algorithm>
#include <ISOBMFF/Macros.hpp>
#include <ISOBMFF/FullBox.hpp>
#include <ISOBMFF/DisplayableObject.hpp>
#include <ISOBMFF/DisplayableObjectContainer.hpp>
#include <vector>
#include <cstdint>

namespace ISOBMFF
{
class ISOBMFF_EXPORT AVCC: public Box, public DisplayableObjectContainer
{
public:

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

AVCC & operator =( AVCC o );

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

virtual std::vector< std::shared_ptr< DisplayableObject > > GetDisplayableObjects() const override;
virtual std::vector< std::pair< std::string, std::string > > GetDisplayableProperties() const override;

uint8_t GetConfigurationVersion() const;
uint8_t GetAVCProfileIndication() const;
uint8_t GetProfileCompatibility() const;
uint8_t GetAVCLevelIndication() const;
uint8_t GetLengthSizeMinusOne() const;
uint8_t GetNumOfSequenceParameterSets() const;
uint8_t GetNumOfPictureParameterSets() const;

void SetConfigurationVersion( uint8_t value );
void SetAVCProfileIndication( uint8_t value );
void SetProfileCompatibility( uint8_t value );
void SetAVCLevelIndication( uint8_t value );
void SetLengthSizeMinusOne( uint8_t value );
void SetNumOfSequenceParameterSets( uint8_t value );
void SetNumOfPictureParameterSets( uint8_t value );


class ISOBMFF_EXPORT NALUnit: public DisplayableObject
{
public:

NALUnit();
NALUnit( BinaryStream & stream );
NALUnit( const NALUnit & o );
NALUnit( NALUnit && o ) noexcept;
virtual ~NALUnit() override;

NALUnit & operator =( NALUnit o );

std::string GetName() const override;

std::vector< uint8_t > GetData() const;
void SetData( const std::vector< uint8_t > & value );

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

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

private:

class IMPL;

std::unique_ptr< IMPL > impl;
};


std::vector< std::shared_ptr< NALUnit > > GetSequenceParameterSetNALUnits() const;
void AddSequenceParameterSetNALUnit( std::shared_ptr< NALUnit > nal_unit );

std::vector< std::shared_ptr< NALUnit > > GetPictureParameterSetNALUnits() const;
void AddPictureParameterSetNALUnit( std::shared_ptr< NALUnit > nal_unit );


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

private:

class IMPL;

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

#endif /* ISOBMFF_AVCC_HPP */
Loading

0 comments on commit 622fe44

Please sign in to comment.