[FFmpeg-devel] [PATCH] avcodec: add properties for lossless to AVCodecParameters
Hendrik Leppkes
h.leppkes at gmail.com
Sun May 8 17:42:13 CEST 2016
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.
- Hendrik
More information about the ffmpeg-devel
mailing list