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

2019-04-28 Thread Marton Balint



On Sun, 14 Apr 2019, Tomas Härdin wrote:


fre 2019-04-12 klockan 01:09 +0200 skrev Marton Balint:

> Signed-off-by: Marton Balint 
---
 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


Renamed the function, and applied.

Thanks,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

2019-04-14 Thread Tomas Härdin
fre 2019-04-12 klockan 01:09 +0200 skrev Marton Balint:
> > Signed-off-by: Marton Balint 
> ---
>  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
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".