summaryrefslogtreecommitdiff
path: root/src/AS_DCP_JP2K.cpp
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2021-04-13 15:50:50 -0700
committerjhurst <jhurst@cinecert.com>2021-04-13 15:50:50 -0700
commitb14d706a72c706c9c59dbdf64a9e41f32465e060 (patch)
tree642c62a644544afb531a8fdbfd4e610bb72728ed /src/AS_DCP_JP2K.cpp
parent4e0891ab9ee94b822043126ea07e97641015e9b7 (diff)
o Added a Clone() method to InterchangeObject and derivatives
that allows making a descriptor copy that is not owned by any other strucure. The caller must arrange to delete the object pointer returned. o While implementing the above it became obvious that the reference-to-a-pointer-to-the-dictionary idiom that is used throughout the lower levels of the MXF library was the cause of much more grief than it was originally designed to prevent. This was made even more obvious when I replaced all of it with simple pointers, which revealed several shadow instances of m_Dict that were only reliable while the object that held them was valid.
Diffstat (limited to 'src/AS_DCP_JP2K.cpp')
-rwxr-xr-xsrc/AS_DCP_JP2K.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/AS_DCP_JP2K.cpp b/src/AS_DCP_JP2K.cpp
index 6ad9eef..a8e7e46 100755
--- a/src/AS_DCP_JP2K.cpp
+++ b/src/AS_DCP_JP2K.cpp
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2004-2016, John Hurst
+Copyright (c) 2004-2021, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -527,7 +527,7 @@ class lh__Reader : public ASDCP::h__ASDCPReader
public:
PictureDescriptor m_PDesc; // codestream parameter list
- lh__Reader(const Dictionary& d) :
+ lh__Reader(const Dictionary *d) :
ASDCP::h__ASDCPReader(d), m_EssenceDescriptor(0), m_EssenceSubDescriptor(0), m_Format(ESS_UNKNOWN) {}
virtual ~lh__Reader() {}
@@ -716,7 +716,7 @@ class ASDCP::JP2K::MXFReader::h__Reader : public lh__Reader
h__Reader();
public:
- h__Reader(const Dictionary& d) : lh__Reader(d) {}
+ h__Reader(const Dictionary *d) : lh__Reader(d) {}
};
@@ -744,7 +744,7 @@ ASDCP::JP2K::FrameBuffer::Dump(FILE* stream, ui32_t dump_len) const
ASDCP::JP2K::MXFReader::MXFReader()
{
- m_Reader = new h__Reader(DefaultCompositeDict());
+ m_Reader = new h__Reader(&DefaultCompositeDict());
}
@@ -893,7 +893,7 @@ class ASDCP::JP2K::MXFSReader::h__SReader : public lh__Reader
ui32_t m_StereoFrameReady;
public:
- h__SReader(const Dictionary& d) : lh__Reader(d), m_StereoFrameReady(0xffffffff) {}
+ h__SReader(const Dictionary *d) : lh__Reader(d), m_StereoFrameReady(0xffffffff) {}
//
Result_t ReadFrame(ui32_t FrameNum, StereoscopicPhase_t phase, FrameBuffer& FrameBuf,
@@ -970,7 +970,7 @@ public:
ASDCP::JP2K::MXFSReader::MXFSReader()
{
- m_Reader = new h__SReader(DefaultCompositeDict());
+ m_Reader = new h__SReader(&DefaultCompositeDict());
}
@@ -1142,7 +1142,7 @@ public:
PictureDescriptor m_PDesc;
byte_t m_EssenceUL[SMPTE_UL_LENGTH];
- lh__Writer(const Dictionary& d) : ASDCP::h__ASDCPWriter(d), m_EssenceSubDescriptor(0) {
+ lh__Writer(const Dictionary *d) : ASDCP::h__ASDCPWriter(d), m_EssenceSubDescriptor(0) {
memset(m_EssenceUL, 0, SMPTE_UL_LENGTH);
}
@@ -1292,7 +1292,7 @@ class ASDCP::JP2K::MXFWriter::h__Writer : public lh__Writer
h__Writer();
public:
- h__Writer(const Dictionary& d) : lh__Writer(d) {}
+ h__Writer(const Dictionary *d) : lh__Writer(d) {}
};
@@ -1360,9 +1360,9 @@ ASDCP::JP2K::MXFWriter::OpenWrite(const std::string& filename, const WriterInfo&
const PictureDescriptor& PDesc, ui32_t HeaderSize)
{
if ( Info.LabelSetType == LS_MXF_SMPTE )
- m_Writer = new h__Writer(DefaultSMPTEDict());
+ m_Writer = new h__Writer(&DefaultSMPTEDict());
else
- m_Writer = new h__Writer(DefaultInteropDict());
+ m_Writer = new h__Writer(&DefaultInteropDict());
m_Writer->m_Info = Info;
@@ -1413,7 +1413,7 @@ class ASDCP::JP2K::MXFSWriter::h__SWriter : public lh__Writer
StereoscopicPhase_t m_NextPhase;
public:
- h__SWriter(const Dictionary& d) : lh__Writer(d), m_NextPhase(SP_LEFT) {}
+ h__SWriter(const Dictionary *d) : lh__Writer(d), m_NextPhase(SP_LEFT) {}
//
Result_t WriteFrame(const FrameBuffer& FrameBuf, StereoscopicPhase_t phase,
@@ -1506,9 +1506,9 @@ ASDCP::JP2K::MXFSWriter::OpenWrite(const std::string& filename, const WriterInfo
const PictureDescriptor& PDesc, ui32_t HeaderSize)
{
if ( Info.LabelSetType == LS_MXF_SMPTE )
- m_Writer = new h__SWriter(DefaultSMPTEDict());
+ m_Writer = new h__SWriter(&DefaultSMPTEDict());
else
- m_Writer = new h__SWriter(DefaultInteropDict());
+ m_Writer = new h__SWriter(&DefaultInteropDict());
if ( PDesc.EditRate != ASDCP::EditRate_24
&& PDesc.EditRate != ASDCP::EditRate_25