From 96aa9b5633f08fdd9c699b0047e95133639213ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Wed, 23 Oct 2019 14:31:16 +0300 Subject: [PATCH] timecodestamper: Add last-known-or-zero mode This uses the last known upstream timecode (counted up per frame), or otherwise zero if none was known. The normal last-known timestamp uses the internal timecode as fallback if no upstream timecode was ever known. --- gst/timecode/gsttimecodestamper.c | 10 ++++++++++ gst/timecode/gsttimecodestamper.h | 1 + 2 files changed, 11 insertions(+) diff --git a/gst/timecode/gsttimecodestamper.c b/gst/timecode/gsttimecodestamper.c index c8bea0ff33..58b1780d7d 100644 --- a/gst/timecode/gsttimecodestamper.c +++ b/gst/timecode/gsttimecodestamper.c @@ -156,6 +156,9 @@ gst_timecodestamper_source_get_type (void) {GST_TIME_CODE_STAMPER_SOURCE_LAST_KNOWN, "Count up from the last known upstream timecode or internal if unknown", "last-known"}, + {GST_TIME_CODE_STAMPER_SOURCE_LAST_KNOWN_OR_ZERO, + "Count up from the last known upstream timecode or zero if unknown", + "last-known-or-zero"}, {GST_TIME_CODE_STAMPER_SOURCE_LTC, "Linear timecode from an audio device", "ltc"}, {GST_TIME_CODE_STAMPER_SOURCE_RTC, @@ -1164,6 +1167,13 @@ gst_timecodestamper_transform_ip (GstBaseTransform * vfilter, if (!tc) tc = timecodestamper->internal_tc; break; + case GST_TIME_CODE_STAMPER_SOURCE_LAST_KNOWN_OR_ZERO: + tc = timecodestamper->last_tc; + if (!tc) { + tc = gst_video_time_code_new (timecodestamper->vinfo.fps_n, + timecodestamper->vinfo.fps_d, NULL, tc_flags, 0, 0, 0, 0, 0); + free_tc = TRUE; + } break; case GST_TIME_CODE_STAMPER_SOURCE_LTC: #if HAVE_LTC diff --git a/gst/timecode/gsttimecodestamper.h b/gst/timecode/gsttimecodestamper.h index 43617f65d6..6450e9d9c0 100644 --- a/gst/timecode/gsttimecodestamper.h +++ b/gst/timecode/gsttimecodestamper.h @@ -49,6 +49,7 @@ typedef enum GstTimeCodeStamperSource GST_TIME_CODE_STAMPER_SOURCE_INTERNAL, GST_TIME_CODE_STAMPER_SOURCE_ZERO, GST_TIME_CODE_STAMPER_SOURCE_LAST_KNOWN, + GST_TIME_CODE_STAMPER_SOURCE_LAST_KNOWN_OR_ZERO, GST_TIME_CODE_STAMPER_SOURCE_LTC, GST_TIME_CODE_STAMPER_SOURCE_RTC, } GstTimeCodeStamperSource;