riffvideo.hpp
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
#ifndef RIFFVIDEO_HPP
#define RIFFVIDEO_HPP
// *****************************************************************************
#include "exiv2lib_export.h"
// included header files
#include "exif.hpp"
#include "image.hpp"
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
// *****************************************************************************
// class definitions
// Add RIFF to the supported image formats
namespace ImageType {
const int riff = 20;
}
class EXIV2LIB_DEPRECATED_EXPORT RiffVideo:public Image
{
public:
RiffVideo(BasicIo::AutoPtr io);
void printStructure(std::ostream& out, PrintStructureOption option,int depth);
void readMetadata();
void writeMetadata();
std::string mimeType() const;
const char* printAudioEncoding(uint64_t i);
protected:
void decodeBlock();
void tagDecoder(Exiv2::DataBuf& buf, unsigned long size);
void junkHandler(long size);
void streamHandler(long size);
void streamFormatHandler(long size);
void aviHeaderTagsHandler(long size);
void listHandler(long size);
void streamDataTagHandler(long size);
void infoTagsHandler();
void nikonTagsHandler();
void odmlTagsHandler();
void skipListData();
void dateTimeOriginal(long size, int i = 0);
double returnSampleRate(Exiv2::DataBuf& buf, long divisor = 1);
void fillAspectRatio(long width = 1,long height = 1);
void fillDuration(double frame_rate, long frame_count);
private:
RiffVideo(const RiffVideo& rhs);
RiffVideo& operator=(const RiffVideo& rhs);
bool equalsRiffTag(Exiv2::DataBuf& buf ,const char* str);
private:
const static int RIFF_TAG_SIZE;
const static char* RIFF_CHUNK_HEADER_ICCP;
const static char* RIFF_CHUNK_HEADER_EXIF;
const static char* RIFF_CHUNK_HEADER_XMP;
bool continueTraversing_;
int streamType_;
}; //Class RiffVideo
// *****************************************************************************
// template, inline and free functions
// These could be static private functions on Image subclasses but then
// ImageFactory needs to be made a friend.
EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newRiffInstance(BasicIo::AutoPtr io, bool create);
EXIV2LIB_DEPRECATED_EXPORT bool isRiffType(BasicIo& iIo, bool advance);
} // namespace Exiv2
#endif // RIFFVIDEO_HPP
Exiv2::BasicIo
An interface for simple binary IO.
Definition: basicio.hpp:55
Exiv2::BasicIo::AutoPtr
std::auto_ptr< BasicIo > AutoPtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
Exiv2::DataBuf
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:193
Exiv2::Image
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:78
Exiv2::Image::AutoPtr
std::auto_ptr< Image > AutoPtr
Image auto_ptr type.
Definition: image.hpp:81
Exiv2::RiffVideo
Class to access RIFF video files.
Definition: riffvideo.hpp:46
Exiv2::RiffVideo::skipListData
void skipListData()
Skips Particular Blocks of Metadata List.
Exiv2::RiffVideo::aviHeaderTagsHandler
void aviHeaderTagsHandler(long size)
Interpret Riff Header tag information, and save it in the respective XMP container.
Exiv2::RiffVideo::streamFormatHandler
void streamFormatHandler(long size)
Interpret Stream Format tag information, and save it in the respective XMP container.
Exiv2::RiffVideo::listHandler
void listHandler(long size)
Interpret Riff List tag information, and save it in the respective XMP container.
Exiv2::RiffVideo::fillDuration
void fillDuration(double frame_rate, long frame_count)
Calculates Duration of a video, and stores it in the respective XMP container.
Exiv2::RiffVideo::tagDecoder
void tagDecoder(Exiv2::DataBuf &buf, unsigned long size)
Interpret tag information, and call the respective function to save it in the respective XMP containe...
Exiv2::RiffVideo::nikonTagsHandler
void nikonTagsHandler()
Interpret Nikon Tags related to Video information, and save it in the respective XMP container.
Exiv2::RiffVideo::printStructure
void printStructure(std::ostream &out, PrintStructureOption option, int depth)
Print out the structure of image file.
Exiv2::RiffVideo::odmlTagsHandler
void odmlTagsHandler()
Interpret OpenDML tag information, and save it in the respective XMP container.
Exiv2::RiffVideo::dateTimeOriginal
void dateTimeOriginal(long size, int i=0)
Interprets DateTimeOriginal tag or stream name tag information, and save it in the respective XMP con...
Exiv2::RiffVideo::junkHandler
void junkHandler(long size)
Interpret Junk tag information, and save it in the respective XMP container.
Exiv2::RiffVideo::writeMetadata
void writeMetadata()
Write metadata back to the image.
Exiv2::RiffVideo::RiffVideo
RiffVideo(BasicIo::AutoPtr io)
Constructor for a Riff video. Since the constructor can not return a result, callers should check the...
Exiv2::RiffVideo::mimeType
std::string mimeType() const
Return the MIME type of the image.
Exiv2::RiffVideo::fillAspectRatio
void fillAspectRatio(long width=1, long height=1)
Calculates Aspect Ratio of a video, and stores it in the respective XMP container.
Exiv2::RiffVideo::readMetadata
void readMetadata()
Read all metadata supported by a specific image format from the image. Before this method is called,...
Exiv2::RiffVideo::returnSampleRate
double returnSampleRate(Exiv2::DataBuf &buf, long divisor=1)
Calculates Sample Rate of a particular stream.
Exiv2::RiffVideo::streamHandler
void streamHandler(long size)
Interpret Stream tag information, and save it in the respective XMP container.
Exiv2::RiffVideo::streamDataTagHandler
void streamDataTagHandler(long size)
Interpret Riff Stream Data tag information, and save it in the respective XMP container.
Exiv2::RiffVideo::infoTagsHandler
void infoTagsHandler()
Interpret INFO tag information, and save it in the respective XMP container.
Exiv2::RiffVideo::decodeBlock
void decodeBlock()
Check for a valid tag and decode the block at the current IO position. Calls tagDecoder() or skips to...
exif.hpp
Encoding and decoding of Exif data.
Exiv2::ImageType::riff
const int riff
Treating riff as an image type>
Definition: riffvideo.hpp:39
Exiv2
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
Exiv2::PrintStructureOption
PrintStructureOption
Options for printStructure.
Definition: image.hpp:64
Exiv2::newRiffInstance
EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newRiffInstance(BasicIo::AutoPtr io, bool create)
Create a new RiffVideo instance and return an auto-pointer to it. Caller owns the returned object and...
Exiv2::isRiffType
EXIV2LIB_DEPRECATED_EXPORT bool isRiffType(BasicIo &iIo, bool advance)
Check if the file iIo is a Riff Video.