Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Himangi Saraogi authored on 2015/03/26 08:05:28... | ... |
@@ -38,6 +38,7 @@ typedef struct { |
38 | 38 |
int first_field; |
39 | 39 |
char *pattern; |
40 | 40 |
unsigned int pattern_pos; |
41 |
+ int64_t start_time; |
|
41 | 42 |
|
42 | 43 |
AVRational pts; |
43 | 44 |
double ts_unit; |
... | ... |
@@ -89,6 +90,8 @@ static av_cold int init(AVFilterContext *ctx) |
89 | 89 |
s->pts.den += *p - '0'; |
90 | 90 |
} |
91 | 91 |
|
92 |
+ s->start_time = AV_NOPTS_VALUE; |
|
93 |
+ |
|
92 | 94 |
s->out_cnt = (max + 1) / 2; |
93 | 95 |
av_log(ctx, AV_LOG_INFO, "Telecine pattern %s yields up to %d frames per frame, pts advance factor: %d/%d\n", |
94 | 96 |
s->pattern, s->out_cnt, s->pts.num, s->pts.den); |
... | ... |
@@ -173,6 +176,9 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) |
173 | 173 |
TelecineContext *s = ctx->priv; |
174 | 174 |
int i, len, ret = 0, nout = 0; |
175 | 175 |
|
176 |
+ if (s->start_time == AV_NOPTS_VALUE) |
|
177 |
+ s->start_time = inpicref->pts; |
|
178 |
+ |
|
176 | 179 |
len = s->pattern[s->pattern_pos] - '0'; |
177 | 180 |
|
178 | 181 |
s->pattern_pos++; |
... | ... |
@@ -235,7 +241,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) |
235 | 235 |
return AVERROR(ENOMEM); |
236 | 236 |
} |
237 | 237 |
|
238 |
- frame->pts = outlink->frame_count * s->ts_unit; |
|
238 |
+ frame->pts = ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) + |
|
239 |
+ outlink->frame_count * s->ts_unit; |
|
239 | 240 |
ret = ff_filter_frame(outlink, frame); |
240 | 241 |
} |
241 | 242 |
av_frame_free(&inpicref); |