Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimangi Saraogi <himangi774@gmail.com>2015-03-26 02:05:28 +0300
committerMichael Niedermayer <michaelni@gmx.at>2015-03-26 02:41:54 +0300
commit1301aa55f6457ab3dbf88a6fe65627bda7c27c80 (patch)
treed2b8c10fd3ff7bd50955a336609bc131985b3be1 /libavfilter/vf_telecine.c
parent21adb9964e2a6160006412d2b85c02b9ce588f25 (diff)
avfilter/vf_telecine: Fix AV desync by using the first input timestamp
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_telecine.c')
-rw-r--r--libavfilter/vf_telecine.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavfilter/vf_telecine.c b/libavfilter/vf_telecine.c
index a0f28d4f35..c75395a327 100644
--- a/libavfilter/vf_telecine.c
+++ b/libavfilter/vf_telecine.c
@@ -38,6 +38,7 @@ typedef struct {
int first_field;
char *pattern;
unsigned int pattern_pos;
+ int64_t start_time;
AVRational pts;
double ts_unit;
@@ -89,6 +90,8 @@ static av_cold int init(AVFilterContext *ctx)
s->pts.den += *p - '0';
}
+ s->start_time = AV_NOPTS_VALUE;
+
s->out_cnt = (max + 1) / 2;
av_log(ctx, AV_LOG_INFO, "Telecine pattern %s yields up to %d frames per frame, pts advance factor: %d/%d\n",
s->pattern, s->out_cnt, s->pts.num, s->pts.den);
@@ -173,6 +176,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
TelecineContext *s = ctx->priv;
int i, len, ret = 0, nout = 0;
+ if (s->start_time == AV_NOPTS_VALUE)
+ s->start_time = inpicref->pts;
+
len = s->pattern[s->pattern_pos] - '0';
s->pattern_pos++;
@@ -235,7 +241,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref)
return AVERROR(ENOMEM);
}
- frame->pts = outlink->frame_count * s->ts_unit;
+ frame->pts = ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) +
+ outlink->frame_count * s->ts_unit;
ret = ff_filter_frame(outlink, frame);
}
av_frame_free(&inpicref);