[FFmpeg-devel] [PATCH 3/5] avcodec: add max_samples

Tomas Härdin tjoppen at acc.umu.se
Tue Sep 3 20:01:51 EEST 2019


tis 2019-09-03 klockan 13:10 +0200 skrev Michael Niedermayer:
> On Tue, Sep 03, 2019 at 12:21:26PM +0200, Tomas Härdin wrote:
> > tis 2019-09-03 klockan 09:20 +0200 skrev Paul B Mahol:
> > > On 9/3/19, Michael Niedermayer <michael at niedermayer.cc> wrote:
> > > > TODO: APIChanges, bump version
> > > > 
> > > > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > > > ---
> > > >  libavcodec/avcodec.h                 | 8 ++++++++
> > > >  libavcodec/options_table.h           | 1 +
> > > >  tests/ref/fate/api-mjpeg-codec-param | 2 ++
> > > >  tests/ref/fate/api-png-codec-param   | 2 ++
> > > >  4 files changed, 13 insertions(+)
> > > > 
> > > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > > > index de4feb6a65..4b771a6ae6 100644
> > > > --- a/libavcodec/avcodec.h
> > > > +++ b/libavcodec/avcodec.h
> > > > @@ -3371,6 +3371,14 @@ typedef struct AVCodecContext {
> > > >       * - encoding: unused
> > > >       */
> > > >      int discard_damaged_percentage;
> > > > +
> > > > +    /**
> > > > +     * The number of samples per frame to maximally accept.
> > > > +     *
> > > > +     * - decoding: set by user
> > > > +     * - encoding: set by user
> > > > +     */
> > > > +    int64_t max_samples;
> > > >  } AVCodecContext;
> > > 
> > > NAK, you can use max_pixels for the same cause.
> > 
> > Or the other way around. Has max_pixels made it to an official release
> > yet? 
> 
> max_pixels is in AVCodecContext since 3.3
> 
> but even if it wasnt. while no question max_samples would be a much
> better name for a unified field than max_pixels.
> 
> We do not unify other related fields like
> width & height with for example nb_samples and channels
> 
> There is also a semantic difference between max_pixels and max_samples
> 
> the max_pixels are the samples at one instance of time
> while max_samples cover a period of time depending on the duration of a packet

This is a good point. max_pixels as applied to audio would then mean
maximum number of channels.

I still think putting audio and video stuff in the same struct is a bit
of a mistake, for just this reason

/Tomas



More information about the ffmpeg-devel mailing list