Exiv2
riffvideo.hpp
Go to the documentation of this file.
1 // ***************************************************************** -*- C++ -*-
2 /*
3  * Copyright (C) 2004-2018 Exiv2 authors
4  * This program is part of the Exiv2 distribution.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
19  */
27 #ifndef RIFFVIDEO_HPP
28 #define RIFFVIDEO_HPP
29 
30 // *****************************************************************************
31 #include "exiv2lib_export.h"
32 
33 // included header files
34 #include "exif.hpp"
35 #include "image.hpp"
36 
37 // *****************************************************************************
38 // namespace extensions
39 namespace Exiv2 {
40 
41 // *****************************************************************************
42 // class definitions
43 
44  // Add RIFF to the supported image formats
45  namespace ImageType {
46  const int riff = 20;
47  }
48 
52  class EXIV2LIB_DEPRECATED_EXPORT RiffVideo:public Image
53  {
54  public:
56 
57 
70 
72 
73  void printStructure(std::ostream& out, PrintStructureOption option,int depth);
74  void readMetadata();
75  void writeMetadata();
77 
79 
80  std::string mimeType() const;
81  const char* printAudioEncoding(uint64_t i);
83 
84  protected:
89  void decodeBlock();
98  void tagDecoder(Exiv2::DataBuf& buf, unsigned long size);
104  void junkHandler(long size);
110  void streamHandler(long size);
116  void streamFormatHandler(long size);
122  void aviHeaderTagsHandler(long size);
128  void listHandler(long size);
134  void streamDataTagHandler(long size);
139  void infoTagsHandler();
144  void nikonTagsHandler();
149  void odmlTagsHandler();
151  void skipListData();
158  void dateTimeOriginal(long size, int i = 0);
165  double returnSampleRate(Exiv2::DataBuf& buf, long divisor = 1);
172  void fillAspectRatio(long width = 1,long height = 1);
179  void fillDuration(double frame_rate, long frame_count);
180 
181  private:
183 
184  RiffVideo(const RiffVideo& rhs);
187  RiffVideo& operator=(const RiffVideo& rhs);
188  bool equalsRiffTag(Exiv2::DataBuf& buf ,const char* str);
190 
191  private:
192  const static int RIFF_TAG_SIZE;
193  const static char* RIFF_CHUNK_HEADER_ICCP;
194  const static char* RIFF_CHUNK_HEADER_EXIF;
195  const static char* RIFF_CHUNK_HEADER_XMP;
197  bool continueTraversing_;
199  int streamType_;
200 
201  }; //Class RiffVideo
202 
203 // *****************************************************************************
204 // template, inline and free functions
205 
206  // These could be static private functions on Image subclasses but then
207  // ImageFactory needs to be made a friend.
213  EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newRiffInstance(BasicIo::AutoPtr io, bool create);
214 
216  EXIV2LIB_DEPRECATED_EXPORT bool isRiffType(BasicIo& iIo, bool advance);
217 
218 } // namespace Exiv2
219 
220 #endif // RIFFVIDEO_HPP
Exiv2::Internal::TagDetails
Helper structure for lookup tables for translations of numeric tag values to human readable labels.
Definition: tags_int.hpp:188
Exiv2::RiffVideo::odmlTagsHandler
void odmlTagsHandler()
Interpret OpenDML tag information, and save it in the respective XMP container.
image_int.hpp
Internal image helpers.
Exiv2::DataBuf::pData_
byte * pData_
Pointer to the buffer, 0 if none has been allocated.
Definition: types.hpp:269
Exiv2::Internal::indent
std::string indent(int32_t d)
indent output for kpsRecursive in printStructure() .
Definition: image_int.cpp:106
exif.hpp
Encoding and decoding of Exif data.
Exiv2::RiffVideo
Class to access RIFF video files.
Definition: riffvideo.hpp:52
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::streamHandler
void streamHandler(long size)
Interpret Stream tag information, and save it in the respective XMP container.
types.hpp
Type definitions for Exiv2 and related functionality.
Exiv2::IptcData::empty
bool empty() const
Return true if there is no IPTC metadata.
Definition: iptc.hpp:258
Exiv2::RiffVideo::infoTagsHandler
void infoTagsHandler()
Interpret INFO tag information, and save it in the respective XMP container.
Exiv2::RiffVideo::writeMetadata
void writeMetadata()
Write metadata back to the image.
Exiv2::makeSlice
Slice< T > makeSlice(T &cont, size_t begin, size_t end)
Return a new slice with the given bounds.
Definition: slice.hpp:673
Exiv2::RiffVideo::printStructure
void printStructure(std::ostream &out, PrintStructureOption option, int depth)
Print out the structure of image file.
Exiv2::exvGettext
const EXIV2API char * exvGettext(const char *str)
Translate a string using the gettext framework. This wrapper hides all the implementation details fro...
Definition: types.cpp:576
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::skipListData
void skipListData()
Skips Particular Blocks of Metadata List.
Exiv2::strError
EXIV2API std::string strError()
Return a system error message and the error code (errno). See strerror(3).
Definition: futils.cpp:352
Exiv2::Internal::TagVocabulary
Helper structure for lookup tables for translations of controlled vocabulary strings to their descrip...
Definition: tags_int.hpp:209
Exiv2::XmpTextValue
Value type suitable for simple XMP properties and XMP nodes of complex types which are not parsed int...
Definition: value.hpp:724
Exiv2::Image::exifData_
ExifData exifData_
Exif data container.
Definition: image.hpp:488
Exiv2::RiffVideo::junkHandler
void junkHandler(long size)
Interpret Junk 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...
Exiv2::XmpKey
Concrete keys for XMP metadata.
Definition: properties.hpp:241
Exiv2::Internal::binaryToString
binaryToStringHelper< T > binaryToString(const Slice< T > sl)
format binary data for display in Image::printStructure()
Definition: image_int.hpp:125
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::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::Image::clearMetadata
virtual void clearMetadata()
Erase all buffered metadata. Metadata is not removed from the actual image until the writeMetadata() ...
Definition: image.cpp:561
Exiv2::RiffVideo::streamFormatHandler
void streamFormatHandler(long size)
Interpret Stream Format tag information, and save it in the respective XMP container.
Exiv2::Internal::TiffMapping::findDecoder
static DecoderFct findDecoder(const std::string &make, uint32_t extendedTag, IfdId group)
Find the decoder function for a key.
Definition: tiffimage_int.cpp:1520
Exiv2::Internal::stringFormat
std::string stringFormat(const char *format,...)
format a string in the pattern of sprintf .
Definition: image_int.cpp:32
tiffimage_int.hpp
Internal class TiffParserWorker to parse TIFF data.
Exiv2::Image::printTiffStructure
void printTiffStructure(BasicIo &io, std::ostream &out, PrintStructureOption option, int depth, size_t offset=0)
Print out the structure of image file.
Definition: image.cpp:543
riffvideo.hpp
An Image subclass to support RIFF video files.
Exiv2::DataBuf
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:204
Exiv2::DataBuf::size_
long size_
The current size of the buffer.
Definition: types.hpp:271
Exiv2::getLong
EXIV2API int32_t getLong(const byte *buf, ByteOrder byteOrder)
Read a 4 byte signed long value from the data buffer.
Definition: types.cpp:328
Exiv2::Internal::TagDetails::label_
const char * label_
Translation of the tag value.
Definition: tags_int.hpp:190
Exiv2::find
const T * find(T(&src)[N], const K &key)
Find an element that matches key in the array src.
Definition: types.hpp:508
Exiv2::isRiffType
EXIV2LIB_DEPRECATED_EXPORT bool isRiffType(BasicIo &iIo, bool advance)
Check if the file iIo is a Riff Video.
Exiv2
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
Exiv2::XmpData::empty
bool empty() const
Return true if there is no XMP metadata.
Definition: xmp.cpp:365
Exiv2::Image::io
virtual BasicIo & io() const
Return a reference to the BasicIo instance being used for Io.
Definition: image.cpp:743
image.hpp
Exiv2::BasicIo::path
virtual std::string path() const =0
Return the path to the IO resource. Often used to form comprehensive error messages where only a Basi...
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,...
EXV_WARNING
#define EXV_WARNING
Shorthand for a temp warning log message object and return its ostringstream.
Definition: error.hpp:148
Exiv2::getUShort
EXIV2API uint16_t getUShort(const byte *buf, ByteOrder byteOrder)
Read a 2 byte unsigned short value from the data buffer.
Definition: types.cpp:278
Exiv2::Image::io_
BasicIo::AutoPtr io_
Image data IO pointer.
Definition: image.hpp:487
Exiv2::ByteOrder
ByteOrder
Type to express the byte order (little or big endian)
Definition: types.hpp:113
Exiv2::Internal
Contains internal objects which are not published and are not part of the libexiv2 API.
Definition: slice.hpp:39
Exiv2::RiffVideo::aviHeaderTagsHandler
void aviHeaderTagsHandler(long size)
Interpret Riff Header tag information, and save it in the respective XMP container.
Exiv2::Image::AutoPtr
std::auto_ptr< Image > AutoPtr
Image auto_ptr type.
Definition: image.hpp:84
Exiv2::Internal::Tag::root
const uint32_t root
Special tag: root IFD.
Definition: tiffcomposite_int.hpp:80
Exiv2::RiffVideo::returnSampleRate
double returnSampleRate(Exiv2::DataBuf &buf, long divisor=1)
Calculates Sample Rate of a particular stream.
Exiv2::RiffVideo::nikonTagsHandler
void nikonTagsHandler()
Interpret Nikon Tags related to Video 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::ImageType::riff
const int riff
Treating riff as an image type>
Definition: riffvideo.hpp:46
tags_int.hpp
Internal Exif tag and type information.
Exiv2::BasicIo::AutoPtr
std::auto_ptr< BasicIo > AutoPtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
Exiv2::Error
BasicError< char > Error
Error class used for exceptions (std::string based)
Definition: error.hpp:324
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::XmpData::add
int add(const XmpKey &key, const Value *value)
Add an Xmpdatum from the supplied key and value pair. This method copies (clones) the value.
Definition: xmp.cpp:322
tags.hpp
Exif tag and type information.
Exiv2::Internal::TagVocabulary::label_
const char * label_
Description of the vocabulary string.
Definition: tags_int.hpp:211
Exiv2::string
@ string
IPTC string type.
Definition: types.hpp:147
Exiv2::PrintStructureOption
PrintStructureOption
Options for printStructure.
Definition: image.hpp:67
Exiv2::meteringMode
EXIV2API ExifData::const_iterator meteringMode(const ExifData &ed)
Return the metering mode setting.
Definition: easyaccess.cpp:417
EXV_ERROR
#define EXV_ERROR
Shorthand for a temp error log message object and return its ostringstream.
Definition: error.hpp:150
Exiv2::toString
std::string toString(const T &arg)
Utility function to convert the argument of any type to a string.
Definition: types.hpp:521
Exiv2::BasicIo
An interface for simple binary IO.
Definition: basicio.hpp:55
Exiv2::Image::xmpData_
XmpData xmpData_
XMP data container.
Definition: image.hpp:490
Exiv2::RiffVideo::mimeType
std::string mimeType() const
Return the MIME type of the image.
Exiv2::Image::xmpData
virtual XmpData & xmpData()
Returns an XmpData instance containing currently buffered XMP data.
Definition: image.cpp:581
Exiv2::Image
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:81
futils.hpp
Basic file utility functions required by Exiv2.
Exiv2::Internal::TiffParserWorker::decode
static ByteOrder decode(ExifData &exifData, IptcData &iptcData, XmpData &xmpData, const byte *pData, uint32_t size, uint32_t root, FindDecoderFct findDecoderFct, TiffHeaderBase *pHeader=0)
Decode TIFF metadata from a data buffer pData of length size into the provided metadata containers.
Definition: tiffimage_int.cpp:1597
Exiv2::Image::iptcData
virtual IptcData & iptcData()
Returns an IptcData instance containing currently buffered IPTC data.
Definition: image.cpp:576
Exiv2::getULong
EXIV2API uint32_t getULong(const byte *buf, ByteOrder byteOrder)
Read a 4 byte unsigned long value from the data buffer.
Definition: types.cpp:283
error.hpp
Error class for exceptions, log message class.