0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

command: add a property to signal whether networking is used

Requested. The property semantics are a bit muddy due to lack of effort.
Anticipated use is different display of cache status, so it should not
matter anyway.
This commit is contained in:
wm4 2017-03-24 15:31:01 +01:00
parent 8de7ba6dfd
commit b9e4fb952d
2 changed files with 20 additions and 0 deletions

View File

@ -1224,6 +1224,14 @@ Property list
Returns ``yes`` if the demuxer is idle, which means the demuxer cache is
filled to the requested amount, and is currently not reading more data.
``demuxer-via-network``
Returns ``yes`` if the stream demuxed via the main demuxer is most likely
played via network. What constitutes "network" is not always clear, might
be used for other types of untrusted streams, could be wrong in certain
cases, and its definition might be changing. Also, external files (like
separate audio files or streams) do not influence the value of this
property (currently).
``paused-for-cache``
Returns ``yes`` when playback is paused because of waiting for the cache.

View File

@ -1742,6 +1742,17 @@ static int mp_property_cache_buffering(void *ctx, struct m_property *prop,
return m_property_int_ro(action, arg, state);
}
static int mp_property_demuxer_is_network(void *ctx, struct m_property *prop,
int action, void *arg)
{
MPContext *mpctx = ctx;
if (!mpctx->demuxer)
return M_PROPERTY_UNAVAILABLE;
return m_property_flag_ro(action, arg, mpctx->demuxer->is_network);
}
static int mp_property_clock(void *ctx, struct m_property *prop,
int action, void *arg)
{
@ -3906,6 +3917,7 @@ static const struct m_property mp_properties_base[] = {
{"demuxer-cache-idle", mp_property_demuxer_cache_idle},
{"cache-buffering-state", mp_property_cache_buffering},
{"paused-for-cache", mp_property_paused_for_cache},
{"demuxer-via-network", mp_property_demuxer_is_network},
{"clock", mp_property_clock},
{"seekable", mp_property_seekable},
{"partially-seekable", mp_property_partially_seekable},