diff --git a/src/common/compression.cpp b/src/common/compression.cpp index 38fe2867a..299b4d443 100644 --- a/src/common/compression.cpp +++ b/src/common/compression.cpp @@ -20,6 +20,7 @@ #include "commonebml.h" #include "compression.h" +#include "hacks.h" using namespace libmatroska; @@ -314,6 +315,17 @@ header_removal_compressor_c::set_track_headers(KaxContentEncoding SetBuffer(m_bytes->get(), m_bytes->get_size()); } +mpeg4_p2_compressor_c::mpeg4_p2_compressor_c() { + if (!hack_engaged(ENGAGE_NATIVE_MPEG4)) + mxerror("The MPEG-4 part 2 compression only works with native MPEG-4. " + "However, native MPEG-4 mode has not been selected with " + "'--engage native_mpeg4'.\n"); + + memory_cptr bytes(new memory_c((unsigned char *)safemalloc(4), 4, true)); + put_uint32_be(bytes->get(), 0x000001b6); + set_bytes(bytes); +} + // --------------------------------------------------------------------- compressor_c::~compressor_c() { diff --git a/src/common/compression.h b/src/common/compression.h index 35cc5f092..4fd4ace61 100644 --- a/src/common/compression.h +++ b/src/common/compression.h @@ -142,11 +142,7 @@ public: class MTX_DLL_API mpeg4_p2_compressor_c: public header_removal_compressor_c { public: - mpeg4_p2_compressor_c() { - memory_cptr bytes(new memory_c((unsigned char *)safemalloc(4), 4, true)); - put_uint32_be(bytes->get(), 0x000001b6); - set_bytes(bytes); - } + mpeg4_p2_compressor_c(); }; // ------------------------------------------------------------------