diff --git a/NEWS.md b/NEWS.md index ac16eef05..6fa520f92 100644 --- a/NEWS.md +++ b/NEWS.md @@ -37,7 +37,8 @@ library will be used if found via `pkg-config`. If it is found, support for reading chapters from DVDs will be enabled in `mkvmerge` and the MKVToolNix GUI. Part of the implementation of #2808. -* Boost's Date/Time, Range and Range Adaptors libraries are not used anymore. +* Boost's Date/Time, Range, Range Adaptors, Tri-Bool, Variant libraries are + not used anymore. # Version 46.0.0 "No Deeper Escape" 2020-05-01 diff --git a/README.md b/README.md index a49f4b621..c98c87a80 100644 --- a/README.md +++ b/README.md @@ -96,8 +96,8 @@ programs and libraries you absolutely need are: - [zlib](http://www.zlib.net/) — a compression library - [Boost](http://www.boost.org/) — Several of Boost's libraries are - used: `filesystem`, `system`, `math`, `operators`, `rational`, - `variant`. At least v1.60.0 is required. + used: `filesystem`, `system`, `math`, `operators`, `rational`. At + least v1.60.0 is required. - [libxslt's xsltproc binary](http://xmlsoft.org/libxslt/) and [DocBook XSL stylesheets](https://sourceforge.net/projects/docbook/files/docbook-xsl/) diff --git a/ac/boost.m4 b/ac/boost.m4 index 4f514d23f..e0232be6c 100644 --- a/ac/boost.m4 +++ b/ac/boost.m4 @@ -26,7 +26,3 @@ AX_BOOST_CHECK_HEADERS([boost/lexical_cast.hpp],,[ AX_BOOST_CHECK_HEADERS([boost/operators.hpp],,[ AC_MSG_ERROR([Boost's Operators library is required but wasn't found]) ]) - -AX_BOOST_CHECK_HEADERS([boost/variant.hpp],,[ - AC_MSG_ERROR([Boost's variant library is required but wasn't found]) -]) diff --git a/src/common/amf.cpp b/src/common/amf.cpp index a17cb6c05..3c801547d 100644 --- a/src/common/amf.cpp +++ b/src/common/amf.cpp @@ -19,6 +19,24 @@ namespace mtx::amf { +namespace { + +std::string +value_to_string(value_type_t const &value) { + if (std::holds_alternative(value)) + return fmt::format("{0}", std::get(value)); + + if (std::holds_alternative(value)) + return std::get(value) ? "yes" : "no"; + + if (std::holds_alternative(value)) + return std::get(value); + + return {}; +} + +} + script_parser_c::script_parser_c(memory_cptr const &mem) : m_data_mem{mem} , m_data{*mem.get()} @@ -62,7 +80,7 @@ script_parser_c::read_properties(std::unordered_map & auto key = read_string(TYPE_STRING); auto value = read_value(); - mxdebug_if(m_debug, fmt::format("{0}Property key: {1}; value read: {2}; value: {3}\n", level_spacer(), key, value.second, boost::apply_visitor(value_to_string_c(), value.first))); + mxdebug_if(m_debug, fmt::format("{0}Property key: {1}; value read: {2}; value: {3}\n", level_spacer(), key, value.second, value_to_string(value.first))); if (key.empty() || !value.second) break; @@ -99,7 +117,7 @@ script_parser_c::read_value() { else if ((TYPE_STRING == data_type) || (TYPE_LONG_STRING == data_type)) { value = read_string(data_type); - m_in_meta_data = boost::get(value) == "onMetaData"; + m_in_meta_data = std::get(value) == "onMetaData"; } else if (TYPE_OBJECT == data_type) { std::unordered_map dummy; diff --git a/src/common/amf.h b/src/common/amf.h index 0dfc4ebdc..8cf1d02d9 100644 --- a/src/common/amf.h +++ b/src/common/amf.h @@ -16,30 +16,15 @@ #include "common/common_pch.h" #include -#include +#include #include "common/mm_mem_io.h" namespace mtx::amf { -using value_type_t = boost::variant; +using value_type_t = std::variant; using meta_data_t = std::unordered_map; -class value_to_string_c: public boost::static_visitor { -public: - std::string operator ()(double value) const { - return fmt::format("{0}", value); - } - - std::string operator ()(bool value) const { - return value ? "yes" : "no"; - } - - std::string operator ()(std::string const &value) const { - return value; - } -}; - class script_parser_c { public: enum data_type_e { @@ -74,13 +59,13 @@ public: meta_data_t const &get_meta_data() const; template - T const * + std::optional get_meta_data_value(std::string const &key) { auto itr = m_meta_data.find(key); if (m_meta_data.end() == itr) - return nullptr; + return {}; - return boost::get(&itr->second); + return std::get(itr->second); } protected: diff --git a/src/input/r_flv.cpp b/src/input/r_flv.cpp index 3ce4ae131..eb1ba040b 100644 --- a/src/input/r_flv.cpp +++ b/src/input/r_flv.cpp @@ -680,7 +680,7 @@ flv_reader_c::process_script_tag() { mtx::amf::script_parser_c parser{m_in->read(m_tag.m_data_size)}; parser.parse(); - double const *number; + std::optional number; if ((number = parser.get_meta_data_value("framerate"))) { m_tracks[m_video_track_idx]->m_v_frame_rate = *number;