Skip to content

Commit

Permalink
Add --repeat-index option for RDD9
Browse files Browse the repository at this point in the history
  • Loading branch information
philipnbbc committed Sep 9, 2024
1 parent 78c3744 commit 3736535
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 2 deletions.
5 changes: 4 additions & 1 deletion apps/bmxtranswrap/bmxtranswrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,6 @@ static void usage(const char *cmd)
printf(" separate partitions for header metadata, index tables, essence container data and footer\n");
printf(" --body-part Create separate body partitions for essence data\n");
printf(" and don't create separate body partitions for index table segments\n");
printf(" --repeat-index Repeat the index table segments in the footer partition\n");
printf(" --clip-wrap Use clip wrapping for a single sound track\n");
printf(" --mp-track-num Use the material package track number property to define a track order. By default the track number is set to 0\n");
printf(" --aes-3 Use AES-3 audio mapping\n");
Expand All @@ -626,6 +625,7 @@ static void usage(const char *cmd)
printf("\n");
printf(" op1a/rdd9:\n");
printf(" --ard-zdf-hdf Use the ARD ZDF HDF profile\n");
printf(" --repeat-index Repeat the index table segments in the footer partition\n");
printf("\n");
printf(" op1a/d10:\n");
printf(" --cbe-index-duration-0 Use duration=0 if index table is CBE\n");
Expand Down Expand Up @@ -3828,6 +3828,9 @@ int main(int argc, const char** argv)
if (clip_sub_type == AS10_CLIP_SUB_TYPE)
rdd9_clip->SetValidator(new AS10RDD9Validator(as10_shim, as10_loose_checks));

if (repeat_index)
rdd9_clip->SetRepeatIndexTable(true);

if (partition_interval_set)
rdd9_clip->SetPartitionInterval(partition_interval);
rdd9_clip->SetOutputStartOffset(- precharge);
Expand Down
5 changes: 4 additions & 1 deletion apps/raw2bmx/raw2bmx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ static void usage(const char *cmd)
printf(" separate partitions for header metadata, index tables, essence container data and footer\n");
printf(" --body-part Create separate body partitions for essence data\n");
printf(" and don't create separate body partitions for index table segments\n");
printf(" --repeat-index Repeat the index table segments in the footer partition\n");
printf(" --clip-wrap Use clip wrapping for a single sound track\n");
printf(" --mp-track-num Use the material package track number property to define a track order. By default the track number is set to 0\n");
printf(" --aes-3 Use AES-3 audio mapping\n");
Expand All @@ -563,6 +562,7 @@ static void usage(const char *cmd)
printf("\n");
printf(" op1a/rdd9:\n");
printf(" --ard-zdf-hdf Use the ARD ZDF HDF profile\n");
printf(" --repeat-index Repeat the index table segments in the footer partition\n");
printf("\n");
printf(" as11d10/d10:\n");
printf(" --d10-mute <flags> Indicate using a string of 8 '0' or '1' which sound channels should be muted. The lsb is the rightmost digit\n");
Expand Down Expand Up @@ -5225,6 +5225,9 @@ int main(int argc, const char** argv)
} else if (clip_type == CW_RDD9_CLIP_TYPE) {
RDD9File *rdd9_clip = clip->GetRDD9Clip();

if (repeat_index)
rdd9_clip->SetRepeatIndexTable(true);

if (partition_interval_set)
rdd9_clip->SetPartitionInterval(partition_interval);
rdd9_clip->SetOutputStartOffset(output_start_offset);
Expand Down
1 change: 1 addition & 0 deletions include/bmx/rdd9_mxf/RDD9File.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class RDD9File
void ReserveHeaderMetadataSpace(uint32_t min_bytes); // default 8192
void SetPartitionInterval(int64_t frame_count); // default 10sec
void SetValidator(RDD9Validator *validator);
void SetRepeatIndexTable(bool enable); // default false. Repeat index table in Footer if true

public:
void SetOutputStartOffset(int64_t offset);
Expand Down
1 change: 1 addition & 0 deletions include/bmx/rdd9_mxf/RDD9IndexTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class RDD9IndexTable

void SetExtensions(mxfOptBool single_index_location, mxfOptBool single_essence_location,
mxfOptBool forward_index_direction);
void SetRepeatIndexTable(bool enable);

void RegisterSystemItem();
void RegisterPictureTrackElement(uint32_t track_index);
Expand Down
5 changes: 5 additions & 0 deletions src/rdd9_mxf/RDD9File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,11 @@ void RDD9File::SetValidator(RDD9Validator *validator)
mValidator->SetRDD9File(this);
}

void RDD9File::SetRepeatIndexTable(bool enable)
{
mIndexTable->SetRepeatIndexTable(enable);
}

void RDD9File::SetOutputStartOffset(int64_t offset)
{
BMX_CHECK(offset >= 0);
Expand Down
5 changes: 5 additions & 0 deletions src/rdd9_mxf/RDD9IndexTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ void RDD9IndexTable::SetExtensions(mxfOptBool single_index_location, mxfOptBool
mForwardIndexDirection = forward_index_direction;
}

void RDD9IndexTable::SetRepeatIndexTable(bool enable)
{
mRepeatInFooter = enable;
}

void RDD9IndexTable::RegisterSystemItem()
{
mIndexElements.push_back(new RDD9IndexTableElement(0, RDD9IndexTableElement::SYSTEM_ITEM, true, false));
Expand Down
1 change: 1 addition & 0 deletions test/rdd9_mxf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ setup_test_dir("rdd9_mxf")
set(tests
ancvbi
mpeg2lg
repeatindex
)

foreach(test ${tests})
Expand Down
1 change: 1 addition & 0 deletions test/rdd9_mxf/repeatindex.md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
624c21119ad01eca312058d5641c0a7c
57 changes: 57 additions & 0 deletions test/rdd9_mxf/test_repeatindex.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Test creating an RDD9 MXF file with the index repeated in the footer.

include("${TEST_SOURCE_DIR}/../testing.cmake")


if(TEST_MODE STREQUAL "check")
set(output_file test_repeatindex.mxf)
elseif(TEST_MODE STREQUAL "samples")
file(MAKE_DIRECTORY ${BMX_TEST_SAMPLES_DIR})

set(output_file ${BMX_TEST_SAMPLES_DIR}/test_repeatindex.mxf)
else()
set(output_file test_repeatindex.mxf)
endif()

set(checksum_file repeatindex.md5)

set(create_test_audio ${CREATE_TEST_ESSENCE}
-t 1
-d 24
audio
)

set(create_test_video ${CREATE_TEST_ESSENCE}
-t 14
-d 24
video
)

set(create_command ${RAW2BMX}
--regtest
-t rdd9
-y 10:11:12:13
--clip test
--part 12
--repeat-index
-o ${output_file}
-a 16:9 --mpeg2lg_422p_hl_1080i video
-q 16 --locked true --pcm audio
-q 16 --locked true --pcm audio
)

run_test_a(
"${TEST_MODE}"
"${BMX_TEST_WITH_VALGRIND}"
"${create_test_video}"
"${create_test_audio}"
""
"${create_command}"
""
""
""
"${output_file}"
"${checksum_file}"
""
""
)

0 comments on commit 3736535

Please sign in to comment.