summaryrefslogtreecommitdiff
path: root/gst/timecode
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2019-10-23 14:31:16 +0300
committerSebastian Dröge <sebastian@centricular.com>2019-10-23 16:48:26 +0300
commit96aa9b5633f08fdd9c699b0047e95133639213ba (patch)
tree9d941304c4d767832d518019858d696fed384a45 /gst/timecode
parentb57687a772917d3cd6d72080b1492d83b0f360ce (diff)
downloadgstreamer-plugins-bad-96aa9b5633f08fdd9c699b0047e95133639213ba.tar.gz
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.
Diffstat (limited to 'gst/timecode')
-rw-r--r--gst/timecode/gsttimecodestamper.c10
-rw-r--r--gst/timecode/gsttimecodestamper.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/gst/timecode/gsttimecodestamper.c b/gst/timecode/gsttimecodestamper.c
index c8bea0ff3..58b1780d7 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 43617f65d..6450e9d9c 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;