Loading...
Searching...
No Matches
asfvideo.hpp
// SPDX-License-Identifier: GPL-2.0-or-later
// Spec : Advanced Systems Format (ASF) Specification : Revision 01.20.05 :
// https://exse.eyewated.com/fls/54b3ed95bbfb1a92.pdf
#pragma once
// *****************************************************************************
#include <array>
#include "exiv2lib_export.h"
// included header files
#include "image.hpp"
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
// *****************************************************************************
// class definitions
class EXIV2API AsfVideo : public Image {
public:
explicit AsfVideo(BasicIo::UniquePtr io);
void readMetadata() override;
void writeMetadata() override;
[[nodiscard]] std::string mimeType() const override;
/* @class GUID_struct
*
* @brief A class to represent a globally unique identifier (GUID) structure
*
* This class represents a globally unique identifier (GUID) structure which is used to identify objects in a
* distributed environment. A GUID is a unique identifier that is generated on a computer and can be used to
* identify an object across different systems. The GUID structure is comprised of four 32-bit values and an
* array of 8 bytes.
*
* @note The byte order of the GUID structure is in little endian.
*
* @see https://en.wikipedia.org/wiki/Globally_unique_identifier
*
*/
class GUIDTag {
uint32_t data1_;
uint16_t data2_;
uint16_t data3_;
std::array<byte, 8> data4_;
public:
bool operator==(const GUIDTag& other) const;
// Constructor to create a GUID object by passing individual values for each attribute
GUIDTag(unsigned int data1, unsigned short data2, unsigned short data3, std::array<byte, 8> data4);
// Constructor to create a GUID object from a byte array
explicit GUIDTag(const uint8_t* bytes);
std::string to_string();
bool operator<(const GUIDTag& other) const;
};
private:
static constexpr size_t CODEC_TYPE_VIDEO = 1;
static constexpr size_t CODEC_TYPE_AUDIO = 2;
class HeaderReader {
DataBuf IdBuf_;
uint64_t size_{};
uint64_t remaining_size_{};
public:
explicit HeaderReader(const BasicIo::UniquePtr& io);
[[nodiscard]] uint64_t getSize() const {
return size_;
}
[[nodiscard]] uint64_t getRemainingSize() const {
return remaining_size_;
}
[[nodiscard]] DataBuf& getId() {
return IdBuf_;
}
};
protected:
void decodeBlock();
void decodeHeader();
void fileProperties();
void streamProperties();
void codecList();
void contentDescription();
void extendedStreamProperties();
void headerExtension() const;
void extendedContentDescription();
void DegradableJPEGMedia();
private:
uint64_t height_{};
uint64_t width_{};
}; // Class AsfVideo
// *****************************************************************************
// template, inline and free functions
// These could be static private functions on Image subclasses but then
// ImageFactory needs to be made a friend.
EXIV2API Image::UniquePtr newAsfInstance(BasicIo::UniquePtr io, bool create);
EXIV2API bool isAsfType(BasicIo& iIo, bool advance);
} // namespace Exiv2
Exiv2::AsfVideo::GUIDTag::operator==
bool operator==(const GUIDTag &other) const
Definition asfvideo.cpp:45
Exiv2::AsfVideo::AsfVideo
AsfVideo(BasicIo::UniquePtr io)
Constructor for a ASF video. Since the constructor can not return a result, callers should check the ...
Definition asfvideo.cpp:205
Exiv2::AsfVideo::writeMetadata
void writeMetadata() override
Write metadata back to the image.
Definition asfvideo.cpp:212
Exiv2::AsfVideo::mimeType
std::string mimeType() const override
Return the MIME type of the image.
Definition asfvideo.cpp:208
Exiv2::AsfVideo::readMetadata
void readMetadata() override
Read all metadata supported by a specific image format from the image. Before this method is called,...
Definition asfvideo.cpp:215
Exiv2::BasicIo
An interface for simple binary IO.
Definition basicio.hpp:35
Exiv2::BasicIo::UniquePtr
std::unique_ptr< BasicIo > UniquePtr
BasicIo auto_ptr type.
Definition basicio.hpp:38
Exiv2::Image::Image
Image(ImageType type, uint16_t supportedMetadata, BasicIo::UniquePtr io)
Constructor taking the image type, a bitmap of the supported metadata types and an auto-pointer that ...
Definition image.cpp:132
Exiv2::Image::io
virtual BasicIo & io() const
Return a reference to the BasicIo instance being used for Io.
Definition image.cpp:696
Exiv2::Image::UniquePtr
std::unique_ptr< Image > UniquePtr
Image auto_ptr type.
Definition image.hpp:53
Exiv2
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
Exiv2::isAsfType
EXIV2API bool isAsfType(BasicIo &iIo, bool advance)
Check if the file iIo is a Windows Asf Video.
Definition asfvideo.cpp:503
Exiv2::newAsfInstance
EXIV2API Image::UniquePtr newAsfInstance(BasicIo::UniquePtr io, bool create)
Create a new AsfVideo instance and return an auto-pointer to it. Caller owns the returned object and ...
Definition asfvideo.cpp:495
Exiv2::DataBuf
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition types.hpp:124