summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xREADME8
-rw-r--r--configure.ac2
-rwxr-xr-xsrc/asdcp-test.cpp39
-rwxr-xr-xsrc/h__Reader.cpp51
-rwxr-xr-xsrc/h__Writer.cpp16
5 files changed, 97 insertions, 19 deletions
diff --git a/README b/README
index 3d19e1f..610ed20 100755
--- a/README
+++ b/README
@@ -112,6 +112,14 @@ utilities all respond to -h.
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
diff --git a/configure.ac b/configure.ac
index fa88e15..e9a42aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,7 +37,7 @@ AC_PREREQ([2.59])
# 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])
diff --git a/src/asdcp-test.cpp b/src/asdcp-test.cpp
index 2af20f2..53d3bf0 100755
--- a/src/asdcp-test.cpp
+++ b/src/asdcp-test.cpp
@@ -286,7 +286,11 @@ public:
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;
}
@@ -294,7 +298,11 @@ public:
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";
}
@@ -1448,7 +1456,7 @@ write_timed_text_file(CommandOptions& Options)
if ( ASDCP_SUCCESS(result) )
{
Parser.FillTimedTextDescriptor(TDesc);
- FrameBuffer.Capacity(2*Kumu::Megabyte);
+ FrameBuffer.Capacity(Options.fb_size);
if ( Options.verbose_flag )
{
@@ -1562,7 +1570,7 @@ read_timed_text_file(CommandOptions& Options)
if ( ASDCP_SUCCESS(result) )
{
Reader.FillTimedTextDescriptor(TDesc);
- FrameBuffer.Capacity(2*Kumu::Megabyte);
+ FrameBuffer.Capacity(Options.fb_size);
if ( Options.verbose_flag )
TimedText::DescriptorDump(TDesc);
@@ -1594,23 +1602,38 @@ read_timed_text_file(CommandOptions& Options)
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);
+ }
}
}
diff --git a/src/h__Reader.cpp b/src/h__Reader.cpp
index a463ae1..b0f8870 100755
--- a/src/h__Reader.cpp
+++ b/src/h__Reader.cpp
@@ -1,5 +1,5 @@
/*
-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
@@ -159,16 +159,51 @@ ASDCP::KLReader::ReadKLFromFile(Kumu::FileReader& Reader)
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
diff --git a/src/h__Writer.cpp b/src/h__Writer.cpp
index 6152a35..2882e33 100755
--- a/src/h__Writer.cpp
+++ b/src/h__Writer.cpp
@@ -605,9 +605,21 @@ ASDCP::h__Writer::WriteEKLVPacket(const ASDCP::FrameBuffer& FrameBuf, const byte
}
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());