From 2b52b1cc03707a4c876b38fdd8879a27a218d498 Mon Sep 17 00:00:00 2001 From: jhurst Date: Tue, 8 Sep 2020 09:33:17 -0700 Subject: Added OpenSSL and Xerces build options to allow stand-alone compilation --- src/asdcp-wrap.cpp | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'src/asdcp-wrap.cpp') diff --git a/src/asdcp-wrap.cpp b/src/asdcp-wrap.cpp index 66f291a..362ff3b 100755 --- a/src/asdcp-wrap.cpp +++ b/src/asdcp-wrap.cpp @@ -534,8 +534,6 @@ write_MPEG2_file(CommandOptions& Options) MPEG2::Parser Parser; MPEG2::MXFWriter Writer; MPEG2::VideoDescriptor VDesc; - byte_t IV_buf[CBC_BLOCK_SIZE]; - Kumu::FortunaRNG RNG; // set up essence parser Result_t result = Parser.OpenRead(Options.filenames.front()); @@ -568,9 +566,12 @@ write_MPEG2_file(CommandOptions& Options) fprintf(stderr, "ATTENTION! Writing SMPTE Universal Labels\n"); } +#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; @@ -596,6 +597,7 @@ write_MPEG2_file(CommandOptions& Options) result = HMAC->InitKey(Options.key_value, Info.LabelSetType); } } +#endif // HAVE_OPENSSL if ( ASDCP_SUCCESS(result) ) result = Writer.OpenWrite(Options.out_file, Info, VDesc); @@ -690,7 +692,6 @@ write_JP2K_S_file(CommandOptions& Options) JP2K::PictureDescriptor PDesc; JP2K::SequenceParser ParserLeft, ParserRight; byte_t IV_buf[CBC_BLOCK_SIZE]; - Kumu::FortunaRNG RNG; if ( Options.filenames.size() != 2 ) { @@ -738,9 +739,11 @@ write_JP2K_S_file(CommandOptions& Options) fprintf(stderr, "ATTENTION! Writing SMPTE Universal Labels\n"); } +#ifdef HAVE_OPENSSL // configure encryption if( Options.key_flag ) { + Kumu::FortunaRNG RNG; Kumu::GenRandomUUID(Info.ContextID); Info.EncryptedEssence = true; @@ -766,6 +769,7 @@ write_JP2K_S_file(CommandOptions& Options) result = HMAC->InitKey(Options.key_value, Info.LabelSetType); } } +#endif // HAVE_OPENSSL if ( ASDCP_SUCCESS(result) ) result = Writer.OpenWrite(Options.out_file, Info, PDesc); @@ -840,7 +844,6 @@ write_JP2K_file(CommandOptions& Options) JP2K::PictureDescriptor PDesc; JP2K::SequenceParser Parser; byte_t IV_buf[CBC_BLOCK_SIZE]; - Kumu::FortunaRNG RNG; // set up essence parser Result_t result = Parser.OpenRead(Options.filenames.front(), Options.j2c_pedantic); @@ -877,9 +880,11 @@ write_JP2K_file(CommandOptions& Options) fprintf(stderr, "ATTENTION! Writing SMPTE Universal Labels\n"); } +#ifdef HAVE_OPENSSL // configure encryption if( Options.key_flag ) { + Kumu::FortunaRNG RNG; Kumu::GenRandomUUID(Info.ContextID); Info.EncryptedEssence = true; @@ -905,6 +910,7 @@ write_JP2K_file(CommandOptions& Options) result = HMAC->InitKey(Options.key_value, Info.LabelSetType); } } +#endif // HAVE_OPENSSL if ( ASDCP_SUCCESS(result) ) result = Writer.OpenWrite(Options.out_file, Info, PDesc); @@ -977,7 +983,6 @@ write_PCM_file(CommandOptions& Options) PCM::AudioDescriptor ADesc; Rational PictureRate = Options.PictureRate(); byte_t IV_buf[CBC_BLOCK_SIZE]; - Kumu::FortunaRNG RNG; // set up essence parser Result_t result = Parser.OpenRead(Options.filenames, PictureRate); @@ -1021,9 +1026,11 @@ write_PCM_file(CommandOptions& Options) fprintf(stderr, "ATTENTION! Writing SMPTE Universal Labels\n"); } +#ifdef HAVE_OPENSSL // configure encryption if( Options.key_flag ) { + Kumu::FortunaRNG RNG; Kumu::GenRandomUUID(Info.ContextID); Info.EncryptedEssence = true; @@ -1049,6 +1056,7 @@ write_PCM_file(CommandOptions& Options) result = HMAC->InitKey(Options.key_value, Info.LabelSetType); } } +#endif // HAVE_OPENSSL if ( ASDCP_SUCCESS(result) ) result = Writer.OpenWrite(Options.out_file, Info, ADesc); @@ -1171,7 +1179,6 @@ write_PCM_with_ATMOS_sync_file(CommandOptions& Options) PCM::AudioDescriptor ADesc; Rational PictureRate = Options.PictureRate(); byte_t IV_buf[CBC_BLOCK_SIZE]; - Kumu::FortunaRNG RNG; WriterInfo Info = s_MyInfo; // fill in your favorite identifiers here if ( Options.asset_id_flag ) @@ -1213,9 +1220,11 @@ write_PCM_with_ATMOS_sync_file(CommandOptions& Options) Info.LabelSetType = LS_MXF_SMPTE; fprintf(stderr, "ATTENTION! Writing SMPTE Universal Labels\n"); +#ifdef HAVE_OPENSSL // configure encryption if( Options.key_flag ) { + Kumu::FortunaRNG RNG; Kumu::GenRandomUUID(Info.ContextID); Info.EncryptedEssence = true; @@ -1241,6 +1250,7 @@ write_PCM_with_ATMOS_sync_file(CommandOptions& Options) result = HMAC->InitKey(Options.key_value, Info.LabelSetType); } } +#endif // HAVE_OPENSSL if ( ASDCP_SUCCESS(result) ) result = Writer.OpenWrite(Options.out_file, Info, ADesc); @@ -1297,6 +1307,8 @@ write_PCM_with_ATMOS_sync_file(CommandOptions& Options) } +#ifdef HAVE_XERCES_C + //------------------------------------------------------------------------------------------ // TimedText essence @@ -1314,7 +1326,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()); @@ -1344,9 +1355,11 @@ write_timed_text_file(CommandOptions& Options) Info.LabelSetType = LS_MXF_SMPTE; fprintf(stderr, "ATTENTION! Writing SMPTE Universal Labels\n"); +#ifdef HAVE_OPENSSL // configure encryption if( Options.key_flag ) { + Kumu::FortunaRNG RNG; Kumu::GenRandomUUID(Info.ContextID); Info.EncryptedEssence = true; @@ -1372,6 +1385,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, Info, TDesc); @@ -1420,6 +1434,8 @@ write_timed_text_file(CommandOptions& Options) return result; } +#endif //HAVE_XERCES_C + // Write one or more plaintext Dolby ATMOS bytestreams to a plaintext ASDCP file // Write one or more plaintext Dolby ATMOS bytestreams to a ciphertext ASDCP file // @@ -1433,7 +1449,6 @@ write_dolby_atmos_file(CommandOptions& Options) ATMOS::AtmosDescriptor ADesc; 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()); @@ -1468,9 +1483,11 @@ write_dolby_atmos_file(CommandOptions& Options) Info.LabelSetType = LS_MXF_SMPTE; +#ifdef HAVE_OPENSSL // configure encryption if( Options.key_flag ) { + Kumu::FortunaRNG RNG; Kumu::GenRandomUUID(Info.ContextID); Info.EncryptedEssence = true; @@ -1496,6 +1513,7 @@ write_dolby_atmos_file(CommandOptions& Options) result = HMAC->InitKey(Options.key_value, Info.LabelSetType); } } +#endif if ( ASDCP_SUCCESS(result) ) result = Writer.OpenWrite(Options.out_file, Info, ADesc); @@ -1555,7 +1573,6 @@ write_aux_data_file(CommandOptions& Options) DCData::DCDataDescriptor DDesc; 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()); @@ -1585,9 +1602,11 @@ write_aux_data_file(CommandOptions& Options) Info.LabelSetType = LS_MXF_SMPTE; +#ifdef HAVE_OPENSSL // configure encryption if( Options.key_flag ) { + Kumu::FortunaRNG RNG; Kumu::GenRandomUUID(Info.ContextID); Info.EncryptedEssence = true; @@ -1613,6 +1632,7 @@ write_aux_data_file(CommandOptions& Options) result = HMAC->InitKey(Options.key_value, Info.LabelSetType); } } +#endif // HAVE_OPENSSL if ( ASDCP_SUCCESS(result) ) result = Writer.OpenWrite(Options.out_file, Info, DDesc); @@ -1726,9 +1746,11 @@ main(int argc, const char** argv) } break; +#ifdef HAVE_XERCES_C case ESS_TIMED_TEXT: result = write_timed_text_file(Options); break; +#endif //HAVE_XERCES_C case ESS_DCDATA_DOLBY_ATMOS: result = write_dolby_atmos_file(Options); -- cgit v1.2.3 From 25416a414301ddf79f499373c279740a519a27b1 Mon Sep 17 00:00:00 2001 From: jhurst Date: Thu, 8 Oct 2020 09:08:43 -0700 Subject: fixed conditional XML parser support --- src/Makefile.am | 11 ++--------- src/as-02-wrap.cpp | 15 +-------------- src/asdcp-test.cpp | 4 ---- src/asdcp-wrap.cpp | 7 ------- 4 files changed, 3 insertions(+), 34 deletions(-) (limited to 'src/asdcp-wrap.cpp') diff --git a/src/Makefile.am b/src/Makefile.am index 65ab3e0..dc1cf86 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -54,12 +54,9 @@ include_HEADERS = \ KM_aes.h \ KM_util.h \ KM_tai.h \ + KM_xml.h \ AS_DCP.h -if HAVE_XERCESC -#include_HEADERS += KM_xml.h -endif - if DEV_HEADERS include_HEADERS += \ S12MTimecode.h \ @@ -107,13 +104,9 @@ endif # sources for kumu library libkumu_la_SOURCES = KM_error.h KM_fileio.cpp KM_fileio.h KM_log.cpp KM_log.h \ KM_memio.h KM_mutex.h KM_platform.h KM_prng.cpp KM_prng.h KM_util.cpp \ - KM_util.h KM_tai.h KM_tai.cpp \ + KM_util.h KM_tai.h KM_tai.cpp KM_xml.cpp KM_xml.h \ KM_sha1.cpp KM_sha1.h KM_aes.h KM_aes.cpp -if HAVE_XERCESC -#libkumu_la_SOURCES += KM_xml.cpp KM_xml.h -endif - # linker flags (*not* including libraries to link against) for a library libkumu_la_LDFLAGS = -release @VERSION@ diff --git a/src/as-02-wrap.cpp b/src/as-02-wrap.cpp index f512084..ded694d 100755 --- a/src/as-02-wrap.cpp +++ b/src/as-02-wrap.cpp @@ -35,17 +35,13 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. For more information about AS-02, please refer to the header file AS_02.h For more information about asdcplib, please refer to the header file AS_DCP.h */ - #include +#include #include #include "AS_02_ACES.h" #include #include -#ifdef HAVE_XERCES_C -#include -#endif - using namespace ASDCP; const ui32_t FRAME_BUFFER_SIZE = 4 * Kumu::Megabyte; @@ -1595,8 +1591,6 @@ write_PCM_file(CommandOptions& Options) } - -#ifdef HAVE_XERCES_C //------------------------------------------------------------------------------------------ // TimedText essence @@ -1726,7 +1720,6 @@ write_timed_text_file(CommandOptions& Options) return result; } -#endif // HAVE_XERCES_C // bool @@ -1817,7 +1810,6 @@ write_isxd_file(CommandOptions& Options) if ( ASDCP_SUCCESS(result) ) { -#ifdef HAVE_XERCES_C if ( Options.isxd_document_namespace == "auto" ) { // get ns of first item @@ -1841,7 +1833,6 @@ write_isxd_file(CommandOptions& Options) return RESULT_FAIL; } } -#endif result = Writer.OpenWrite(Options.out_file, Info, Options.isxd_document_namespace, Options.edit_rate); } @@ -1913,12 +1904,10 @@ 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) ) @@ -2001,11 +1990,9 @@ 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() ) diff --git a/src/asdcp-test.cpp b/src/asdcp-test.cpp index 29f8c6e..ecf6f21 100755 --- a/src/asdcp-test.cpp +++ b/src/asdcp-test.cpp @@ -1478,7 +1478,6 @@ read_PCM_file(CommandOptions& Options) } -#ifdef HAVE_XERCES_C //------------------------------------------------------------------------------------------ // TimedText essence @@ -1601,7 +1600,6 @@ write_timed_text_file(CommandOptions& Options) return result; } -#endif //HAVE_XERCES_C // Read one or more timed text streams from a plaintext ASDCP file @@ -2079,11 +2077,9 @@ 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 default: fprintf(stderr, "%s: Unknown file type, not ASDCP-compatible essence.\n", diff --git a/src/asdcp-wrap.cpp b/src/asdcp-wrap.cpp index 362ff3b..2028f53 100755 --- a/src/asdcp-wrap.cpp +++ b/src/asdcp-wrap.cpp @@ -1306,9 +1306,6 @@ write_PCM_with_ATMOS_sync_file(CommandOptions& Options) return result; } - -#ifdef HAVE_XERCES_C - //------------------------------------------------------------------------------------------ // TimedText essence @@ -1434,8 +1431,6 @@ write_timed_text_file(CommandOptions& Options) return result; } -#endif //HAVE_XERCES_C - // Write one or more plaintext Dolby ATMOS bytestreams to a plaintext ASDCP file // Write one or more plaintext Dolby ATMOS bytestreams to a ciphertext ASDCP file // @@ -1746,11 +1741,9 @@ main(int argc, const char** argv) } break; -#ifdef HAVE_XERCES_C case ESS_TIMED_TEXT: result = write_timed_text_file(Options); break; -#endif //HAVE_XERCES_C case ESS_DCDATA_DOLBY_ATMOS: result = write_dolby_atmos_file(Options); -- cgit v1.2.3