diff --git a/include/exiv2/isobmff.hpp b/include/exiv2/bmffimage.hpp similarity index 86% rename from include/exiv2/isobmff.hpp rename to include/exiv2/bmffimage.hpp index f94baf03..7001f54a 100644 --- a/include/exiv2/isobmff.hpp +++ b/include/exiv2/bmffimage.hpp @@ -43,7 +43,7 @@ namespace Exiv2 /*! @brief Class to access ISO BMFF images. */ - class EXIV2API ISOBMFF : public Image { + class EXIV2API BmffImage : public Image { public: //! @name Creators //@{ @@ -61,13 +61,13 @@ namespace Exiv2 @param create Specifies if an existing image should be read (false) or if a new file should be created (true). */ - ISOBMFF(BasicIo::AutoPtr io, bool create); + BmffImage(BasicIo::AutoPtr io, bool create); //@} //! @name Manipulators //@{ - void readMetadata() override; - void writeMetadata() override; + void readMetadata() /* override */ ; + void writeMetadata() /* override */ ; /*! @brief Print out the structure of image file. @@ -75,27 +75,28 @@ namespace Exiv2 not valid (does not look like data of the specific image type). @warning This function is not thread safe and intended for exiv2 -pS for debugging. */ - void printStructure(std::ostream& out, PrintStructureOption option,int depth) override; + void printStructure(std::ostream& out, PrintStructureOption option,int depth) /* override */ ; /*! @brief Todo: Not supported yet(?). Calling this function will throw an instance of Error(kerInvalidSettingForImage). */ - void setComment(const std::string& comment) override; + void setComment(const std::string& comment) /* override */ ; //@} //! @name Accessors //@{ - std::string mimeType() const override; + std::string mimeType() const /* override */ ; //@} - - ISOBMFF& operator=(const ISOBMFF& rhs) = delete; - ISOBMFF& operator=(const ISOBMFF&& rhs) = delete; - ISOBMFF(const ISOBMFF& rhs) = delete; - ISOBMFF(const ISOBMFF&& rhs) = delete; +#if 0 + BmffImage& operator=(const BmffImage& rhs) /* = delete*/ ; + BmffImage& operator=(const BmffImage&& rhs) /* = delete */ ; + BmffImage(const BmffImage& rhs) /* = delete */; + BmffImage(const BmffImage&& rhs) /* = delete */; +#endif private: - int fileType = ImageType::bmff; + int fileType /* = ImageType::bmff*/ ; /*! @brief Provides the main implementation of writeMetadata() by @@ -107,7 +108,7 @@ namespace Exiv2 void doWriteMetadata(BasicIo& outIo); //@} - }; // class ISOBMFF + }; // class BmffImage // ***************************************************************************** // template, inline and free functions diff --git a/include/exiv2/exiv2.hpp b/include/exiv2/exiv2.hpp index ec0f214a..1313ad3b 100644 --- a/include/exiv2/exiv2.hpp +++ b/include/exiv2/exiv2.hpp @@ -46,9 +46,9 @@ #include "exiv2/image.hpp" #include "exiv2/ini.hpp" #include "exiv2/iptc.hpp" -#ifdef EXV_ENABLE_ISOBMFF -#include "isobmff.hpp" -#endif // EXV_ENABLE_ISOBMFF +#ifdef EXV_ENABLE_ISOBMFF +#include "bmffimage.hpp" +#endif// EXV_ENABLE_ISOBMFF #include "exiv2/jp2image.hpp" #include "exiv2/jpgimage.hpp" #include "exiv2/metadatum.hpp" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0079e006..3b2c32bd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -46,6 +46,7 @@ add_library( exiv2lib ../include/exiv2/rwlock.hpp ../include/exiv2/slice.hpp basicio.cpp ../include/exiv2/basicio.hpp + bmffimage.cpp ../include/exiv2/bmffimage.hpp bmpimage.cpp ../include/exiv2/bmpimage.hpp convert.cpp ../include/exiv2/convert.hpp cr2image.cpp ../include/exiv2/cr2image.hpp @@ -61,7 +62,6 @@ add_library( exiv2lib image.cpp ../include/exiv2/image.hpp ini.cpp ../include/exiv2/ini.hpp iptc.cpp ../include/exiv2/iptc.hpp - isobmff.cpp ../include/exiv2/isobmff.hpp jp2image.cpp ../include/exiv2/jp2image.hpp jpgimage.cpp ../include/exiv2/jpgimage.hpp metadatum.cpp ../include/exiv2/metadatum.hpp diff --git a/src/isobmff.cpp b/src/bmffimage.cpp similarity index 71% rename from src/isobmff.cpp rename to src/bmffimage.cpp index 6f2cd0d2..cdec8157 100644 --- a/src/isobmff.cpp +++ b/src/bmffimage.cpp @@ -23,7 +23,7 @@ // included header files #include "config.h" -#include "isobmff.hpp" +#include "bmffimage.hpp" #include "tiffimage.hpp" #include "image.hpp" #include "image_int.hpp" @@ -32,6 +32,7 @@ #include "futils.hpp" #include "types.hpp" #include "safe_op.hpp" +#include "unused.h" // + standard includes #include @@ -48,18 +49,20 @@ namespace Exiv2 EXIV2API bool enableISOBMFF(bool enable) { -#ifdef EXV_ENABLE_ISOBMFF +#ifdef EXV_ENABLE_ISOBMFF enabled = enable; -#endif // EXV_ENABLE_ISOBMFF - return enabled; + return true; +#endif//EXV_ENABLE_ISOBMFF + enable = false ; + return enable ; } - ISOBMFF::ISOBMFF(BasicIo::AutoPtr io, bool /* create */) + BmffImage::BmffImage(BasicIo::AutoPtr io, bool /* create */) : Image(ImageType::bmff, mdExif | mdIptc | mdXmp, std::move(io)) { - } // ISOBMFF::ISOBMFF + } // BmffImage::BmffImage - std::string ISOBMFF::mimeType() const + std::string BmffImage::mimeType() const { /* switch (fileType) @@ -74,49 +77,21 @@ namespace Exiv2 return "image/unknown"; } */ + return "image/bmff"; + } - void ISOBMFF::setComment(const std::string& /*comment*/) + void BmffImage::setComment(const std::string& /*comment*/) { // Todo: implement me! throw(Error(kerInvalidSettingForImage, "Image comment", "ISO BMFF")); } // ISOBMFF::setComment - static void lf(std::ostream& out, bool& bLF) - { - if ( bLF ) { - out << std::endl; - out.flush(); - bLF = false ; - } - } - - static bool isBigEndian() - { - union { - uint32_t i; - char c[4]; - } e = { 0x01000000 }; - - return e.c[0] != 0; - } - - static std::string toAscii(long n) - { - const auto p = reinterpret_cast(&n); - std::string result; - bool bBigEndian = isBigEndian(); - for ( int i = 0 ; i < 4 ; i++) { - result += p[ bBigEndian ? i : (3-i) ]; - } - return result; - } - - void ISOBMFF::readMetadata() + void BmffImage::readMetadata() { } // ISOBMFF::readMetadata - void ISOBMFF::printStructure(std::ostream& out, PrintStructureOption option, int depth) + void BmffImage::printStructure(std::ostream& out, PrintStructureOption option, int depth) { if (io_->open() != 0) throw Error(kerDataSourceOpenFailed, io_->path(), strError()); @@ -127,17 +102,20 @@ namespace Exiv2 throw Error(kerFailedToReadImageData); throw Error(kerNotAnImage); } + UNUSED(out); + UNUSED(option); + UNUSED(depth); } // ISOBMFF::printStructure - void ISOBMFF::writeMetadata() + void BmffImage::writeMetadata() { - } // ISOBMFF::writeMetadata + } // BmffImage::writeMetadata // ************************************************************************* // free functions Image::AutoPtr newBmffInstance(BasicIo::AutoPtr io, bool create) { - Image::AutoPtr image(new ISOBMFF(std::move(io), create)); + Image::AutoPtr image(new BmffImage(std::move(io), create)); if (!image->good()) { image.reset(); @@ -158,11 +136,12 @@ namespace Exiv2 { return false; } - bool isobmffMatched = buf[4] == 'f' && buf[5] == 't' && buf[6] == 'y' && buf[7] == 'p'; + + bool result = buf[4] == 'f' && buf[5] == 't' && buf[6] == 'y' && buf[7] == 'p'; if (!advance) { iIo.seek(-len, BasicIo::cur); } - return isobmffMatched; + return result; } } // namespace Exiv2 diff --git a/src/image.cpp b/src/image.cpp index a3a36fcb..d5cef016 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -31,17 +31,17 @@ #include "safe_op.hpp" #include "slice.hpp" +#ifdef EXV_ENABLE_ISOBMFF +#include "bmffimage.hpp" +#endif// EXV_ENABLE_ISOBMFF #include "cr2image.hpp" #include "crwimage.hpp" #include "epsimage.hpp" -#ifdef EXV_ENABLE_ISOBMFF -#include "isobmff.hpp" -#endif // EXV_ENABLE_ISOBMFF #include "jpgimage.hpp" #include "mrwimage.hpp" -#ifdef EXV_HAVE_LIBZ +#ifdef EXV_HAVE_LIBZ # include "pngimage.hpp" -#endif // EXV_HAVE_LIBZ +#endif// EXV_HAVE_LIBZ #include "rafimage.hpp" #include "tiffimage.hpp" #include "tiffimage_int.hpp" @@ -56,12 +56,12 @@ #include "jp2image.hpp" #include "nikonmn_int.hpp" -#ifdef EXV_ENABLE_VIDEO +#ifdef EXV_ENABLE_VIDEO #include "matroskavideo.hpp" #include "quicktimevideo.hpp" #include "riffvideo.hpp" #include "asfvideo.hpp" -#endif // EXV_ENABLE_VIDEO +#endif// EXV_ENABLE_VIDEO #include "rw2image.hpp" #include "pgfimage.hpp" #include "xmpsidecar.hpp"