diff options
author | Kacper Michajłow <kasper93@gmail.com> | 2024-04-16 20:29:17 +0200 |
---|---|---|
committer | Kacper Michajłow <kasper93@gmail.com> | 2024-04-16 21:58:55 +0200 |
commit | d23f641bb3b02ab226ed7228ea6b8d1a0cda2785 (patch) | |
tree | f26b4fa700b348e50992a37653686ad31c308b50 /player | |
parent | 68bcbf66ef4a9bcab1ffd6c5c5cf8fd7fd39bb7e (diff) | |
download | mpv-d23f641bb3b02ab226ed7228ea6b8d1a0cda2785.tar.bz2 mpv-d23f641bb3b02ab226ed7228ea6b8d1a0cda2785.tar.xz |
player/command: remove codec-info and use track-list directly
Turns out that adding more medatata like HDR10+ and Dolby Vision would
produce a lot of duplication and it is better to centralize it around
the track-list property.
Fixes: e720159f72be2a816db849acb286f36a1ac4622b
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 48 | ||||
-rw-r--r-- | player/lua/stats.lua | 14 |
2 files changed, 14 insertions, 48 deletions
diff --git a/player/command.c b/player/command.c index aed4027586..ff5ca353f0 100644 --- a/player/command.c +++ b/player/command.c @@ -1829,32 +1829,6 @@ static int mp_property_audio_delay(void *ctx, struct m_property *prop, return mp_property_generic_option(mpctx, prop, action, arg); } -static int property_codec_info(MPContext *mpctx, struct m_property *prop, - int action, void *arg, enum stream_type st) -{ - struct track *track = mpctx->current_track[0][st]; - if (!track || !track->stream) - return M_PROPERTY_UNAVAILABLE; - - struct m_sub_property props[] = { - {"name", SUB_PROP_STR(track->stream->codec->codec), - .unavailable = !track->stream->codec->codec}, - {"desc", SUB_PROP_STR(track->stream->codec->codec_desc), - .unavailable = !track->stream->codec->codec_desc}, - {"profile", SUB_PROP_STR(track->stream->codec->codec_profile), - .unavailable = !track->stream->codec->codec_profile}, - {0} - }; - - return m_property_read_sub(props, action, arg); -} - -static int mp_property_audio_codec_info(void *ctx, struct m_property *prop, - int action, void *arg) -{ - return property_codec_info(ctx, prop, action, arg, STREAM_AUDIO); -} - static int property_audiofmt(struct mp_aframe *fmt, int action, void *arg) { if (!fmt || !mp_aframe_config_is_valid(fmt)) @@ -2272,12 +2246,6 @@ static int mp_property_frame_count(void *ctx, struct m_property *prop, return m_property_int_ro(action, arg, frames); } -static int mp_property_video_codec_info(void *ctx, struct m_property *prop, - int action, void *arg) -{ - return property_codec_info(ctx, prop, action, arg, STREAM_VIDEO); -} - static const char *get_aspect_ratio_name(double ratio) { // Depending on cropping/mastering exact ratio may differ. @@ -4019,9 +3987,8 @@ static const struct m_property mp_properties_base[] = { {"ao-volume", mp_property_ao_volume}, {"ao-mute", mp_property_ao_mute}, {"audio-delay", mp_property_audio_delay}, - {"audio-codec-info", mp_property_audio_codec_info}, - M_PROPERTY_ALIAS("audio-codec-name", "audio-codec-info/name"), - M_PROPERTY_ALIAS("audio-codec", "audio-codec-info/desc"), + M_PROPERTY_ALIAS("audio-codec-name", "current-tracks/audio/codec"), + M_PROPERTY_ALIAS("audio-codec", "current-tracks/audio/codec-desc"), {"audio-params", mp_property_audio_params}, {"audio-out-params", mp_property_audio_out_params}, {"aid", property_switch_track, .priv = (void *)(const int[]){0, STREAM_AUDIO}}, @@ -4035,9 +4002,8 @@ static const struct m_property mp_properties_base[] = { {"video-dec-params", mp_property_dec_imgparams}, {"video-params", mp_property_vd_imgparams}, {"video-frame-info", mp_property_video_frame_info}, - {"video-codec-info", mp_property_video_codec_info}, - M_PROPERTY_ALIAS("video-format", "video-codec-info/name"), - M_PROPERTY_ALIAS("video-codec", "video-codec-info/desc"), + M_PROPERTY_ALIAS("video-format", "current-tracks/video/codec"), + M_PROPERTY_ALIAS("video-codec", "current-tracks/video/codec-desc"), M_PROPERTY_ALIAS("dwidth", "video-out-params/dw"), M_PROPERTY_ALIAS("dheight", "video-out-params/dh"), M_PROPERTY_ALIAS("width", "video-params/w"), @@ -4183,10 +4149,10 @@ static const char *const *const mp_event_property_change[] = { "video-format", "video-codec", "video-bitrate", "dwidth", "dheight", "width", "height", "container-fps", "aspect", "aspect-name", "vo-configured", "current-vo", "video-dec-params", "osd-dimensions", "hwdec", "hwdec-current", "hwdec-interop", - "window-id", "video-codec-info"), + "window-id", "track-list", "current-tracks"), E(MPV_EVENT_AUDIO_RECONFIG, "audio-format", "audio-codec", "audio-bitrate", "samplerate", "channels", "audio", "volume", "volume-gain", "mute", - "current-ao", "audio-codec-name", "audio-params", "audio-codec-info", + "current-ao", "audio-codec-name", "audio-params", "track-list", "current-tracks", "audio-out-params", "volume-max", "volume-gain-min", "volume-gain-max", "mixer-active"), E(MPV_EVENT_SEEK, "seeking", "core-idle", "eof-reached"), E(MPV_EVENT_PLAYBACK_RESTART, "seeking", "core-idle", "eof-reached"), @@ -6605,7 +6571,7 @@ static void cmd_context_menu(void *p) struct mp_cmd_ctx *cmd = p; struct MPContext *mpctx = cmd->mpctx; struct vo *vo = mpctx->video_out; - + if (vo) vo_control(vo, VOCTRL_SHOW_MENU, NULL); } diff --git a/player/lua/stats.lua b/player/lua/stats.lua index 549ad1d03f..3d093c7e2e 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -892,9 +892,9 @@ local function add_video(s) end append(s, "", {prefix=o.nl .. o.nl .. "Video:", nl="", indent=""}) - local ci = mp.get_property_native("video-codec-info") - if ci and append(s, ci["desc"], {prefix_sep="", nl="", indent=""}) then - append(s, ci["profile"], {prefix="[", nl="", indent=" ", prefix_sep="", + local track = mp.get_property_native("current-tracks/video") + if track and append(s, track["codec-desc"], {prefix_sep="", nl="", indent=""}) then + append(s, track["codec-profile"], {prefix="[", nl="", indent=" ", prefix_sep="", no_prefix_markup=true, suffix="]"}) append_property(s, "hwdec-current", {prefix="HW:", nl="", indent=o.prefix_sep .. o.prefix_sep, @@ -948,10 +948,10 @@ local function add_audio(s) end append(s, "", {prefix=o.nl .. o.nl .. "Audio:", nl="", indent=""}) - local ci = mp.get_property_native("audio-codec-info") - if ci then - append(s, ci["desc"], {prefix_sep="", nl="", indent=""}) - append(s, ci["profile"], {prefix="[", nl="", indent=" ", prefix_sep="", + local track = mp.get_property_native("current-tracks/audio") + if track then + append(s, track["codec-desc"], {prefix_sep="", nl="", indent=""}) + append(s, track["codec-profile"], {prefix="[", nl="", indent=" ", prefix_sep="", no_prefix_markup=true, suffix="]"}) end append_property(s, "current-ao", {prefix="AO:", nl="", |