Implemented J2K desc to/from MD
[asdcplib.git] / src / klvwalk.cpp
index 779ee72bd2944f365b70c9dfaaac55a6c6c03dd4..90b719b87544c4f791b7e18a60311a2111ac629b 100755 (executable)
@@ -1,5 +1,5 @@
 /*
-Copyright (c) 2005-2015, John Hurst
+Copyright (c) 2005-2018, John Hurst
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -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) )
@@ -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);