summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-02-17 02:52:26 +0100
committerwm4 <wm4@nowhere>2014-02-17 02:52:59 +0100
commit5fcf4b46f7e1eea43a2e675a6be3fa99c2dd4dd6 (patch)
treee46f60111fa1655b6c9b394330050eaa84d2b9ab /player
parentb3b59b9a2d51d57656eda965d02762131b0bd5b7 (diff)
downloadmpv-5fcf4b46f7e1eea43a2e675a6be3fa99c2dd4dd6.tar.bz2
mpv-5fcf4b46f7e1eea43a2e675a6be3fa99c2dd4dd6.tar.xz
client API: add events for video and audio reconfig
Diffstat (limited to 'player')
-rw-r--r--player/audio.c3
-rw-r--r--player/client.c2
-rw-r--r--player/core.h2
-rw-r--r--player/playloop.c2
-rw-r--r--player/video.c4
5 files changed, 12 insertions, 1 deletions
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 <stdbool.h>
+#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.