X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Fklvwalk.cpp;h=9a815b76ff92423ec73c0858fc4845f7a43ba2cc;hb=3bb652da6ea2765b1538d0713cefa284238c8bdb;hp=467eff938fc9e37633b481b37e33f29277169db7;hpb=c589ee9d47d9f00aa4be32c5832a44ce466f014d;p=asdcplib.git diff --git a/src/klvwalk.cpp b/src/klvwalk.cpp index 467eff9..9a815b7 100755 --- a/src/klvwalk.cpp +++ b/src/klvwalk.cpp @@ -1,5 +1,5 @@ /* -Copyright (c) 2005-2006, John Hurst +Copyright (c) 2005-2008, John Hurst All rights reserved. Redistribution and use in source and binary forms, with or without @@ -47,7 +47,7 @@ using Kumu::DefaultLogSink; // // 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 FileList_t; // Increment the iterator, test for an additional non-option command line argument. @@ -65,12 +65,12 @@ banner(FILE* stream = stdout) { fprintf(stream, "\n\ %s (asdcplib %s)\n\n\ -Copyright (c) 2005-2006 John Hurst\n\ +Copyright (c) 2005-2008 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); } // @@ -82,15 +82,14 @@ USAGE: %s [-r] [-v] [ ...]\n\ \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); } // @@ -123,7 +122,6 @@ USAGE: %s [-r] [-v] [ ...]\n\ { switch ( argv[i][1] ) { - case 'h': help_flag = true; break; case 'r': read_mxf_flag = true; break; case 'V': version_flag = true; break; @@ -180,7 +178,7 @@ main(int argc, const char** argv) 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; } @@ -192,7 +190,7 @@ main(int argc, const char** argv) 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; @@ -202,8 +200,28 @@ main(int argc, const char** argv) 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::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; + result = TmpPart.InitFromFile(Reader); + + if ( ASDCP_SUCCESS(result) && TmpPart.BodySID > 0 ) + TmpPart.Dump(stdout); + } + } + } + if ( ASDCP_SUCCESS(result) ) { ASDCP::MXF::OPAtomIndexFooter Index; @@ -218,6 +236,9 @@ main(int argc, const char** argv) if ( ASDCP_SUCCESS(result) ) Index.Dump(stdout); } + + if ( ASDCP_SUCCESS(result) ) + Header.m_RIP.Dump(stdout); } else // dump klv {