Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix_enableBMFF_v1 #1554

Merged
merged 2 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ option( EXIV2_ENABLE_WIN_UNICODE "Use Unicode paths (wstring) on Windows"
option( EXIV2_ENABLE_WEBREADY "Build webready support into library" OFF )
option( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo (WEBREADY)" OFF )
option( EXIV2_ENABLE_SSH "USE Libssh for SshIo (WEBREADY)" OFF )
option( EXIV2_ENABLE_BMFF "Build with BMFF support" OFF )
option( EXIV2_ENABLE_BMFF "Build with BMFF support" ON )

option( EXIV2_BUILD_SAMPLES "Build sample applications" ON )
option( EXIV2_BUILD_EXIV2_COMMAND "Build exiv2 command-line executable" ON )
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON
option( EXIV2_ENABLE_EXTERNAL_XMP "Use external version of XMP" OFF )
option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON )
...
option( EXIV2_ENABLE_BMFF "Build with BMFF support" OFF )
option( EXIV2_ENABLE_BMFF "Build with BMFF support" ON )
577 rmills@rmillsmm:~/gnu/github/exiv2/exiv2 $
```

Expand Down Expand Up @@ -786,7 +786,7 @@ Access to the bmff code is guarded in two ways. Firstly, you have to build the
EXIV2API bool enableBMFF(bool enable);
```

The return value from `enableBMFF()` reports the current status of bmff support before calling this function.
The return value from `enableBMFF()` is true if the library has been build with bmff support (cmake option -DEXIV2_ANABLE_BMFF=On).

Applications may wish to provide a preference setting to enable bmff support and thereby place the responsibility for the use of this code with the user of the application.

Expand Down
5 changes: 5 additions & 0 deletions include/exiv2/bmffimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@
namespace Exiv2
{
EXIV2API bool enableBMFF(bool enable = true);
}

#ifdef EXV_ENABLE_BMFF
namespace Exiv2
{
struct Iloc
{
Iloc(uint32_t ID = 0, uint32_t start = 0, uint32_t length = 0) : ID_(ID), start_(start), length_(length){};
Expand Down Expand Up @@ -168,3 +172,4 @@ namespace Exiv2
//! Check if the file iIo is a BMFF image.
EXIV2API bool isBmffType(BasicIo& iIo, bool advance);
} // namespace Exiv2
#endif // EXV_ENABLE_BMFF
2 changes: 0 additions & 2 deletions include/exiv2/exiv2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
#include "exiv2/mrwimage.hpp"
#include "exiv2/orfimage.hpp"
#include "exiv2/pgfimage.hpp"
#ifdef EXV_ENABLE_BMFF
#include "bmffimage.hpp"
#endif

#ifdef EXV_HAVE_LIBZ
#include "exiv2/pngimage.hpp"
Expand Down
8 changes: 3 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,9 @@ if( EXIV2_ENABLE_VIDEO )
)
endif()

if( EXIV2_ENABLE_BMFF )
target_sources(exiv2lib PRIVATE
bmffimage.cpp ../include/exiv2/bmffimage.hpp
)
endif()
target_sources(exiv2lib PRIVATE
bmffimage.cpp ../include/exiv2/bmffimage.hpp
)

# Other library target properties
# ---------------------------------------------------------
Expand Down
21 changes: 14 additions & 7 deletions src/bmffimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,15 @@ struct BmffBoxHeader

// *****************************************************************************
// class member definitions
#ifdef EXV_ENABLE_BMFF
namespace Exiv2
{
static bool enabled = false;

#ifdef EXV_ENABLE_BMFF
static bool enabled = false;
EXIV2API bool enableBMFF(bool enable)
{
bool result = enabled;
enabled = enable ;
return result ;
enabled = enable ;
return true ;
}
#endif // EXV_ENABLE_BMFF

std::string Iloc::toString() const
{
Expand Down Expand Up @@ -629,3 +626,13 @@ namespace Exiv2
return matched;
}
} // namespace Exiv2
#else // ifdef EXV_ENABLE_BMFF
namespace Exiv2
{
EXIV2API bool enableBMFF(bool)
{
return false ;
}
}
#endif