mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-17 20:17:55 +02:00
mxfdec: Make mxf->partitions sorted by offset
This also zeroes new entries for good measure (used by future patches).
This commit is contained in:
parent
e5f9c8927b
commit
289bc14449
@ -192,6 +192,7 @@ typedef struct {
|
|||||||
MXFPartition *current_partition;
|
MXFPartition *current_partition;
|
||||||
int parsing_backward;
|
int parsing_backward;
|
||||||
int64_t last_forward_tell;
|
int64_t last_forward_tell;
|
||||||
|
int last_forward_partition;
|
||||||
} MXFContext;
|
} MXFContext;
|
||||||
|
|
||||||
enum MXFWrappingScheme {
|
enum MXFWrappingScheme {
|
||||||
@ -446,7 +447,20 @@ static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size
|
|||||||
if (!mxf->partitions)
|
if (!mxf->partitions)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
|
||||||
partition = mxf->current_partition = &mxf->partitions[mxf->partitions_count++];
|
if (mxf->parsing_backward) {
|
||||||
|
/* insert the new partition pack in the middle
|
||||||
|
* this makes the entries in mxf->partitions sorted by offset */
|
||||||
|
memmove(&mxf->partitions[mxf->last_forward_partition+1],
|
||||||
|
&mxf->partitions[mxf->last_forward_partition],
|
||||||
|
(mxf->partitions_count - mxf->last_forward_partition)*sizeof(*mxf->partitions));
|
||||||
|
partition = mxf->current_partition = &mxf->partitions[mxf->last_forward_partition];
|
||||||
|
} else {
|
||||||
|
mxf->last_forward_partition++;
|
||||||
|
partition = mxf->current_partition = &mxf->partitions[mxf->partitions_count];
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(partition, 0, sizeof(*partition));
|
||||||
|
mxf->partitions_count++;
|
||||||
|
|
||||||
switch(uid[13]) {
|
switch(uid[13]) {
|
||||||
case 2:
|
case 2:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user