diff --git a/DOCS/interface-changes/packet-bitrate.txt b/DOCS/interface-changes/packet-bitrate.txt new file mode 100644 index 0000000000000..2c2dc3dcb47b7 --- /dev/null +++ b/DOCS/interface-changes/packet-bitrate.txt @@ -0,0 +1 @@ +remove deprecated `packet-video-bitrate` `packet-audio-bitrate` and `packet-sub-bitrate` properties diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index b4c9706d40d90..d71d705e2b734 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -3479,14 +3479,6 @@ Property list In earlier versions of mpv, these properties returned a static (but bad) guess using a completely different method. -``packet-video-bitrate``, ``packet-audio-bitrate``, ``packet-sub-bitrate`` - Old and deprecated properties for ``video-bitrate``, ``audio-bitrate``, - ``sub-bitrate``. They behave exactly the same, but return a value in - kilobits. Also, they don't have any OSD formatting, though the same can be - achieved with e.g. ``${=video-bitrate}``. - - These properties shouldn't be used anymore. - ``audio-device-list`` The list of discovered audio devices. This is mostly for use with the client API, and reflects what ``--audio-device=help`` with the command line diff --git a/player/command.c b/player/command.c index e109108573786..c97d3d16ba39b 100644 --- a/player/command.c +++ b/player/command.c @@ -3340,8 +3340,7 @@ static int mp_property_packet_bitrate(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; - int type = (uintptr_t)prop->priv & ~0x100; - bool old = (uintptr_t)prop->priv & 0x100; + int type = *(int *)prop->priv; struct demuxer *demuxer = NULL; if (mpctx->current_track[0][type]) @@ -3359,10 +3358,6 @@ static int mp_property_packet_bitrate(void *ctx, struct m_property *prop, // r[type] is in bytes/second -> bits double rate = r[type] * 8; - // Same story, but used kilobits for some reason. - if (old) - return m_property_int64_ro(action, arg, llrint(rate / 1000.0)); - if (action == M_PROPERTY_PRINT) { rate /= 1000; if (rate < 1000) { @@ -4133,15 +4128,9 @@ static const struct m_property mp_properties_base[] = { {"ab-loop-a", mp_property_ab_loop}, {"ab-loop-b", mp_property_ab_loop}, -#define PROPERTY_BITRATE(name, old, type) \ - {name, mp_property_packet_bitrate, (void *)(uintptr_t)((type)|(old?0x100:0))} - PROPERTY_BITRATE("packet-video-bitrate", true, STREAM_VIDEO), - PROPERTY_BITRATE("packet-audio-bitrate", true, STREAM_AUDIO), - PROPERTY_BITRATE("packet-sub-bitrate", true, STREAM_SUB), - - PROPERTY_BITRATE("video-bitrate", false, STREAM_VIDEO), - PROPERTY_BITRATE("audio-bitrate", false, STREAM_AUDIO), - PROPERTY_BITRATE("sub-bitrate", false, STREAM_SUB), + {"video-bitrate", mp_property_packet_bitrate, .priv = (void *)&(const int){STREAM_VIDEO}}, + {"audio-bitrate", mp_property_packet_bitrate, .priv = (void *)&(const int){STREAM_AUDIO}}, + {"sub-bitrate", mp_property_packet_bitrate, .priv = (void *)&(const int){STREAM_SUB}}, {"focused", mp_property_focused}, {"display-names", mp_property_display_names}, diff --git a/player/lua/stats.lua b/player/lua/stats.lua index 5d59e5c76c433..17f1e8df66d4f 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -993,7 +993,7 @@ local function add_video(s) end append_img_params(s, r, ro) append_hdr(s, ro) - append_property(s, "packet-video-bitrate", {prefix="Bitrate:", suffix=" kbps"}) + append_property(s, "video-bitrate", {prefix="Bitrate:"}) append_filters(s, "vf", "Filters:") end @@ -1038,7 +1038,7 @@ local function add_audio(s) append(s, merge(r, ro, "format"), {prefix="Format:", nl=cc and "" or o.nl, indent=cc and o.prefix_sep .. o.prefix_sep}) append(s, merge(r, ro, "samplerate"), {prefix="Sample Rate:", suffix=" Hz"}) - append_property(s, "packet-audio-bitrate", {prefix="Bitrate:", suffix=" kbps"}) + append_property(s, "audio-bitrate", {prefix="Bitrate:"}) append_filters(s, "af", "Filters:") end