static void add_decoders(struct mp_decoder_list *list) { for (int n = 0; codecs[n] != AV_CODEC_ID_NONE; n++) { const char *format = mp_codec_from_av_codec_id(codecs[n]); if (format) { mp_add_decoder(list, "spdif", format, format, "libavformat/spdifenc audio pass-through decoder"); } } mp_add_decoder(list, "spdif", "dts", "dts-hd", "libavformat/spdifenc audio pass-through decoder"); }
// (Abuses the decoder list data structures.) void mp_add_lavc_encoders(struct mp_decoder_list *list) { AVCodec *cur = NULL; for (;;) { cur = av_codec_next(cur); if (!cur) break; if (av_codec_is_encoder(cur)) { mp_add_decoder(list, "lavc", mp_codec_from_av_codec_id(cur->id), cur->name, cur->long_name); } } }
void mp_add_lavc_decoders(struct mp_decoder_list *list, enum AVMediaType type) { AVCodec *cur = NULL; for (;;) { cur = av_codec_next(cur); if (!cur) break; if (av_codec_is_decoder(cur) && cur->type == type && !is_crap(cur)) { mp_add_decoder(list, "lavc", mp_codec_from_av_codec_id(cur->id), cur->name, cur->long_name); } } }
static void add_codecs(struct mp_decoder_list *list, enum AVMediaType type, bool decoders) { void *iter = NULL; for (;;) { const AVCodec *cur = av_codec_iterate(&iter); if (!cur) break; if (av_codec_is_decoder(cur) == decoders && (type == AVMEDIA_TYPE_UNKNOWN || cur->type == type)) { mp_add_decoder(list, mp_codec_from_av_codec_id(cur->id), cur->name, cur->long_name); } } }
void mp_add_decoder(struct mp_decoder_list *list, const char *family, const char *codec, const char *decoder, const char *desc) { struct mp_decoder_entry entry = { .family = talloc_strdup(list, family), .codec = talloc_strdup(list, codec), .decoder = talloc_strdup(list, decoder), .desc = talloc_strdup(list, desc), }; MP_TARRAY_APPEND(list, list->entries, list->num_entries, entry); } static void mp_add_decoder_entry(struct mp_decoder_list *list, struct mp_decoder_entry *entry) { mp_add_decoder(list, entry->family, entry->codec, entry->decoder, entry->desc); }
static void add_decoders(struct mp_decoder_list *list) { mp_add_decoder(list, "mpg123", "mp3", "mp3", "High-performance decoder using libmpg123"); }