Exiv2
Loading...
Searching...
No Matches
riffvideo.hpp
1// SPDX-License-Identifier: GPL-2.0-or-later
2#pragma once
3
4#include "exif.hpp"
5#include "exiv2lib_export.h"
6#include "image.hpp"
7
8namespace Exiv2 {
9
10// *****************************************************************************
11// class definitions
12
16class EXIV2API RiffVideo : public Image {
17 public:
19
20
31 explicit RiffVideo(BasicIo::UniquePtr io);
33
35
36 void readMetadata() override;
37 void writeMetadata() override;
39
41
42 [[nodiscard]] std::string mimeType() const override;
44
45 protected:
47 std::string id_;
48 uint64_t size_ = 0;
49
50 public:
51 explicit HeaderReader(const BasicIo::UniquePtr& io);
52
53 [[nodiscard]] uint64_t getSize() const {
54 return size_;
55 }
56
57 [[nodiscard]] const std::string& getId() const {
58 return id_;
59 }
60 };
61
62 void readList(const HeaderReader& header_);
63
64 void readChunk(const HeaderReader& header_);
65
66 void decodeBlocks();
67
68 private:
69 static bool equal(const std::string& str1, const std::string& str2);
70
74 void readAviHeader();
75
79 void readStreamHeader();
80
85 void readStreamFormat(uint64_t size_);
86
91 void readStreamData(uint64_t size_) const;
92
97 void StreamName(uint64_t size_) const;
102 void readInfoListChunk(uint64_t size_);
103
109 void readMoviList(uint64_t size_) const;
115 void readVPRPChunk(uint64_t size_) const;
120 void readIndexChunk(uint64_t size_) const;
125 void readDataChunk(uint64_t size_) const;
130 void readJunk(uint64_t size_) const;
131
132 static std::string getStreamType(uint32_t stream);
138 void fillDuration(double frame_rate, size_t frame_count);
139
145 void fillAspectRatio(size_t width, size_t height);
146
147 static constexpr auto CHUNK_HEADER_ICCP = "ICCP";
148 static constexpr auto CHUNK_HEADER_EXIF = "EXIF";
149 static constexpr auto CHUNK_HEADER_XMP = "XMP ";
150
151 /* Chunk header names */
152 static constexpr auto CHUNK_ID_MOVI = "MOVI";
153 static constexpr auto CHUNK_ID_DATA = "DATA";
154 static constexpr auto CHUNK_ID_HDRL = "HDRL";
155 static constexpr auto CHUNK_ID_STRL = "STRL";
156 static constexpr auto CHUNK_ID_LIST = "LIST";
157 static constexpr auto CHUNK_ID_JUNK = "JUNK";
158 static constexpr auto CHUNK_ID_AVIH = "AVIH";
159 static constexpr auto CHUNK_ID_STRH = "STRH";
160 static constexpr auto CHUNK_ID_STRF = "STRF";
161 static constexpr auto CHUNK_ID_FMT = "FMT ";
162 static constexpr auto CHUNK_ID_STRN = "STRN";
163 static constexpr auto CHUNK_ID_STRD = "STRD";
164 static constexpr auto CHUNK_ID_IDIT = "IDIT";
165 static constexpr auto CHUNK_ID_INFO = "INFO";
166 static constexpr auto CHUNK_ID_NCDT = "NCDT";
167 static constexpr auto CHUNK_ID_ODML = "ODML";
168 static constexpr auto CHUNK_ID_VPRP = "VPRP";
169 static constexpr auto CHUNK_ID_IDX1 = "IDX1";
170
171 int streamType_{};
172
173}; // Class RiffVideo
174
175/*
176 @brief Create a new RiffVideo instance and return an auto-pointer to it.
177 Caller owns the returned object and the auto-pointer ensures that
178 it will be deleted.
179 */
180EXIV2API Image::UniquePtr newRiffInstance(BasicIo::UniquePtr io, bool create);
181
183EXIV2API bool isRiffType(BasicIo& iIo, bool advance);
184
185} // namespace Exiv2
std::unique_ptr< BasicIo > UniquePtr
BasicIo auto_ptr type.
Definition basicio.hpp:38
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition image.hpp:50
std::unique_ptr< Image > UniquePtr
Image auto_ptr type.
Definition image.hpp:53
Definition riffvideo.hpp:46
Class to access RIFF video files.
Definition riffvideo.hpp:16
Encoding and decoding of Exif data.
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
EXIV2API bool isRiffType(BasicIo &iIo, bool advance)
Check if the file iIo is a Riff Video.
Definition riffvideo.cpp:760
List of TIFF compression to MIME type mappings.
Definition tiffimage.cpp:47