summaryrefslogtreecommitdiff
path: root/asdcplib/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-22 17:26:11 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-22 17:26:11 +0100
commit64fa6bfcdff322541a6afe7f079890a109cd4f71 (patch)
tree4363b51ff9a0688c38a32bb43c5da4112ecb326b /asdcplib/src
parentbfbd64d680a0cbe9867b23088023ae5f9ecc219b (diff)
Various more 3D fixes.
Diffstat (limited to 'asdcplib/src')
-rwxr-xr-xasdcplib/src/AS_DCP.h11
-rwxr-xr-xasdcplib/src/AS_DCP_JP2K.cpp33
2 files changed, 32 insertions, 12 deletions
diff --git a/asdcplib/src/AS_DCP.h b/asdcplib/src/AS_DCP.h
index 2681bf14..3edd1f74 100755
--- a/asdcplib/src/AS_DCP.h
+++ b/asdcplib/src/AS_DCP.h
@@ -1268,11 +1268,11 @@ namespace ASDCP {
virtual MXF::OPAtomHeader& OPAtomHeader();
virtual MXF::OPAtomIndexFooter& OPAtomIndexFooter();
- // Open the file for writing. The file must not exist. Returns error if
+ // Open the file for writing. The file must not exist unless overwrite is true. Returns error if
// the operation cannot be completed or if nonsensical data is discovered
// in the essence descriptor.
Result_t OpenWrite(const char* filename, const WriterInfo&,
- const PictureDescriptor&, ui32_t HeaderSize = 16384);
+ const PictureDescriptor&, ui32_t HeaderSize, bool overwrite);
// Writes a pair of frames of essence to the MXF file. If the optional AESEncContext
// argument is present, the essence is encrypted prior to writing.
@@ -1287,11 +1287,16 @@ namespace ASDCP {
// RESULT_SPHASE will be returned if phase is reversed. The first frame
// written must be left eye.
Result_t WriteFrame(const FrameBuffer&, StereoscopicPhase_t phase,
- AESEncContext* = 0, HMACContext* = 0);
+ AESEncContext* = 0, HMACContext* = 0, std::string* hash = 0);
+ Result_t FakeWriteFrame(int size);
+
// Closes the MXF file, writing the index and revised header. Returns
// RESULT_SPHASE if WriteFrame was called an odd number of times.
Result_t Finalize();
+
+ // Return the current file offset in the MXF file that we are writing
+ ui64_t Tell() const;
};
//
diff --git a/asdcplib/src/AS_DCP_JP2K.cpp b/asdcplib/src/AS_DCP_JP2K.cpp
index e67bd8df..903b2e85 100755
--- a/asdcplib/src/AS_DCP_JP2K.cpp
+++ b/asdcplib/src/AS_DCP_JP2K.cpp
@@ -1182,7 +1182,7 @@ public:
//
Result_t WriteFrame(const FrameBuffer& FrameBuf, StereoscopicPhase_t phase,
- AESEncContext* Ctx, HMACContext* HMAC)
+ AESEncContext* Ctx, HMACContext* HMAC, std::string* hash)
{
if ( m_NextPhase != phase )
return RESULT_SPHASE;
@@ -1190,11 +1190,11 @@ public:
if ( phase == SP_LEFT )
{
m_NextPhase = SP_RIGHT;
- return lh__Writer::WriteFrame(FrameBuf, true, Ctx, HMAC);
+ return lh__Writer::WriteFrame(FrameBuf, true, Ctx, HMAC, hash);
}
m_NextPhase = SP_LEFT;
- return lh__Writer::WriteFrame(FrameBuf, false, Ctx, HMAC);
+ return lh__Writer::WriteFrame(FrameBuf, false, Ctx, HMAC, hash);
}
//
@@ -1253,7 +1253,7 @@ ASDCP::JP2K::MXFSWriter::OPAtomIndexFooter()
// the operation cannot be completed.
ASDCP::Result_t
ASDCP::JP2K::MXFSWriter::OpenWrite(const char* filename, const WriterInfo& Info,
- const PictureDescriptor& PDesc, ui32_t HeaderSize)
+ const PictureDescriptor& PDesc, ui32_t HeaderSize, bool overwrite)
{
if ( Info.LabelSetType == LS_MXF_SMPTE )
m_Writer = new h__SWriter(DefaultSMPTEDict());
@@ -1276,7 +1276,7 @@ ASDCP::JP2K::MXFSWriter::OpenWrite(const char* filename, const WriterInfo& Info,
m_Writer->m_Info = Info;
- Result_t result = m_Writer->OpenWrite(filename, ASDCP::ESS_JPEG_2000_S, HeaderSize, false);
+ Result_t result = m_Writer->OpenWrite(filename, ASDCP::ESS_JPEG_2000_S, HeaderSize, overwrite);
if ( ASDCP_SUCCESS(result) )
{
@@ -1315,10 +1315,10 @@ ASDCP::JP2K::MXFSWriter::WriteFrame(const SFrameBuffer& FrameBuf, AESEncContext*
if ( m_Writer.empty() )
return RESULT_INIT;
- Result_t result = m_Writer->WriteFrame(FrameBuf.Left, SP_LEFT, Ctx, HMAC);
+ Result_t result = m_Writer->WriteFrame(FrameBuf.Left, SP_LEFT, Ctx, HMAC, 0);
if ( ASDCP_SUCCESS(result) )
- result = m_Writer->WriteFrame(FrameBuf.Right, SP_RIGHT, Ctx, HMAC);
+ result = m_Writer->WriteFrame(FrameBuf.Right, SP_RIGHT, Ctx, HMAC, 0);
return result;
}
@@ -1329,12 +1329,21 @@ ASDCP::JP2K::MXFSWriter::WriteFrame(const SFrameBuffer& FrameBuf, AESEncContext*
// error occurs.
ASDCP::Result_t
ASDCP::JP2K::MXFSWriter::WriteFrame(const FrameBuffer& FrameBuf, StereoscopicPhase_t phase,
- AESEncContext* Ctx, HMACContext* HMAC)
+ AESEncContext* Ctx, HMACContext* HMAC, std::string* hash)
{
if ( m_Writer.empty() )
return RESULT_INIT;
- return m_Writer->WriteFrame(FrameBuf, phase, Ctx, HMAC);
+ return m_Writer->WriteFrame(FrameBuf, phase, Ctx, HMAC, hash);
+}
+
+ASDCP::Result_t
+ASDCP::JP2K::MXFSWriter::FakeWriteFrame(int size)
+{
+ if ( m_Writer.empty() )
+ return RESULT_INIT;
+
+ return m_Writer->FakeWriteFrame(size, true);
}
// Closes the MXF file, writing the index and other closing information.
@@ -1347,6 +1356,12 @@ ASDCP::JP2K::MXFSWriter::Finalize()
return m_Writer->Finalize();
}
+ui64_t
+ASDCP::JP2K::MXFSWriter::Tell() const
+{
+ return m_Writer->m_File.Tell();
+}
+
//
// end AS_DCP_JP2K.cpp
//