From 1d4a906682d19207b0885d90f25fe3e5fd9bb844 Mon Sep 17 00:00:00 2001 From: jelkins Date: Thu, 8 Oct 2020 17:29:11 -0700 Subject: check values for ContainerDuration. --- src/AS_DCP_MPEG2.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/AS_DCP_MPEG2.cpp') diff --git a/src/AS_DCP_MPEG2.cpp b/src/AS_DCP_MPEG2.cpp index 8afa8bc..2a11de2 100755 --- a/src/AS_DCP_MPEG2.cpp +++ b/src/AS_DCP_MPEG2.cpp @@ -48,9 +48,11 @@ MD_to_MPEG2_VDesc(MXF::MPEG2VideoDescriptor* VDescObj, MPEG2::VideoDescriptor& V VDesc.SampleRate = VDescObj->SampleRate; VDesc.EditRate = VDescObj->SampleRate; VDesc.FrameRate = VDescObj->SampleRate.Numerator; - assert(VDescObj->ContainerDuration <= 0xFFFFFFFFL); - VDesc.ContainerDuration = (ui32_t) VDescObj->ContainerDuration; - + if ( ! VDescObj->ContainerDuration.empty() ) + { + assert(VDescObj->ContainerDuration <= 0xFFFFFFFFL); + VDesc.ContainerDuration = (ui32_t) VDescObj->ContainerDuration; + } VDesc.FrameLayout = VDescObj->FrameLayout; VDesc.StoredWidth = VDescObj->StoredWidth; VDesc.StoredHeight = VDescObj->StoredHeight; @@ -77,7 +79,6 @@ MPEG2_VDesc_to_MD(MPEG2::VideoDescriptor& VDesc, MXF::MPEG2VideoDescriptor* VDes VDescObj->SampleRate = VDesc.SampleRate; VDescObj->ContainerDuration = VDesc.ContainerDuration; - VDescObj->FrameLayout = VDesc.FrameLayout; VDescObj->StoredWidth = VDesc.StoredWidth; VDescObj->StoredHeight = VDesc.StoredHeight; -- cgit v1.2.3 From 97e63717adfef05acd1584897942f4834aeacfa0 Mon Sep 17 00:00:00 2001 From: jelkins Date: Fri, 9 Oct 2020 11:43:06 -0700 Subject: add more empty() checks and adjust whitespace --- src/AS_DCP_MPEG2.cpp | 26 +++++++++++++++++++++----- src/PCMParserList.cpp | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'src/AS_DCP_MPEG2.cpp') diff --git a/src/AS_DCP_MPEG2.cpp b/src/AS_DCP_MPEG2.cpp index 2a11de2..b7e6252 100755 --- a/src/AS_DCP_MPEG2.cpp +++ b/src/AS_DCP_MPEG2.cpp @@ -60,13 +60,29 @@ MD_to_MPEG2_VDesc(MXF::MPEG2VideoDescriptor* VDescObj, MPEG2::VideoDescriptor& V VDesc.ComponentDepth = VDescObj->ComponentDepth; VDesc.HorizontalSubsampling = VDescObj->HorizontalSubsampling; - VDesc.VerticalSubsampling = VDescObj->VerticalSubsampling; - VDesc.ColorSiting = VDescObj->ColorSiting; - VDesc.CodedContentType = VDescObj->CodedContentType; + if ( ! VDescObj->VerticalSubsampling.empty() ) + { + VDesc.VerticalSubsampling = VDescObj->VerticalSubsampling; + } + if ( ! VDescObj->ColorSiting.empty() ) + { + VDesc.ColorSiting = VDescObj->ColorSiting; + } + if ( ! VDescObj->CodedContentType.empty() ) + { + VDesc.CodedContentType = VDescObj->CodedContentType; + } VDesc.LowDelay = VDescObj->LowDelay.get() == 0 ? false : true; - VDesc.BitRate = VDescObj->BitRate; - VDesc.ProfileAndLevel = VDescObj->ProfileAndLevel; + if ( ! VDescObj->BitRate.empty() ) + { + VDesc.BitRate = VDescObj->BitRate; + } + if ( ! VDescObj->ProfileAndLevel.empty() ) + { + VDesc.ProfileAndLevel = VDescObj->ProfileAndLevel; + } + return RESULT_OK; } diff --git a/src/PCMParserList.cpp b/src/PCMParserList.cpp index 67e7ef8..b814951 100755 --- a/src/PCMParserList.cpp +++ b/src/PCMParserList.cpp @@ -194,7 +194,7 @@ ASDCP::PCMParserList::OpenRead(const Kumu::PathList_t& argv, const Rational& Pic } if ( I->ADesc.ContainerDuration < m_ADesc.ContainerDuration ) - m_ADesc.ContainerDuration = I->ADesc.ContainerDuration; + m_ADesc.ContainerDuration = I->ADesc.ContainerDuration; m_ADesc.BlockAlign += I->ADesc.BlockAlign; } -- cgit v1.2.3