Skip to content

Commit

Permalink
Merge pull request #104 from bbc/philipn-release-1.3
Browse files Browse the repository at this point in the history
Release version 1.3
  • Loading branch information
philipnbbc authored Nov 11, 2024
2 parents e498059 + 9766e41 commit 323fe77
Show file tree
Hide file tree
Showing 14 changed files with 80 additions and 33 deletions.
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions apps/bmxparse/bmxparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion deps/libMXF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion deps/libMXFpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions include/bmx/essence_parser/JXSEssenceParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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();

Expand Down
8 changes: 4 additions & 4 deletions include/bmx/essence_parser/RawEssenceReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/apps/AppUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

5 changes: 1 addition & 4 deletions src/essence_parser/JXSEssenceParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down
23 changes: 14 additions & 9 deletions src/essence_parser/KLVEssenceReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
8 changes: 6 additions & 2 deletions src/essence_parser/RawEssenceReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#endif

#define __STDC_FORMAT_MACROS
#define __STDC_LIMIT_MACROS

#include <cstdio>
#include <cstring>
Expand All @@ -43,6 +44,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <limits.h>

#include <bmx/essence_parser/RawEssenceReader.h>
#include <bmx/essence_parser/AVCEssenceParser.h>
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/mxf_helper/JPEGXSMXFDescriptorHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void JPEGXSMXFDescriptorHelper::SetJPEGXSComponentTable(std::vector<uint8_t> 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;
Expand Down
8 changes: 4 additions & 4 deletions test/create_test_essence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tools/h264dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 323fe77

Please sign in to comment.