*/
int avcodec_is_open(AVCodecContext *s);
+/**
+ * @return a non-zero number if codec is an encoder, zero otherwise
+ */
+int av_codec_is_encoder(AVCodec *codec);
+
+/**
+ * @return a non-zero number if codec is a decoder, zero otherwise
+ */
+int av_codec_is_decoder(AVCodec *codec);
+
#endif /* AVCODEC_AVCODEC_H */
ff_dsputil_static_init();
}
-static av_always_inline int codec_is_encoder(AVCodec *codec)
+int av_codec_is_encoder(AVCodec *codec)
{
return codec && (codec->encode || codec->encode2);
}
-static av_always_inline int codec_is_decoder(AVCodec *codec)
+int av_codec_is_decoder(AVCodec *codec)
{
return codec && codec->decode;
}
/* if the decoder init function was already called previously,
free the already allocated subtitle_header before overwriting it */
- if (codec_is_decoder(codec))
+ if (av_codec_is_decoder(codec))
av_freep(&avctx->subtitle_header);
#define SANE_NB_CHANNELS 128U
ret = AVERROR(EINVAL);
goto free_and_end;
}
- if (codec_is_encoder(avctx->codec)) {
+ if (av_codec_is_encoder(avctx->codec)) {
int i;
if (avctx->codec->sample_fmts) {
for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++)
av_opt_free(avctx->priv_data);
av_opt_free(avctx);
av_freep(&avctx->priv_data);
- if (codec_is_encoder(avctx->codec))
+ if (av_codec_is_encoder(avctx->codec))
av_freep(&avctx->extradata);
avctx->codec = NULL;
avctx->active_thread_type = 0;
AVCodec *p, *experimental=NULL;
p = first_avcodec;
while (p) {
- if (codec_is_encoder(p) && p->id == id) {
+ if (av_codec_is_encoder(p) && p->id == id) {
if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) {
experimental = p;
} else
return NULL;
p = first_avcodec;
while (p) {
- if (codec_is_encoder(p) && strcmp(name,p->name) == 0)
+ if (av_codec_is_encoder(p) && strcmp(name,p->name) == 0)
return p;
p = p->next;
}
AVCodec *p;
p = first_avcodec;
while (p) {
- if (codec_is_decoder(p) && p->id == id)
+ if (av_codec_is_decoder(p) && p->id == id)
return p;
p = p->next;
}
return NULL;
p = first_avcodec;
while (p) {
- if (codec_is_decoder(p) && strcmp(name,p->name) == 0)
+ if (av_codec_is_decoder(p) && strcmp(name,p->name) == 0)
return p;
p = p->next;
}