[FFmpeg-devel] [PATCH] avcodec: add properties for lossless to AVCodecParameters

Michael Niedermayer michael at niedermayer.cc
Mon May 9 14:29:50 CEST 2016


On Sun, May 08, 2016 at 05:42:13PM +0200, Hendrik Leppkes wrote:
> On Sun, May 8, 2016 at 5:33 PM, Michael Niedermayer
> <michael at niedermayer.cc> wrote:
> > On Sun, May 08, 2016 at 04:10:01PM +0200, wm4 wrote:
> >> On Sun,  8 May 2016 12:10:07 +0200
> >> Michael Niedermayer <michael at niedermayer.cc> wrote:
> >>
> >> > Fixes Ticket5467
> >> >
> >> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> >> > ---
> >> >  libavcodec/avcodec.h |    4 ++++
> >> >  libavcodec/utils.c   |    2 ++
> >> >  2 files changed, 6 insertions(+)
> >> >
> >> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> >> > index 3813a0a..1db2e0f 100644
> >> > --- a/libavcodec/avcodec.h
> >> > +++ b/libavcodec/avcodec.h
> >> > @@ -4050,6 +4050,10 @@ typedef struct AVCodecParameters {
> >> >       * Audio only. Number of samples to skip after a discontinuity.
> >> >       */
> >> >      int seek_preroll;
> >> > +
> >> > +    /** Properties, like FF_CODEC_PROPERTY_LOSSLESS.
> >> > +     */
> >> > +    int properties;
> >> >  } AVCodecParameters;
> >> >
> >> >  /**
> >> > diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> >> > index e6609ef..8638bc2 100644
> >> > --- a/libavcodec/utils.c
> >> > +++ b/libavcodec/utils.c
> >> > @@ -4076,6 +4076,7 @@ int avcodec_parameters_from_context(AVCodecParameters *par,
> >> >      par->bits_per_raw_sample   = codec->bits_per_raw_sample;
> >> >      par->profile               = codec->profile;
> >> >      par->level                 = codec->level;
> >> > +    par->properties            = codec->properties;
> >> >
> >> >      switch (par->codec_type) {
> >> >      case AVMEDIA_TYPE_VIDEO:
> >> > @@ -4130,6 +4131,7 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
> >> >      codec->bits_per_raw_sample   = par->bits_per_raw_sample;
> >> >      codec->profile               = par->profile;
> >> >      codec->level                 = par->level;
> >> > +    codec->properties            = par->properties;
> >> >
> >> >      switch (par->codec_type) {
> >> >      case AVMEDIA_TYPE_VIDEO:
> >>
> >> Can you explain what exactly this is needed for?
> >
> > User apps can with this identify which streams are lossless without
> > them needing to open decoders for each stream and explicitly decode
> > some frames for each stream.
> >
> > it fixes a regression where this information is incorrectly printed
> > by av_dump_format()
> >
> > it fixes a regression where the existing lossless flag as documented by
> > the current documentation is set incorrectly
> >
> 
> We can copy it to the deprecated st->codec to keep the existing things
> working, but it still remains not a container flag, and the purpose of
> this structure is not to export every single piece of information a
> decoder might output.

this can be done but then dump_stream_format() would also need to move
back to using the deprecated struct (for that field at least) instead
of just codec par, not sure thats the only function thats affected ...

Also theres a deeper problem,
User want, benefit from and sometimes need, "every single piece of
information a decoder might output.", well not "every" of course
but its hard to draw lines what may be needed and what not.

Having an API that provides this information without user apps needing
to implement full data collection using low level APIs dealing with
errors and unseekable protocols, ...
should be quite useful


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160509/3bf1f607/attachment.sig>


More information about the ffmpeg-devel mailing list