summaryrefslogtreecommitdiffstats
path: root/mp_core.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-08-04 02:00:28 +0200
committerwm4 <wm4@nowhere>2012-08-04 19:56:23 +0200
commita4f7a3df50c82a427bde283aeb6a71f0faaec859 (patch)
treef4c6f79413f2af33e171df70496dab8cb92f7d9e /mp_core.h
parentc0abc94a4bf21a69b9e5dfd8d1b02e85b82bc063 (diff)
downloadmpv-a4f7a3df50c82a427bde283aeb6a71f0faaec859.tar.bz2
mpv-a4f7a3df50c82a427bde283aeb6a71f0faaec859.tar.xz
mplayer: fix idle mode regressions
Commit 89a17bcda6c16 simplified the idle loop to run any commands mplayer receives, not just playlist related commands. Unfortunately, it turns out many slave commands always assume the presence of a demuxer. MPContext->demuxer is assumed not to be NULL. This made the player crash when receiving slave commands like pause/unpause, chapter control, subtitle selection. We want mplayer being able to handle this. Any slave command or property, as long as it's backed by a persistent setting, should be run successfully, even if no file is being played. If the slave command doesn't make sense in this state, it shouldn't crash the player. Insert some NULL checks when accessing demuxers. If sh_video or sh_audio are not NULL, assume demuxer can't be NULL. (There actually aren't that many properties which need to be changed. If it gets too complicated, we could employ alternative mechanisms instead, such as explicitly marking safe properties with a flag.)
Diffstat (limited to 'mp_core.h')
-rw-r--r--mp_core.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/mp_core.h b/mp_core.h
index 49cc81a8e1..153869d620 100644
--- a/mp_core.h
+++ b/mp_core.h
@@ -104,6 +104,8 @@ typedef struct MPContext {
struct timeline_part *timeline;
int num_timeline_parts;
int timeline_part;
+ // NOTE: even if num_chapters==0, chapters being not NULL signifies presence
+ // of chapter metadata
struct chapter *chapters;
int num_chapters;
double video_offset;