mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
1852555ca1
commit
c30bf22d8d
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue