diff --git a/mrv2/docs/HISTORY.md b/mrv2/docs/HISTORY.md index 4152169b0..7a8500238 100644 --- a/mrv2/docs/HISTORY.md +++ b/mrv2/docs/HISTORY.md @@ -64,7 +64,12 @@ v1.0.7 - Made warnings also show up in the status bar, but with an orange background. - Improved HUD Attributes. They are now listed alphabetically and they are not repeated. Also, they refresh properly. - +- Fixed Media Information panel not refreshing properly when changing images. +- mrv2's tlRender library now reads the video and audio stream metadata. +- When there's no audio metadata there's no longer the titles of + Attribute/Value used at the end of the Metadata tab in the Media Info Panel. +- Metadata is now sorted and stripped of repeated data. +- Metadata folder now remembers to be opened. v1.0.6 diff --git a/mrv2/lib/mrvApp/mrvApp.cpp b/mrv2/lib/mrvApp/mrvApp.cpp index 3c15da031..11c0e7835 100644 --- a/mrv2/lib/mrvApp/mrvApp.cpp +++ b/mrv2/lib/mrvApp/mrvApp.cpp @@ -634,26 +634,24 @@ namespace mrv const char* kModule = ""; for (const auto& i : value) { + const std::string& msg = i.message; + if (msg == lastMessage) + return; + lastMessage = msg; switch (i.type) { case log::Type::Error: { - const std::string& msg = i.message; - if (msg == lastMessage) - return; - lastMessage = msg; LOG_ERROR(msg); break; } case log::Type::Warning: { - const std::string& msg = i.message; LOG_WARNING(msg); break; } case log::Type::Status: { - const std::string& msg = i.message; LOG_INFO(msg); break; } diff --git a/mrv2/lib/mrvCore/mrvString.h b/mrv2/lib/mrvCore/mrvString.h index 147458817..3fea67dd5 100644 --- a/mrv2/lib/mrvCore/mrvString.h +++ b/mrv2/lib/mrvCore/mrvString.h @@ -115,6 +115,15 @@ namespace mrv double toDouble() const; }; + struct CaseInsensitiveCompare + { + inline bool operator()(const std::string& a, + const std::string& b) const + { + return string::toLower(a) < string::toLower(b); + } + }; + } // namespace string } // namespace mrv diff --git a/mrv2/lib/mrvGL/mrvTimelineViewport.cpp b/mrv2/lib/mrvGL/mrvTimelineViewport.cpp index d181b799a..cbd47fcc5 100644 --- a/mrv2/lib/mrvGL/mrvTimelineViewport.cpp +++ b/mrv2/lib/mrvGL/mrvTimelineViewport.cpp @@ -66,7 +66,7 @@ namespace mrv float TimelineViewport::Private::helpTextFade; bool TimelineViewport::Private::hudActive = true; HudDisplay TimelineViewport::Private::hud = HudDisplay::kNone; - std::map + std::map TimelineViewport::Private::tagData; static void drawTimeoutText_cb(TimelineViewport* view) diff --git a/mrv2/lib/mrvGL/mrvTimelineViewportPrivate.h b/mrv2/lib/mrvGL/mrvTimelineViewportPrivate.h index a6e6af756..931412a10 100644 --- a/mrv2/lib/mrvGL/mrvTimelineViewportPrivate.h +++ b/mrv2/lib/mrvGL/mrvTimelineViewportPrivate.h @@ -9,6 +9,8 @@ #include #include +#include "mrvCore/mrvString.h" + #include "mrvDraw/Annotation.h" class ViewerUI; @@ -16,18 +18,11 @@ class Fl_Menu_Button; namespace mrv { - struct CaseInsensitiveCompare - { - inline bool operator()(const std::string& a, const std::string& b) const - { - return tl::string::toLower(a) < tl::string::toLower(b); - } - }; struct TimelineViewport::Private { static std::map tagData; + string::CaseInsensitiveCompare> tagData; static timeline::BackgroundOptions backgroundOptions; timeline::OCIOOptions ocioOptions; diff --git a/mrv2/lib/mrvPanels/mrvImageInfoPanel.cpp b/mrv2/lib/mrvPanels/mrvImageInfoPanel.cpp index 5b281f9af..0c5cba6c9 100644 --- a/mrv2/lib/mrvPanels/mrvImageInfoPanel.cpp +++ b/mrv2/lib/mrvPanels/mrvImageInfoPanel.cpp @@ -16,6 +16,7 @@ #include "mrvCore/mrvI8N.h" #include "mrvCore/mrvUtil.h" #include "mrvCore/mrvSequence.h" +#include "mrvCore/mrvString.h" #include "mrvCore/mrvMath.h" #include "mrvFl/mrvHotkey.h" @@ -446,8 +447,7 @@ namespace mrv std::string prefix = tab_prefix(); std::string key = prefix + "Main"; - std_any value = settings->getValue(key); - int open = std_any_empty(value) ? 1 : std_any_cast(value); + int open = settings->getValue(key); if (!open) m_image->close(); @@ -468,14 +468,12 @@ namespace mrv m_video); key = prefix + "Video"; - value = settings->getValue(key); - open = std_any_empty(value) ? 0 : std_any_cast(value); + open = settings->getValue(key); if (!open) m_video->close(); Y += m_video->h(); m_audio = new CollapsibleGroup(g->x(), Y, W, 400, _("Audio")); - m_audio->close(); m_audio->end(); b = m_audio->button(); b->callback( @@ -491,14 +489,14 @@ namespace mrv m_audio); key = prefix + "Audio"; - value = settings->getValue(key); - open = std_any_empty(value) ? 0 : std_any_cast(value); + open = settings->getValue(key); if (!open) m_audio->close(); Y += m_audio->h(); + + m_subtitle = new CollapsibleGroup(g->x(), Y, W, 400, _("Subtitle")); - m_subtitle->close(); m_subtitle->end(); b = m_subtitle->button(); b->callback( @@ -514,15 +512,13 @@ namespace mrv m_subtitle); key = prefix + "Subtitle"; - value = settings->getValue(key); - open = std_any_empty(value) ? 0 : std_any_cast(value); + open = settings->getValue(key); if (!open) m_subtitle->close(); Y += m_subtitle->h(); m_attributes = new CollapsibleGroup(g->x(), Y, W, 400, _("Metadata")); - m_attributes->close(); m_attributes->end(); b = m_attributes->button(); b->callback( @@ -704,7 +700,7 @@ namespace mrv m_subtitle->hide(); m_attributes->hide(); - DBG3; + } void ImageInfoPanel::set_tabs() const @@ -754,17 +750,17 @@ namespace mrv fill_data(); - m_image->end(); m_attributes->end(); - m_video->end(); - m_audio->end(); m_subtitle->end(); + m_audio->end(); + m_video->end(); + m_image->end(); if (player) g->end(); - DBG3; + } Table* @@ -1932,13 +1928,13 @@ namespace mrv _("OCIO Input Color Space"), img->ocio_input_color_space().c_str() ); - DBG3; + ++group; #endif #if 0 - DBG3; + if ( !img->has_video() ) { add_text( _("Line Order"), _("Line order in file"), @@ -1951,7 +1947,7 @@ namespace mrv { ++group; - DBG3; + add_text( _("Compression"), _("Clip Compression"), img->compression() ); @@ -1965,7 +1961,7 @@ namespace mrv #if 0 - DBG3; + const char* space_type = nullptr; double memory_space = double( to_memory( (long double)img->memory(), space_type ) ); @@ -1973,7 +1969,7 @@ namespace mrv add_text( _("Memory"), _("Memory without Compression"), buf ); - DBG3; + if ( img->disk_space() >= 0 ) { @@ -1984,7 +1980,7 @@ namespace mrv (long double) img->memory() ) ); - DBG3; + snprintf( buf, 256, _("%.3f %s (%.2f %% of memory size)"), disk_space, space_type, pct ); @@ -2003,50 +1999,22 @@ namespace mrv } - DBG3; + ++group; add_text( _("Creation Date"), _("Creation Date"), img->creation_date() ); - DBG3; + - DBG3; + #endif - DBG3; + g->tooltip(nullptr); - image::Tags tags; - if (!videoData.empty() && !videoData[0].layers.empty() && - videoData[0].layers[0].image) - { - { - m_curr = add_browser(m_attributes); - tags = videoData[0].layers[0].image->getTags(); - for (const auto& tag : tags) - { - add_text(_(tag.first.c_str()), "", tag.second); - } - - m_attributes->show(); - } - } - - m_curr = add_browser(m_attributes); - - for (const auto& tag : info.tags) - { - auto it = tags.find(tag.first); - if (it != tags.end()) - continue; - add_text(_(tag.first.c_str()), "", tag.second); - } - - m_attributes->show(); - if (num_audio_streams > 0) { for (int i = 0; i < num_audio_streams; ++i) @@ -2108,9 +2076,6 @@ namespace mrv ++group; - add_text(_("Language"), _("Language if known"), audio.name); - ++group; - #if 0 add_text( _("Disposition"), _("Disposition of Track"), s.disposition); @@ -2172,6 +2137,47 @@ namespace mrv } #endif + std::map tagData; + image::Tags tags; + + // First, add global tags + for (const auto& tag : info.tags) + { + tagData[tag.first] = tag.second; + } + + // Then add image tags + if (!videoData.empty() && !videoData[0].layers.empty() && + videoData[0].layers[0].image) + { + m_curr = add_browser(m_attributes); + tags = videoData[0].layers[0].image->getTags(); + for (const auto& tag : tags) + { + tagData[tag.first] = tag.second; + } + } + + for (const auto& item : tagData) + { + bool skip = false; + if (item.first.substr(0, 5) == "Video" || + item.first.substr(0, 5) == "Audio") + { + if (item.first.substr(0, 12) != "Video Stream" && + item.first.substr(0, 12) != "Audio Stream") + skip = true; + } + if (skip) + { + continue; + } + add_text( _(item.first.c_str()), "", _(item.second.c_str())); + } + + m_attributes->show(); + // Call g->end() so we refresh the pack/scroll sizes // g->end(); } diff --git a/tlRender b/tlRender index d38a27131..6b635b0f6 160000 --- a/tlRender +++ b/tlRender @@ -1 +1 @@ -Subproject commit d38a2713198f93950cc3c08265b1bc62898e4a7a +Subproject commit 6b635b0f638082e8d7527b1f591bd27d879d4ea0