/*
-Copyright (c) 2004-2005, John Hurst
+Copyright (c) 2004-2006, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
\brief AS-DCP library, misc classes and subroutines
*/
+#include <KM_fileio.h>
#include "AS_DCP_internal.h"
-#include "FileIO.h"
-#include "DirScanner.h"
#include "JP2K.h"
#include "Wav.h"
char str_buf[40];
- fprintf(stream," ProductUUID: %s\n", bin2hex(Info.ProductUUID, 16, str_buf, 40));
+ fprintf(stream," ProductUUID: %s\n", UUID(Info.ProductUUID).EncodeHex(str_buf, 40));
fprintf(stream,"\
ProductVersion: %s\n\
CompanyName: %s\n\
if ( Info.EncryptedEssence )
{
fprintf(stream, " HMAC: %s\n", ( Info.UsesHMAC ? "Yes" : "No"));
- fprintf(stream, " ContextID: %s\n", bin2hex(Info.ContextID, 16, str_buf, 40));
- fprintf(stream, "CryptographicKeyID: %s\n", bin2hex(Info.CryptographicKeyID, 16, str_buf, 40));
+ fprintf(stream, " ContextID: %s\n", UUID(Info.ContextID).EncodeHex(str_buf, 40));
+ fprintf(stream, "CryptographicKeyID: %s\n", UUID(Info.CryptographicKeyID).EncodeHex(str_buf, 40));
}
- fprintf(stream," AssetUUID: %s\n", bin2hex(Info.AssetUUID, 16, str_buf, 40));
+ fprintf(stream," AssetUUID: %s\n", UUID(Info.AssetUUID).EncodeHex(str_buf, 40));
fprintf(stream," Label Set Type: %s\n", ( Info.LabelSetType == LS_MXF_SMPTE ? "SMPTE" :
( Info.LabelSetType == LS_MXF_INTEROP ? "MXF Interop" :
"Unknown" ) ));
Info.CompanyName = "Unknown Company";
memset(Info.ProductUUID, 0, UUIDlen);
- InfoObj->ProductName.ToString(tmp_str);
+ InfoObj->ProductName.EncodeString(tmp_str, IdentBufferLen);
if ( *tmp_str ) Info.ProductName = tmp_str;
- InfoObj->VersionString.ToString(tmp_str);
+ InfoObj->VersionString.EncodeString(tmp_str, IdentBufferLen);
if ( *tmp_str ) Info.ProductVersion = tmp_str;
- InfoObj->CompanyName.ToString(tmp_str);
+ InfoObj->CompanyName.EncodeString(tmp_str, IdentBufferLen);
if ( *tmp_str ) Info.CompanyName = tmp_str;
memcpy(Info.ProductUUID, InfoObj->ProductUID.Value(), UUIDlen);
ASDCP::EssenceType(const char* filename, EssenceType_t& type)
{
ASDCP_TEST_NULL_STR(filename);
- FileReader Reader;
+ Kumu::FileReader Reader;
OPAtomHeader TestHeader;
Result_t result = Reader.OpenRead(filename);
return result;
}
-
//
ASDCP::Result_t
ASDCP::RawEssenceType(const char* filename, EssenceType_t& type)
ASDCP_TEST_NULL_STR(filename);
type = ESS_UNKNOWN;
ASDCP::FrameBuffer FB;
- FileReader Reader;
+ Kumu::FileReader Reader;
ui32_t read_count;
Result_t result = FB.Capacity(Wav::MaxWavHeader); // using Wav max because everything else is much smaller
- if ( ASDCP::PathIsFile(filename) )
+ if ( Kumu::PathIsFile(filename) )
{
result = Reader.OpenRead(filename);
type = ESS_PCM_24b_48k;
}
}
- else if ( ASDCP::PathIsDirectory(filename) )
+ else if ( Kumu::PathIsDirectory(filename) )
{
- char next_file[ASDCP_MAX_PATH];
- DirScanner Scanner;
+ char next_file[Kumu::MaxFilePath];
+ Kumu::DirScanner Scanner;
Result_t result = Scanner.Open(filename);
if ( ASDCP_SUCCESS(result) )
p += MXF_BER_LENGTH;
// sequence number
- i2p<ui64_t>(ASDCP_i64_BE(sequence), p);
+ Kumu::i2p<ui64_t>(KM_i64_BE(sequence), p);
p += sizeof(ui64_t);
// HMAC length
byte_t* p = (byte_t*)FB.RoData() + ( FB.Size() - klv_intpack_size );
// test the AssetID length
- if ( ! read_test_BER(&p, UUIDlen) )
+ if ( ! Kumu::read_test_BER(&p, UUIDlen) )
return RESULT_HMACFAIL;
// test the AssetID
p += UUIDlen;
// test the sequence length
- if ( ! read_test_BER(&p, sizeof(ui64_t)) )
+ if ( ! Kumu::read_test_BER(&p, sizeof(ui64_t)) )
return RESULT_HMACFAIL;
- ui32_t test_sequence = (ui32_t)ASDCP_i64_BE(cp2i<ui64_t>(p));
+ ui32_t test_sequence = (ui32_t)KM_i64_BE(Kumu::cp2i<ui64_t>(p));
// test the sequence value
if ( test_sequence != sequence )
p += sizeof(ui64_t);
// test the HMAC length
- if ( ! read_test_BER(&p, HMAC_SIZE) )
+ if ( ! Kumu::read_test_BER(&p, HMAC_SIZE) )
return RESULT_HMACFAIL;
// test the HMAC