Change History
+2010.06.09 - bug fixes, v1.6.36
+ o Added support for new Edit Rates to asdcp-test.cpp.
+ o Expanded timed-text file reader in asdcp-test.cpp.
+ o Fixed large BER value encoding (plaintext) and decoding
+ (plaintext and ciphertext). This feature was introduced in
+ v1.5.31).
+
+
2010.05.13 - bug fixes, enhancements, v1.6.34
o ST 429-5 files have corrected ULs for DCTimedTextDescriptor and
GenericStream DataElement. Files made with previous versions of
# For example, if asdcplib version 1.0.0 were modified to accomodate changes
# in file format, and if no changes were made to AS_DCP.h, the new version would be
# 1.0.1. If changes were also required in AS_DCP.h, the new version would be 1.1.1.
-AC_INIT([asdcplib], [1.6.35], [asdcplib@cinecert.com])
+AC_INIT([asdcplib], [1.6.36], [asdcplib@cinecert.com])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/KM_error.h])
Rational PictureRate()
{
if ( picture_rate == 23 ) return EditRate_23_98;
+ if ( picture_rate == 25 ) return EditRate_25;
+ if ( picture_rate == 30 ) return EditRate_30;
if ( picture_rate == 48 ) return EditRate_48;
+ if ( picture_rate == 50 ) return EditRate_50;
+ if ( picture_rate == 60 ) return EditRate_60;
return EditRate_24;
}
const char* szPictureRate()
{
if ( picture_rate == 23 ) return "23.976";
+ if ( picture_rate == 25 ) return "25";
+ if ( picture_rate == 30 ) return "30";
if ( picture_rate == 48 ) return "48";
+ if ( picture_rate == 50 ) return "50";
+ if ( picture_rate == 60 ) return "60";
return "24";
}
if ( ASDCP_SUCCESS(result) )
{
Parser.FillTimedTextDescriptor(TDesc);
- FrameBuffer.Capacity(2*Kumu::Megabyte);
+ FrameBuffer.Capacity(Options.fb_size);
if ( Options.verbose_flag )
{
if ( ASDCP_SUCCESS(result) )
{
Reader.FillTimedTextDescriptor(TDesc);
- FrameBuffer.Capacity(2*Kumu::Megabyte);
+ FrameBuffer.Capacity(Options.fb_size);
if ( Options.verbose_flag )
TimedText::DescriptorDump(TDesc);
return result;
std::string XMLDoc;
+ std::string out_path = Kumu::PathDirname(Options.file_root);
+ ui32_t write_count;
+ char buf[64];
TimedText::ResourceList_t::const_iterator ri;
result = Reader.ReadTimedTextResource(XMLDoc, Context, HMAC);
- // do something with the XML here
- fprintf(stderr, "XMLDoc size: %lu\n", XMLDoc.size());
+ if ( ASDCP_SUCCESS(result) )
+ {
+ Kumu::FileWriter Writer;
+ result = Writer.OpenWrite(Options.file_root);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = Writer.Write(reinterpret_cast<const byte_t*>(XMLDoc.c_str()), XMLDoc.size(), &write_count);
+ }
for ( ri = TDesc.ResourceList.begin() ; ri != TDesc.ResourceList.end() && ASDCP_SUCCESS(result); ri++ )
{
- result = Reader.ReadAncillaryResource((*ri).ResourceID, FrameBuffer, Context, HMAC);
+ result = Reader.ReadAncillaryResource(ri->ResourceID, FrameBuffer, Context, HMAC);
if ( ASDCP_SUCCESS(result) )
{
- // if ( Options.verbose_flag )
- FrameBuffer.Dump(stderr, Options.fb_dump_size);
+ Kumu::FileWriter Writer;
+ result = Writer.OpenWrite(Kumu::PathJoin(out_path, Kumu::UUID(ri->ResourceID).EncodeHex(buf, 64)).c_str());
- // do something with the resource data here
+ if ( ASDCP_SUCCESS(result) )
+ {
+ if ( Options.verbose_flag )
+ FrameBuffer.Dump(stderr, Options.fb_dump_size);
+
+ result = Writer.Write(FrameBuffer.RoData(), FrameBuffer.Size(), &write_count);
+ }
}
}
/*
-Copyright (c) 2004-2009, John Hurst
+Copyright (c) 2004-2010, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
ui32_t header_length = SMPTE_UL_LENGTH + MXF_BER_LENGTH;
Result_t result = Reader.Read(m_KeyBuf, header_length, &read_count);
- if ( ASDCP_SUCCESS(result) )
+ if ( ASDCP_FAILURE(result) )
+ return result;
+
+ if ( read_count != header_length )
+ return RESULT_READFAIL;
+
+ const byte_t* ber_start = m_KeyBuf + SMPTE_UL_LENGTH;
+
+ if ( ( *ber_start & 0x80 ) == 0 )
{
- if ( read_count != header_length )
- result = RESULT_READFAIL;
-
- else
- result = InitFromBuffer(m_KeyBuf, header_length);
+ DefaultLogSink().Error("BER encoding error.\n");
+ return RESULT_FORMAT;
}
- return result;
+ ui8_t ber_size = ( *ber_start & 0x0f ) + 1;
+
+ if ( ber_size > 9 )
+ {
+ DefaultLogSink().Error("BER size encoding error.\n");
+ return RESULT_FORMAT;
+ }
+
+ if ( ber_size < MXF_BER_LENGTH )
+ {
+ DefaultLogSink().Error("BER size %d shorter than AS-DCP minimum %d.\n",
+ ber_size, MXF_BER_LENGTH);
+ return RESULT_FORMAT;
+ }
+
+ if ( ber_size > MXF_BER_LENGTH )
+ {
+ ui32_t diff = ber_size - MXF_BER_LENGTH;
+ assert((SMPTE_UL_LENGTH + MXF_BER_LENGTH + diff) <= (SMPTE_UL_LENGTH * 2));
+ result = Reader.Read(m_KeyBuf + SMPTE_UL_LENGTH + MXF_BER_LENGTH, diff, &read_count);
+
+ if ( ASDCP_FAILURE(result) )
+ return result;
+
+ if ( read_count != diff )
+ return RESULT_READFAIL;
+
+ header_length += diff;
+ }
+
+ return InitFromBuffer(m_KeyBuf, header_length);
}
// standard method of reading a plaintext or encrypted frame
}
else
{
+ ui32_t BER_length = MXF_BER_LENGTH;
+
+ if ( FrameBuf.Size() > 0x00ffffff ) // Need BER integer longer than MXF_BER_LENGTH bytes
+ {
+ BER_length = Kumu::get_BER_length_for_value(FrameBuf.Size());
+
+ if ( BER_length == 0 )
+ result = RESULT_KLV_CODING;
+ }
+
Overhead.WriteRaw((byte_t*)EssenceUL, SMPTE_UL_LENGTH);
- Overhead.WriteBER(FrameBuf.Size(), MXF_BER_LENGTH);
- result = m_File.Writev(Overhead.Data(), Overhead.Length());
+ Overhead.WriteBER(FrameBuf.Size(), BER_length);
+
+ if ( ASDCP_SUCCESS(result) )
+ result = m_File.Writev(Overhead.Data(), Overhead.Length());
if ( ASDCP_SUCCESS(result) )
result = m_File.Writev((byte_t*)FrameBuf.RoData(), FrameBuf.Size());