summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-29 15:08:05 +0100
committerwm4 <wm4@nowhere>2013-12-01 19:39:42 +0100
commit20e08ac84e1addaf659e8211e38235022bf8f96e (patch)
treeb8d3fa0341fe52bee40462f327ed7b96ec60d559
parent93518bc6527451d582d757393c6ec028493e25b6 (diff)
downloadmpv-20e08ac84e1addaf659e8211e38235022bf8f96e.tar.bz2
mpv-20e08ac84e1addaf659e8211e38235022bf8f96e.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.
-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 4d0fee6be6..e14f865bd2 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;
}