Rename class ISOBMFF => class bmffImage to match other image handlers. Removed C++11 style code. Removed unused code.
This commit is contained in:
parent
460a802671
commit
0844e1bbfb
@ -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
|
||||
@ -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"
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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 <string>
|
||||
@ -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<const char*>(&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
|
||||
@ -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"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user