Blame include/exiv2/quicktimevideo.hpp

Packit Service 21b5d1
// ***************************************************************** -*- C++ -*-
Packit Service 21b5d1
/*
Packit Service 21b5d1
 * Copyright (C) 2004-2018 Exiv2 authors
Packit Service 21b5d1
 * This program is part of the Exiv2 distribution.
Packit Service 21b5d1
 *
Packit Service 21b5d1
 * This program is free software; you can redistribute it and/or
Packit Service 21b5d1
 * modify it under the terms of the GNU General Public License
Packit Service 21b5d1
 * as published by the Free Software Foundation; either version 2
Packit Service 21b5d1
 * of the License, or (at your option) any later version.
Packit Service 21b5d1
 *
Packit Service 21b5d1
 * This program is distributed in the hope that it will be useful,
Packit Service 21b5d1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 21b5d1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Service 21b5d1
 * GNU General Public License for more details.
Packit Service 21b5d1
 *
Packit Service 21b5d1
 * You should have received a copy of the GNU General Public License
Packit Service 21b5d1
 * along with this program; if not, write to the Free Software
Packit Service 21b5d1
 * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
Packit Service 21b5d1
 */
Packit Service 21b5d1
/*!
Packit Service 21b5d1
  @file    quicktimevideo.hpp
Packit Service 21b5d1
  @brief   An Image subclass to support Quick Time video files
Packit Service 21b5d1
  @author  Abhinav Badola for GSoC 2012
Packit Service 21b5d1
           mail.abu.to@gmail.com
Packit Service 21b5d1
  @date    28-Jun-12, AB: created
Packit Service 21b5d1
 */
