Commit edb50856 authored by Tomas Härdin's avatar Tomas Härdin Committed by Janne Grunau

mxfdec: Add hack that adjusts the n_delta calculation when system items are present.

Signed-off-by: 's avatarJanne Grunau <janne-libav@jannau.net>
parent 682b6db7
...@@ -181,6 +181,7 @@ typedef struct { ...@@ -181,6 +181,7 @@ typedef struct {
uint8_t *local_tags; uint8_t *local_tags;
int local_tags_count; int local_tags_count;
uint64_t footer_partition; uint64_t footer_partition;
int system_item;
int64_t essence_offset; int64_t essence_offset;
int first_essence_kl_length; int first_essence_kl_length;
int64_t first_essence_length; int64_t first_essence_length;
...@@ -205,6 +206,7 @@ typedef struct { ...@@ -205,6 +206,7 @@ typedef struct {
/* partial keys to match */ /* partial keys to match */
static const uint8_t mxf_header_partition_pack_key[] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 }; static const uint8_t mxf_header_partition_pack_key[] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 };
static const uint8_t mxf_essence_element_key[] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 }; static const uint8_t mxf_essence_element_key[] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 };
static const uint8_t mxf_system_item_key[] = { 0x06,0x0E,0x2B,0x34,0x02,0x05,0x01,0x01,0x0D,0x01,0x03,0x01,0x04 };
static const uint8_t mxf_klv_key[] = { 0x06,0x0e,0x2b,0x34 }; static const uint8_t mxf_klv_key[] = { 0x06,0x0e,0x2b,0x34 };
/* complete keys to match */ /* complete keys to match */
static const uint8_t mxf_crypto_source_container_ul[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 }; static const uint8_t mxf_crypto_source_container_ul[] = { 0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 };
...@@ -990,7 +992,7 @@ static int mxf_parse_index(MXFContext *mxf, int i, AVStream *st) ...@@ -990,7 +992,7 @@ static int mxf_parse_index(MXFContext *mxf, int i, AVStream *st)
accumulated_offset = 0; accumulated_offset = 0;
/* HACK: How to correctly link between streams and slices? */ /* HACK: How to correctly link between streams and slices? */
if (i < st->index) if (i < mxf->system_item + st->index)
n_delta++; n_delta++;
if (n_delta >= tableseg->nb_delta_entries && st->index != 0) if (n_delta >= tableseg->nb_delta_entries && st->index != 0)
continue; continue;
...@@ -1356,6 +1358,11 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -1356,6 +1358,11 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_seek(s->pb, klv.offset, SEEK_SET); avio_seek(s->pb, klv.offset, SEEK_SET);
break; break;
} }
if (IS_KLV_KEY(klv.key, mxf_system_item_key)) {
mxf->system_item = 1;
avio_skip(s->pb, klv.length);
continue;
}
for (metadata = mxf_metadata_read_table; metadata->read; metadata++) { for (metadata = mxf_metadata_read_table; metadata->read; metadata++) {
if (IS_KLV_KEY(klv.key, metadata->key)) { if (IS_KLV_KEY(klv.key, metadata->key)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment