#include "common.hh" #include "strutil.hh" #include "timezone.hh" #include "video.hh" #if HAVE_MEDIAINFO #include #endif namespace { class VideoImpl : public Video { public: VideoImpl(uint64_t width, uint64_t height) : width_(width), height_(height) {} uint64_t width() const override { return width_; } uint64_t height() const override { return height_; } double length() const override { return length_; } Location location() const override { return location_; } Date date() const override { return date_; } void set_length(double length) { length_ = length; } void set_location(Location location) { location_ = location; } void set_date(Date date) { date_ = date; } private: uint64_t width_; uint64_t height_; double length_{0.0}; Location location_; Date date_; }; #if HAVE_MEDIAINFO bool parse_location(std::string const& str, Location* location) { auto end = str.find('/'); if (end == std::string::npos) return false; char* latend = nullptr; location->lat = strtod(str.c_str(), &latend); if (!latend) return false; char* lngend = nullptr; location->lng = strtod(latend, &lngend); if (!lngend) return false; if (lngend != str.c_str() + end) return false; return true; } #endif } // namespace std::unique_ptr