Change History
+2010.01.05 - bug fixes, enhancements, v1.5.32
+ o Re-fixed swapped Interop and SMPTE OP Atom UL values. The swap
+ introduced in v1.5.31 was done in error.
+ o Added -z,-Z options to asdcp-test (j2c parameter checking)
+ o Reformed jp2k-test as j2c-test, added help and list processing,
+ added to standard install target.
+
+
2009.12.31 - bug fixes, enhancements, v1.5.31
o Fixed swapped Interop and SMPTE OP Atom UL values.
o Added get_BER_length_for_value() subroutine.
# 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.31], [asdcplib@cinecert.com])
+AC_INIT([asdcplib], [1.5.32], [asdcplib@cinecert.com])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/KM_error.h])
}
else
{
+ fprintf(stream, "COM:\n");
Kumu::hexdump(CommentData(), CommentSize(), stream);
}
}
/*
-Copyright (c) 2006-2009, John Hurst
+Copyright (c) 2006-2010, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
{ { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // 0
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{0}, false, "MICAlgorithm_NONE" },
- { { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x02, // 1
+ { { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01, // 1
0x0d, 0x01, 0x02, 0x01, 0x10, 0x00, 0x00, 0x00 },
{0}, false, "MXFInterop_OPAtom" },
- { { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01, // 2
+ { { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x02, // 2
0x0d, 0x01, 0x02, 0x01, 0x10, 0x00, 0x00, 0x00 },
{0}, false, "OPAtom" },
{ { 0x06, 0x0e, 0x2b, 0x34, 0x04, 0x01, 0x01, 0x01, // 3
}
else if ( OperationalPattern == InteropOPAtomUL ) // Interop
{
- // if ( m_Dict == &DefaultCompositeDict() )
- // m_Dict = &DefaultInteropDict();
+ if ( m_Dict == &DefaultCompositeDict() )
+ m_Dict = &DefaultInteropDict();
}
else
{
endif
# list of programs to be built and installed
-bin_PROGRAMS = asdcp-test blackwave klvwalk kmfilegen kmrandgen \
+bin_PROGRAMS = asdcp-test j2c-test blackwave klvwalk kmfilegen kmrandgen \
kmuuidgen wavesplit
# sources for a program
klvwalk_LDADD = libasdcp.la
wavesplit_SOURCES = wavesplit.cpp
wavesplit_LDADD = libasdcp.la
+j2c_test_SOURCES = j2c-test.cpp
+j2c_test_LDADD = libasdcp.la
# list of programs that need to be compiled for use in test suite
-check_PROGRAMS = asdcp-mem-test path-test jp2k-test S429-5-cgi \
+check_PROGRAMS = asdcp-mem-test path-test S429-5-cgi \
fips-186-rng-test asdcp-version
if DEV_HEADERS
check_PROGRAMS += tt-xform
asdcp_mem_test_LDADD = libasdcp.la
path_test_SOURCES = path-test.cpp
path_test_LDADD = libkumu.la
-jp2k_test_SOURCES = jp2k-test.cpp
-jp2k_test_LDADD = libasdcp.la
S429_5_cgi_SOURCES = S429-5-cgi.cpp
S429_5_cgi_LDADD = libasdcp.la
fips_186_rng_test_SOURCES = fips-186-rng-test.cpp
/*
-Copyright (c) 2003-2009, John Hurst
+Copyright (c) 2003-2010, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
{
fprintf(stream, "\n\
%s (asdcplib %s)\n\n\
-Copyright (c) 2003-2009 John Hurst\n\n\
+Copyright (c) 2003-2010 John Hurst\n\n\
asdcplib may be copied only under the terms of the license found at\n\
the top of every file in the asdcplib distribution kit.\n\n\
Specify the -h (help) option for further information about %s\n\n",
USAGE: %s -c <output-file> [-3] [-a <uuid>] [-b <buffer-size>]\n\
[-d <duration>] [-e|-E] [-f <start-frame>] [-j <key-id-string>]\n\
[-k <key-string>] [-l <label>] [-L] [-M] [-p <frame-rate>] [-R]\n\
- [-s <num>] [-v] [-W] <input-file> [<input-file-2> ...]\n\
+ [-s <num>] [-v] [-W] [-z|-Z] <input-file> [<input-file-2> ...]\n\
\n\
%s [-h|-help] [-V]\n\
\n\
-W - Read input file only, do not write source file\n\
-w <width> - Width of numeric element in a series of frame file names\n\
(use with -x, default 6).\n\
+ -z - Fail if j2c inputs have unequal parameters (default)\n\
+ -Z - Ignore unequal parameters in j2c inputs\n\
\n");
fprintf(stream, "\
bool duration_flag; // true if duration argument given
bool do_repeat; // if true and -c -d, repeat first input frame
bool use_smpte_labels; // if true, SMPTE UL values will be written instead of MXF Interop values
+ bool j2c_pedantic; // passed to JP2K::SequenceParser::OpenRead
ui32_t picture_rate; // fps of picture when wrapping PCM
ui32_t fb_size; // size of picture frame buffer
ui32_t file_count; // number of elements in filenames[]
verbose_flag(false), fb_dump_size(0), showindex_flag(false), showheader_flag(false),
no_write_flag(false), version_flag(false), help_flag(false), stereo_image_flag(false),
number_width(6), start_frame(0),
- duration(0xffffffff), duration_flag(false), do_repeat(false), use_smpte_labels(false),
+ duration(0xffffffff), duration_flag(false), do_repeat(false), use_smpte_labels(false), j2c_pedantic(true),
picture_rate(24), fb_size(FRAME_BUFFER_SIZE), file_count(0), file_root(0), out_file(0),
channel_fmt(PCM::CF_NONE)
{
file_root = argv[i];
break;
+ case 'Z': j2c_pedantic = false; break;
+ case 'z': j2c_pedantic = true; break;
+
default:
fprintf(stderr, "Unrecognized option: %s\n", argv[i]);
return;
}
// set up essence parser
- Result_t result = ParserLeft.OpenRead(Options.filenames[0]);
+ Result_t result = ParserLeft.OpenRead(Options.filenames[0], Options.j2c_pedantic);
if ( ASDCP_SUCCESS(result) )
- result = ParserRight.OpenRead(Options.filenames[1]);
+ result = ParserRight.OpenRead(Options.filenames[1], Options.j2c_pedantic);
// set up MXF writer
if ( ASDCP_SUCCESS(result) )
Kumu::FortunaRNG RNG;
// set up essence parser
- Result_t result = Parser.OpenRead(Options.filenames[0]);
+ Result_t result = Parser.OpenRead(Options.filenames[0], Options.j2c_pedantic);
// set up MXF writer
if ( ASDCP_SUCCESS(result) )
/*
-Copyright (c) 2005-2009, John Hurst
+Copyright (c) 2005-2010, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-/*! \file jp2k-test.cpp
+/*! \file j2c-test.cpp
\version $Id$
\brief JP2K parser test
*/
using namespace ASDCP;
using namespace ASDCP::JP2K;
+
+
+//------------------------------------------------------------------------------------------
+//
+// command line option parser class
+
+static const char* PROGRAM_NAME = "j2c-test"; // program name for messages
+
+// Macros used to test command option data state.
+
+// Increment the iterator, test for an additional non-option command line argument.
+// Causes the caller to return if there are no remaining arguments or if the next
+// argument begins with '-'.
+#define TEST_EXTRA_ARG(i,c) if ( ++i >= argc || argv[(i)][0] == '-' ) \
+ { \
+ fprintf(stderr, "Argument not found for option %c.\n", (c)); \
+ return; \
+ }
+//
+void
+banner(FILE* stream = stderr)
+{
+ fprintf(stream, "\n\
+%s (asdcplib %s)\n\n\
+Copyright (c) 2005-2010 John Hurst\n\n\
+%s is part of asdcplib.\n\
+asdcplib may be copied only under the terms of the license found at\n\
+the top of every file in the asdcplib distribution kit.\n\n\
+Specify the -h (help) option for further information about %s\n\n",
+ PROGRAM_NAME, ASDCP::Version(), PROGRAM_NAME, PROGRAM_NAME);
+}
+
+//
+void
+usage(FILE* stream = stderr)
+{
+ fprintf(stream, "\
+USAGE: %s [-h|-help] [-V]\n\
+\n\
+ %s [-r] [-v] <filename> [...]\n\
+\n\
+ -V - Show version\n\
+ -h - Show help\n\
+ -r - Show raw data\n\
+ -v - Print extra detail\n\
+\n\
+ NOTES: o There is no option grouping, all options must be distinct arguments.\n\
+ o All option arguments must be separated from the option by whitespace.\n\
+\n", PROGRAM_NAME, PROGRAM_NAME);
+}
+
+//
+//
+class CommandOptions
+{
+ CommandOptions();
+
+public:
+ bool error_flag; // true if the given options are in error or not complete
+ bool version_flag; // true if the version display option was selected
+ bool verbose_flag; // true if the verbose option was selected
+ bool detail_flag; // true if the version display option was selected
+ bool help_flag; // true if the help display option was selected
+ std::list<std::string> filename_list;
+
+ CommandOptions(int argc, const char** argv) :
+ error_flag(true), version_flag(false), verbose_flag(false),
+ detail_flag(false), help_flag(false)
+ {
+ for ( int i = 1; i < argc; i++ )
+ {
+ if ( argv[i][0] == '-' && isalpha(argv[i][1]) && argv[i][2] == 0 )
+ {
+ switch ( argv[i][1] )
+ {
+ case 'V': version_flag = true; break;
+ case 'h': help_flag = true; break;
+ case 'r': detail_flag = true; break;
+ case 'v': verbose_flag = true; break;
+
+ default:
+ fprintf(stderr, "Unrecognized option: %c\n", argv[i][1]);
+ return;
+ }
+ }
+ else
+ {
+ filename_list.push_back(argv[i]);
+ }
+ }
+
+ if ( filename_list.empty() )
+ {
+ fputs("Input j2c filename(s) required.\n", stderr);
+ return;
+ }
+
+ error_flag = false;
+ }
+};
+
+
+
+
//
int
main(int argc, const char** argv)
{
- ASDCP::JP2K::FrameBuffer FB;
- Marker MyMarker;
+ CommandOptions Options(argc, argv);
- if ( argc < 2 )
- return 1;
+ if ( Options.version_flag )
+ banner();
- FB.Capacity(1024*1024*2);
- CodestreamParser Parser;
+ if ( Options.help_flag )
+ usage();
- Result_t result = Parser.OpenReadFrame(argv[1], FB);
+ if ( Options.version_flag || Options.help_flag )
+ return 0;
- if ( result != RESULT_OK )
+ if ( Options.error_flag )
{
- fputs("Program stopped on error.\n", stderr);
-
- if ( result != RESULT_FAIL )
- {
- fputs(result.Label(), stderr);
- fputc('\n', stderr);
- }
-
- return 1;
+ fprintf(stderr, "There was a problem. Type %s -h for help.\n", PROGRAM_NAME);
+ return 3;
}
- const byte_t* p = FB.RoData();
- const byte_t* end_p = p + FB.Size();
-
- hexdump(p, 256, stderr);
+ ASDCP::JP2K::FrameBuffer FB;
+ Marker MyMarker;
+ CodestreamParser Parser;
+ std::list<std::string>::iterator i;
- while ( p < end_p && ASDCP_SUCCESS(GetNextMarker(&p, MyMarker)) )
+ Result_t result = FB.Capacity(1024*1024*4);
+
+ for ( i = Options.filename_list.begin(); ASDCP_SUCCESS(result) && i != Options.filename_list.end(); i++ )
{
- MyMarker.Dump();
+ result = Parser.OpenReadFrame(argv[1], FB);
- switch ( MyMarker.m_Type )
+ if ( ASDCP_SUCCESS(result) )
{
- case MRK_SOD:
- p = end_p;
- break;
+ const byte_t* p = FB.RoData();
+ const byte_t* end_p = p + FB.Size();
+
+ while ( p < end_p && ASDCP_SUCCESS(GetNextMarker(&p, MyMarker)) )
+ {
+ if ( Options.verbose_flag )
+ {
+ MyMarker.Dump(stdout);
+
+ if ( Options.detail_flag )
+ hexdump(MyMarker.m_Data - 2, MyMarker.m_DataSize + 2, stdout);
+ }
+
+ switch ( MyMarker.m_Type )
+ {
+ case MRK_SOD:
+ p = end_p;
+ break;
+
+ case MRK_SIZ:
+ {
+ Accessor::SIZ SIZ_(MyMarker);
+ SIZ_.Dump(stdout);
+ }
+ break;
+
+ case MRK_COM:
+ {
+ Accessor::COM COM_(MyMarker);
+ COM_.Dump(stdout);
+ }
+ break;
+ }
+ }
+ }
+ }
- case MRK_SIZ:
- {
- Accessor::SIZ SIZ_(MyMarker);
- hexdump(MyMarker.m_Data - 2, MyMarker.m_DataSize + 2, stderr);
- SIZ_.Dump();
- }
- break;
+ if ( ASDCP_FAILURE(result) )
+ {
+ fputs("Program stopped on error.\n", stderr);
- case MRK_COM:
- {
- Accessor::COM COM_(MyMarker);
- COM_.Dump();
- }
- break;
+ if ( result != RESULT_FAIL )
+ {
+ fputs(result, stderr);
+ fputc('\n', stderr);
}
+
+ return 1;
}
-
+
return 0;
}
-
//
-// end jp2k-test.cpp
+// end j2c-test.cpp
//
done
-#${BUILD_DIR}/jp2k-test${EXEEXT} ${TEST_FILES}/${TEST_FILE_PREFIX}/MM_2k_XYZ_000000.j2c
+#${BUILD_DIR}/j2c-test${EXEEXT} ${TEST_FILES}/${TEST_FILE_PREFIX}/MM_2k_XYZ_000000.j2c
#if [ $? -ne 0 ]; then
# exit 1
#fi