diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-01-18 20:25:02 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-01-18 20:25:02 +0000 |
| commit | 2489080f9a5d2891da0fc313b2c0ac1450a630ad (patch) | |
| tree | 2f4fe733439db89943eb208713f034eb7df12b65 /asdcplib/src/JP2K_Codestream_Parser.cpp | |
| parent | c289685296d58228df0a88354e966105b242c915 (diff) | |
Allow incremental writing of picture MXFs.
Diffstat (limited to 'asdcplib/src/JP2K_Codestream_Parser.cpp')
| -rwxr-xr-x | asdcplib/src/JP2K_Codestream_Parser.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/asdcplib/src/JP2K_Codestream_Parser.cpp b/asdcplib/src/JP2K_Codestream_Parser.cpp index c7891231..5ab7a322 100755 --- a/asdcplib/src/JP2K_Codestream_Parser.cpp +++ b/asdcplib/src/JP2K_Codestream_Parser.cpp @@ -91,6 +91,26 @@ public: return result; } + + Result_t OpenReadFrame(const unsigned char * data, unsigned int size, FrameBuffer& FB) + { + if ( FB.Capacity() < size ) + { + DefaultLogSink().Error("FrameBuf.Capacity: %u frame length: %u\n", FB.Capacity(), (ui32_t) size); + return RESULT_SMALLBUF; + } + + memcpy (FB.Data(), data, size); + FB.Size(size); + + byte_t start_of_data = 0; // out param + const Result_t result = ParseMetadataIntoDesc(FB, m_PDesc, &start_of_data); + + if ( ASDCP_SUCCESS(result) ) + FB.PlaintextOffset(start_of_data); + + return result; + } }; ASDCP::Result_t @@ -224,6 +244,15 @@ ASDCP::JP2K::CodestreamParser::OpenReadFrame(const char* filename, FrameBuffer& return m_Parser->OpenReadFrame(filename, FB); } +// Opens the stream for reading, parses enough data to provide a complete +// set of stream metadata for the MXFWriter below. +ASDCP::Result_t +ASDCP::JP2K::CodestreamParser::OpenReadFrame(const unsigned char* data, unsigned int size, FrameBuffer& FB) const +{ + const_cast<ASDCP::JP2K::CodestreamParser*>(this)->m_Parser = new h__CodestreamParser; + return m_Parser->OpenReadFrame(data, size, FB); +} + // ASDCP::Result_t ASDCP::JP2K::CodestreamParser::FillPictureDescriptor(PictureDescriptor& PDesc) const |
