Exiv2
quicktimevideo.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 QUICKTIMEVIDEO_HPP_
21 #define QUICKTIMEVIDEO_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
32 namespace Exiv2 {
33 
34 // *****************************************************************************
35 // class definitions
36 
40 class EXIV2API QuickTimeVideo : public Image {
41  public:
43 
44 
55  explicit QuickTimeVideo(BasicIo::UniquePtr io, size_t max_recursion_depth = 1000);
57 
59 
60  void readMetadata() override;
61  void writeMetadata() override;
63 
65 
66  [[nodiscard]] std::string mimeType() const override;
68 
69  protected:
74  void decodeBlock(size_t recursion_depth, std::string const& entered_from = "");
83  void tagDecoder(Exiv2::DataBuf& buf, size_t size, size_t recursion_depth);
84 
85  private:
91  void fileTypeDecoder(size_t size);
97  void mediaHeaderDecoder(size_t size);
103  void videoHeaderDecoder(size_t size);
109  void movieHeaderDecoder(size_t size);
115  void trackHeaderDecoder(size_t size);
121  void handlerDecoder(size_t size);
126  void multipleEntriesDecoder(size_t recursion_depth);
132  void sampleDesc(size_t size);
137  void imageDescDecoder();
143  void userDataDecoder(size_t size, size_t recursion_depth);
149  void previewTagDecoder(size_t size);
155  void keysTagDecoder(size_t size);
161  void trackApertureTagDecoder(size_t size);
167  void NikonTagsDecoder(size_t size);
173  void CameraTagsDecoder(size_t size);
178  void audioDescDecoder();
183  void timeToSampleDecoder();
188  void setMediaStream();
194  void discard(size_t size);
195 
197  uint64_t timeScale_ = 0;
199  int currentStream_ = 0;
201  bool continueTraversing_ = false;
203  uint64_t height_ = 0;
204  uint64_t width_ = 0;
206  const size_t max_recursion_depth_;
207 
208 }; // QuickTimeVideo End
209 
210 // *****************************************************************************
211 // template, inline and free functions
212 
213 // These could be static private functions on Image subclasses but then
214 // ImageFactory needs to be made a friend.
220 EXIV2API Image::UniquePtr newQTimeInstance(BasicIo::UniquePtr io, bool create);
221 
223 EXIV2API bool isQTimeType(BasicIo& iIo, bool advance);
224 
225 } // namespace Exiv2
226 
227 #endif // QUICKTIMEVIDEO_HPP_
std::unique_ptr< Image > UniquePtr
Image auto_ptr type.
Definition: image.hpp:53
An interface for simple binary IO.
Definition: basicio.hpp:35
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:50
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:124
EXIV2API bool isQTimeType(BasicIo &iIo, bool advance)
Check if the file iIo is a Quick Time Video.
Definition: quicktimevideo.cpp:1605
List of TIFF compression to MIME type mappings.
Definition: tiffimage.cpp:47
std::unique_ptr< BasicIo > UniquePtr
BasicIo auto_ptr type.
Definition: basicio.hpp:38
EXIV2API Image::UniquePtr newQTimeInstance(BasicIo::UniquePtr io, bool create)
Create a new QuicktimeVideo instance and return an auto-pointer to it. Caller owns the returned objec...
Definition: quicktimevideo.cpp:1597
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition: asfvideo.hpp:15
Class to access QuickTime video files.
Definition: quicktimevideo.hpp:40
Encoding and decoding of Exif data.