diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2024-04-10 21:24:06 +0200 |
---|---|---|
committer | Kacper Michajłow <kasper93@gmail.com> | 2024-04-15 19:34:40 +0200 |
commit | e720159f72be2a816db849acb286f36a1ac4622b (patch) | |
tree | 8ea4ca753638abc96c16af0e8972194d39a51a57 /common | |
parent | 3995cd3714d2768f56c234633d1839f83746233b (diff) | |
download | mpv-e720159f72be2a816db849acb286f36a1ac4622b.tar.bz2 mpv-e720159f72be2a816db849acb286f36a1ac4622b.tar.xz |
player/command: add video-codec-info and audio-codec-info
Adds support for extracting codec profile. Old properties are redirected
to new one and removed from docs. Likely will stay like that forever as
there is no reason to remove them.
As a effect of unification of properties between audio and video,
video-codec will now print codec (format) descriptive name, not decoder
long name as it were before. In practice this change fixes what docs
says. If you really need decoder name, use the `track-list/N/decoder-desc`.
Diffstat (limited to 'common')
-rw-r--r-- | common/av_common.c | 9 | ||||
-rw-r--r-- | common/av_common.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/common/av_common.c b/common/av_common.c index 5d07349af0..e5733c3848 100644 --- a/common/av_common.c +++ b/common/av_common.c @@ -402,3 +402,12 @@ void mp_free_av_packet(AVPacket **pkt) } av_packet_free(pkt); } + +void mp_codec_info_from_av(const AVCodecContext *avctx, struct mp_codec_params *c) +{ + c->codec_profile = av_get_profile_name(avctx->codec, avctx->profile); + if (!c->codec_profile) + c->codec_profile = avcodec_profile_name(avctx->codec_id, avctx->profile); + c->codec = avctx->codec_descriptor->name; + c->codec_desc = avctx->codec_descriptor->long_name; +} diff --git a/common/av_common.h b/common/av_common.h index 1f05e14fab..c584085890 100644 --- a/common/av_common.h +++ b/common/av_common.h @@ -50,5 +50,6 @@ void mp_avdict_print_unset(struct mp_log *log, int msgl, struct AVDictionary *d) int mp_set_avopts(struct mp_log *log, void *avobj, char **kv); int mp_set_avopts_pos(struct mp_log *log, void *avobj, void *posargs, char **kv); void mp_free_av_packet(AVPacket **pkt); +void mp_codec_info_from_av(const AVCodecContext *avctx, struct mp_codec_params *c); #endif |