This allows e.g. to correlate signalstats metadata to time position
without having to find out the filter chain timebase first.
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
... | ... |
@@ -30,6 +30,7 @@ |
30 | 30 |
#include "libavutil/eval.h" |
31 | 31 |
#include "libavutil/internal.h" |
32 | 32 |
#include "libavutil/opt.h" |
33 |
+#include "libavutil/timestamp.h" |
|
33 | 34 |
#include "avfilter.h" |
34 | 35 |
#include "audio.h" |
35 | 36 |
#include "formats.h" |
... | ... |
@@ -305,13 +306,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
305 | 305 |
break; |
306 | 306 |
case METADATA_PRINT: |
307 | 307 |
if (!s->key && e) { |
308 |
- s->print(ctx, "frame %"PRId64" pts %"PRId64"\n", inlink->frame_count, frame->pts); |
|
308 |
+ s->print(ctx, "frame %"PRId64" pts %"PRId64" pts_time %s\n", |
|
309 |
+ inlink->frame_count, frame->pts, av_ts2timestr(frame->pts, &inlink->time_base)); |
|
309 | 310 |
s->print(ctx, "%s=%s\n", e->key, e->value); |
310 | 311 |
while ((e = av_dict_get(metadata, "", e, AV_DICT_IGNORE_SUFFIX)) != NULL) { |
311 | 312 |
s->print(ctx, "%s=%s\n", e->key, e->value); |
312 | 313 |
} |
313 | 314 |
} else if (e && e->value && (!s->value || (e->value && s->compare(s, e->value, s->value)))) { |
314 |
- s->print(ctx, "frame %"PRId64" pts %"PRId64"\n", inlink->frame_count, frame->pts); |
|
315 |
+ s->print(ctx, "frame %"PRId64" pts %"PRId64" pts_time %s\n", |
|
316 |
+ inlink->frame_count, frame->pts, av_ts2timestr(frame->pts, &inlink->time_base)); |
|
315 | 317 |
s->print(ctx, "%s=%s\n", s->key, e->value); |
316 | 318 |
} |
317 | 319 |
return ff_filter_frame(outlink, frame); |