[FFmpeg-devel] [PATCH 03/12] avformat/mxfdec: extend mxf_handle_missing_index_segment for all clip wrapped essences

Marton Balint cus at passwd.hu
Wed Jun 13 21:35:49 EEST 2018



On Wed, 13 Jun 2018, Tomas Härdin wrote:

> sön 2018-06-10 klockan 12:36 +0200 skrev Marton Balint:
>> Also make sure we set a valid track index sid and a valid track edit rate in
>> order for the index to be useful.
>> 
>> > Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
>>  libavformat/mxfdec.c | 39 +++++++++++++++++++++++----------------
>>  1 file changed, 23 insertions(+), 16 deletions(-)
>> 
>> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
>> index 927653b515..1ab34f4873 100644
>> --- a/libavformat/mxfdec.c
>> +++ b/libavformat/mxfdec.c
>> @@ -2877,35 +2877,33 @@ static void mxf_handle_small_eubc(AVFormatContext *s)
>>  }
>>  
>>  /**
>> - * Deal with the case where OPAtom files does not have any IndexTableSegments.
>> + * Deal with the case where ClipWrapped essences does not have any IndexTableSegments.
>>   */
>> -static int mxf_handle_missing_index_segment(MXFContext *mxf)
>> +static int mxf_handle_missing_index_segment(MXFContext *mxf, AVStream *st)
>>  {
>> -    AVFormatContext *s = mxf->fc;
>> -    AVStream *st = NULL;
>> +    MXFTrack *track = st->priv_data;
>>      MXFIndexTableSegment *segment = NULL;
>>      MXFPartition *p = NULL;
>>      int essence_partition_count = 0;
>>      int i, ret;
>>  
>> -    st = mxf_get_opatom_stream(mxf);
>> -    if (!st)
>> -        return 0;
>> -
>>      /* TODO: support raw video without an index if they exist */
>> -    if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO || !is_pcm(st->codecpar->codec_id))
>> +    if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO || !is_pcm(st->codecpar->codec_id) || track->wrapping != ClipWrapped)
>>          return 0;
>>  
>> -    /* check if file already has a IndexTableSegment */
>> +    /* check if track already has a IndexTableSegment */
>
> "an" :)

Fixed locally.

>
>>      for (i = 0; i < mxf->metadata_sets_count; i++) {
>> -        if (mxf->metadata_sets[i]->type == IndexTableSegment)
>> -            return 0;
>> +        if (mxf->metadata_sets[i]->type == IndexTableSegment) {
>> +            MXFIndexTableSegment *s = (MXFIndexTableSegment*)mxf->metadata_sets[i];
>> +            if (s->body_sid == track->body_sid)
>> +                return 0;
>> +        }
>
> Feels like this would have been pretty bork before? Or maybe it just
> worked because OPAtom.

Yeah, it was only used for OPAtom before, therefore multiple index tables 
was not an issue.

Regards,
Marton


More information about the ffmpeg-devel mailing list