Skip to content

Commit 5a1cfcf

Browse files
update to v2.1.1
1 parent 3a703e4 commit 5a1cfcf

File tree

186 files changed

+99694
-982
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+99694
-982
lines changed

README

+52-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
$Id: README,v 1.84 2013/07/02 21:29:09 mikey Exp $
2+
$Id: README,v 1.89 2014/01/06 18:59:41 mikey Exp $
33

44
The asdcplib library is a set of objects that offer
55
simplified access to files conforming to the sound and
@@ -90,7 +90,8 @@ http://expat.sourceforge.net/ for source and build instructions.
9090

9191
To configure and build, type './configure' followed by 'make'. There
9292
are several test targets on the POSIX side, but you need to assemble
93-
a set of test files to use them.
93+
a set of test files to use them. AS-02 support can be enabled with
94+
--enable-as-02.
9495

9596
I have tested this build on win32, Linux, OpenBSD, and Darwin
9697
platforms. Others may work as well.
@@ -139,7 +140,51 @@ command-line utilities all respond to -h.
139140

140141
Change History
141142

142-
2013-07-02 - IMF/AS-02 support, bug fixes 2.0.0
143+
2014-01-06 – Additional IMF/AS-02 support, bug fixes 2.1.1
144+
o Fixed missing-index-partion bugs for AS-02 files.
145+
o Moved LocalFilenameResolver into the AS_DCP public API so that it
146+
can be used by other modules including AS-02.
147+
o Did further refactoring of AS-02 Writer classes to separate CBR
148+
and VBR indexing implementations.
149+
o Fixed wave wrapping UL in clip-wrapped AS-02 files. Renamed some
150+
UL constants to reflect "clip" or "frame" wrapping.
151+
o Re-factored JP2K_PDesc_to_MD() and MD_to_JP2K_PDesc() to work
152+
with GenericPictureEssenceDescriptor objects.
153+
o Fixed a bug that was suppressing PictureComponentSizing,
154+
CodingStyleDefault and QuantizationDefault when writing the
155+
essence descriptor in a JP2K file (AS-DCP and AS-02).
156+
o Fixed the version byte on the following UL values:
157+
StereoscopicPictureSubDescriptor
158+
GenericPictureEssenceDescriptor_ColorPrimaries
159+
GenericPictureEssenceDescriptor_ActiveHeight
160+
GenericPictureEssenceDescriptor_ActiveWidth
161+
GenericPictureEssenceDescriptor_ActiveXOffset
162+
GenericPictureEssenceDescriptor_ActiveYOffset
163+
o Added some essence descriptor options to as-02-wrap.
164+
o Changed bit rate display in asdcp-info from mebi-bits/s to
165+
mega-bits/s.
166+
o Added "SMPTE" / "Interop" format type display to asdcp-info.
167+
o Improved integration of ST 377-4 MCA concepts with ST 429-2 static
168+
labels.
169+
o Modified asdcp-wrap to assume -L when wrapping timed-text (since
170+
there is no MXF text wrapping for Interop.)
171+
o Added new EssenceType_t values for IMF/AS-02 track files.
172+
o Added detection for AS-02 track files to ASDCP::EssenceType()
173+
o Changed lots of "const char*" to "const std::string&" in the
174+
APIs defined by KM_fileio.h and AS_DCP.h.
175+
o Fixed VBR Delta Segment entries to correctly flag progressive
176+
material.
177+
o Fixed PCM unwrapping bugs in as-02-unwrap.
178+
o Fixed missing return statement in ArchivableString::ArchiveLength
179+
(thanks to both Kristof Provost and Franck Chopin)
180+
o Fixed broken sample alignment in RF64Writer (thanks to Wolfgang
181+
Woehl and Dolby)
182+
o Fixed win32 build (thanks to Dolby)
183+
o fixed a bug that caused blackwave to only produce 96kHz WAV files.
184+
(thanks to Stephane W)
185+
186+
187+
2013-07-02 – IMF/AS-02 support, bug fixes 2.0.0
143188
o Massive refactoring of internals to allow easier implementation
144189
of AS-02. Some API changes were made as well (note that
145190
OPAtomHeader is now OP1aHeader and RIP is no longer part of the
@@ -148,13 +193,14 @@ Change History
148193
TIME TO EVALUATE THIS RELEASE THOUROUGHLY BEFORE ADDING IT TO
149194
YOUR RELEASE PATH.
150195
o Final integration of Fraunhoffer IIS code contribution. AS-02
151-
files are now fully supported with some TODOs and one major
152-
exception: LEAD indexes are not supported by the MXF writers
196+
files are now fully supported with some TODOs and two major
197+
exceptions: LEAD indexes are not supported by the MXF writers
153198
and interlace images are not yet supported.
154199
o Added support for MCA labels (ST 428-12) to asdcp-wrap. Note
155200
that this project is still in the early stages of interop testing
156201
so errors are likely present and don't expect any server to
157-
understand this feature.
202+
make use of this feature.
203+
158204

159205
2013-07-01 - Bug fixes, enhancements 1.12.50
160206
o Fixed missing return statement in ArchivableString::ArchiveLength

configure

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for asdcplib 2.0.0.
3+
# Generated by GNU Autoconf 2.69 for asdcplib 2.1.1.
44
#
55
# Report bugs to <[email protected]>.
66
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
590590
# Identity of this package.
591591
PACKAGE_NAME='asdcplib'
592592
PACKAGE_TARNAME='asdcplib'
593-
PACKAGE_VERSION='2.0.0'
594-
PACKAGE_STRING='asdcplib 2.0.0'
593+
PACKAGE_VERSION='2.1.1'
594+
PACKAGE_STRING='asdcplib 2.1.1'
595595
PACKAGE_BUGREPORT='[email protected]'
596596
PACKAGE_URL=''
597597

@@ -1364,7 +1364,7 @@ if test "$ac_init_help" = "long"; then
13641364
# Omit some internal or obsolete options to make the list less imposing.
13651365
# This message is too long to be a string in the A/UX 3.1 sh.
13661366
cat <<_ACEOF
1367-
\`configure' configures asdcplib 2.0.0 to adapt to many kinds of systems.
1367+
\`configure' configures asdcplib 2.1.1 to adapt to many kinds of systems.
13681368

13691369
Usage: $0 [OPTION]... [VAR=VALUE]...
13701370

@@ -1434,7 +1434,7 @@ fi
14341434

14351435
if test -n "$ac_init_help"; then
14361436
case $ac_init_help in
1437-
short | recursive ) echo "Configuration of asdcplib 2.0.0:";;
1437+
short | recursive ) echo "Configuration of asdcplib 2.1.1:";;
14381438
esac
14391439
cat <<\_ACEOF
14401440

@@ -1557,7 +1557,7 @@ fi
15571557
test -n "$ac_init_help" && exit $ac_status
15581558
if $ac_init_version; then
15591559
cat <<\_ACEOF
1560-
asdcplib configure 2.0.0
1560+
asdcplib configure 2.1.1
15611561
generated by GNU Autoconf 2.69
15621562

15631563
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1956,7 +1956,7 @@ cat >config.log <<_ACEOF
19561956
This file contains any messages produced by compilers while
19571957
running configure, to aid debugging if configure makes a mistake.
19581958

1959-
It was created by asdcplib $as_me 2.0.0, which was
1959+
It was created by asdcplib $as_me 2.1.1, which was
19601960
generated by GNU Autoconf 2.69. Invocation command line was
19611961

19621962
$ $0 $@
@@ -2783,7 +2783,7 @@ fi
27832783

27842784
# Define the identity of the package.
27852785
PACKAGE='asdcplib'
2786-
VERSION='2.0.0'
2786+
VERSION='2.1.1'
27872787

27882788

27892789
cat >>confdefs.h <<_ACEOF
@@ -17292,7 +17292,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
1729217292
# report actual input values of CONFIG_FILES etc. instead of their
1729317293
# values after options handling.
1729417294
ac_log="
17295-
This file was extended by asdcplib $as_me 2.0.0, which was
17295+
This file was extended by asdcplib $as_me 2.1.1, which was
1729617296
generated by GNU Autoconf 2.69. Invocation command line was
1729717297

1729817298
CONFIG_FILES = $CONFIG_FILES
@@ -17349,7 +17349,7 @@ _ACEOF
1734917349
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1735017350
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1735117351
ac_cs_version="\\
17352-
asdcplib config.status 2.0.0
17352+
asdcplib config.status 2.1.1
1735317353
configured by $0, generated by GNU Autoconf 2.69,
1735417354
with options \\"\$ac_cs_config\\"
1735517355

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ AC_PREREQ([2.59])
3737
# For example, if asdcplib version 1.0.0 were modified to accomodate changes
3838
# in file format, and if no changes were made to AS_DCP.h, the new version would be
3939
# 1.0.1. If changes were also required in AS_DCP.h, the new version would be 1.1.1.
40-
AC_INIT([asdcplib], [2.0.0], [[email protected]])
40+
AC_INIT([asdcplib], [2.1.1], [[email protected]])
4141

4242
AC_CONFIG_AUX_DIR([build-aux])
4343
AC_CONFIG_SRCDIR([src/KM_error.h])

src/AS_02.h

+159-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2727
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
*/
2929
/*! \file AS_02.h
30-
\version $Id: AS_02.h,v 1.12 2013/06/17 17:55:54 jhurst Exp $
30+
\version $Id: AS_02.h,v 1.15 2014/01/02 23:29:21 jhurst Exp $
3131
\brief AS-02 library, public interface
3232
3333
This module implements MXF AS-02 is a set of file access objects that
@@ -97,7 +97,6 @@ namespace AS_02
9797
Result_t Lookup(ui32_t frame_num, ASDCP::MXF::IndexTableSegment::IndexEntry&) const;
9898
};
9999

100-
101100

102101
// Returns size in bytes of a single sample of data described by ADesc
103102
inline ui32_t CalcSampleSize(const ASDCP::MXF::WaveAudioDescriptor& d)
@@ -118,6 +117,15 @@ namespace AS_02
118117
return CalcSampleSize(d) * CalcSamplesPerFrame(d, edit_rate);
119118
}
120119

120+
// Returns number of frames for data described by ADesc, given a duration in samples and an edit rate
121+
inline ui32_t CalcFramesFromDurationInSamples(const ui32_t durationInSamples, const ASDCP::MXF::WaveAudioDescriptor& d,
122+
const ASDCP::Rational& edit_rate)
123+
{
124+
return static_cast<ui32_t>(static_cast<ui64_t>(durationInSamples) *
125+
static_cast<ui64_t>(d.AudioSamplingRate.Denominator * edit_rate.Numerator) /
126+
static_cast<ui64_t>(d.AudioSamplingRate.Numerator * edit_rate.Denominator));
127+
}
128+
121129
} // namespace MXF
122130

123131
//---------------------------------------------------------------------------------
@@ -134,7 +142,7 @@ namespace AS_02
134142
};
135143

136144
namespace JP2K
137-
{
145+
{
138146
//
139147
class MXFWriter
140148
{
@@ -159,7 +167,7 @@ namespace AS_02
159167
ASDCP::MXF::InterchangeObject_list_t& essence_sub_descriptor_list,
160168
const ASDCP::Rational& edit_rate, const ui32_t& header_size = 16384,
161169
const IndexStrategy_t& strategy = IS_FOLLOW, const ui32_t& partition_space = 10);
162-
170+
163171
// Writes a frame of essence to the MXF file. If the optional AESEncContext
164172
// argument is present, the essence is encrypted prior to writing.
165173
// Fails if the file is not open, is finalized, or an operating system
@@ -230,7 +238,7 @@ namespace AS_02
230238
// the reader to signal the number of samples to be read by each call to ReadFrame();
231239

232240
//
233-
class MXFWriter
241+
class MXFWriter
234242
{
235243
class h__Writer;
236244
ASDCP::mem_ptr<h__Writer> m_Writer;
@@ -306,6 +314,152 @@ namespace AS_02
306314
};
307315
} // namespace PCM
308316

317+
//---------------------------------------------------------------------------------
318+
//
319+
namespace TimedText
320+
{
321+
using ASDCP::TimedText::TimedTextDescriptor;
322+
using ASDCP::TimedText::TimedTextResourceDescriptor;
323+
using ASDCP::TimedText::ResourceList_t;
324+
325+
//
326+
class ST2052_TextParser
327+
{
328+
class h__TextParser;
329+
ASDCP::mem_ptr<h__TextParser> m_Parser;
330+
ASDCP_NO_COPY_CONSTRUCT(ST2052_TextParser);
331+
332+
public:
333+
ST2052_TextParser();
334+
virtual ~ST2052_TextParser();
335+
336+
// Opens an XML file for reading, parses data to provide a complete
337+
// set of stream metadata for the MXFWriter below.
338+
Result_t OpenRead(const std::string& filename) const;
339+
340+
// Parse an XML string
341+
Result_t OpenRead(const std::string& xml_doc, const std::string& filename) const;
342+
343+
// Fill a TimedTextDescriptor struct with the values from the file's contents.
344+
// Returns RESULT_INIT if the file is not open.
345+
Result_t FillTimedTextDescriptor(ASDCP::TimedText::TimedTextDescriptor&) const;
346+
347+
// Reads the complete Timed Text Resource into the given string.
348+
Result_t ReadTimedTextResource(std::string&) const;
349+
350+
// Reads the Ancillary Resource having the given ID. Fails if the buffer
351+
// is too small or the resource does not exist. The optional Resolver
352+
// argument can be provided which will be used to retrieve the resource
353+
// having a particulat UUID. If a Resolver is not supplied, the default
354+
// internal resolver will return the contents of the file having the UUID
355+
// as the filename. The filename must exist in the same directory as the
356+
// XML file opened with OpenRead().
357+
Result_t ReadAncillaryResource(const Kumu::UUID&, ASDCP::TimedText::FrameBuffer&,
358+
const ASDCP::TimedText::IResourceResolver* Resolver = 0) const;
359+
};
360+
361+
//
362+
class MXFWriter
363+
{
364+
class h__Writer;
365+
ASDCP::mem_ptr<h__Writer> m_Writer;
366+
ASDCP_NO_COPY_CONSTRUCT(MXFWriter);
367+
368+
public:
369+
MXFWriter();
370+
virtual ~MXFWriter();
371+
372+
// Warning: direct manipulation of MXF structures can interfere
373+
// with the normal operation of the wrapper. Caveat emptor!
374+
virtual ASDCP::MXF::OP1aHeader& OP1aHeader();
375+
virtual ASDCP::MXF::RIP& RIP();
376+
377+
// Open the file for writing. The file must not exist. Returns error if
378+
// the operation cannot be completed or if nonsensical data is discovered
379+
// in the essence descriptor.
380+
Result_t OpenWrite(const std::string& filename, const ASDCP::WriterInfo&,
381+
const ASDCP::TimedText::TimedTextDescriptor&, ui32_t HeaderSize = 16384);
382+
383+
// Writes the Timed-Text Resource to the MXF file. The file must be UTF-8
384+
// encoded. If the optional AESEncContext argument is present, the essence
385+
// is encrypted prior to writing. Fails if the file is not open, is finalized,
386+
// or an operating system error occurs.
387+
// This method may only be called once, and it must be called before any
388+
// call to WriteAncillaryResource(). RESULT_STATE will be returned if these
389+
// conditions are not met.
390+
Result_t WriteTimedTextResource(const std::string& XMLDoc, ASDCP::AESEncContext* = 0, ASDCP::HMACContext* = 0);
391+
392+
// Writes an Ancillary Resource to the MXF file. If the optional AESEncContext
393+
// argument is present, the essence is encrypted prior to writing.
394+
// Fails if the file is not open, is finalized, or an operating system
395+
// error occurs. RESULT_STATE will be returned if the method is called before
396+
// WriteTimedTextResource()
397+
Result_t WriteAncillaryResource(const ASDCP::TimedText::FrameBuffer&, ASDCP::AESEncContext* = 0, ASDCP::HMACContext* = 0);
398+
399+
// Closes the MXF file, writing the index and revised header.
400+
Result_t Finalize();
401+
};
402+
403+
//
404+
class MXFReader
405+
{
406+
class h__Reader;
407+
ASDCP::mem_ptr<h__Reader> m_Reader;
408+
ASDCP_NO_COPY_CONSTRUCT(MXFReader);
409+
410+
public:
411+
MXFReader();
412+
virtual ~MXFReader();
413+
414+
// Warning: direct manipulation of MXF structures can interfere
415+
// with the normal operation of the wrapper. Caveat emptor!
416+
virtual ASDCP::MXF::OP1aHeader& OP1aHeader();
417+
virtual AS_02::MXF::AS02IndexReader& AS02IndexReader();
418+
virtual ASDCP::MXF::RIP& RIP();
419+
420+
// Open the file for reading. The file must exist. Returns error if the
421+
// operation cannot be completed.
422+
Result_t OpenRead(const std::string& filename) const;
423+
424+
// Returns RESULT_INIT if the file is not open.
425+
Result_t Close() const;
426+
427+
// Fill a TimedTextDescriptor struct with the values from the file's header.
428+
// Returns RESULT_INIT if the file is not open.
429+
Result_t FillTimedTextDescriptor(ASDCP::TimedText::TimedTextDescriptor&) const;
430+
431+
// Fill a WriterInfo struct with the values from the file's header.
432+
// Returns RESULT_INIT if the file is not open.
433+
Result_t FillWriterInfo(ASDCP::WriterInfo&) const;
434+
435+
// Reads the complete Timed Text Resource into the given string. Fails if the resource
436+
// is encrypted and AESDecContext is NULL (use the following method to retrieve the
437+
// raw ciphertet block).
438+
Result_t ReadTimedTextResource(std::string&, ASDCP::AESDecContext* = 0, ASDCP::HMACContext* = 0) const;
439+
440+
// Reads the complete Timed Text Resource from the MXF file. If the optional AESEncContext
441+
// argument is present, the resource is decrypted after reading. If the MXF
442+
// file is encrypted and the AESDecContext argument is NULL, the frame buffer
443+
// will contain the ciphertext frame data. If the HMACContext argument is
444+
// not NULL, the HMAC will be calculated (if the file supports it).
445+
// Returns RESULT_INIT if the file is not open, failure if the frame number is
446+
// out of range, or if optional decrypt or HAMC operations fail.
447+
Result_t ReadTimedTextResource(ASDCP::TimedText::FrameBuffer&, ASDCP::AESDecContext* = 0, ASDCP::HMACContext* = 0) const;
448+
449+
// Reads the timed-text resource having the given UUID from the MXF file. If the
450+
// optional AESEncContext argument is present, the resource is decrypted after
451+
// reading. If the MXF file is encrypted and the AESDecContext argument is NULL,
452+
// the frame buffer will contain the ciphertext frame data. If the HMACContext
453+
// argument is not NULL, the HMAC will be calculated (if the file supports it).
454+
// Returns RESULT_INIT if the file is not open, failure if the frame number is
455+
// out of range, or if optional decrypt or HAMC operations fail.
456+
Result_t ReadAncillaryResource(const Kumu::UUID&, ASDCP::TimedText::FrameBuffer&, ASDCP::AESDecContext* = 0, ASDCP::HMACContext* = 0) const;
457+
458+
// Print debugging information to stream
459+
void DumpHeaderMetadata(FILE* = 0) const;
460+
void DumpIndex(FILE* = 0) const;
461+
};
462+
} // namespace TimedText
309463

310464

311465
} // namespace AS_02

0 commit comments

Comments
 (0)