Skip to content

Commit 3afb1f4

Browse files
authored
Use generic sv_tlv_find_and_decode_tags() (#434)
instead of explicit function for optional tags.
1 parent 5229205 commit 3afb1f4

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

lib/src/sv_auth.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,10 @@ is_recurrent_data_decoded(signed_video_t *self)
10221022
if (item->bu && item->bu->is_sv_sei && item->tmp_validation_status == 'P') {
10231023
const uint8_t *tlv_data = item->bu->tlv_data;
10241024
size_t tlv_size = item->bu->tlv_size;
1025-
recurrent_data_decoded = sv_tlv_find_and_decode_optional_tags(self, tlv_data, tlv_size);
1025+
size_t num_of_tags = 0;
1026+
const sv_tlv_tag_t *optional_tags = sv_get_optional_tags(&num_of_tags);
1027+
recurrent_data_decoded =
1028+
sv_tlv_find_and_decode_tags(self, tlv_data, tlv_size, optional_tags, num_of_tags);
10261029
}
10271030
item = item->next;
10281031
}

lib/src/sv_tlv.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,7 @@ tag_is_present(sv_tlv_tag_t tag, const sv_tlv_tag_t *tags, size_t num_of_tags)
12401240
return false;
12411241
}
12421242

1243-
static bool
1243+
bool
12441244
sv_tlv_find_and_decode_tags(signed_video_t *self,
12451245
const uint8_t *tlv_data,
12461246
size_t tlv_data_size,
@@ -1278,17 +1278,6 @@ sv_tlv_find_and_decode_tags(signed_video_t *self,
12781278
return decoded_tags > 0;
12791279
}
12801280

1281-
bool
1282-
sv_tlv_find_and_decode_optional_tags(signed_video_t *self,
1283-
const uint8_t *tlv_data,
1284-
size_t tlv_data_size)
1285-
{
1286-
size_t num_of_tags = 0;
1287-
const sv_tlv_tag_t *optional_tags = sv_get_optional_tags(&num_of_tags);
1288-
1289-
return sv_tlv_find_and_decode_tags(self, tlv_data, tlv_data_size, optional_tags, num_of_tags);
1290-
}
1291-
12921281
const sv_tlv_tag_t *
12931282
sv_get_optional_tags(size_t *num_of_optional_tags)
12941283
{

lib/src/sv_tlv.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,25 @@ uint8_t
133133
sv_read_byte(uint16_t *last_two_bytes, const uint8_t **payload, bool do_emulation_prevention);
134134

135135
/**
136-
* @brief Scans the TLV part of a SEI payload and decodes all recurrent tags
136+
* @brief Scans the TLV part of a SEI payload and decodes tags
137137
*
138138
* The data is assumed to have been written in a TLV format. This function parses data and
139-
* finds all tags dependent on recurrency (marked not |is_always_present|) and decodes them.
139+
* finds all |tags| and decodes them.
140140
*
141141
* @param self Pointer to the signed_video_t session.
142142
* @param tlv_data Pointer to the TLV data to scan.
143143
* @param tlv_data_size Size of the TLV data.
144+
* @param tags An array of the TLV tags to decode.
145+
* @param num_of_tags Size of the array of TLV tags.
144146
*
145147
* @return True if find and decoding tag was successful.
146148
*/
147149
bool
148-
sv_tlv_find_and_decode_optional_tags(signed_video_t *self,
150+
sv_tlv_find_and_decode_tags(signed_video_t *self,
149151
const uint8_t *tlv_data,
150-
size_t tlv_data_size);
152+
size_t tlv_data_size,
153+
const sv_tlv_tag_t *tags,
154+
size_t num_of_tags);
151155

152156
/**
153157
* @brief Helper to get only the optional tags as an array

0 commit comments

Comments
 (0)