summaryrefslogtreecommitdiff
path: root/src/as-02-wrap.cpp
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2020-09-08 09:33:17 -0700
committerjhurst <jhurst@cinecert.com>2020-09-08 09:33:17 -0700
commit2b52b1cc03707a4c876b38fdd8879a27a218d498 (patch)
tree6510eb7fef08bf66d7a52f097f31109866ce4791 /src/as-02-wrap.cpp
parente1e8fdd9d0715c9df4ab12190cb27b02f3a1c5d8 (diff)
Added OpenSSL and Xerces build options to allow stand-alone compilation
Diffstat (limited to 'src/as-02-wrap.cpp')
-rwxr-xr-xsrc/as-02-wrap.cpp45
1 files changed, 32 insertions, 13 deletions
diff --git a/src/as-02-wrap.cpp b/src/as-02-wrap.cpp
index db76e19..f512084 100755
--- a/src/as-02-wrap.cpp
+++ b/src/as-02-wrap.cpp
@@ -37,13 +37,15 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <KM_fileio.h>
-#include <KM_prng.h>
-#include <KM_xml.h>
#include <AS_02.h>
#include "AS_02_ACES.h"
#include <PCMParserList.h>
#include <Metadata.h>
+#ifdef HAVE_XERCES_C
+#include <KM_xml.h>
+#endif
+
using namespace ASDCP;
const ui32_t FRAME_BUFFER_SIZE = 4 * Kumu::Megabyte;
@@ -987,8 +989,6 @@ write_JP2K_file(CommandOptions& Options)
AS_02::JP2K::MXFWriter Writer;
JP2K::FrameBuffer FrameBuffer(Options.fb_size);
JP2K::SequenceParser Parser;
- byte_t IV_buf[CBC_BLOCK_SIZE];
- Kumu::FortunaRNG RNG;
ASDCP::MXF::FileDescriptor *essence_descriptor = 0;
ASDCP::MXF::InterchangeObject_list_t essence_sub_descriptors;
@@ -1098,9 +1098,12 @@ write_JP2K_file(CommandOptions& Options)
else
Kumu::GenRandomUUID(Info.AssetUUID);
+#ifdef HAVE_OPENSSL
// configure encryption
if( Options.key_flag )
{
+ byte_t IV_buf[CBC_BLOCK_SIZE];
+ Kumu::FortunaRNG RNG;
Kumu::GenRandomUUID(Info.ContextID);
Info.EncryptedEssence = true;
@@ -1126,6 +1129,7 @@ write_JP2K_file(CommandOptions& Options)
result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
}
}
+#endif // HAVE_OPENSSL
if ( ASDCP_SUCCESS(result) )
{
@@ -1191,8 +1195,6 @@ write_ACES_file(CommandOptions& Options)
AS_02::ACES::MXFWriter Writer;
AS_02::ACES::FrameBuffer FrameBuffer(Options.fb_size);
AS_02::ACES::SequenceParser Parser;
- byte_t IV_buf[CBC_BLOCK_SIZE];
- Kumu::FortunaRNG RNG;
ASDCP::MXF::FileDescriptor *essence_descriptor = 0;
ASDCP::MXF::InterchangeObject_list_t essence_sub_descriptors;
AS_02::ACES::PictureDescriptor PDesc;
@@ -1314,6 +1316,10 @@ write_ACES_file(CommandOptions& Options)
else
Kumu::GenRandomUUID(Info.AssetUUID);
+#ifdef HAVE_OPENSSL
+ byte_t IV_buf[CBC_BLOCK_SIZE];
+ Kumu::FortunaRNG RNG;
+
// configure encryption
if (Options.key_flag)
{
@@ -1342,6 +1348,7 @@ write_ACES_file(CommandOptions& Options)
result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
}
}
+#endif
if (ASDCP_SUCCESS(result))
{
@@ -1435,8 +1442,6 @@ write_PCM_file(CommandOptions& Options)
PCMParserList Parser;
AS_02::PCM::MXFWriter Writer;
PCM::FrameBuffer FrameBuffer;
- byte_t IV_buf[CBC_BLOCK_SIZE];
- Kumu::FortunaRNG RNG;
ASDCP::MXF::WaveAudioDescriptor *essence_descriptor = 0;
// set up essence parser
@@ -1511,9 +1516,12 @@ write_PCM_file(CommandOptions& Options)
else
Kumu::GenRandomUUID(Info.AssetUUID);
+#ifdef HAVE_OPENSSL
// configure encryption
if( Options.key_flag )
{
+ byte_t IV_buf[CBC_BLOCK_SIZE];
+ Kumu::FortunaRNG RNG;
Kumu::GenRandomUUID(Info.ContextID);
Info.EncryptedEssence = true;
@@ -1539,6 +1547,7 @@ write_PCM_file(CommandOptions& Options)
result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
}
}
+#endif // HAVE_OPENSSL
if ( ASDCP_SUCCESS(result) )
{
@@ -1587,7 +1596,7 @@ write_PCM_file(CommandOptions& Options)
-
+#ifdef HAVE_XERCES_C
//------------------------------------------------------------------------------------------
// TimedText essence
@@ -1605,7 +1614,6 @@ write_timed_text_file(CommandOptions& Options)
TimedText::FrameBuffer FrameBuffer;
TimedText::TimedTextDescriptor TDesc;
byte_t IV_buf[CBC_BLOCK_SIZE];
- Kumu::FortunaRNG RNG;
// set up essence parser
Result_t result = Parser.OpenRead(Options.filenames.front());
@@ -1640,9 +1648,11 @@ write_timed_text_file(CommandOptions& Options)
else
Kumu::GenRandomUUID(Info.AssetUUID);
+#ifdef HAVE_OPENSSL
// configure encryption
if( Options.key_flag )
{
+ Kumu::FortunaRNG RNG;
Kumu::GenRandomUUID(Info.ContextID);
Info.EncryptedEssence = true;
@@ -1668,6 +1678,7 @@ write_timed_text_file(CommandOptions& Options)
result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
}
}
+#endif // HAVE_OPENSSL
if ( ASDCP_SUCCESS(result) )
result = Writer.OpenWrite(Options.out_file.c_str(), Info, TDesc);
@@ -1715,6 +1726,7 @@ write_timed_text_file(CommandOptions& Options)
return result;
}
+#endif // HAVE_XERCES_C
//
bool
@@ -1745,8 +1757,6 @@ write_isxd_file(CommandOptions& Options)
AS_02::ISXD::MXFWriter Writer;
DCData::FrameBuffer FrameBuffer(Options.fb_size);
DCData::SequenceParser Parser;
- byte_t IV_buf[CBC_BLOCK_SIZE];
- Kumu::FortunaRNG RNG;
// set up essence parser
Result_t result = Parser.OpenRead(Options.filenames.front());
@@ -1772,9 +1782,12 @@ write_isxd_file(CommandOptions& Options)
Info.LabelSetType = LS_MXF_SMPTE;
+#ifdef HAVE_OPENSSL
// configure encryption
if( Options.key_flag )
{
+ byte_t IV_buf[CBC_BLOCK_SIZE];
+ Kumu::FortunaRNG RNG;
Kumu::GenRandomUUID(Info.ContextID);
Info.EncryptedEssence = true;
@@ -1800,9 +1813,11 @@ write_isxd_file(CommandOptions& Options)
result = HMAC->InitKey(Options.key_value, Info.LabelSetType);
}
}
+#endif // HAVE_OPENSSL
if ( ASDCP_SUCCESS(result) )
{
+#ifdef HAVE_XERCES_C
if ( Options.isxd_document_namespace == "auto" )
{
// get ns of first item
@@ -1826,6 +1841,7 @@ write_isxd_file(CommandOptions& Options)
return RESULT_FAIL;
}
}
+#endif
result = Writer.OpenWrite(Options.out_file, Info, Options.isxd_document_namespace, Options.edit_rate);
}
@@ -1897,11 +1913,12 @@ write_isxd_file(CommandOptions& Options)
return RESULT_READFAIL;
global_metadata.Size(read_count);
-
+#ifdef HAVE_XERCES_C
std::string ns_prefix, type_name;
Kumu::AttributeList doc_attr_list;
result = GetXMLDocType(global_metadata.RoData(), global_metadata.Size(), ns_prefix, type_name,
namespace_name, doc_attr_list) ? RESULT_OK : RESULT_FAIL;
+#endif
}
if ( KM_SUCCESS(result) )
@@ -1984,9 +2001,11 @@ main(int argc, const char** argv)
result = write_PCM_file(Options);
break;
+#ifdef HAVE_XERCES_C
case ESS_TIMED_TEXT:
result = write_timed_text_file(Options);
break;
+#endif //HAVE_XERCES_C
case ESS_DCDATA_UNKNOWN:
if ( ! Options.isxd_document_namespace.empty() )