diff options
author | Marton Balint <cus@passwd.hu> | 2018-02-17 15:02:19 +0100 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2018-03-01 22:03:53 +0100 |
commit | 5c2fd59700c4050f81e902bfde914fe9684aa4ad (patch) | |
tree | 30a002c3469a8a362860a3b22ec2fa7eb56d16f6 /libavformat | |
parent | e9b0e42e773d4a1c9575c75e95688faca7ce4e06 (diff) | |
download | ffmpeg-streaming-5c2fd59700c4050f81e902bfde914fe9684aa4ad.zip ffmpeg-streaming-5c2fd59700c4050f81e902bfde914fe9684aa4ad.tar.gz |
avformat/mxfdec: use the first system item if available for calculating essence_offset
Also add an additional system item key.
Fixes parsing of ffmpeg-bugs/trac/ticket2817/warehouse.mxf
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mxfdec.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 95767cc..43a0220 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -289,7 +289,8 @@ static const uint8_t mxf_header_partition_pack_key[] = { 0x06,0x0e,0x2b,0x 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_avid_essence_element_key[] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0e,0x04,0x03,0x01 }; static const uint8_t mxf_canopus_essence_element_key[] = { 0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x0a,0x0e,0x0f,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_system_item_key_cp[] = { 0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x03,0x01,0x04 }; +static const uint8_t mxf_system_item_key_gc[] = { 0x06,0x0e,0x2b,0x34,0x02,0x53,0x01,0x01,0x0d,0x01,0x03,0x01,0x14 }; static const uint8_t mxf_klv_key[] = { 0x06,0x0e,0x2b,0x34 }; /* 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 }; @@ -2861,7 +2862,8 @@ static int mxf_read_header(AVFormatContext *s) if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) || IS_KLV_KEY(klv.key, mxf_essence_element_key) || IS_KLV_KEY(klv.key, mxf_avid_essence_element_key) || - IS_KLV_KEY(klv.key, mxf_system_item_key)) { + IS_KLV_KEY(klv.key, mxf_system_item_key_cp) || + IS_KLV_KEY(klv.key, mxf_system_item_key_gc)) { if (!mxf->current_partition) { av_log(mxf->fc, AV_LOG_ERROR, "found essence prior to first PartitionPack\n"); @@ -2888,7 +2890,10 @@ static int mxf_read_header(AVFormatContext *s) mxf->current_partition->essence_length = klv.length; } else { /* NOTE: op1a_essence_offset may be less than to klv.offset (C0023S01.mxf) */ - mxf->current_partition->essence_offset = op1a_essence_offset; + if (IS_KLV_KEY(klv.key, mxf_system_item_key_cp) || IS_KLV_KEY(klv.key, mxf_system_item_key_gc)) + mxf->current_partition->essence_offset = klv.offset; + else + mxf->current_partition->essence_offset = op1a_essence_offset; } } |