summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-03-01 21:46:49 +0100
committerwm4 <wm4@nowhere>2016-03-01 21:46:57 +0100
commit33774e18ed4c49857c042870099e3e3dd6fe614d (patch)
treed19275a23ca9ea6551a52bca99d62b0d9493edd5 /common
parentaf66fa8fa5d8e46b26a08a2b241f03d46abb3c2b (diff)
downloadmpv-33774e18ed4c49857c042870099e3e3dd6fe614d.tar.bz2
mpv-33774e18ed4c49857c042870099e3e3dd6fe614d.tar.xz
command: add encoder-list property
Also change decoder-list (for the sake of sharing the underlying code for both properties).
Diffstat (limited to 'common')
-rw-r--r--common/av_common.c15
-rw-r--r--common/av_common.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/common/av_common.c b/common/av_common.c
index 8b979cabba..5cb434f969 100644
--- a/common/av_common.c
+++ b/common/av_common.c
@@ -158,6 +158,21 @@ void mp_add_lavc_decoders(struct mp_decoder_list *list, enum AVMediaType type)
}
}
+// (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);
+ }
+ }
+}
+
int mp_codec_to_av_codec_id(const char *codec)
{
int id = AV_CODEC_ID_NONE;
diff --git a/common/av_common.h b/common/av_common.h
index e9df328fbf..1478adf8fb 100644
--- a/common/av_common.h
+++ b/common/av_common.h
@@ -36,6 +36,7 @@ int64_t mp_pts_to_av(double mp_pts, AVRational *tb);
double mp_pts_from_av(int64_t av_pts, AVRational *tb);
void mp_set_avcodec_threads(struct mp_log *l, AVCodecContext *avctx, int threads);
void mp_add_lavc_decoders(struct mp_decoder_list *list, enum AVMediaType type);
+void mp_add_lavc_encoders(struct mp_decoder_list *list);
int mp_codec_to_av_codec_id(const char *codec);
const char *mp_codec_from_av_codec_id(int codec_id);
void mp_set_avdict(struct AVDictionary **dict, char **kv);