[FFmpeg-devel] [PATCH 4/5] avformat/mxfdec: take into account run-in in find_partition_by_offset

Tomas Härdin tjoppen at acc.umu.se
Sun Apr 14 18:58:34 EEST 2019


fre 2019-04-12 klockan 01:09 +0200 skrev Marton Balint:
> > Signed-off-by: Marton Balint <cus at passwd.hu>
> ---
>  libavformat/mxfdec.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> index 236294880e..6f0f87763d 100644
> --- a/libavformat/mxfdec.c
> +++ b/libavformat/mxfdec.c
> @@ -433,15 +433,15 @@ static int find_body_sid_by_offset(MXFContext *mxf, int64_t offset)

Maybe we should rename the function to make it clear offset is
absolute?

>  {
>      // we look for partition where the offset is placed
>      int a, b, m;
> -    int64_t this_partition;
> +    int64_t pack_ofs;
>  
>      a = -1;
>      b = mxf->partitions_count;
>  
>      while (b - a > 1) {
> -        m         = (a + b) >> 1;
> -        this_partition = mxf->partitions[m].this_partition;
> -        if (this_partition <= offset)
> +        m = (a + b) >> 1;
> +        pack_ofs = mxf->partitions[m].pack_ofs;
> +        if (pack_ofs <= offset)
>              a = m;
>          else
>              b = m;

Looks OK otherwise

/Tomas


More information about the ffmpeg-devel mailing list