diff --git a/CHANGELOG.md b/CHANGELOG.md index 918ef0d1..8ed9c80f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,46 @@ # bmx Changelog +## v1.3 + +### Breaking changes + +* None + +### Features + +* Add basic support for ANC / VBI frame wrapped in KLV for input into raw2bmx (https://github.com/bbc/bmx/pull/102) +* Add a `--repeat-index` option for RDD 9 (https://github.com/bbc/bmx/pull/96) +* Add support for AVC separate fields (https://github.com/bbc/bmx/pull/94) +* Improve reading growing files (https://github.com/bbc/bmx/pull/90) +* Add a reference to the Conan packages in the README (https://github.com/bbc/bmx/pull/81) +* Add MCA notes for IMF ADM Track Files (https://github.com/bbc/bmx/pull/75) +* Remove a general sample rate check in File Descriptors that was overly restrictive (https://github.com/bbc/bmx/pull/72) +* Set the MXF Descriptor Aspect Ratio from the value parsed from the MPEG-2 video bitstream (https://github.com/bbc/bmx/pull/67) +* Include item and set key in low-level read error messages (https://github.com/bbc/bmx/pull/65) +* MXFDump dumps Generic Stream Partition Packs (https://github.com/bbc/bmx/pull/64) +* Tolerate Track Number not equalling 0x01 in Timed Text essence element keys (https://github.com/bbc/bmx/pull/62) +* Add a link to the [RDD 6 XML Creator](https://bbc.github.io/bmx/meta/rdd6_xml_creator/) (https://github.com/bbc/bmx/pull/61) +* Document adding UUIDs to IMF filenames (https://github.com/bbc/bmx/pull/59) +* Speed improvement for parsing DV, RDD 36 (ProRes), JPEG XS and VC3 formats by using bitstream information about the frame size (https://github.com/bbc/bmx/pull/54) + +### Bug fixes + +* Fix failure to support variable size ANC / VBI alongside variable size video (https://github.com/bbc/bmx/pull/103) +* Enable precharge and postroll in AVC Long GOP and fix the system timecode when there is precharge (https://github.com/bbc/bmx/pull/100) +* Fix missing commandline output file arg in docs (https://github.com/bbc/bmx/pull/93) +* Handle EMU protection bytes in skipped PIC timing SEI payload in h264dump (https://github.com/bbc/bmx/pull/89) +* Fix various errors found using `-fsanitize` (https://github.com/bbc/bmx/pull/79) +* Fix index out of bounds error in MXFDump (https://github.com/bbc/bmx/pull/76) +* Accept the correct the name for the ProRes 4444 XQ commandline option, `--rdd36_4444_xq`, in addition to the old incorrect name `--rdd36_4444_hq` (https://github.com/bbc/bmx/pull/68/files) +* Set OP1a / RDD 9 default Index Table entry array element flag to 0x80 (random access) to match spec. This effects VC2, Timed Text, RDD 36 and data essence types. (https://github.com/bbc/bmx/pull/63) + +### Build changes + +* Treat implicit function declarations in C as errors (https://github.com/bbc/bmx/pull/78) +* Remove the fixed `-O2` compile flag (https://github.com/bbc/bmx/pull/73) +* Only set C++11 as a minimum requirement, allowing newer versions to be used (https://github.com/bbc/bmx/pull/71) +* Add a compatibility fix for building using C++20 (https://github.com/bbc/bmx/pull/69) + ## v1.2 ### Breaking changes diff --git a/CMakeLists.txt b/CMakeLists.txt index 46ab1f93..71a6f948 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ else() endif() project(bmx - VERSION 1.2 + VERSION 1.3 DESCRIPTION "A C++ library and set of utilities to read and write the SMPTE ST 377-1 MXF file format" HOMEPAGE_URL https://github.com/bbc/bmx LANGUAGES C CXX diff --git a/apps/bmxparse/bmxparse.cpp b/apps/bmxparse/bmxparse.cpp index 6069a464..fd9951f6 100644 --- a/apps/bmxparse/bmxparse.cpp +++ b/apps/bmxparse/bmxparse.cpp @@ -948,7 +948,7 @@ int main(int argc, const char **argv) frame_start = 0; } - frame_size = parser->ParseFrameSize2(buffer.data, buffer.size); + frame_size = parser->ParseFrameSize2(buffer.data, (uint32_t)buffer.size); if (frame_size.IsNull()) { log_error("Failed to parse frame size\n"); @@ -959,7 +959,7 @@ int main(int argc, const char **argv) if (frame_size.IsUnknown()) { if (buffer.Fill(file) == 0) { // Try create a complete frame from the available data assuming it's a valid frame - if (!frame_size.CompleteSize(buffer.size)) + if (!frame_size.CompleteSize((uint32_t)buffer.size)) break; BMX_ASSERT(frame_size.IsComplete()); diff --git a/deps/libMXF/CMakeLists.txt b/deps/libMXF/CMakeLists.txt index e2333067..47b1b874 100644 --- a/deps/libMXF/CMakeLists.txt +++ b/deps/libMXF/CMakeLists.txt @@ -13,7 +13,7 @@ else() endif() project(libMXF - VERSION 1.2 + VERSION 1.3 DESCRIPTION "Low-level C library for reading and writing the SMPTE ST 377-1 MXF file format" HOMEPAGE_URL https://github.com/bbc/libMXF LANGUAGES C CXX diff --git a/deps/libMXFpp/CMakeLists.txt b/deps/libMXFpp/CMakeLists.txt index 7c3cf085..3dbcfc3a 100644 --- a/deps/libMXFpp/CMakeLists.txt +++ b/deps/libMXFpp/CMakeLists.txt @@ -13,7 +13,7 @@ else() endif() project(libMXF++ - VERSION 1.2 + VERSION 1.3 DESCRIPTION "C++ wrapper library for libMXF that supports reading and writing the SMPTE ST 377-1 MXF file format" HOMEPAGE_URL https://github.com/bbc/libMXFpp LANGUAGES CXX diff --git a/include/bmx/essence_parser/JXSEssenceParser.h b/include/bmx/essence_parser/JXSEssenceParser.h index 50bacaed..0f55664c 100644 --- a/include/bmx/essence_parser/JXSEssenceParser.h +++ b/include/bmx/essence_parser/JXSEssenceParser.h @@ -139,7 +139,7 @@ namespace bmx class CAP { const unsigned char* m_MarkerData; - uint32_t m_DataSize; + size_t m_DataSize; NO_COPY_CONSTRUCT(CAP); CAP(); @@ -181,7 +181,7 @@ namespace bmx class PIH { const unsigned char* m_MarkerData; - uint32_t m_DataSize; + size_t m_DataSize; NO_COPY_CONSTRUCT(PIH); PIH(); diff --git a/include/bmx/essence_parser/RawEssenceReader.h b/include/bmx/essence_parser/RawEssenceReader.h index f8f0954e..7d19af5c 100644 --- a/include/bmx/essence_parser/RawEssenceReader.h +++ b/include/bmx/essence_parser/RawEssenceReader.h @@ -51,8 +51,8 @@ class RawEssenceReader void SetMaxReadLength(int64_t len); - void SetFrameStartSize(int64_t len); - void SetReadBlockSize(int64_t len); + void SetFrameStartSize(int64_t len); // len <= uint32 max + void SetReadBlockSize(int64_t len); // len <= uint32 max void SetFixedSampleSize(uint32_t size); @@ -84,8 +84,8 @@ class RawEssenceReader EssenceSource *mEssenceSource; int64_t mMaxReadLength; - int64_t mFrameStartSize; - int64_t mReadBlockSize; + uint32_t mFrameStartSize; + uint32_t mReadBlockSize; int64_t mTotalReadLength; uint32_t mMaxSampleSize; diff --git a/src/apps/AppUtils.cpp b/src/apps/AppUtils.cpp index 6af0a5ae..8e6c8a9c 100644 --- a/src/apps/AppUtils.cpp +++ b/src/apps/AppUtils.cpp @@ -1563,6 +1563,6 @@ void bmx::rt_sleep(float rt_factor, uint64_t start_tick, Rational sample_rate, i sample_rate.denominator / (rt_factor * sample_rate.numerator)); uint64_t delta_tick = delta_tick_count(tick, target_tick); if (delta_tick) - sleep_msec(delta_tick); + sleep_msec((delta_tick <= UINT32_MAX ? (uint32_t)delta_tick : UINT32_MAX)); } diff --git a/src/essence_parser/JXSEssenceParser.cpp b/src/essence_parser/JXSEssenceParser.cpp index 8b081ed3..533c5704 100644 --- a/src/essence_parser/JXSEssenceParser.cpp +++ b/src/essence_parser/JXSEssenceParser.cpp @@ -146,7 +146,6 @@ void JXSEssenceParser::ParseFrameInfo(const unsigned char *data, uint32_t data_s { int32_t result = 0; Marker NextMarker; - unsigned char *start_of_data = 0; const unsigned char* p = data; const unsigned char* end_p = p + data_size; mFrameSize = 0; @@ -248,7 +247,7 @@ void JXSEssenceParser::ParseFrameInfo(const unsigned char *data, uint32_t data_s { if (pih) { Accessor::CDT CDT_(NextMarker); - int i, count = NextMarker.m_DataSize >> 1; + int i, count = (int)(NextMarker.m_DataSize >> 1); for (i = 0; i < count && i < m_subDesc.JPEGXSNc; i++) { image_components[i].Bc = CDT_.Bc(i); image_components[i].Sx = CDT_.Sx(i); // subsampling in x @@ -262,8 +261,6 @@ void JXSEssenceParser::ParseFrameInfo(const unsigned char *data, uint32_t data_s } break; case MRK_SLH: // slice header: the entropy coded data starts here - if (start_of_data != 0) - *start_of_data = p - data; p = end_p; break; case MRK_NIL: diff --git a/src/essence_parser/KLVEssenceReader.cpp b/src/essence_parser/KLVEssenceReader.cpp index 7c08a665..30d8253c 100644 --- a/src/essence_parser/KLVEssenceReader.cpp +++ b/src/essence_parser/KLVEssenceReader.cpp @@ -56,24 +56,29 @@ KLVEssenceReader::~KLVEssenceReader() uint32_t KLVEssenceReader::ReadValue() { // Position at the next non-zero Value - uint64_t v_size = 0; - while (v_size == 0) { - if (!mEssenceSource->PositionInV(&v_size) || v_size > UINT32_MAX) { - if (v_size > UINT32_MAX) - log_warn("KLV value size %" PRIu64 " > max uint32 is not supported\n", v_size); + uint64_t v_size64 = 0; + while (v_size64 == 0) { + if (!mEssenceSource->PositionInV(&v_size64)) { mValueBuffer.SetSize(0); return 0; } } + if (v_size64 > UINT32_MAX) { + log_warn("KLV value size %" PRIu64 " > max uint32 is not supported\n", v_size64); + mValueBuffer.SetSize(0); + return 0; + } + uint32_t value_size = (uint32_t)v_size64; + // Expect to be at the start of the V because the read below reads the whole V BMX_CHECK(mEssenceSource->GetOffsetInV() == 0); - mValueBuffer.Allocate(v_size); + mValueBuffer.Allocate(value_size); - uint32_t read_size = mEssenceSource->Read(mValueBuffer.GetBytes(), v_size); - if (read_size != v_size) { - log_warn("Incomplete KLV; only read %u of %u\n", read_size, v_size); + uint32_t read_size = mEssenceSource->Read(mValueBuffer.GetBytes(), value_size); + if (read_size != value_size) { + log_warn("Incomplete KLV; only read %u of %u\n", read_size, value_size); mValueBuffer.SetSize(0); return 0; } diff --git a/src/essence_parser/RawEssenceReader.cpp b/src/essence_parser/RawEssenceReader.cpp index 5af65ce2..bf13c4bd 100644 --- a/src/essence_parser/RawEssenceReader.cpp +++ b/src/essence_parser/RawEssenceReader.cpp @@ -34,6 +34,7 @@ #endif #define __STDC_FORMAT_MACROS +#define __STDC_LIMIT_MACROS #include #include @@ -43,6 +44,7 @@ #ifdef HAVE_UNISTD_H #include #endif +#include #include #include @@ -90,12 +92,14 @@ void RawEssenceReader::SetMaxReadLength(int64_t len) void RawEssenceReader::SetFrameStartSize(int64_t len) { - mFrameStartSize = len; + BMX_CHECK(len <= UINT32_MAX); + mFrameStartSize = (uint32_t)len; } void RawEssenceReader::SetReadBlockSize(int64_t len) { - mReadBlockSize = len; + BMX_CHECK(len <= UINT32_MAX); + mReadBlockSize = (uint32_t)len; } void RawEssenceReader::SetFixedSampleSize(uint32_t size) diff --git a/src/mxf_helper/JPEGXSMXFDescriptorHelper.cpp b/src/mxf_helper/JPEGXSMXFDescriptorHelper.cpp index 56b59fe2..672d449c 100644 --- a/src/mxf_helper/JPEGXSMXFDescriptorHelper.cpp +++ b/src/mxf_helper/JPEGXSMXFDescriptorHelper.cpp @@ -69,7 +69,7 @@ void JPEGXSMXFDescriptorHelper::SetJPEGXSComponentTable(std::vector val { mxfpp::ByteArray arr; arr.data = (unsigned char*)value.data(); - arr.length = value.size(); + arr.length = (uint16_t)value.size(); mJPEGXSSubDescriptor->setJPEGXSComponentTable(arr); mComponentTable = value; diff --git a/test/create_test_essence.cpp b/test/create_test_essence.cpp index 269088f1..8904db03 100644 --- a/test/create_test_essence.cpp +++ b/test/create_test_essence.cpp @@ -922,14 +922,14 @@ static void write_anc_data(FILE *file, unsigned int duration, bool klv_var_size) anc_data_size[0] = 16 + 1 + sizeof(core_anc_frame); anc_data[0] = new unsigned char[anc_data_size[0]]; memcpy(anc_data[0], klv_key, 16); - anc_data[0][16] = anc_data_size[0] - 17; + anc_data[0][16] = (unsigned char)(anc_data_size[0] - 17); memcpy(&anc_data[0][17], core_anc_frame, sizeof(core_anc_frame)); // Add an extra padding byte to the odd frame anc_data_size[1] = 16 + 1 + sizeof(core_anc_frame) + 1; anc_data[1] = new unsigned char[anc_data_size[1]]; memcpy(anc_data[1], klv_key, 16); - anc_data[1][16] = anc_data_size[1] - 17; + anc_data[1][16] = (unsigned char)(anc_data_size[1] - 17); memcpy(&anc_data[1][17], core_anc_frame, sizeof(core_anc_frame)); anc_data[1][16 + 1 + 11] = 0x09; anc_data[1][anc_data_size[1] - 1] = 0x00; @@ -968,14 +968,14 @@ static void write_vbi_data(FILE *file, unsigned int duration, bool klv_var_size) vbi_data_size[0] = 16 + 1 + sizeof(core_vbi_frame); vbi_data[0] = new unsigned char[vbi_data_size[0]]; memcpy(vbi_data[0], klv_key, 16); - vbi_data[0][16] = vbi_data_size[0] - 17; + vbi_data[0][16] = (unsigned char)(vbi_data_size[0] - 17); memcpy(&vbi_data[0][17], core_vbi_frame, sizeof(core_vbi_frame)); // Add an extra padding byte to the odd frame vbi_data_size[1] = 16 + 1 + sizeof(core_vbi_frame) + 1; vbi_data[1] = new unsigned char[vbi_data_size[1]]; memcpy(vbi_data[1], klv_key, 16); - vbi_data[1][16] = vbi_data_size[1] - 17; + vbi_data[1][16] = (unsigned char)(vbi_data_size[1] - 17); memcpy(&vbi_data[1][17], core_vbi_frame, sizeof(core_vbi_frame)); vbi_data[1][16 + 1 + 11] = 0x09; vbi_data[1][vbi_data_size[1] - 1] = 0x00; diff --git a/tools/h264dump.c b/tools/h264dump.c index 198f5f50..3676aed8 100644 --- a/tools/h264dump.c +++ b/tools/h264dump.c @@ -1861,7 +1861,7 @@ static int skip_sei_payload(ParseContext *context, uint64_t num_bytes) while (rem_num_bytes > 0) { uint8_t read_num_bytes = 8; if (read_num_bytes > rem_num_bytes) - read_num_bytes = rem_num_bytes; + read_num_bytes = (uint8_t)rem_num_bytes; /* Skip payload by calling read_bits to ensure context->emu_prevention_count is updated */ if (!read_bits(context, read_num_bytes * 8))