Packit Service 21b5d1
#ifndef QUICKTIMEVIDEO_HPP
Packit Service 21b5d1
#define QUICKTIMEVIDEO_HPP
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
#include "exiv2lib_export.h"
Packit Service 21b5d1
Packit Service 21b5d1
// included header files
Packit Service 21b5d1
#include "exif.hpp"
Packit Service 21b5d1
#include "image.hpp"
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// namespace extensions
Packit Service 21b5d1
namespace Exiv2 {
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// class definitions
Packit Service 21b5d1
Packit Service 21b5d1
    // Add qtime to the supported image formats
Packit Service 21b5d1
    namespace ImageType {
Packit Service 21b5d1
        const int qtime = 22; //!< Treating qtime as an image type>
Packit Service 21b5d1
    }
Packit Service 21b5d1
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Class to access QuickTime video files.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    class EXIV2LIB_DEPRECATED_EXPORT QuickTimeVideo:public Image
Packit Service 21b5d1
    {
Packit Service 21b5d1
    public:
Packit Service 21b5d1
        //! @name Creators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Constructor for a QuickTime video. Since the constructor
Packit Service 21b5d1
              can not return a result, callers should check the good() method
Packit Service 21b5d1
              after object construction to determine success or failure.
Packit Service 21b5d1
          @param io An auto-pointer that owns a BasicIo instance used for
Packit Service 21b5d1
              reading and writing image metadata. \b Important: The constructor
Packit Service 21b5d1
              takes ownership of the passed in BasicIo instance through the
Packit Service 21b5d1
              auto-pointer. Callers should not continue to use the BasicIo
Packit Service 21b5d1
              instance after it is passed to this method. Use the Image::io()
Packit Service 21b5d1
              method to get a temporary reference.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        QuickTimeVideo(BasicIo::AutoPtr io);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Manipulators
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        void readMetadata();
Packit Service 21b5d1
        void writeMetadata();
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
        //! @name Accessors
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        std::string mimeType() const;
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    protected:
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Check for a valid tag and decode the block at the current IO
Packit Service 21b5d1
          position. Calls tagDecoder() or skips to next tag, if required.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void decodeBlock();
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret tag information, and call the respective function
Packit Service 21b5d1
              to save it in the respective XMP container. Decodes a Tag
Packit Service 21b5d1
              Information and saves it in the respective XMP container, if
Packit Service 21b5d1
              the block size is small.
Packit Service 21b5d1
          @param buf Data buffer which cotains tag ID.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void tagDecoder(Exiv2::DataBuf & buf, unsigned long size);
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret file type of the video, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void fileTypeDecoder(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Media Header Tag, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void mediaHeaderDecoder(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Video Header Tag, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void videoHeaderDecoder(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Movie Header Tag, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void movieHeaderDecoder(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Track Header Tag, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void trackHeaderDecoder(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Handler Tag, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void handlerDecoder(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Tag which contain other sub-tags,
Packit Service 21b5d1
              and save it in the respective XMP container.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void multipleEntriesDecoder();
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Sample Description Tag, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void sampleDesc(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Image Description Tag, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void imageDescDecoder();
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret User Data Tag, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void userDataDecoder(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Preview Tag, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void previewTagDecoder(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Meta Keys Tags, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void keysTagDecoder(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Track Aperture Tags, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void trackApertureTagDecoder(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Nikon Tag, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void NikonTagsDecoder(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Tags from Different Camera make, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
          @param size Size of the data block used to store Tag Information.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void CameraTagsDecoder(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Interpret Audio Description Tag, and save it
Packit Service 21b5d1
              in the respective XMP container.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void audioDescDecoder();
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Helps to calculate Frame Rate from timeToSample chunk,
Packit Service 21b5d1
              and save it in the respective XMP container.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void timeToSampleDecoder();
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Recognizes which stream is currently under processing,
Packit Service 21b5d1
              and save its information in currentStream_ .
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void setMediaStream();
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Used to discard a tag along with its data. The Tag will
Packit Service 21b5d1
              be skipped and not decoded.
Packit Service 21b5d1
          @param size Size of the data block that is to skipped.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void discard(unsigned long size);
Packit Service 21b5d1
        /*!
Packit Service 21b5d1
          @brief Calculates Aspect Ratio of a video, and stores it in the
Packit Service 21b5d1
              respective XMP container.
Packit Service 21b5d1
         */
Packit Service 21b5d1
        void aspectRatio();
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        //! @name NOT Implemented
Packit Service 21b5d1
        //@{
Packit Service 21b5d1
        //! Copy constructor
Packit Service 21b5d1
        QuickTimeVideo(const QuickTimeVideo& rhs);
Packit Service 21b5d1
        //! Assignment operator
Packit Service 21b5d1
        QuickTimeVideo& operator=(const QuickTimeVideo& rhs);
Packit Service 21b5d1
        //@}
Packit Service 21b5d1
Packit Service 21b5d1
    private:
Packit Service 21b5d1
        //! Variable which stores Time Scale unit, used to calculate time.
Packit Service 21b5d1
        uint64_t timeScale_;
Packit Service 21b5d1
        //! Variable which stores current stream being processsed.
Packit Service 21b5d1
        int currentStream_;
Packit Service 21b5d1
        //! Variable to check the end of metadata traversing.
Packit Service 21b5d1
        bool continueTraversing_;
Packit Service 21b5d1
        //! Variable to store height and width of a video frame.
Packit Service 21b5d1
        uint64_t height_, width_;
Packit Service 21b5d1
Packit Service 21b5d1
    }; //QuickTimeVideo End
Packit Service 21b5d1
Packit Service 21b5d1
// *****************************************************************************
Packit Service 21b5d1
// template, inline and free functions
Packit Service 21b5d1
Packit Service 21b5d1
    // These could be static private functions on Image subclasses but then
Packit Service 21b5d1
    // ImageFactory needs to be made a friend.
Packit Service 21b5d1
    /*!
Packit Service 21b5d1
      @brief Create a new QuicktimeVideo instance and return an auto-pointer to it.
Packit Service 21b5d1
          Caller owns the returned object and the auto-pointer ensures that
Packit Service 21b5d1
          it will be deleted.
Packit Service 21b5d1
     */
Packit Service 21b5d1
    EXIV2LIB_DEPRECATED_EXPORT Image::AutoPtr newQTimeInstance(BasicIo::AutoPtr io, bool create);
Packit Service 21b5d1
Packit Service 21b5d1
    //! Check if the file iIo is a Quick Time Video.
Packit Service 21b5d1
    EXIV2LIB_DEPRECATED_EXPORT bool isQTimeType(BasicIo& iIo, bool advance);
Packit Service 21b5d1
Packit Service 21b5d1
}                                       // namespace Exiv2
Packit Service 21b5d1
Packit Service 21b5d1
#endif                                  // QUICKTIMEVIDEO_HPP