Skip to content

Commit 3685d92

Browse files
mikeymikey
mikey
authored and
mikey
committed
version bump
1 parent 5884edb commit 3685d92

10 files changed

+152
-95
lines changed

COPYING

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

2-
AS-DCP Lib is Copyright (c) 2003-2009, John Hurst
2+
AS-DCP Lib is Copyright (c) 2003-2012, John Hurst
33
All rights reserved.
44

55
Redistribution and use in source and binary forms, with or without
@@ -24,3 +24,32 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2424
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2525
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

27+
28+
29+
IMF Essence Component (AS-02) implementation:
30+
(AS_02.h AS_02_internal.h AS_02_JP2K.cpp AS_02_MXF.cpp AS_02_PCM.cpp
31+
as-02-unwrap.cpp as-02-wrap.cpp h__02_Reader.cpp h__02_Writer.cpp)
32+
Copyright (c) 2011-2012, Robert Scheler, Heiko Sparenberg Fraunhofer IIS, John Hurst
33+
All rights reserved.
34+
35+
Redistribution and use in source and binary forms, with or without
36+
modification, are permitted provided that the following conditions
37+
are met:
38+
1. Redistributions of source code must retain the above copyright
39+
notice, this list of conditions and the following disclaimer.
40+
2. Redistributions in binary form must reproduce the above copyright
41+
notice, this list of conditions and the following disclaimer in the
42+
documentation and/or other materials provided with the distribution.
43+
3. The name of the author may not be used to endorse or promote products
44+
derived from this software without specific prior written permission.
45+
46+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
47+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
48+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
49+
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
50+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
51+
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
52+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
53+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
54+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
55+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README

+41-23
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,23 @@ $Id$
44
The asdcplib library is a set of objects that offer
55
simplified access to files conforming to the sound and
66
picture track file formats developed by the SMPTE Working
7-
Group DC28.20.
7+
Group DC28.20 (now TC 21DC).
88

9-
This work was originally funded by Digital Cinema
10-
Initiatives, LLC (DCI). Subsequent efforts have been funded
11-
by Deluxe Laboratories, Doremi Labs, CineCert LLC, Avica
12-
Technology and others.
9+
Recently, support has also been added for SMPTE draft ST
10+
2067-5 "IMF Essence Component", AKA "AS-02". This code was
11+
donated by Fraunhofer IIS. It carries additional copyright
12+
information which should be listed whenever you link the
13+
AS-02 elements of the library. Please look at the top of
14+
the AS-02 files to see this copyright information.
15+
16+
AS-02 support is carried in separate object modules, so
17+
unless you #include <AS_02.h> and link libas-02.so you are
18+
still using plain old asdcp.
19+
20+
This work was originally funded by Digital Cinema Initiatives,
21+
LLC (DCI). Subsequent efforts have been funded by Deluxe
22+
Laboratories, Doremi Labs, CineCert LLC, Avica Technology
23+
and others.
1324

1425
**The asdcplib project was originally housed on SourceForge.
1526
The project has moved to http://www.cinecert.com/asdcplib/
@@ -32,11 +43,11 @@ supporting this project.
3243
Design Notes
3344

3445
This library is intended (but of course not limited) for
35-
use by developers of commercial D-Cinema products. It is
36-
designed to be easily integrated into a wide variety of
37-
development environments. Commercial users are strongly
38-
urged to use static linking (at least where you use this
39-
library) to prevent malicious in-field replacement of
46+
use by developers of commercial D-Cinema products (and now
47+
IMF!). It is designed to be easily integrated into a wide
48+
variety of development environments. Commercial users are
49+
strongly urged to use static linking (at least where you use
50+
this library) to prevent malicious in-field replacement of
4051
critical system modules. This recommendation should be
4152
considered wherever Open Source or Free software is being
4253
used in conjunction with critical security parameters, such
@@ -50,12 +61,15 @@ crypto functions can be replaced by linking to alternative
5061
implementations of the ASDCP:: objects which provide those
5162
services.
5263

