Implemented J2K desc to/from MD
[asdcplib.git] / src / klvwalk.cpp
index b7550e61e71d638e8baf15b240e5321659737c65..90b719b87544c4f791b7e18a60311a2111ac629b 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2005-2009, John Hurst
+Copyright (c) 2005-2018, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -65,7 +65,7 @@ banner(FILE* stream = stdout)
 {
   fprintf(stream, "\n\
 %s (asdcplib %s)\n\n\
-Copyright (c) 2005-2009 John Hurst\n\
+Copyright (c) 2005-2013 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\
@@ -201,31 +201,33 @@ main(int argc, const char** argv)
          ASDCP::MXF::OP1aHeader Header(Dict);
          ASDCP::MXF::RIP RIP(Dict);
          
-         result = Reader.OpenRead((*fi).c_str());
+         result = Reader.OpenRead(*fi);
          
-         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) )
+             result = MXF::SeekToRIP(Reader);
+             
+             if ( ASDCP_SUCCESS(result) )
                {
-                 DefaultLogSink().Error("File contains no RIP\n");
-                 result = RESULT_OK;
+                 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 if ( RIP.PairArray.empty() )
+             else
                {
-                 DefaultLogSink().Error("RIP contains no Pairs.\n");
+                 DefaultLogSink().Error("read_mxf SeekToRIP failed: %s\n", result.Label());
                }
-
-             Reader.Seek(0);
-           }
-         else
-           {
-             DefaultLogSink().Error("read_mxf SeekToRIP failed: %s\n", result.Label());
            }
 
          if ( ASDCP_SUCCESS(result) )
@@ -236,7 +238,7 @@ main(int argc, const char** argv)
          
          if ( ASDCP_SUCCESS(result) && RIP.PairArray.size() > 2 )
            {
-             MXF::Array<MXF::RIP::Pair>::const_iterator pi = RIP.PairArray.begin();
+             MXF::RIP::const_pair_iterator pi = RIP.PairArray.begin();
 
              for ( pi++; pi != RIP.PairArray.end() && ASDCP_SUCCESS(result); pi++ )
                {
@@ -309,7 +311,7 @@ main(int argc, const char** argv)
            {
              RIP.Dump();
 
-             MXF::Array<MXF::RIP::Pair>::const_iterator i;
+             MXF::RIP::const_pair_iterator i;
              for ( i = RIP.PairArray.begin(); i != RIP.PairArray.end(); ++i )
                {
                  Reader.Seek(i->ByteOffset);
@@ -339,7 +341,7 @@ main(int argc, const char** argv)
          
          while ( ASDCP_SUCCESS(result) )
            {
-             fprintf(stdout, "@0x%08qx: ", pos);
+             fprintf(stdout, "@0x%08llx: ", pos);
              KP.Dump(stdout, DefaultCompositeDict(), true);
              pos = Reader.Tell();
              result = KP.InitFromFile(Reader);