summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-08-31 12:48:36 +0200
committerwm4 <wm4@nowhere>2018-08-31 12:55:22 +0200
commit559a400ac36e75a8d73ba263fd7fa6736df1c2da (patch)
tree5e117d0ddfd279cae346fc334d4c3f9262509fef /player/command.c
parent5f83b6a5f5939ce39af929f200b1ea236fbe350c (diff)
downloadmpv-559a400ac36e75a8d73ba263fd7fa6736df1c2da.tar.bz2
mpv-559a400ac36e75a8d73ba263fd7fa6736df1c2da.tar.xz
demux, stream: rip out the classic stream cache
The demuxer cache is the only cache now. Might need another change to combat seeking failures in mp4 etc. The only bad thing is the loss of cache-speed, which was sort of nice to have.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c134
1 files changed, 0 insertions, 134 deletions
diff --git a/player/command.c b/player/command.c
index f556e7211d..ab9a09fcac 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1559,134 +1559,6 @@ static int mp_property_playback_abort(void *ctx, struct m_property *prop,
return m_property_flag_ro(action, arg, !mpctx->playing || mpctx->stop_play);
}
-static int mp_property_cache(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- float cache = mp_get_cache_percent(mpctx);
- if (cache < 0)
- return M_PROPERTY_UNAVAILABLE;
-
- if (action == M_PROPERTY_PRINT) {
- *(char **)arg = talloc_asprintf(NULL, "%d", (int)cache);
- return M_PROPERTY_OK;
- }
-
- return m_property_float_ro(action, arg, cache);
-}
-
-static int property_int_kb_size(int kb_size, int action, void *arg)
-{
- switch (action) {
- case M_PROPERTY_GET:
- *(int *)arg = kb_size;
- return M_PROPERTY_OK;
- case M_PROPERTY_PRINT:
- *(char **)arg = format_file_size(kb_size * 1024LL);
- return M_PROPERTY_OK;
- case M_PROPERTY_GET_TYPE:
- *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_INT};
- return M_PROPERTY_OK;
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
-}
-
-static int mp_property_cache_size(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- struct demuxer *demuxer = mpctx->demuxer;
- if (!demuxer)
- return M_PROPERTY_UNAVAILABLE;
- switch (action) {
- case M_PROPERTY_GET:
- case M_PROPERTY_PRINT: {
- struct stream_cache_info info = {0};
- demux_stream_control(demuxer, STREAM_CTRL_GET_CACHE_INFO, &info);
- if (info.size <= 0)
- break;
- return property_int_kb_size(info.size / 1024, action, arg);
- }
- case M_PROPERTY_GET_TYPE:
- *(struct m_option *)arg = (struct m_option){
- .type = CONF_TYPE_INT,
- .flags = M_OPT_MIN,
- .min = 0,
- };
- return M_PROPERTY_OK;
- case M_PROPERTY_SET: {
- int64_t size = *(int *)arg * 1024LL;
- int r = demux_stream_control(demuxer, STREAM_CTRL_SET_CACHE_SIZE, &size);
- if (r == STREAM_UNSUPPORTED)
- break;
- if (r == STREAM_OK)
- return M_PROPERTY_OK;
- return M_PROPERTY_ERROR;
- }
- }
- return M_PROPERTY_NOT_IMPLEMENTED;
-}
-
-static int mp_property_cache_used(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- if (!mpctx->demuxer)
- return M_PROPERTY_UNAVAILABLE;
-
- struct stream_cache_info info = {0};
- demux_stream_control(mpctx->demuxer, STREAM_CTRL_GET_CACHE_INFO, &info);
- if (info.size <= 0)
- return M_PROPERTY_UNAVAILABLE;
- return property_int_kb_size(info.fill / 1024, action, arg);
-}
-
-static int mp_property_cache_free(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- if (!mpctx->demuxer)
- return M_PROPERTY_UNAVAILABLE;
-
- struct stream_cache_info info = {0};
- demux_stream_control(mpctx->demuxer, STREAM_CTRL_GET_CACHE_INFO, &info);
- if (info.size <= 0)
- return M_PROPERTY_UNAVAILABLE;
-
- return property_int_kb_size((info.size - info.fill) / 1024, action, arg);
-}
-
-static int mp_property_cache_speed(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- if (!mpctx->demuxer)
- return M_PROPERTY_UNAVAILABLE;
-
- struct stream_cache_info info = {0};
- demux_stream_control(mpctx->demuxer, STREAM_CTRL_GET_CACHE_INFO, &info);
- if (info.size <= 0)
- return M_PROPERTY_UNAVAILABLE;
-
- if (action == M_PROPERTY_PRINT) {
- *(char **)arg = talloc_strdup_append(format_file_size(info.speed), "/s");
- return M_PROPERTY_OK;
- }
- return m_property_int64_ro(action, arg, info.speed);
-}
-
-static int mp_property_cache_idle(void *ctx, struct m_property *prop,
- int action, void *arg)
-{
- MPContext *mpctx = ctx;
- struct stream_cache_info info = {0};
- if (mpctx->demuxer)
- demux_stream_control(mpctx->demuxer, STREAM_CTRL_GET_CACHE_INFO, &info);
- if (info.size <= 0)
- return M_PROPERTY_UNAVAILABLE;
- return m_property_flag_ro(action, arg, info.idle);
-}
-
static int mp_property_demuxer_cache_duration(void *ctx, struct m_property *prop,
int action, void *arg)
{
@@ -3897,12 +3769,6 @@ static const struct m_property mp_properties_base[] = {
{"eof-reached", mp_property_eof_reached},
{"seeking", mp_property_seeking},
{"playback-abort", mp_property_playback_abort},
- {"cache-percent", mp_property_cache},
- {"cache-free", mp_property_cache_free},
- {"cache-used", mp_property_cache_used},
- {"cache-size", mp_property_cache_size},
- {"cache-idle", mp_property_cache_idle},
- {"cache-speed", mp_property_cache_speed},
{"demuxer-cache-duration", mp_property_demuxer_cache_duration},
{"demuxer-cache-time", mp_property_demuxer_cache_time},
{"demuxer-cache-idle", mp_property_demuxer_cache_idle},