Skip to content

Commit

Permalink
Merge pull request #62 from bbc/philipn-data-essence-keys
Browse files Browse the repository at this point in the history
Reader tolerates number != 01 in Timed Text essence key
  • Loading branch information
philipnbbc authored Mar 28, 2024
2 parents 0a6a015 + cdb3c75 commit 0c72b44
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
7 changes: 7 additions & 0 deletions deps/libMXF/mxf/mxf_labels_and_keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,13 @@ void mxf_complete_essence_element_key(mxfKey *key, uint8_t count, uint8_t type,
key->octet15 = num;
}

void mxf_complete_essence_element_key_from_track_num(mxfKey *key, uint32_t track_num)
{
key->octet13 = (uint8_t)((track_num >> 16) & 0xff);
key->octet14 = (uint8_t)((track_num >> 8) & 0xff);
key->octet15 = (uint8_t)(track_num & 0xff);
}

void mxf_complete_essence_element_track_num(uint32_t *trackNum, uint8_t count, uint8_t type, uint8_t num)
{
*trackNum &= 0xFF000000;
Expand Down
1 change: 1 addition & 0 deletions deps/libMXF/mxf/mxf_labels_and_keys.h
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,7 @@ static const mxfUL ADM_ITU2076_PROFILES_LEVELS =


void mxf_complete_essence_element_key(mxfKey *key, uint8_t count, uint8_t type, uint8_t num);
void mxf_complete_essence_element_key_from_track_num(mxfKey *key, uint32_t track_num);
void mxf_complete_essence_element_track_num(uint32_t *trackNum, uint8_t count, uint8_t type, uint8_t num);


Expand Down
1 change: 1 addition & 0 deletions include/bmx/mxf_reader/MXFTimedTextTrackReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class MXFTimedTextTrackReader : public MXFFileTrackReader

private:
uint32_t mBodySID;
mxfKey mEssenceElementKey;
};


Expand Down
7 changes: 5 additions & 2 deletions src/mxf_reader/MXFTimedTextTrackReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ MXFTimedTextTrackReader::MXFTimedTextTrackReader(MXFFileReader *file_reader, siz
{
BMX_ASSERT(track_info->essence_type == TIMED_TEXT);
mBodySID = 0;

mEssenceElementKey = MXF_EE_K(TimedText);
mxf_complete_essence_element_key_from_track_num(&mEssenceElementKey, track_info->file_track_number);
}

MXFTimedTextTrackReader::~MXFTimedTextTrackReader()
Expand Down Expand Up @@ -110,7 +113,7 @@ void MXFTimedTextTrackReader::ReadTimedText(FILE *file_out, unsigned char **data
{
BMX_ASSERT(mBodySID != 0);

ReadStream(mBodySID, &MXF_EE_K(TimedText), file_out, data_out, size_out, 0);
ReadStream(mBodySID, &mEssenceElementKey, file_out, data_out, size_out, 0);
}

void MXFTimedTextTrackReader::ReadAncillaryResourceById(mxfUUID resource_id, FILE *file_out,
Expand Down Expand Up @@ -147,7 +150,7 @@ TimedTextMXFResourceProvider* MXFTimedTextTrackReader::CreateResourceProvider()
provider = new TimedTextMXFResourceProvider(file);

vector<pair<int64_t, int64_t> > ranges;
ReadStream(mBodySID, &MXF_EE_K(TimedText), 0, 0, 0, &ranges);
ReadStream(mBodySID, &mEssenceElementKey, 0, 0, 0, &ranges);
provider->AddTimedTextResource(ranges);

vector<TimedTextAncillaryResource> &anc_resources = GetManifest()->GetAncillaryResources();
Expand Down

0 comments on commit 0c72b44

Please sign in to comment.