[FFmpeg-devel] [PATCH 08/12] avformat/mxfdec: add support for returning the partition for mxf_edit_unit_absolute_offset and mxf_absolute_bodysid_offset

Tomas Härdin tjoppen at acc.umu.se
Thu Jun 14 15:25:39 EEST 2018


ons 2018-06-13 klockan 22:16 +0200 skrev Marton Balint:
> 
> On Wed, 13 Jun 2018, Tomas Härdin wrote:
> 
> > sön 2018-06-10 klockan 12:36 +0200 skrev Marton Balint:
> > > > Signed-off-by: Marton Balint <cus at passwd.hu>
> > > 
> > > ---
> > >  libavformat/mxfdec.c | 18 ++++++++++--------
> > >  1 file changed, 10 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> > > index 0f4cc9c3a3..8054e051cf 100644
> > > --- a/libavformat/mxfdec.c
> > > +++ b/libavformat/mxfdec.c
> > > @@ -1399,7 +1399,7 @@ static int mxf_get_sorted_table_segments(MXFContext *mxf, int *nb_sorted_segment
> > >  /**
> > >   * Computes the absolute file offset of the given essence container offset
> > >   */
> > > -static int mxf_absolute_bodysid_offset(MXFContext *mxf, int body_sid, int64_t offset, int64_t *offset_out)
> > > +static int mxf_absolute_bodysid_offset(MXFContext *mxf, int body_sid, int64_t offset, int64_t *offset_out, MXFPartition **partition_out)
> > >  {
> > >      MXFPartition *last_p = NULL;
> > >      int a, b, m, m0;
> > > @@ -1427,6 +1427,8 @@ static int mxf_absolute_bodysid_offset(MXFContext *mxf, int body_sid, int64_t of
> > >  
> > >      if (last_p && (!last_p->essence_length || last_p->essence_length > (offset - last_p->body_offset))) {
> > >          *offset_out = last_p->essence_offset + (offset - last_p->body_offset);
> > > +        if (partition_out)
> > > +            *partition_out = last_p;
> > >          return 0;
> > >      }
> > >  
> > > @@ -1461,7 +1463,7 @@ static int64_t mxf_essence_container_end(MXFContext *mxf, int body_sid)
> > >  }
> > >  
> > >  /* EditUnit -> absolute offset */
> > > -static int mxf_edit_unit_absolute_offset(MXFContext *mxf, MXFIndexTable *index_table, int64_t edit_unit, int64_t *edit_unit_out, int64_t *offset_out, int nag)
> > > +static int mxf_edit_unit_absolute_offset(MXFContext *mxf, MXFIndexTable *index_table, int64_t edit_unit, int64_t *edit_unit_out, int64_t *offset_out, MXFPartition **partition_out, int nag)
> > 
> > Putting the pointer last would give a more readable patch, plus it's
> > nicer if all output vars are on the end (just a style preference)
> 
> This is your code as well ;), "nag" was already the last, so it would be 
> strange to put *partition_out after "nag", but have *offset_out before 
> "nag".

Yeah. Whatever you feel like is fine

/Tomas


More information about the ffmpeg-devel mailing list