Exiv2
riffvideo.hpp
1// ***************************************************************** -*- C++ -*-
2/*
3 * Copyright (C) 2004-2021 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 */
20#ifndef RIFFVIDEO_HPP
21#define RIFFVIDEO_HPP
22
23// *****************************************************************************
24#include "exiv2lib_export.h"
25
26// included header files
27#include "exif.hpp"
28#include "image.hpp"
29
30// *****************************************************************************
31// namespace extensions
32namespace Exiv2 {
33
34// *****************************************************************************
35// class definitions
36
37 // Add RIFF to the supported image formats
38 namespace ImageType {
39 const int riff = 20;
40 }
41
45 class EXIV2LIB_DEPRECATED_EXPORT RiffVideo:public Image
46 {
47 public:
49
50
63
65
66 void printStructure(std::ostream& out, PrintStructureOption option,int depth);
70
72
73 std::string mimeType() const;
74 const char* printAudioEncoding(uint64_t i);
76
77 protected:
91 void tagDecoder(Exiv2::DataBuf& buf, unsigned long size);
97 void junkHandler(long size);
103 void streamHandler(long size);
109 void streamFormatHandler(long size);
115 void aviHeaderTagsHandler(long size);
121 void listHandler(long size);
127 void streamDataTagHandler(long size);
151 void dateTimeOriginal(long size, int i = 0);
158 double returnSampleRate(Exiv2::DataBuf& buf, long divisor = 1);
165 void fillAspectRatio(long width = 1,long height = 1);
172 void fillDuration(double frame_rate, long frame_count);
173
174 private:
176
177
178 RiffVideo(const RiffVideo& rhs);
180 RiffVideo& operator=(const RiffVideo& rhs);
181 bool equalsRiffTag(Exiv2::DataBuf& buf ,const char* str);
183
184 private:
185 const static int RIFF_TAG_SIZE;
186 const static char* RIFF_CHUNK_HEADER_ICCP;
187 const static char* RIFF_CHUNK_HEADER_EXIF;
188 const static char* RIFF_CHUNK_HEADER_XMP;
190 bool continueTraversing_;
192 int streamType_;
193
194 }; //Class RiffVideo
195
196// *****************************************************************************
197// template, inline and free functions
198
199 // These could be static private functions on Image subclasses but then
200 // ImageFactory needs to be made a friend.
206 EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newRiffInstance(BasicIo::AutoPtr io, bool create);
207
209 EXIV2LIB_DEPRECATED_EXPORT bool isRiffType(BasicIo& iIo, bool advance);
210
211} // namespace Exiv2
212
213#endif // RIFFVIDEO_HPP
An interface for simple binary IO.
Definition: basicio.hpp:55
std::auto_ptr< BasicIo > AutoPtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:193
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:78
std::auto_ptr< Image > AutoPtr
Image auto_ptr type.
Definition: image.hpp:81
Class to access RIFF video files.
Definition: riffvideo.hpp:46
void skipListData()
Skips Particular Blocks of Metadata List.
void aviHeaderTagsHandler(long size)
Interpret Riff Header tag information, and save it in the respective XMP container.
void streamFormatHandler(long size)
Interpret Stream Format tag information, and save it in the respective XMP container.
void listHandler(long size)
Interpret Riff List tag information, and save it in the respective XMP container.
void fillDuration(double frame_rate, long frame_count)
Calculates Duration of a video, and stores it in the respective XMP container.
void tagDecoder(Exiv2::DataBuf &buf, unsigned long size)
Interpret tag information, and call the respective function to save it in the respective XMP containe...
void nikonTagsHandler()
Interpret Nikon Tags related to Video information, and save it in the respective XMP container.
void printStructure(std::ostream &out, PrintStructureOption option, int depth)
Print out the structure of image file.
void odmlTagsHandler()
Interpret OpenDML tag information, and save it in the respective XMP container.
void dateTimeOriginal(long size, int i=0)
Interprets DateTimeOriginal tag or stream name tag information, and save it in the respective XMP con...
void junkHandler(long size)
Interpret Junk tag information, and save it in the respective XMP container.
void writeMetadata()
Write metadata back to the image.
RiffVideo(BasicIo::AutoPtr io)
Constructor for a Riff video. Since the constructor can not return a result, callers should check the...
std::string mimeType() const
Return the MIME type of the image.
void fillAspectRatio(long width=1, long height=1)
Calculates Aspect Ratio of a video, and stores it in the respective XMP container.
void readMetadata()
Read all metadata supported by a specific image format from the image. Before this method is called,...
double returnSampleRate(Exiv2::DataBuf &buf, long divisor=1)
Calculates Sample Rate of a particular stream.
void streamHandler(long size)
Interpret Stream tag information, and save it in the respective XMP container.
void streamDataTagHandler(long size)
Interpret Riff Stream Data tag information, and save it in the respective XMP container.
void infoTagsHandler()
Interpret INFO tag information, and save it in the respective XMP container.
void decodeBlock()
Check for a valid tag and decode the block at the current IO position. Calls tagDecoder() or skips to...
Encoding and decoding of Exif data.
const int riff
Treating riff as an image type>
Definition: riffvideo.hpp:39
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
PrintStructureOption
Options for printStructure.
Definition: image.hpp:64
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...
EXIV2LIB_DEPRECATED_EXPORT bool isRiffType(BasicIo &iIo, bool advance)
Check if the file iIo is a Riff Video.