diff options
author | wm4 <wm4@nowhere> | 2018-09-07 22:26:48 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2019-09-19 20:37:04 +0200 |
commit | 5c7ecad93a771d71a773cace996afd706bbef3d2 (patch) | |
tree | 499b4e7d0baba5417180f94641bc355746ed108c /player/command.c | |
parent | b298140b07842bd3573866564ad30ddfef65638c (diff) | |
download | mpv-5c7ecad93a771d71a773cace996afd706bbef3d2.tar.bz2 mpv-5c7ecad93a771d71a773cace996afd706bbef3d2.tar.xz |
demux: simplify API for returning cache status
Instead of going through those weird DEMUXER_CTRLs, query this
information directly. I'm not sure which kind of brain damage made me
use CTRLs for these. Since there are no other DEMUXER_CTRLs that make
sense for the frontend, remove the remaining infrastructure for them
too.
Diffstat (limited to 'player/command.c')
-rw-r--r-- | player/command.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/player/command.c b/player/command.c index 3621fae90c..71238e4ae1 100644 --- a/player/command.c +++ b/player/command.c @@ -1423,9 +1423,8 @@ static int mp_property_cache_speed(void *ctx, struct m_property *prop, if (!mpctx->demuxer) return M_PROPERTY_UNAVAILABLE; - struct demux_ctrl_reader_state s; - if (demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_READER_STATE, &s) < 1) - return M_PROPERTY_UNAVAILABLE; + struct demux_reader_state s; + demux_get_reader_state(mpctx->demuxer, &s); uint64_t val = s.bytes_per_second; @@ -1443,9 +1442,8 @@ static int mp_property_demuxer_cache_duration(void *ctx, struct m_property *prop if (!mpctx->demuxer) return M_PROPERTY_UNAVAILABLE; - struct demux_ctrl_reader_state s; - if (demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_READER_STATE, &s) < 1) - return M_PROPERTY_UNAVAILABLE; + struct demux_reader_state s; + demux_get_reader_state(mpctx->demuxer, &s); if (s.ts_duration < 0) return M_PROPERTY_UNAVAILABLE; @@ -1460,9 +1458,8 @@ static int mp_property_demuxer_cache_time(void *ctx, struct m_property *prop, if (!mpctx->demuxer) return M_PROPERTY_UNAVAILABLE; - struct demux_ctrl_reader_state s; - if (demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_READER_STATE, &s) < 1) - return M_PROPERTY_UNAVAILABLE; + struct demux_reader_state s; + demux_get_reader_state(mpctx->demuxer, &s); if (s.ts_end == MP_NOPTS_VALUE) return M_PROPERTY_UNAVAILABLE; @@ -1477,9 +1474,8 @@ static int mp_property_demuxer_cache_idle(void *ctx, struct m_property *prop, if (!mpctx->demuxer) return M_PROPERTY_UNAVAILABLE; - struct demux_ctrl_reader_state s; - if (demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_READER_STATE, &s) < 1) - return M_PROPERTY_UNAVAILABLE; + struct demux_reader_state s; + demux_get_reader_state(mpctx->demuxer, &s); return m_property_flag_ro(action, arg, s.idle); } @@ -1498,9 +1494,8 @@ static int mp_property_demuxer_cache_state(void *ctx, struct m_property *prop, if (action != M_PROPERTY_GET) return M_PROPERTY_NOT_IMPLEMENTED; - struct demux_ctrl_reader_state s; - if (demux_control(mpctx->demuxer, DEMUXER_CTRL_GET_READER_STATE, &s) < 1) - return M_PROPERTY_UNAVAILABLE; + struct demux_reader_state s; + demux_get_reader_state(mpctx->demuxer, &s); struct mpv_node *r = (struct mpv_node *)arg; node_init(r, MPV_FORMAT_NODE_MAP, NULL); @@ -3035,8 +3030,7 @@ static int mp_property_packet_bitrate(void *ctx, struct m_property *prop, return M_PROPERTY_UNAVAILABLE; double r[STREAM_TYPE_COUNT]; - if (demux_control(demuxer, DEMUXER_CTRL_GET_BITRATE_STATS, &r) < 1) - return M_PROPERTY_UNAVAILABLE; + demux_get_bitrate_stats(demuxer, r); if (r[type] < 0) return M_PROPERTY_UNAVAILABLE; |