53-
AS_DCP.h contains the entire API. You do not need to read
54-
any of the other files, except maybe asdcp-test.cpp which
55-
contains detailed usage examples of each of the API's
56-
services. The KM_* files may be of interest for general
57-
development support, but may be ignored if all you want
58-
is simple AS-DCP support.
64+
AS_DCP.h contains the entire AS-DCP API. You do not need to
65+
read any of the other files, except maybe asdcp-test.cpp which
66+
contains detailed usage examples of each of the API's services.
67+
The KM_* files may be of interest for general development
68+
support, but may be ignored if all you want is simple AS-DCP
69+
support.
70+
71+
Likewise, draft 2067-5 "IMF Essence Component" (AS-02) support
72+
is entirely contained in AS-02.h
5973

6074

6175
Build Instructions
@@ -67,9 +81,8 @@ MinGW installed. For those Windows users who would prefer to build
6781
this natively, an "nmake" build file and instructions can be found
6882
in the win32 subdirectory.
6983

70-
OpenSSL is also required, and the most recent version of v0.9.8
71-
is recommended. See http://www.openssl.org/ for more information
72-
and download instructions.
84+
OpenSSL is also required, any recent version should be fine. See
85+
http://www.openssl.org/ for more information and download instructions.
7386

7487
Optional support for writing Timed Text Track Files is supported by
7588
either Xerces-C or Expat. See http://xerces.apache.org/xerces-c/ or
@@ -114,14 +127,19 @@ j2c-test - Displays information about JP2K codestreams.
114127

115128
Documentation
116129

117-
The API documentation is mostly in AS_DCP.h. Read that file for
118-
a detailed description of the library's capabilities. Read
119-
asdcp-test.cpp for library usage examples. The command-line
120-
utilities all respond to -h.
130+
The API documentation is mostly in AS_DCP.h. and AS_02.h Read those
131+
files for a detailed description of the library's capabilities. Read
132+
asdcp-*.cpp files for library usage examples. The
133+
command-line utilities all respond to -h.
121134

122135

123136
Change History
124137

138+
2012-08-07 - bug fix, 1.10.46
139+
o Added zero-initializers to time values when parsing a timestamp string
140+
(in the case where the (T...) option was not present the time was
141+
uninitialized).
142+
125143
2012-03-06 - bug fixes, enhancements 1.9.45
126144
o Removed ASDCP::Timestamp, all items that were of that class are now
127145
of class Kumu::Timestamp

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], [1.10.45pre1], [asdcplib@cinecert.com])
40+
AC_INIT([asdcplib], [1.10.45d], [asdcplib@cinecert.com])
4141

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

src/KM_log.cpp

