GUI: headers: add support for "video projection" track headers

Implements part of #2064.
This commit is contained in:
Moritz Bunkus 2017-08-05 16:21:36 +02:00
parent d0906f371d
commit 69c7033b18
2 changed files with 16 additions and 14 deletions

View File

@ -26,6 +26,8 @@
attributes. Part of the implementation of #2064. attributes. Part of the implementation of #2064.
* mkvpropedit: added support for the "video projection" track header * mkvpropedit: added support for the "video projection" track header
attributes. Part of the implementation of #2064. attributes. Part of the implementation of #2064.
* MKVToolNix GUI: header editor: added support for the "video projection"
track header attributes. Part of the implementation of #2064.
## Bug fixes ## Bug fixes

View File

@ -355,29 +355,22 @@ Tab::pruneEmptyMastersForTrack(TrackTypePage &page) {
if (!mtx::included_in(trackType, track_video, track_audio)) if (!mtx::included_in(trackType, track_video, track_audio))
return; return;
auto handler = [](EbmlMaster *parent, EbmlMaster *child) { std::unordered_map<EbmlMaster *, bool> handled;
if (!parent || !child || (0 < child->ListSize()))
return;
auto itr = std::find(parent->begin(), parent->end(), child);
if (itr != parent->end())
parent->Remove(itr);
delete child;
};
if (trackType == track_video) { if (trackType == track_video) {
auto trackVideo = &GetChild<KaxTrackVideo>(page.m_master); auto trackVideo = &GetChild<KaxTrackVideo>(page.m_master);
auto videoColour = &GetChild<KaxVideoColour>(trackVideo); auto videoColour = &GetChild<KaxVideoColour>(trackVideo);
auto videoColourMasterMeta = &GetChild<KaxVideoColourMasterMeta>(videoColour); auto videoColourMasterMeta = &GetChild<KaxVideoColourMasterMeta>(videoColour);
auto videoProjection = &GetChild<KaxVideoProjection>(trackVideo);
handler(videoColour, videoColourMasterMeta); remove_master_from_parent_if_empty_or_only_defaults(videoColour, videoColourMasterMeta, handled);
handler(trackVideo, videoColour); remove_master_from_parent_if_empty_or_only_defaults(trackVideo, videoColour, handled);
handler(&page.m_master, trackVideo); remove_master_from_parent_if_empty_or_only_defaults(trackVideo, videoProjection, handled);
remove_master_from_parent_if_empty_or_only_defaults(&page.m_master, trackVideo, handled);
} else } else
// trackType is track_audio // trackType is track_audio
handler(&page.m_master, &GetChild<KaxTrackAudio>(page.m_master)); remove_master_from_parent_if_empty_or_only_defaults(&page.m_master, &GetChild<KaxTrackAudio>(page.m_master), handled);
} }
void void
@ -487,13 +480,20 @@ Tab::handleTracks(kax_analyzer_data_c const &data) {
colourMasterMetaPage->setParentPage(*page); colourMasterMetaPage->setParentPage(*page);
colourMasterMetaPage->init(); colourMasterMetaPage->init();
auto projectionPage = new TopLevelPage{*this, YT("Video projection information")};
projectionPage->setInternalIdentifier(Q("videoProjection %1").arg(trackIdxMkvmerge - 1));
projectionPage->setParentPage(*page);
projectionPage->init();
parentMastersByCallback[&KaxTrackVideo::ClassInfos] = &GetChild<KaxTrackVideo>(kTrackEntry); parentMastersByCallback[&KaxTrackVideo::ClassInfos] = &GetChild<KaxTrackVideo>(kTrackEntry);
parentMastersByCallback[&KaxVideoColour::ClassInfos] = &GetChild<KaxVideoColour>(parentMastersByCallback[&KaxTrackVideo::ClassInfos]); parentMastersByCallback[&KaxVideoColour::ClassInfos] = &GetChild<KaxVideoColour>(parentMastersByCallback[&KaxTrackVideo::ClassInfos]);
parentMastersByCallback[&KaxVideoColourMasterMeta::ClassInfos] = &GetChild<KaxVideoColourMasterMeta>(parentMastersByCallback[&KaxVideoColour::ClassInfos]); parentMastersByCallback[&KaxVideoColourMasterMeta::ClassInfos] = &GetChild<KaxVideoColourMasterMeta>(parentMastersByCallback[&KaxVideoColour::ClassInfos]);
parentMastersByCallback[&KaxVideoProjection::ClassInfos] = &GetChild<KaxVideoProjection>(parentMastersByCallback[&KaxTrackVideo::ClassInfos]);
parentPagesByCallback[&KaxTrackVideo::ClassInfos] = page; parentPagesByCallback[&KaxTrackVideo::ClassInfos] = page;
parentPagesByCallback[&KaxVideoColour::ClassInfos] = colourPage; parentPagesByCallback[&KaxVideoColour::ClassInfos] = colourPage;
parentPagesByCallback[&KaxVideoColourMasterMeta::ClassInfos] = colourMasterMetaPage; parentPagesByCallback[&KaxVideoColourMasterMeta::ClassInfos] = colourMasterMetaPage;
parentPagesByCallback[&KaxVideoProjection::ClassInfos] = projectionPage;
} else if (track_audio == trackType) { } else if (track_audio == trackType) {
parentMastersByCallback[&KaxTrackAudio::ClassInfos] = &GetChild<KaxTrackAudio>(kTrackEntry); parentMastersByCallback[&KaxTrackAudio::ClassInfos] = &GetChild<KaxTrackAudio>(kTrackEntry);