mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 05:01:23 +00:00
mxftypes: Check for the existence of all required fields
According to SMPTE ST 377-1:2019 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7626>
This commit is contained in:
parent
7cc16b64b7
commit
1b81c9ca87
1 changed files with 11 additions and 0 deletions
|
@ -1064,6 +1064,7 @@ mxf_index_table_segment_parse (const MXFUL * ul,
|
||||||
#endif
|
#endif
|
||||||
guint16 tag, tag_size;
|
guint16 tag, tag_size;
|
||||||
const guint8 *tag_data;
|
const guint8 *tag_data;
|
||||||
|
guint8 found_bitset = 0;
|
||||||
|
|
||||||
g_return_val_if_fail (ul != NULL, FALSE);
|
g_return_val_if_fail (ul != NULL, FALSE);
|
||||||
|
|
||||||
|
@ -1090,12 +1091,14 @@ mxf_index_table_segment_parse (const MXFUL * ul,
|
||||||
memcpy (&segment->instance_id, tag_data, 16);
|
memcpy (&segment->instance_id, tag_data, 16);
|
||||||
GST_DEBUG (" instance id = %s",
|
GST_DEBUG (" instance id = %s",
|
||||||
mxf_uuid_to_string (&segment->instance_id, str));
|
mxf_uuid_to_string (&segment->instance_id, str));
|
||||||
|
found_bitset |= 1;
|
||||||
break;
|
break;
|
||||||
case 0x3f0b:
|
case 0x3f0b:
|
||||||
if (!mxf_fraction_parse (&segment->index_edit_rate, tag_data, tag_size))
|
if (!mxf_fraction_parse (&segment->index_edit_rate, tag_data, tag_size))
|
||||||
goto error;
|
goto error;
|
||||||
GST_DEBUG (" index edit rate = %d/%d", segment->index_edit_rate.n,
|
GST_DEBUG (" index edit rate = %d/%d", segment->index_edit_rate.n,
|
||||||
segment->index_edit_rate.d);
|
segment->index_edit_rate.d);
|
||||||
|
found_bitset |= 2;
|
||||||
break;
|
break;
|
||||||
case 0x3f0c:
|
case 0x3f0c:
|
||||||
if (tag_size != 8)
|
if (tag_size != 8)
|
||||||
|
@ -1103,6 +1106,7 @@ mxf_index_table_segment_parse (const MXFUL * ul,
|
||||||
segment->index_start_position = GST_READ_UINT64_BE (tag_data);
|
segment->index_start_position = GST_READ_UINT64_BE (tag_data);
|
||||||
GST_DEBUG (" index start position = %" G_GINT64_FORMAT,
|
GST_DEBUG (" index start position = %" G_GINT64_FORMAT,
|
||||||
segment->index_start_position);
|
segment->index_start_position);
|
||||||
|
found_bitset |= 4;
|
||||||
break;
|
break;
|
||||||
case 0x3f0d:
|
case 0x3f0d:
|
||||||
if (tag_size != 8)
|
if (tag_size != 8)
|
||||||
|
@ -1110,6 +1114,7 @@ mxf_index_table_segment_parse (const MXFUL * ul,
|
||||||
segment->index_duration = GST_READ_UINT64_BE (tag_data);
|
segment->index_duration = GST_READ_UINT64_BE (tag_data);
|
||||||
GST_DEBUG (" index duration = %" G_GINT64_FORMAT,
|
GST_DEBUG (" index duration = %" G_GINT64_FORMAT,
|
||||||
segment->index_duration);
|
segment->index_duration);
|
||||||
|
found_bitset |= 8;
|
||||||
break;
|
break;
|
||||||
case 0x3f05:
|
case 0x3f05:
|
||||||
if (tag_size != 4)
|
if (tag_size != 4)
|
||||||
|
@ -1129,6 +1134,7 @@ mxf_index_table_segment_parse (const MXFUL * ul,
|
||||||
goto error;
|
goto error;
|
||||||
segment->body_sid = GST_READ_UINT32_BE (tag_data);
|
segment->body_sid = GST_READ_UINT32_BE (tag_data);
|
||||||
GST_DEBUG (" body sid = %u", segment->body_sid);
|
GST_DEBUG (" body sid = %u", segment->body_sid);
|
||||||
|
found_bitset |= 16;
|
||||||
break;
|
break;
|
||||||
case 0x3f08:
|
case 0x3f08:
|
||||||
if (tag_size != 1)
|
if (tag_size != 1)
|
||||||
|
@ -1275,6 +1281,11 @@ mxf_index_table_segment_parse (const MXFUL * ul,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (found_bitset != 31) {
|
||||||
|
GST_WARNING ("Not all required fields present");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
/* If edit unit byte count is 0 there *must* be entries */
|
/* If edit unit byte count is 0 there *must* be entries */
|
||||||
if (segment->edit_unit_byte_count == 0 && segment->n_index_entries == 0) {
|
if (segment->edit_unit_byte_count == 0 && segment->n_index_entries == 0) {
|
||||||
GST_WARNING
|
GST_WARNING
|
||||||
|
|
Loading…
Reference in a new issue