From 5fcf4b46f7e1eea43a2e675a6be3fa99c2dd4dd6 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 17 Feb 2014 02:52:26 +0100 Subject: client API: add events for video and audio reconfig --- player/audio.c | 3 +++ player/client.c | 2 ++ player/core.h | 2 ++ player/playloop.c | 2 +- player/video.c | 4 ++++ 5 files changed, 12 insertions(+), 1 deletion(-) (limited to 'player') diff --git a/player/audio.c b/player/audio.c index 39e1eddabd..ed4d0f5f2a 100644 --- a/player/audio.c +++ b/player/audio.c @@ -39,6 +39,7 @@ #include "video/decode/dec_video.h" #include "core.h" +#include "command.h" static int build_afilter_chain(struct MPContext *mpctx) { @@ -111,6 +112,8 @@ void reinit_audio_chain(struct MPContext *mpctx) goto no_audio; } + mp_notify(mpctx, MPV_EVENT_AUDIO_RECONFIG, NULL); + if (!(mpctx->initialized_flags & INITIALIZED_ACODEC)) { mpctx->initialized_flags |= INITIALIZED_ACODEC; assert(!mpctx->d_audio); diff --git a/player/client.c b/player/client.c index 79f8f91324..f63611f79c 100644 --- a/player/client.c +++ b/player/client.c @@ -842,6 +842,8 @@ static const char *event_table[] = { [MPV_EVENT_TICK] = "tick", [MPV_EVENT_SCRIPT_INPUT_DISPATCH] = "script-input-dispatch", [MPV_EVENT_CLIENT_MESSAGE] = "client-message", + [MPV_EVENT_VIDEO_RECONFIG] = "video-reconfig", + [MPV_EVENT_AUDIO_RECONFIG] = "audio-reconfig", }; const char *mpv_event_name(mpv_event_id event) diff --git a/player/core.h b/player/core.h index 12f248dcc2..9048685827 100644 --- a/player/core.h +++ b/player/core.h @@ -21,6 +21,8 @@ #include +#include "libmpv/client.h" + #include "common/common.h" #include "options/options.h" #include "sub/osd.h" diff --git a/player/playloop.c b/player/playloop.c index 57d5281240..261deaf217 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -51,7 +51,6 @@ #include "core.h" #include "screenshot.h" #include "command.h" -#include "libmpv/client.h" #define WAKEUP_PERIOD 0.5 @@ -893,6 +892,7 @@ void handle_force_window(struct MPContext *mpctx, bool reconfig) }; vo_reconfig(vo, &p, 0); redraw_osd(mpctx); + mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL); } } diff --git a/player/video.c b/player/video.c index 9ca5e9e697..348954c855 100644 --- a/player/video.c +++ b/player/video.c @@ -72,6 +72,10 @@ static void reconfig_video(struct MPContext *mpctx, set_allowed_vo_formats(d_video->vfilter, mpctx->video_out); + // The event should happen _after_ filter and VO reconfig. Since we don't + // have any fine grained locking, this is just as good. + mp_notify(mpctx, MPV_EVENT_VIDEO_RECONFIG, NULL); + if (video_reconfig_filters(d_video, params) < 0) { // Most video filters don't work with hardware decoding, so this // might be the reason filter reconfig failed. -- cgit v1.2.3