Change History
+-- NEW STUFF FROM JH --
+ o Added get_BER_length_for_value() subroutine.
+ o Modified ASDCP::h__Writer::WriteEKLVPacket() to allow larger BER
+ lengths for KLV packets larger than 16 MB. This was required to
+ support large font files in the SMPTE 429-5 implementation.
+
2009.11.06 - bug fixes, enhancements, v1.5.29
o Fixed a bug that could cause HMAC values to be incorrectly
stored in MXF files. Files created with versions of asdcplib
o Jpeg2000 codestream EditRate and SampleRate mismatches
now warns instead of returning an error.
o Improved error handling in Jpeg2000 sequence parsing routines.
- o Added two methods to Kumu::Timestamp, AddSeconds(), to add (or subtract)
- seconds to a time value, and GetSecondsSinceEpoch() to get the number of
- seconds since the unix epoch.
- o Added new option to asdcp-test, '-a', to specify a UUID when creating MXF files.
- o Added support for specifying the intrinsic duration of MXF files containing
- timed text.
+ o Added two methods to Kumu::Timestamp, AddSeconds(), to add (or
+ subtract) seconds to a time value, and GetSecondsSinceEpoch()
+ to get the number of seconds since the unix epoch.
+ o Added new option to asdcp-test, '-a', to specify a UUID when
+ creating MXF files.
+ o Added support for specifying the intrinsic duration of MXF files
+ containing timed text.
o Added new option to wavesplit, '-i', to display WAV file metadata.
# 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.5.30], [asdcplib@cinecert.com])
+AC_INIT([asdcplib], [1.5.31], [asdcplib@cinecert.com])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/KM_error.h])
//------------------------------------------------------------------------------------------
-// read a ber value from the buffer and compare with test value.
-// Advances buffer to first character after BER value.
-
// read a ber value from the buffer and compare with test value.
// Advances buffer to first character after BER value.
//
0
};
+//
+ui32_t
+Kumu::get_BER_length_for_value(ui64_t val)
+{
+ for ( ui32_t i = 0; i < 9; i++ )
+ {
+ if ( ( val & ber_masks[i] ) == 0 )
+ return i + 1;
+ }
+
+ ui64Printer tmp_i(val);
+ DefaultLogSink().Error("BER integer encoding not supported for large value %s\n", tmp_i.c_str());
+ return 0;
+}
//
bool
{ // sanity check BER length
if ( ber_len > 9 )
{
- DefaultLogSink().Error("BER size %u exceeds maximum size of 9\n", ber_len);
+ DefaultLogSink().Error("BER integer length %u exceeds maximum size of 9\n", ber_len);
return false;
}
- if ( val & ber_masks[ber_len - 1] )
+ if ( ( val & ber_masks[ber_len - 1] ) != 0 )
{
ui64Printer tmp_i(val);
- DefaultLogSink().Error("BER size %u too small for value %s\n", tmp_i.c_str());
+ DefaultLogSink().Error("BER integer length %u too small for value %s\n", ber_len, tmp_i.c_str());
return false;
}
}
return (*buf & 0x0f) + 1;
}
+ // Return the BER length required to encode value. A return value of zero
+ // indicates a value too large for this library.
+ ui32_t get_BER_length_for_value(ui64_t valuse);
+
// read a BER value
bool read_BER(const byte_t* buf, ui64_t* val);
// construct encrypted triplet header
ui32_t ETLength = klv_cryptinfo_size + m_CtFrameBuf.Size();
+ ui32_t BER_length = MXF_BER_LENGTH;
if ( m_Info.UsesHMAC )
ETLength += klv_intpack_size;
else
ETLength += (MXF_BER_LENGTH * 3); // for empty intpack
- Overhead.WriteBER(ETLength, MXF_BER_LENGTH); // write encrypted triplet length
- Overhead.WriteBER(UUIDlen, MXF_BER_LENGTH); // write ContextID length
- Overhead.WriteRaw(m_Info.ContextID, UUIDlen); // write ContextID
- Overhead.WriteBER(sizeof(ui64_t), MXF_BER_LENGTH); // write PlaintextOffset length
- Overhead.WriteUi64BE(FrameBuf.PlaintextOffset()); // write PlaintextOffset
- Overhead.WriteBER(SMPTE_UL_LENGTH, MXF_BER_LENGTH); // write essence UL length
- Overhead.WriteRaw((byte_t*)EssenceUL, SMPTE_UL_LENGTH); // write the essence UL
- Overhead.WriteBER(sizeof(ui64_t), MXF_BER_LENGTH); // write SourceLength length
- Overhead.WriteUi64BE(FrameBuf.Size()); // write SourceLength
- Overhead.WriteBER(m_CtFrameBuf.Size(), MXF_BER_LENGTH); // write ESV length
-
- result = m_File.Writev(Overhead.Data(), Overhead.Length());
+ if ( ETLength > 0x00ffffff ) // Need BER integer longer than MXF_BER_LENGTH bytes
+ {
+ BER_length = Kumu::get_BER_length_for_value(ETLength);
+
+ if ( BER_length == 0 )
+ result = RESULT_KLV_CODING;
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ if ( ! ( Overhead.WriteBER(ETLength, BER_length) // write encrypted triplet length
+ && Overhead.WriteBER(UUIDlen, MXF_BER_LENGTH) // write ContextID length
+ && Overhead.WriteRaw(m_Info.ContextID, UUIDlen) // write ContextID
+ && Overhead.WriteBER(sizeof(ui64_t), MXF_BER_LENGTH) // write PlaintextOffset length
+ && Overhead.WriteUi64BE(FrameBuf.PlaintextOffset()) // write PlaintextOffset
+ && Overhead.WriteBER(SMPTE_UL_LENGTH, MXF_BER_LENGTH) // write essence UL length
+ && Overhead.WriteRaw((byte_t*)EssenceUL, SMPTE_UL_LENGTH) // write the essence UL
+ && Overhead.WriteBER(sizeof(ui64_t), MXF_BER_LENGTH) // write SourceLength length
+ && Overhead.WriteUi64BE(FrameBuf.Size()) // write SourceLength
+ && Overhead.WriteBER(m_CtFrameBuf.Size(), BER_length) ) ) // write ESV length
+ {
+ result = RESULT_KLV_CODING;
+ }
+ }
+
+ if ( ASDCP_SUCCESS(result) )
+ result = m_File.Writev(Overhead.Data(), Overhead.Length());
}
if ( ASDCP_SUCCESS(result) )