On Wed, 3 Jan 2018 16:50:00 +0000 Rostislav Pehlivanov <atomnu...@gmail.com> wrote:
> On 3 January 2018 at 15:25, wm4 <nfx...@googlemail.com> wrote: > > > On Wed, 3 Jan 2018 00:42:36 +0000 > > Josh de Kock <j...@itanimul.li> wrote: > > > > > +static AVCodec *find_codec_by_name(const char *name, int (*x)(const > > AVCodec *)) > > > +{ > > > + void *i = 0; > > > + const AVCodec *p; > > > + > > > + if (!name) > > > + return NULL; > > > + > > > + while ((p = av_codec_iterate(&i))) { > > > + if (!x(p)) > > > + continue; > > > + if (strcmp(name, p->name) == 0) > > > + return (AVCodec*)p; > > > + } > > > + > > > + return NULL; > > > +} > > > + > > > +AVCodec *avcodec_find_encoder_by_name(const char *name) > > > +{ > > > + return find_codec_by_name(name, av_codec_is_encoder); > > > +} > > > + > > > +AVCodec *avcodec_find_decoder_by_name(const char *name) > > > +{ > > > + return find_codec_by_name(name, av_codec_is_decoder); > > > } > > > > Personally I'd argue a bool parameter or so to select encoders vs. > > decoders would be less roudnabout (like it was before), but I have no > > strong opinion. Could be considered an improvement as well. > > > > > I think separate functions would be better in this case. My comment was just about how find_codec_by_name() is called. Certainly we don't want to duplicate the actual code. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel