[FFmpeg-devel] [PATCH] ffmpeg: fail on experimental encoders if -strict > experimental

Michael Niedermayer michaelni
Wed May 26 18:56:52 CEST 2010


On Wed, May 26, 2010 at 09:31:55AM +0200, Janne Grunau wrote:
> On Wed, May 26, 2010 at 02:08:00AM +0200, Michael Niedermayer wrote:
> > On Wed, May 26, 2010 at 12:48:00AM +0200, Janne Grunau wrote:
> > > Hi,
> > > 
> > > not sure if I'm abusing -strict too much. Even the exprimental encoders should
> > > produce standard compliant output.
> > > 
> > > Depends on the CODEC_CAP_EXPERIMENTAL patch
> > > 
> > > Janne
> > 
> > >  ffmpeg.c |   23 ++++++++++++++++-------
> > >  1 file changed, 16 insertions(+), 7 deletions(-)
> > > e735ba4cec8890f65607e89198e4ed9859e91469  ffmpeg_fail_on_experimental_encoders.diff
> > > commit f7be47f7a94abe9a5a318034ea932b35eee37e7a
> > > Author: Janne Grunau <janne at grunau.be>
> > > Date:   Mon May 24 23:15:19 2010 +0200
> > > 
> > >     ffmpeg: fail if encoder is experimental and -strict > experimental
> > > 
> > > diff --git a/ffmpeg.c b/ffmpeg.c
> > > index 63f0e6b..6eb7aa9 100644
> > > --- a/ffmpeg.c
> > > +++ b/ffmpeg.c
> > > @@ -3068,7 +3068,7 @@ static int opt_input_ts_offset(const char *opt, const char *arg)
> > >      return 0;
> > >  }
> > >  
> > > -static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
> > > +static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict)
> > >  {
> > >      const char *codec_string = encoder ? "encoder" : "decoder";
> > >      AVCodec *codec;
> > > @@ -3086,6 +3086,12 @@ static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
> > >          fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name);
> > >          av_exit(1);
> > >      }
> > > +    if(codec->caps & CODEC_CAP_EXPERIMENTAL && strict > FF_COMPLIANCE_EXPERIMENTAL) {
> > > +        fprintf(stderr, "%s \"%s\" is experimental and might produce bad "
> > > +                "results. Add \"-strict experimental\" if you want to use it.\n",
> > > +                codec_string, codec->name);
> > > +        av_exit(1);
> > > +    }
> > >      return codec->id;
> > >  }
> > >  
> > > @@ -3133,9 +3139,9 @@ static void opt_input_file(const char *filename)
> > >  
> > >      set_context_opts(ic, avformat_opts, AV_OPT_FLAG_DECODING_PARAM);
> > >  
> > > -    ic->video_codec_id   = find_codec_or_die(video_codec_name   , AVMEDIA_TYPE_VIDEO   , 0);
> > > -    ic->audio_codec_id   = find_codec_or_die(audio_codec_name   , AVMEDIA_TYPE_AUDIO   , 0);
> > > -    ic->subtitle_codec_id= find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0);
> > > +    ic->video_codec_id   = find_codec_or_die(video_codec_name   , AVMEDIA_TYPE_VIDEO   , 0, 0);
> > > +    ic->audio_codec_id   = find_codec_or_die(audio_codec_name   , AVMEDIA_TYPE_AUDIO   , 0, 0);
> > > +    ic->subtitle_codec_id= find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 0, 0);
> > 
> > 0 is not ideal, it would be nice to be able to use this for decoders as well
> 
> Agreed, there is unfortunately no AVCodecContext. Another hint that I'm

avcodec_opts doesnt work?

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

Incandescent light bulbs waste a lot of energy as heat so the EU forbids them.
Their replacement, compact fluorescent lamps, much more expensive, dont fit in
many old lamps, flicker, contain toxic mercury, produce a fraction of the light
that is claimed and in a unnatural spectrum rendering colors different than
in natural light. Ah and we now need to turn the heaters up more in winter to
compensate the lower wasted heat. Who wins? Not the environment, thats for sure
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100526/70a07572/attachment.pgp>



More information about the ffmpeg-devel mailing list