summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-29 15:08:05 +0100
committerwm4 <wm4@nowhere>2013-11-29 15:08:05 +0100
commit2ec629bedec47be21da0742126ca4c6122186ccb (patch)
treea558ad715ec0a8e00c48b1585f5ebadff359081a /video
parent54f15bd3779041aef105aa51c491065ae722bb09 (diff)
downloadmpv-2ec629bedec47be21da0742126ca4c6122186ccb.tar.bz2
mpv-2ec629bedec47be21da0742126ca4c6122186ccb.tar.xz
vf_pullup: properly reset on seek
Sometimes, vf_pullup hanged on seek. This was because it never was properly reset. Old timestamps messed up the timestamp calculations, which made the player show frames for a ridiculously long time, which is perceived as pausing or hanging.
Diffstat (limited to 'video')
-rw-r--r--video/filter/vf_pullup.c51
1 files changed, 37 insertions, 14 deletions
diff --git a/video/filter/vf_pullup.c b/video/filter/vf_pullup.c
index 163ad70ed4..e22266bd16 100644
--- a/video/filter/vf_pullup.c
+++ b/video/filter/vf_pullup.c
@@ -41,8 +41,29 @@ struct vf_priv_s {
int fakecount;
char *qbuf;
double lastpts;
+ char *args;
};
+static void reset(struct vf_instance *vf)
+{
+ if (vf->priv->ctx)
+ pullup_free_context(vf->priv->ctx);
+ free(vf->priv->qbuf);
+ vf->priv->qbuf = NULL;
+ vf->priv->init = 0;
+ struct pullup_context *c;
+ vf->priv->ctx = c = pullup_alloc_context();
+ vf->priv->fakecount = 1;
+ c->verbose = verbose>0;
+ c->junk_left = c->junk_right = 1;
+ c->junk_top = c->junk_bottom = 4;
+ c->strict_breaks = 0;
+ c->metric_plane = 0;
+ if (vf->priv->args) {
+ sscanf(vf->priv->args, "%d:%d:%d:%d:%d:%d", &c->junk_left, &c->junk_right, &c->junk_top, &c->junk_bottom, &c->strict_breaks, &c->metric_plane);
+ }
+}
+
static void init_pullup(struct vf_instance *vf, mp_image_t *mpi)
{
struct pullup_context *c = vf->priv->ctx;
@@ -230,6 +251,7 @@ static int config(struct vf_instance *vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
+ reset(vf);
if (height&3) return 0;
return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt);
}
@@ -240,25 +262,26 @@ static void uninit(struct vf_instance *vf)
free(vf->priv);
}
-static int vf_open(vf_instance_t *vf, char *args)
+static int control(vf_instance_t *vf, int request, void *data)
{
- struct vf_priv_s *p;
- struct pullup_context *c;
+ switch (request) {
+ case VFCTRL_SEEK_RESET:
+ reset(vf);
+ break;
+ }
+ return vf_next_control(vf, request, data);
+}
+
+static int vf_open(vf_instance_t *vf, char *args)
+{;
vf->filter = filter;
vf->config = config;
vf->query_format = query_format;
+ vf->control = control;
vf->uninit = uninit;
- vf->priv = p = calloc(1, sizeof(struct vf_priv_s));
- p->ctx = c = pullup_alloc_context();
- p->fakecount = 1;
- c->verbose = verbose>0;
- c->junk_left = c->junk_right = 1;
- c->junk_top = c->junk_bottom = 4;
- c->strict_breaks = 0;
- c->metric_plane = 0;
- if (args) {
- sscanf(args, "%d:%d:%d:%d:%d:%d", &c->junk_left, &c->junk_right, &c->junk_top, &c->junk_bottom, &c->strict_breaks, &c->metric_plane);
- }
+ vf->priv = calloc(1, sizeof(struct vf_priv_s));
+ vf->priv->args = talloc_strdup(vf, args);
+ reset(vf);
return 1;
}