summaryrefslogtreecommitdiffstats
path: root/common/av_common.c
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2024-04-10 21:24:06 +0200
committerKacper Michajłow <kasper93@gmail.com>2024-04-15 19:34:40 +0200
commite720159f72be2a816db849acb286f36a1ac4622b (patch)
tree8ea4ca753638abc96c16af0e8972194d39a51a57 /common/av_common.c
parent3995cd3714d2768f56c234633d1839f83746233b (diff)
downloadmpv-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/av_common.c')
-rw-r--r--common/av_common.c9
1 files changed, 9 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;
+}