From deb41c2ea127f5195aba9bb776fd8eca5a2912c2 Mon Sep 17 00:00:00 2001 From: Frank Galligan Date: Tue, 2 Jun 2015 16:14:19 -0700 Subject: [PATCH] Add support to parse DisplayUnit. BUG=https://code.google.com/p/webm/issues/detail?id=1009 Change-Id: I209ee6caf5bc10dfc1761e650821cc2338a4b13c --- mkvparser.cpp | 9 +++++++++ mkvparser.hpp | 2 ++ 2 files changed, 11 insertions(+) diff --git a/mkvparser.cpp b/mkvparser.cpp index 833c807..0bba3c4 100644 --- a/mkvparser.cpp +++ b/mkvparser.cpp @@ -4574,6 +4574,7 @@ long VideoTrack::Parse(Segment* pSegment, const Info& info, long long height = 0; long long display_width = 0; long long display_height = 0; + long long display_unit = 0; long long stereo_mode = 0; double rate = 0.0; @@ -4617,6 +4618,11 @@ long VideoTrack::Parse(Segment* pSegment, const Info& info, if (display_height <= 0) return E_FILE_FORMAT_INVALID; + } else if (id == 0x14B2) { // display unit + display_unit = UnserializeUInt(pReader, pos, size); + + if (display_unit < 0) + return E_FILE_FORMAT_INVALID; } else if (id == 0x13B8) { // stereo mode stereo_mode = UnserializeUInt(pReader, pos, size); @@ -4655,6 +4661,7 @@ long VideoTrack::Parse(Segment* pSegment, const Info& info, pTrack->m_height = height; pTrack->m_display_width = display_width; pTrack->m_display_height = display_height; + pTrack->m_display_unit = display_unit; pTrack->m_stereo_mode = stereo_mode; pTrack->m_rate = rate; @@ -4767,6 +4774,8 @@ long long VideoTrack::GetDisplayHeight() const { return m_display_height > 0 ? m_display_height : GetHeight(); } +long long VideoTrack::GetDisplayUnit() const { return m_display_unit; } + long long VideoTrack::GetStereoMode() const { return m_stereo_mode; } double VideoTrack::GetFrameRate() const { return m_rate; } diff --git a/mkvparser.hpp b/mkvparser.hpp index 65b8cef..ddbcb60 100644 --- a/mkvparser.hpp +++ b/mkvparser.hpp @@ -400,6 +400,7 @@ class VideoTrack : public Track { long long GetHeight() const; long long GetDisplayWidth() const; long long GetDisplayHeight() const; + long long GetDisplayUnit() const; long long GetStereoMode() const; double GetFrameRate() const; @@ -411,6 +412,7 @@ class VideoTrack : public Track { long long m_height; long long m_display_width; long long m_display_height; + long long m_display_unit; long long m_stereo_mode; double m_rate;