/*
-Copyright (c) 2005-2006, John Hurst
+Copyright (c) 2005-2009, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
//
// command line option parser class
-static const char* PACKAGE = "klvwalk"; // program name for messages
+static const char* PROGRAM_NAME = "klvwalk"; // program name for messages
typedef std::list<std::string> FileList_t;
// Increment the iterator, test for an additional non-option command line argument.
{
fprintf(stream, "\n\
%s (asdcplib %s)\n\n\
-Copyright (c) 2005-2006 John Hurst\n\
+Copyright (c) 2005-2009 John Hurst\n\
%s is part of the asdcplib DCP tools package.\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",
- PACKAGE, ASDCP::Version(), PACKAGE, PACKAGE);
+ PROGRAM_NAME, ASDCP::Version(), PROGRAM_NAME, PROGRAM_NAME);
}
//
\n\
%s [-h|-help] [-V]\n\
\n\
- -h | -help - Show help\n\
- -r - When KLV data is an OPAtom file, additionally\n\
- display OPAtom headers\n\
- -v - Verbose. Prints informative messages to stderr\n\
- -V - Show version information\n\
+ -h | -help - Show help\n\
+ -r - When KLV data is an MXF OPAtom file, display OPAtom headers\n\
+ -v - Verbose. Prints informative messages to stderr\n\
+ -V - Show version information\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", PACKAGE, PACKAGE);
+\n", PROGRAM_NAME, PROGRAM_NAME);
}
//
{
switch ( argv[i][1] )
{
-
case 'h': help_flag = true; break;
case 'r': read_mxf_flag = true; break;
case 'V': version_flag = true; break;
if ( Options.error_flag )
{
- fprintf(stderr, "There was a problem. Type %s -h for help.\n", PACKAGE);
+ fprintf(stderr, "There was a problem. Type %s -h for help.\n", PROGRAM_NAME);
return 3;
}
if (Options.verbose_flag)
fprintf(stderr, "Opening file %s\n", ((*fi).c_str()));
- if ( Options.read_mxf_flag )
+ if ( Options.read_mxf_flag ) // dump MXF
{
Kumu::FileReader Reader;
- ASDCP::MXF::OPAtomHeader Header;
+ const Dictionary* Dict = &DefaultCompositeDict();
+ ASDCP::MXF::OPAtomHeader Header(Dict);
result = Reader.OpenRead((*fi).c_str());
if ( ASDCP_SUCCESS(result) )
result = Header.InitFromFile(Reader);
- Header.Dump(stdout);
+ if ( ASDCP_SUCCESS(result) )
+ Header.Dump(stdout);
+ if ( ASDCP_SUCCESS(result) && Header.m_RIP.PairArray.size() > 2 )
+ {
+ MXF::Array<MXF::RIP::Pair>::const_iterator pi = Header.m_RIP.PairArray.begin();
+
+ for ( pi++; pi != Header.m_RIP.PairArray.end() && ASDCP_SUCCESS(result); pi++ )
+ {
+ result = Reader.Seek((*pi).ByteOffset);
+
+ if ( ASDCP_SUCCESS(result) )
+ {
+ MXF::Partition TmpPart(Dict);
+ result = TmpPart.InitFromFile(Reader);
+
+ if ( ASDCP_SUCCESS(result) && TmpPart.BodySID > 0 )
+ TmpPart.Dump(stdout);
+ }
+ }
+ }
+
if ( ASDCP_SUCCESS(result) )
{
- ASDCP::MXF::OPAtomIndexFooter Index;
+ ASDCP::MXF::OPAtomIndexFooter Index(Dict);
result = Reader.Seek(Header.FooterPartition);
if ( ASDCP_SUCCESS(result) )
if ( ASDCP_SUCCESS(result) )
Index.Dump(stdout);
}
+
+ if ( ASDCP_SUCCESS(result) )
+ Header.m_RIP.Dump(stdout);
}
else // dump klv
{
while ( ASDCP_SUCCESS(result) )
{
- KP.Dump(stdout, true);
+ KP.Dump(stdout, DefaultCompositeDict(), true);
result = KP.InitFromFile(Reader);
}