avformat/mxfdec: fix essence_offset calculation
authorMarton Balint <cus@passwd.hu>
Sat, 17 Feb 2018 10:47:57 +0000 (11:47 +0100)
committerMarton Balint <cus@passwd.hu>
Thu, 1 Mar 2018 21:03:53 +0000 (22:03 +0100)
The reference point for a KAG is the first byte of the key of a Partition Pack.

Fixes ticket #2817.
Fixes ticket #5317.

Signed-off-by: Marton Balint <cus@passwd.hu>
libavformat/mxfdec.c

index fcae863..95767cc 100644 (file)
@@ -2875,8 +2875,8 @@ static int mxf_read_header(AVFormatContext *s)
                  *       for OPAtom we still need the actual essence_offset though (the KL's length can vary)
                  */
                 int64_t op1a_essence_offset =
-                    round_to_kag(mxf->current_partition->this_partition +
-                                 mxf->current_partition->pack_length,       mxf->current_partition->kag_size) +
+                    mxf->current_partition->this_partition +
+                    round_to_kag(mxf->current_partition->pack_length,       mxf->current_partition->kag_size) +
                     round_to_kag(mxf->current_partition->header_byte_count, mxf->current_partition->kag_size) +
                     round_to_kag(mxf->current_partition->index_byte_count,  mxf->current_partition->kag_size);