summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2016-12-03 21:26:24 +0000
committerjhurst <>2016-12-03 21:26:24 +0000
commit74e6b1105dffe52c6f347d723507ab346eabbb5a (patch)
treeb0e166ee8988cc9f2b150691effd0c4a1fa77cbd /src
parent779d581d1176e0d09ae13a65d8047509bfa11eeb (diff)
o Fixed *all* Partiton version numbers in AS-02 files
Diffstat (limited to 'src')
-rw-r--r--src/AS_02_PHDR.cpp8
-rw-r--r--src/AS_02_TimedText.cpp4
-rw-r--r--src/AS_02_internal.h6
-rw-r--r--src/KM_fileio.cpp20
-rw-r--r--src/h__02_Writer.cpp4
5 files changed, 34 insertions, 8 deletions
diff --git a/src/AS_02_PHDR.cpp b/src/AS_02_PHDR.cpp
index d52618e..94b973d 100644
--- a/src/AS_02_PHDR.cpp
+++ b/src/AS_02_PHDR.cpp
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2011-2015, John Hurst
+Copyright (c) 2011-2016, John Hurst
All rights reserved.
@@ -500,6 +500,8 @@ AS_02::PHDR::MXFWriter::h__Writer::WritePHDRHeader(const std::string& PackageLab
UL body_ul(m_Dict->ul(MDD_ClosedCompleteBodyPartition));
Partition body_part(m_Dict);
body_part.BodySID = 1;
+ body_part.MajorVersion = m_HeaderPart.MajorVersion;
+ body_part.MinorVersion = m_HeaderPart.MinorVersion;
body_part.OperationalPattern = m_HeaderPart.OperationalPattern;
body_part.EssenceContainers = m_HeaderPart.EssenceContainers;
body_part.ThisPartition = m_ECStart;
@@ -599,6 +601,8 @@ AS_02::PHDR::MXFWriter::h__Writer::WriteFrame(const AS_02::PHDR::FrameBuffer& Fr
UL body_ul(m_Dict->ul(MDD_ClosedCompleteBodyPartition));
Partition body_part(m_Dict);
body_part.BodySID = 1;
+ body_part.MajorVersion = m_HeaderPart.MajorVersion;
+ body_part.MinorVersion = m_HeaderPart.MinorVersion;
body_part.OperationalPattern = m_HeaderPart.OperationalPattern;
body_part.EssenceContainers = m_HeaderPart.EssenceContainers;
body_part.ThisPartition = m_File.Tell();
@@ -645,6 +649,8 @@ AS_02::PHDR::MXFWriter::h__Writer::Finalize(const std::string& PHDR_master_metad
static UL GenericStream_DataElement(m_Dict->ul(MDD_GenericStream_DataElement));
ASDCP::MXF::Partition GSPart(m_Dict);
+ GSPart.MajorVersion = m_HeaderPart.MajorVersion;
+ GSPart.MinorVersion = m_HeaderPart.MinorVersion;
GSPart.ThisPartition = here;
GSPart.PreviousPartition = m_RIP.PairArray.back().ByteOffset;
GSPart.OperationalPattern = m_HeaderPart.OperationalPattern;
diff --git a/src/AS_02_TimedText.cpp b/src/AS_02_TimedText.cpp
index 4965859..9e14600 100644
--- a/src/AS_02_TimedText.cpp
+++ b/src/AS_02_TimedText.cpp
@@ -602,6 +602,8 @@ AS_02::TimedText::MXFWriter::h__Writer::WriteTimedTextResource(const std::string
assert(m_Dict);
ASDCP::MXF::Partition partition(m_Dict);
+ partition.MajorVersion = m_HeaderPart.MajorVersion;
+ partition.MinorVersion = m_HeaderPart.MinorVersion;
partition.ThisPartition = here;
partition.BodySID = 0;
partition.IndexSID = 129;
@@ -650,6 +652,8 @@ AS_02::TimedText::MXFWriter::h__Writer::WriteAncillaryResource(const ASDCP::Time
static UL GenericStream_DataElement(m_Dict->ul(MDD_GenericStream_DataElement));
ASDCP::MXF::Partition GSPart(m_Dict);
+ GSPart.MajorVersion = m_HeaderPart.MajorVersion;
+ GSPart.MinorVersion = m_HeaderPart.MinorVersion;
GSPart.ThisPartition = here;
GSPart.PreviousPartition = m_RIP.PairArray.back().ByteOffset;
GSPart.BodySID = m_EssenceStreamID;
diff --git a/src/AS_02_internal.h b/src/AS_02_internal.h
index f67af68..9153ac9 100644
--- a/src/AS_02_internal.h
+++ b/src/AS_02_internal.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2011-2015, Robert Scheler, Heiko Sparenberg Fraunhofer IIS,
+Copyright (c) 2011-2016, Robert Scheler, Heiko Sparenberg Fraunhofer IIS,
John Hurst
All rights reserved.
@@ -193,6 +193,8 @@ namespace AS_02
UL body_ul(this->m_Dict->ul(MDD_ClosedCompleteBodyPartition));
Partition body_part(this->m_Dict);
body_part.BodySID = 1;
+ body_part.MajorVersion = this->m_HeaderPart.MajorVersion;
+ body_part.MinorVersion = this->m_HeaderPart.MinorVersion;
body_part.OperationalPattern = this->m_HeaderPart.OperationalPattern;
body_part.EssenceContainers = this->m_HeaderPart.EssenceContainers;
body_part.ThisPartition = this->m_ECStart;
@@ -231,6 +233,8 @@ namespace AS_02
this->m_HeaderPart.FooterPartition = here;
assert(this->m_Dict);
+ footer_part.MajorVersion = this->m_HeaderPart.MajorVersion;
+ footer_part.MinorVersion = this->m_HeaderPart.MinorVersion;
footer_part.OperationalPattern = this->m_HeaderPart.OperationalPattern;
footer_part.EssenceContainers = this->m_HeaderPart.EssenceContainers;
footer_part.FooterPartition = here;
diff --git a/src/KM_fileio.cpp b/src/KM_fileio.cpp
index b35e8ac..231f3b8 100644
--- a/src/KM_fileio.cpp
+++ b/src/KM_fileio.cpp
@@ -48,6 +48,10 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <mach-o/dyld.h>
#endif
+#if defined(__OpenBSD__)
+#include <sys/sysctl.h>
+#endif
+
using namespace Kumu;
#ifdef KM_WIN32
@@ -658,17 +662,23 @@ Kumu::GetExecutablePath(const std::string& default_path)
size_t size = X_BUFSIZE;
ssize_t rc = readlink("/proc/self/exe", path, size);
success = ( rc != -1 );
-#elif defined(__OpenBSD__) || defined(__FreeBSD__)
- size_t size = X_BUFSIZE;
- ssize_t rc = readlink("/proc/curproc/file", path, size);
- success = ( rc != -1 );
+#elif defined(__OpenBSD__)
+ // This fails if the CWD changes after the program has started but before the
+ // call to GetExecutablePath(). For least surprise, call GetExecutablePath()
+ // immediately in main() and save the value for later use.
+ const, char* p = getenv("_");
+ if ( p )
+ {
+ return Kumu::PathMakeAbsolute(p);
+ }
#elif defined(__FreeBSD__)
+ // requires procfs
size_t size = X_BUFSIZE;
ssize_t rc = readlink("/proc/curproc/file", path, size);
success = ( rc != -1 );
#elif defined(__NetBSD__)
size_t size = X_BUFSIZE;
- ssize_t rc = readlink("/proc/curproc/file", path, size);
+ ssize_t rc = readlink("/proc/curproc/exe", path, size);
success = ( rc != -1 );
#elif defined(__sun) && defined(__SVR4)
size_t size = X_BUFSIZE;
diff --git a/src/h__02_Writer.cpp b/src/h__02_Writer.cpp
index f400afd..62f21f2 100644
--- a/src/h__02_Writer.cpp
+++ b/src/h__02_Writer.cpp
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2011-2013, Robert Scheler, Heiko Sparenberg Fraunhofer IIS,
+Copyright (c) 2011-2016, Robert Scheler, Heiko Sparenberg Fraunhofer IIS,
John Hurst
All rights reserved.
@@ -199,6 +199,8 @@ AS_02::h__AS02WriterFrame::WriteEKLVPacket(const ASDCP::FrameBuffer& FrameBuf,co
UL body_ul(m_Dict->ul(MDD_ClosedCompleteBodyPartition));
Partition body_part(m_Dict);
+ body_part.MajorVersion = m_HeaderPart.MajorVersion;
+ body_part.MinorVersion = m_HeaderPart.MinorVersion;
body_part.BodySID = 1;
body_part.OperationalPattern = m_HeaderPart.OperationalPattern;
body_part.EssenceContainers = m_HeaderPart.EssenceContainers;