+10-5
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ Kumu::DefaultLogSink()
9090
void
9191
Kumu::EntryListLogSink::WriteEntry(const LogEntry& Entry)
9292
{
93-
AutoMutex L(m_Lock);
93+
AutoMutex L(m_lock);
94+
WriteEntryToListeners(Entry);
9495

9596
if ( Entry.TestFilter(m_filter) )
9697
m_Target.push_back(Entry);
@@ -102,8 +103,9 @@ Kumu::EntryListLogSink::WriteEntry(const LogEntry& Entry)
102103
void
103104
Kumu::StdioLogSink::WriteEntry(const LogEntry& Entry)
104105
{
105-
AutoMutex L(m_Lock);
106106
std::string buf;
107+
AutoMutex L(m_lock);
108+
WriteEntryToListeners(Entry);
107109

108110
if ( Entry.TestFilter(m_filter) )
109111
{
@@ -121,8 +123,9 @@ Kumu::StdioLogSink::WriteEntry(const LogEntry& Entry)
121123
void
122124
Kumu::WinDbgLogSink::WriteEntry(const LogEntry& Entry)
123125
{
124-
AutoMutex L(m_Lock);
125126
std::string buf;
127+
AutoMutex L(m_lock);
128+
WriteEntryToListeners(Entry);
126129

127130
if ( Entry.TestFilter(m_filter) )
128131
{
@@ -140,8 +143,9 @@ Kumu::WinDbgLogSink::WriteEntry(const LogEntry& Entry)
140143
void
141144
Kumu::StreamLogSink::WriteEntry(const LogEntry& Entry)
142145
{
143-
AutoMutex L(m_Lock);
144146
std::string buf;
147+
AutoMutex L(m_lock);
148+
WriteEntryToListeners(Entry);
145149

146150
if ( Entry.TestFilter(m_filter) )
147151
{
@@ -199,7 +203,8 @@ Kumu::SyslogLogSink::WriteEntry(const LogEntry& Entry)
199203
case Kumu::LOG_DEBUG: priority = SYSLOG_DEBUG; break;
200204
}
201205

202-
AutoMutex L(m_Lock);
206+
AutoMutex L(m_lock);
207+
WriteEntryToListeners(Entry);
203208

204209
if ( Entry.TestFilter(m_filter) )
205210
{

src/KM_log.h

+47-41
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3939
#include <stdarg.h>
4040
#include <errno.h>
4141
#include <iosfwd>
42+
#include <set>
4243

4344
#define LOG_MSG_IMPL(t) \
4445
va_list args; \
@@ -149,6 +150,18 @@ namespace Kumu
149150
protected:
150151
i32_t m_filter;
151152
i32_t m_options;
153+
Mutex m_lock;
154+
std::set<ILogSink*> m_listeners;
155+
156+
// you must obtain m_lock BEFORE calling this from your own WriteEntry
157+
void WriteEntryToListeners(const LogEntry& entry)
158+
{
159+
std::set<ILogSink*>::iterator i;
160+
for ( i = m_listeners.begin(); i != m_listeners.end(); ++i )
161+
(*i)->WriteEntry(entry);
162+
}
163+
164+
KM_NO_COPY_CONSTRUCT(ILogSink);
152165

153166
public:
154167
ILogSink() : m_filter(LOG_ALLOW_ALL), m_options(LOG_OPTION_NONE) {}
@@ -162,6 +175,19 @@ namespace Kumu
162175
void UnsetOptionFlag(i32_t o) { m_options &= ~o; }
163176
bool TestOptionFlag(i32_t o) const { return ((m_options & o) == o); }
164177

178+
void AddListener(ILogSink& s) {
179+
if ( &s != this )
180+
{
181+
AutoMutex l(m_lock);
182+
m_listeners.insert(&s);
183+
}
184+
}
185+
186+
void DelListener(ILogSink& s) {
187+
AutoMutex l(m_lock);
188+
m_listeners.erase(&s);
189+
}
190+
165191
// library messages
166192
void Error(const char* fmt, ...) { LOG_MSG_IMPL(LOG_ERROR); }
167193
void Warn(const char* fmt, ...) { LOG_MSG_IMPL(LOG_WARN); }
@@ -190,51 +216,35 @@ namespace Kumu
190216
ILogSink& DefaultLogSink();
191217

192218

193-
// Sets a log sink as the default until the object is destroyed.
194-
// The original default sink is saved and then restored on delete.
195-
class LogSinkContext
196-
{
197-
KM_NO_COPY_CONSTRUCT(LogSinkContext);
198-
LogSinkContext();
199-
ILogSink* m_orig;
219+
// attach a log sink as a listener until deleted
220+
class LogSinkListenContext
221+
{
222+
ILogSink* m_log_source;
223+
ILogSink* m_sink;
224+
KM_NO_COPY_CONSTRUCT(LogSinkListenContext);
225+
LogSinkListenContext();
226+
227+
public:
228+
LogSinkListenContext(ILogSink& source, ILogSink& sink)
229+
{
230+
m_log_source = &source;
231+
m_sink = &sink;
232+
m_log_source->AddListener(*m_sink);
233+
}
234+
235+
~LogSinkListenContext()
236+
{
237+
m_log_source->DelListener(*m_sink);
238+
}
239+
};
200240

201-
public:
202-
LogSinkContext(ILogSink& sink) {
203-
m_orig = &DefaultLogSink();
204-
SetDefaultLogSink(&sink);
205-
}
206-
207-
~LogSinkContext() {
208-
SetDefaultLogSink(m_orig);
209-
}
210-
};
211241

212242
//------------------------------------------------------------------------------------------
213243
//
214244

215-
// write messages to two subordinate log sinks
216-
class TeeLogSink : public ILogSink
217-
{
218-
KM_NO_COPY_CONSTRUCT(TeeLogSink);
219-
TeeLogSink();
220-
221-
ILogSink& m_a;
222-
ILogSink& m_b;
223-
224-
public:
225-
TeeLogSink(ILogSink& a, ILogSink& b) : m_a(a), m_b(b) {}
226-
virtual ~TeeLogSink() {}
227-
228-
void WriteEntry(const LogEntry& Entry) {
229-
m_a.WriteEntry(Entry);
230-
m_b.WriteEntry(Entry);
231-
}
232-
};
233-
234245
// collect log messages into the given list, does not test filter
235246
class EntryListLogSink : public ILogSink
236247
{
237-
Mutex m_Lock;
238248
LogEntryList& m_Target;
239249
KM_NO_COPY_CONSTRUCT(EntryListLogSink);
240250
EntryListLogSink();
@@ -250,7 +260,6 @@ namespace Kumu
250260
// write messages to a POSIX stdio stream
251261
class StdioLogSink : public ILogSink
252262
{
253-
Mutex m_Lock;
254263
FILE* m_stream;
255264
KM_NO_COPY_CONSTRUCT(StdioLogSink);
256265

@@ -266,7 +275,6 @@ namespace Kumu
266275
// write messages to the Win32 debug stream
267276
class WinDbgLogSink : public ILogSink
268277
{
269-
Mutex m_Lock;
270278
KM_NO_COPY_CONSTRUCT(WinDbgLogSink);
271279

272280
public:
@@ -281,7 +289,6 @@ namespace Kumu
281289
// write messages to a POSIX file descriptor
282290
class StreamLogSink : public ILogSink
283291
{
284-
Mutex m_Lock;
285292
int m_fd;
286293
KM_NO_COPY_CONSTRUCT(StreamLogSink);
287294
StreamLogSink();
@@ -296,7 +303,6 @@ namespace Kumu
296303
// write messages to the syslog facility
297304
class SyslogLogSink : public ILogSink
298305
{
299-
Mutex m_Lock;
300306
KM_NO_COPY_CONSTRUCT(SyslogLogSink);
301307
SyslogLogSink();
302308

src/KM_util.cpp

+13-1
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ Kumu::Timestamp::EncodeString(char* str_buf, ui32_t buf_len) const
812812
return str_buf;
813813
}
814814

815-
//
815+
// ^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?(?:([+-]\d{2}):(\d{2}))?)?$
816816
bool
817817
Kumu::Timestamp::DecodeString(const char* datestr)
818818
{
@@ -825,6 +825,9 @@ Kumu::Timestamp::DecodeString(const char* datestr)
825825

826826
ui32_t char_count = 10;
827827
TAI::caltime YMDhms;
828+
YMDhms.hour = 0;
829+
YMDhms.minute = 0;
830+
YMDhms.second = 0;
828831
YMDhms.offset = 0;
829832
YMDhms.date.year = atoi(datestr);
830833
YMDhms.date.month = atoi(datestr + 5);
@@ -954,6 +957,15 @@ Kumu::Timestamp::GetCTime() const
954957
return m_Timestamp.x - ui64_C(4611686018427387914);
955958
}
956959

960+
//
961+
void
962+
Kumu::Timestamp::SetCTime(const ui64_t& ctime)
963+
{
964+
m_Timestamp.x = ctime + ui64_C(4611686018427387914);
965+
}
966+
967+
968+
957969

958970
//------------------------------------------------------------------------------------------
959971

0 commit comments

Comments
 (0)