Loading...
Searching...
No Matches
riffvideo.hpp
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include "exif.hpp"
#include "exiv2lib_export.h"
#include "image.hpp"
namespace Exiv2 {
// *****************************************************************************
// class definitions
class EXIV2API RiffVideo : public Image {
public:
explicit RiffVideo(BasicIo::UniquePtr io);
void readMetadata() override;
void writeMetadata() override;
[[nodiscard]] std::string mimeType() const override;
protected:
class HeaderReader {
std::string id_;
uint64_t size_ = 0;
public:
explicit HeaderReader(const BasicIo::UniquePtr& io);
[[nodiscard]] uint64_t getSize() const {
return size_;
}
[[nodiscard]] const std::string& getId() const {
return id_;
}
};
void readList(const HeaderReader& header_);
void readChunk(const HeaderReader& header_);
void decodeBlocks();
private:
static bool equal(const std::string& str1, const std::string& str2);
void readAviHeader();
void readStreamHeader();
void readStreamFormat(uint64_t size_);
void readStreamData(uint64_t size_) const;
void StreamName(uint64_t size_) const;
void readInfoListChunk(uint64_t size_);
void readMoviList(uint64_t size_) const;
void readVPRPChunk(uint64_t size_) const;
void readIndexChunk(uint64_t size_) const;
void readDataChunk(uint64_t size_) const;
void readJunk(uint64_t size_) const;
static std::string getStreamType(uint32_t stream);
void fillDuration(double frame_rate, size_t frame_count);
void fillAspectRatio(size_t width, size_t height);
static constexpr auto CHUNK_HEADER_ICCP = "ICCP";
static constexpr auto CHUNK_HEADER_EXIF = "EXIF";
static constexpr auto CHUNK_HEADER_XMP = "XMP ";
/* Chunk header names */
static constexpr auto CHUNK_ID_MOVI = "MOVI";
static constexpr auto CHUNK_ID_DATA = "DATA";
static constexpr auto CHUNK_ID_HDRL = "HDRL";
static constexpr auto CHUNK_ID_STRL = "STRL";
static constexpr auto CHUNK_ID_LIST = "LIST";
static constexpr auto CHUNK_ID_JUNK = "JUNK";
static constexpr auto CHUNK_ID_AVIH = "AVIH";
static constexpr auto CHUNK_ID_STRH = "STRH";
static constexpr auto CHUNK_ID_STRF = "STRF";
static constexpr auto CHUNK_ID_FMT = "FMT ";
static constexpr auto CHUNK_ID_STRN = "STRN";
static constexpr auto CHUNK_ID_STRD = "STRD";
static constexpr auto CHUNK_ID_IDIT = "IDIT";
static constexpr auto CHUNK_ID_INFO = "INFO";
static constexpr auto CHUNK_ID_NCDT = "NCDT";
static constexpr auto CHUNK_ID_ODML = "ODML";
static constexpr auto CHUNK_ID_VPRP = "VPRP";
static constexpr auto CHUNK_ID_IDX1 = "IDX1";
int streamType_{};
}; // Class RiffVideo
/*
@brief Create a new RiffVideo instance and return an auto-pointer to it.
Caller owns the returned object and the auto-pointer ensures that
it will be deleted.
*/
EXIV2API Image::UniquePtr newRiffInstance(BasicIo::UniquePtr io, bool create);
EXIV2API bool isRiffType(BasicIo& iIo, bool advance);
} // namespace Exiv2
Exiv2::BasicIo::UniquePtr
std::unique_ptr< BasicIo > UniquePtr
BasicIo auto_ptr type.
Definition basicio.hpp:38
Exiv2::Image
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition image.hpp:50
Exiv2::Image::UniquePtr
std::unique_ptr< Image > UniquePtr
Image auto_ptr type.
Definition image.hpp:53
Exiv2::RiffVideo::HeaderReader
Definition riffvideo.hpp:46
Exiv2::RiffVideo
Class to access RIFF video files.
Definition riffvideo.hpp:16
exif.hpp
Encoding and decoding of Exif data.
Exiv2
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
Exiv2::isRiffType
EXIV2API bool isRiffType(BasicIo &iIo, bool advance)
Check if the file iIo is a Riff Video.
Definition riffvideo.cpp:760
Exiv2::mimeType
List of TIFF compression to MIME type mappings.
Definition tiffimage.cpp:47