| Exiv2

Loading...
Searching...
No Matches
asfvideo.hpp
1// SPDX-License-Identifier: GPL-2.0-or-later
2// Spec : Advanced Systems Format (ASF) Specification : Revision 01.20.05 :
3// https://exse.eyewated.com/fls/54b3ed95bbfb1a92.pdf
4#pragma once
5
6// *****************************************************************************
7#include <array>
8#include "exiv2lib_export.h"
9
10// included header files
11#include "image.hpp"
12
13// *****************************************************************************
14// namespace extensions
15 namespace Exiv2 {
16
17// *****************************************************************************
18// class definitions
19
23 class EXIV2API AsfVideo : public Image {
24 public:
26
27
38
39 explicit AsfVideo(BasicIo::UniquePtr io);
41
43
44 void readMetadata() override;
45 void writeMetadata() override;
47
49
50 [[nodiscard]] std::string mimeType() const override;
52
53 /* @class GUID_struct
54 *
55 * @brief A class to represent a globally unique identifier (GUID) structure
56 *
57 * This class represents a globally unique identifier (GUID) structure which is used to identify objects in a
58 * distributed environment. A GUID is a unique identifier that is generated on a computer and can be used to
59 * identify an object across different systems. The GUID structure is comprised of four 32-bit values and an
60 * array of 8 bytes.
61 *
62 * @note The byte order of the GUID structure is in little endian.
63 *
64 * @see https://en.wikipedia.org/wiki/Globally_unique_identifier
65 *
66 */
67 class GUIDTag {
68 uint32_t data1_;
69 uint16_t data2_;
70 uint16_t data3_;
71 std::array<byte, 8> data4_;
72
73 public:
74 bool operator==(const GUIDTag& other) const;
75
76 // Constructor to create a GUID object by passing individual values for each attribute
77 GUIDTag(unsigned int data1, unsigned short data2, unsigned short data3, std::array<byte, 8> data4);
78
79 // Constructor to create a GUID object from a byte array
80 explicit GUIDTag(const uint8_t* bytes);
81
82 std::string to_string();
83
84 bool operator<(const GUIDTag& other) const;
85 };
86
87 private:
88 static constexpr size_t CODEC_TYPE_VIDEO = 1;
89 static constexpr size_t CODEC_TYPE_AUDIO = 2;
90
91 class HeaderReader {
92 DataBuf IdBuf_;
93 uint64_t size_{};
94 uint64_t remaining_size_{};
95
96 public:
97 explicit HeaderReader(const BasicIo::UniquePtr& io);
98
99 [[nodiscard]] uint64_t getSize() const {
100 return size_;
101 }
102
103 [[nodiscard]] uint64_t getRemainingSize() const {
104 return remaining_size_;
105 }
106
107 [[nodiscard]] DataBuf& getId() {
108 return IdBuf_;
109 }
110 };
111
112 protected:
117 void decodeBlock();
118
119 void decodeHeader();
124 void fileProperties();
129 void streamProperties();
134 void codecList();
139 void contentDescription();
144 void extendedStreamProperties();
149 void headerExtension() const;
155 void extendedContentDescription();
156
157 void DegradableJPEGMedia();
158
159 private:
161 uint64_t height_{};
162 uint64_t width_{};
163
164}; // Class AsfVideo
165
166// *****************************************************************************
167// template, inline and free functions
168
169// These could be static private functions on Image subclasses but then
170// ImageFactory needs to be made a friend.
176EXIV2API Image::UniquePtr newAsfInstance(BasicIo::UniquePtr io, bool create);
177
179EXIV2API bool isAsfType(BasicIo& iIo, bool advance);
180} // 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