diff options
author | wm4 <wm4@nowhere> | 2014-02-28 01:31:38 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-02-28 01:31:38 +0100 |
commit | c30bf22d8d31336696430406b0483bfc9821c8bb (patch) | |
tree | 20686c0dee0993bc01199f8e87150c6622319a9a | |
parent | 1852555ca1100e06e970a9c9703ebcb045ff6006 (diff) | |
download | mpv-c30bf22d8d31336696430406b0483bfc9821c8bb.tar.bz2 mpv-c30bf22d8d31336696430406b0483bfc9821c8bb.tar.xz |
client API: rename MPV_EVENT_PLAYBACK_START, add MPV_EVENT_SEEK
Rename MPV_EVENT_PLAYBACK_START to MPV_EVENT_FILE_LOADED.
Add MPV_EVENT_SEEK and MPV_EVENT_PLAYBACK_RESTART.
-rw-r--r-- | libmpv/client.h | 16 | ||||
-rw-r--r-- | player/client.c | 4 | ||||
-rw-r--r-- | player/loadfile.c | 2 | ||||
-rw-r--r-- | player/playloop.c | 5 |
4 files changed, 23 insertions, 4 deletions
diff --git a/libmpv/client.h b/libmpv/client.h index 0c0cde7b0f..b211eea69d 100644 --- a/libmpv/client.h +++ b/libmpv/client.h @@ -768,7 +768,7 @@ typedef enum mpv_event_id { * Notification when the file has been loaded (headers were read etc.), and * decoding starts. */ - MPV_EVENT_PLAYBACK_START = 8, + MPV_EVENT_FILE_LOADED = 8, /** * The list of video/audio/subtitle tracks was changed. */ @@ -831,7 +831,19 @@ typedef enum mpv_event_id { * unspecified whether this happens on file start or only when it changes * within a file.) */ - MPV_EVENT_METADATA_UPDATE = 19 + MPV_EVENT_METADATA_UPDATE = 19, + /** + * Happens when a seek was initiated. Playback stops. Usually it will + * resume with MPV_EVENT_PLAYBACK_START as soon as the seek is finished. + */ + MPV_EVENT_SEEK = 20, + /** + * There was a discontinuity of some sort (like a seek), and playback + * was reinitialized. Usually happens after seeking, or ordered chapter + * segment switches. The main purpose is allowing the client to detect + * when a seek request is finished. + */ + MPV_EVENT_PLAYBACK_RESTART = 21 } mpv_event_id; /** diff --git a/player/client.c b/player/client.c index c1e665a9fb..824389335d 100644 --- a/player/client.c +++ b/player/client.c @@ -997,7 +997,7 @@ static const char *event_table[] = { [MPV_EVENT_COMMAND_REPLY] = "command-reply", [MPV_EVENT_START_FILE] = "start-file", [MPV_EVENT_END_FILE] = "end-file", - [MPV_EVENT_PLAYBACK_START] = "playback-start", + [MPV_EVENT_FILE_LOADED] = "file-loaded", [MPV_EVENT_TRACKS_CHANGED] = "tracks-changed", [MPV_EVENT_TRACK_SWITCHED] = "track-switched", [MPV_EVENT_IDLE] = "idle", @@ -1009,6 +1009,8 @@ static const char *event_table[] = { [MPV_EVENT_VIDEO_RECONFIG] = "video-reconfig", [MPV_EVENT_AUDIO_RECONFIG] = "audio-reconfig", [MPV_EVENT_METADATA_UPDATE] = "metadata-update", + [MPV_EVENT_SEEK] = "seek", + [MPV_EVENT_PLAYBACK_RESTART] = "playback-restart", }; const char *mpv_event_name(mpv_event_id event) diff --git a/player/loadfile.c b/player/loadfile.c index 90b2484ccf..28c4c4f146 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1341,7 +1341,7 @@ goto_reopen_demuxer: ; if (mpctx->opts->pause) pause_player(mpctx, PAUSE_BY_COMMAND); - mp_notify(mpctx, MPV_EVENT_PLAYBACK_START, NULL); + mp_notify(mpctx, MPV_EVENT_FILE_LOADED, NULL); playback_start = mp_time_sec(); mpctx->error_playing = false; diff --git a/player/playloop.c b/player/playloop.c index d1d15ca192..0989b5116c 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -208,6 +208,8 @@ static void seek_reset(struct MPContext *mpctx, bool reset_ao) #if HAVE_ENCODING encode_lavc_discontinuity(mpctx->encode_lavc_ctx); #endif + + mp_notify(mpctx, MPV_EVENT_SEEK, NULL); } // return -1 if seek failed (non-seekable stream?), 0 otherwise @@ -1167,6 +1169,7 @@ void run_playloop(struct MPContext *mpctx) if (mpctx->d_audio) fill_audio_out_buffers(mpctx, endpts); mpctx->restart_playback = false; + mp_notify(mpctx, MPV_EVENT_PLAYBACK_RESTART, NULL); } mpctx->time_frame = 0; get_relative_time(mpctx); @@ -1207,6 +1210,8 @@ void run_playloop(struct MPContext *mpctx) mpctx->opts->playback_speed * buffered_audio); } mpctx->playback_pts = a_pos; + if (was_restart) + mp_notify(mpctx, MPV_EVENT_PLAYBACK_RESTART, NULL); } update_subtitles(mpctx); |