diff options
author | Josh de Kock <josh@itanimul.li> | 2017-12-22 22:17:00 +0000 |
---|---|---|
committer | Josh de Kock <josh@itanimul.li> | 2018-02-06 18:50:27 +0000 |
commit | 7e8eba2d8755962d9dca5eade57bf8f591a73c0c (patch) | |
tree | b997d9b1f5efa61f828f21e130355e3f9d85d3b0 /libavcodec/utils.c | |
parent | caa4bd7a9fe9186a56fdcb8194263b066978cbbe (diff) | |
download | ffmpeg-7e8eba2d8755962d9dca5eade57bf8f591a73c0c.tar.gz |
lavc: add new API for iterating codecs and codec parsers
Based on an unfinished patch by atomnuker.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index aefe631590..8c7d056da6 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -46,7 +46,6 @@ #include "decode.h" #include "hwaccel.h" #include "libavutil/opt.h" -#include "me_cmp.h" #include "mpegvideo.h" #include "thread.h" #include "frame_thread_encoder.h" @@ -92,18 +91,6 @@ void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size) memset(*p, 0, min_size + AV_INPUT_BUFFER_PADDING_SIZE); } -/* encoder management */ -static AVCodec *first_avcodec = NULL; -static AVCodec **last_avcodec = &first_avcodec; - -AVCodec *av_codec_next(const AVCodec *c) -{ - if (c) - return c->next; - else - return first_avcodec; -} - int av_codec_is_encoder(const AVCodec *codec) { return codec && (codec->encode_sub || codec->encode2 ||codec->send_frame); @@ -114,27 +101,6 @@ int av_codec_is_decoder(const AVCodec *codec) return codec && (codec->decode || codec->receive_frame); } -static AVMutex codec_register_mutex = AV_MUTEX_INITIALIZER; - -av_cold void avcodec_register(AVCodec *codec) -{ - AVCodec **p; - - ff_mutex_lock(&codec_register_mutex); - p = last_avcodec; - - while (*p) - p = &(*p)->next; - *p = codec; - codec->next = NULL; - last_avcodec = &codec->next; - - ff_mutex_unlock(&codec_register_mutex); - - if (codec->init_static_data) - codec->init_static_data(codec); -} - int ff_set_dimensions(AVCodecContext *s, int width, int height) { int ret = av_image_check_size2(width, height, s->max_pixels, AV_PIX_FMT_NONE, 0, s); @@ -1155,71 +1121,6 @@ FF_ENABLE_DEPRECATION_WARNINGS return 0; } -static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id) -{ - switch(id){ - //This is for future deprecatec codec ids, its empty since - //last major bump but will fill up again over time, please don't remove it - default : return id; - } -} - -static AVCodec *find_encdec(enum AVCodecID id, int encoder) -{ - AVCodec *p, *experimental = NULL; - p = first_avcodec; - id= remap_deprecated_codec_id(id); - while (p) { - if ((encoder ? av_codec_is_encoder(p) : av_codec_is_decoder(p)) && - p->id == id) { - if (p->capabilities & AV_CODEC_CAP_EXPERIMENTAL && !experimental) { - experimental = p; - } else - return p; - } - p = p->next; - } - return experimental; -} - -AVCodec *avcodec_find_encoder(enum AVCodecID id) -{ - return find_encdec(id, 1); -} - -AVCodec *avcodec_find_encoder_by_name(const char *name) -{ - AVCodec *p; - if (!name) - return NULL; - p = first_avcodec; - while (p) { - if (av_codec_is_encoder(p) && strcmp(name, p->name) == 0) - return p; - p = p->next; - } - return NULL; -} - -AVCodec *avcodec_find_decoder(enum AVCodecID id) -{ - return find_encdec(id, 0); -} - -AVCodec *avcodec_find_decoder_by_name(const char *name) -{ - AVCodec *p; - if (!name) - return NULL; - p = first_avcodec; - while (p) { - if (av_codec_is_decoder(p) && strcmp(name, p->name) == 0) - return p; - p = p->next; - } - return NULL; -} - const char *avcodec_get_name(enum AVCodecID id) { const AVCodecDescriptor *cd; |