summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-10 15:39:05 +0200
committerwm4 <wm4@nowhere>2013-09-10 15:39:05 +0200
commit328b95101971e407d9db031e1d6186ada0bd5a6e (patch)
tree6efae21e4c07c7a4f232b03adf3b0ffc5106b7d3
parent316dfb93d706b73d0129b6a5e1bed84d57c8cb2d (diff)
downloadmpv-328b95101971e407d9db031e1d6186ada0bd5a6e.tar.bz2
mpv-328b95101971e407d9db031e1d6186ada0bd5a6e.tar.xz
command: make title property unavailable if there's no support
Instead of returning 0 if the stream doesn't have title info, make the property unavailable.
-rw-r--r--mpvcore/command.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mpvcore/command.c b/mpvcore/command.c
index d986ae1a64..a5f66aae2b 100644
--- a/mpvcore/command.c
+++ b/mpvcore/command.c
@@ -559,10 +559,10 @@ static int mp_property_titles(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
struct demuxer *demuxer = mpctx->master_demuxer;
- if (!demuxer)
+ unsigned int num_titles;
+ if (!demuxer || stream_control(demuxer->stream, STREAM_CTRL_GET_NUM_TITLES,
+ &num_titles) < 1)
return M_PROPERTY_UNAVAILABLE;
- int num_titles = 0;
- stream_control(demuxer->stream, STREAM_CTRL_GET_NUM_TITLES, &num_titles);
return m_property_int_ro(prop, action, arg, num_titles);
}