diff options
| author | mikey <mikey@cinecert.com> | 2013-06-03 21:33:32 +0000 |
|---|---|---|
| committer | mikey <> | 2013-06-03 21:33:32 +0000 |
| commit | de10f4a1f35fce05226b267baf6622e67e3d4c83 (patch) | |
| tree | db3f13e818eb19bb6ac41b04f842c398c6bb1b8a /src/klvwalk.cpp | |
| parent | 25b162e106470d59bfbe57957c5855a6d1eb9260 (diff) | |
fixing reserved symbol conflict with AS_02_USE (USE_AS_02)
Diffstat (limited to 'src/klvwalk.cpp')
| -rwxr-xr-x | src/klvwalk.cpp | 63 |
1 files changed, 60 insertions, 3 deletions
diff --git a/src/klvwalk.cpp b/src/klvwalk.cpp index f87d2c5..6ef0474 100755 --- a/src/klvwalk.cpp +++ b/src/klvwalk.cpp @@ -78,12 +78,13 @@ void usage(FILE* stream = stdout) { fprintf(stream, "\ -USAGE: %s [-r] [-v] <input-file> [<input-file2> ...]\n\ +USAGE: %s [-r|-p] [-v] <input-file> [<input-file2> ...]\n\ \n\ %s [-h|-help] [-V]\n\ \n\ -h | -help - Show help\n\ - -r - When KLV data is an MXF OPAtom file, display OPAtom headers\n\ + -r - When KLV data is an MXF OPAtom or OP 1a file, display headers\n\ + -p - Display partition headers by walking the RIP\n\ -v - Verbose. Prints informative messages to stderr\n\ -V - Show version information\n\ \n\ @@ -104,10 +105,12 @@ USAGE: %s [-r] [-v] <input-file> [<input-file2> ...]\n\ bool help_flag; // true if the help display option was selected bool verbose_flag; // true if the informative messages option was selected bool read_mxf_flag; // true if the -r option was selected + bool walk_parts_flag; // true if the -p option was selected FileList_t inFileList; // File to operate on CommandOptions(int argc, const char** argv) : - error_flag(true), version_flag(false), help_flag(false), verbose_flag(false), read_mxf_flag(false) + error_flag(true), version_flag(false), help_flag(false), + verbose_flag(false), read_mxf_flag(false), walk_parts_flag(false) { for ( int i = 1; i < argc; i++ ) { @@ -124,6 +127,7 @@ USAGE: %s [-r] [-v] <input-file> [<input-file2> ...]\n\ { case 'h': help_flag = true; break; case 'r': read_mxf_flag = true; break; + case 'p': walk_parts_flag = true; break; case 'V': version_flag = true; break; case 'v': verbose_flag = true; break; @@ -267,6 +271,59 @@ main(int argc, const char** argv) if ( ASDCP_SUCCESS(result) ) RIP.Dump(stdout); } + else if ( Options.walk_parts_flag ) + { + Kumu::FileReader Reader; + const Dictionary* Dict = &DefaultCompositeDict(); + ASDCP::MXF::OP1aHeader Header(Dict); + ASDCP::MXF::RIP RIP(Dict); + + result = Reader.OpenRead((*fi).c_str()); + + if ( ASDCP_SUCCESS(result) ) + result = MXF::SeekToRIP(Reader); + + if ( ASDCP_SUCCESS(result) ) + { + result = RIP.InitFromFile(Reader); + ui32_t test_s = RIP.PairArray.size(); + + if ( ASDCP_FAILURE(result) ) + { + DefaultLogSink().Error("File contains no RIP\n"); + result = RESULT_OK; + } + else if ( RIP.PairArray.empty() ) + { + DefaultLogSink().Error("RIP contains no Pairs.\n"); + } + + Reader.Seek(0); + } + else + { + DefaultLogSink().Error("ASDCP::h__Reader::OpenMXFRead, SeekToRIP failed\n"); + } + + if ( ASDCP_SUCCESS(result) ) + { + MXF::Array<MXF::RIP::Pair>::const_iterator i; + for ( i = RIP.PairArray.begin(); i != RIP.PairArray.end(); ++i ) + { + Reader.Seek(i->ByteOffset); + MXF::Partition plain_part(Dict); + plain_part.InitFromFile(Reader); + + if ( plain_part.ThisPartition != i->ByteOffset ) + { + DefaultLogSink().Error("ThisPartition value error: wanted=%qu, got=%qu\n", + plain_part.ThisPartition, i->ByteOffset); + } + + plain_part.Dump(); + } + } + } else // dump klv { Kumu::FileReader Reader; |
