summaryrefslogtreecommitdiffstats
path: root/TOOLS/vf_dlopen/telecine.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-10-16 07:30:30 +0200
committerwm4 <wm4@nowhere>2012-10-16 07:30:30 +0200
commit4e89851aa128a614f59ff4885af384a266cb24e6 (patch)
treec6ab9f34ef3e9c1d58f8ec837b93e249e79bdcf6 /TOOLS/vf_dlopen/telecine.c
parentf45eab6faea05834c1337175dbe51437707b8d7e (diff)
parent6557f206efeb4569a42f1e4810172bc97fd64619 (diff)
downloadmpv-4e89851aa128a614f59ff4885af384a266cb24e6.tar.bz2
mpv-4e89851aa128a614f59ff4885af384a266cb24e6.tar.xz
Merge branch 'master' into osd_changes
Conflicts: Makefile command.c libvo/gl_common.c libvo/vo_corevideo.m libvo/vo_opengl.c libvo/vo_opengl_old.c libvo/vo_opengl_shaders.glsl sub/ass_mp.c sub/osd_libass.c sub/sd_ass.c
Diffstat (limited to 'TOOLS/vf_dlopen/telecine.c')
-rw-r--r--TOOLS/vf_dlopen/telecine.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/TOOLS/vf_dlopen/telecine.c b/TOOLS/vf_dlopen/telecine.c
index 109fef2d6b..1b3db26a20 100644
--- a/TOOLS/vf_dlopen/telecine.c
+++ b/TOOLS/vf_dlopen/telecine.c
@@ -11,7 +11,7 @@
/*
* telecine filter
*
- * usage: -vf dlopen=./telecine.so:t:32
+ * usage: -vf dlopen=./telecine.so:t:23
*
* Parameter: first parameter is "t" for top field first, "b" for bottom field first
* then digits (0-9) for how many fields a frame is to be displayed
@@ -44,6 +44,7 @@ typedef struct {
int occupied;
double lastpts_in;
double lastpts_out;
+ int first_frame_of_group;
} tc_data_t;
static int tc_config(struct vf_dlopen_context *ctx)
@@ -116,9 +117,9 @@ static int tc_put_image(struct vf_dlopen_context *ctx)
if (tc->pattern_pos == 0 && !tc->occupied) {
// at the start of the pattern, reset pts
- double newpts = ctx->inpic.pts - (delta * tc->pts_num) / tc->pts_denom;
- // printf("pts reset: %f -> %f (delta: %f)\n", tc->lastpts_out, newpts, newpts - tc->lastpts_out);
- tc->lastpts_out = newpts;
+ // printf("pts reset: %f -> %f (delta: %f)\n", tc->lastpts_out, ctx->inpic.pts, ctx->inpic.pts - tc->lastpts_out);
+ tc->lastpts_out = ctx->inpic.pts;
+ tc->first_frame_of_group = 1;
}
++tc->pattern_pos;
if (!tc->pattern[tc->pattern_pos])
@@ -150,7 +151,10 @@ static int tc_put_image(struct vf_dlopen_context *ctx)
(ctx->inpic.planeheight[p] - !tc->firstfield + 1) / 2
);
}
- tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
+ if (tc->first_frame_of_group)
+ tc->first_frame_of_group = 0;
+ else
+ tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
ctx->outpic[nout].pts = tc->lastpts_out;
// printf("pts written: %f\n", ctx->outpic[nout].pts);
++nout;
@@ -167,7 +171,10 @@ static int tc_put_image(struct vf_dlopen_context *ctx)
MIN(ctx->inpic.planestride[p], ctx->outpic[nout].planestride[p]),
ctx->inpic.planeheight[p]
);
- tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
+ if (tc->first_frame_of_group)
+ tc->first_frame_of_group = 0;
+ else
+ tc->lastpts_out += (delta * tc->pts_num) / tc->pts_denom;
ctx->outpic[nout].pts = tc->lastpts_out;
// printf("pts written: %f\n", ctx->outpic[nout].pts);
++nout;