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.
This commit is contained in:
Sebastian Dröge 2019-10-23 14:31:16 +03:00
parent b57687a772
commit 96aa9b5633
2 changed files with 11 additions and 0 deletions

View file

@ -156,6 +156,9 @@ gst_timecodestamper_source_get_type (void)
{GST_TIME_CODE_STAMPER_SOURCE_LAST_KNOWN, {GST_TIME_CODE_STAMPER_SOURCE_LAST_KNOWN,
"Count up from the last known upstream timecode or internal if unknown", "Count up from the last known upstream timecode or internal if unknown",
"last-known"}, "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, {GST_TIME_CODE_STAMPER_SOURCE_LTC,
"Linear timecode from an audio device", "ltc"}, "Linear timecode from an audio device", "ltc"},
{GST_TIME_CODE_STAMPER_SOURCE_RTC, {GST_TIME_CODE_STAMPER_SOURCE_RTC,
@ -1164,6 +1167,13 @@ gst_timecodestamper_transform_ip (GstBaseTransform * vfilter,
if (!tc) if (!tc)
tc = timecodestamper->internal_tc; tc = timecodestamper->internal_tc;
break; 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; break;
case GST_TIME_CODE_STAMPER_SOURCE_LTC: case GST_TIME_CODE_STAMPER_SOURCE_LTC:
#if HAVE_LTC #if HAVE_LTC

View file

@ -49,6 +49,7 @@ typedef enum GstTimeCodeStamperSource
GST_TIME_CODE_STAMPER_SOURCE_INTERNAL, GST_TIME_CODE_STAMPER_SOURCE_INTERNAL,
GST_TIME_CODE_STAMPER_SOURCE_ZERO, GST_TIME_CODE_STAMPER_SOURCE_ZERO,
GST_TIME_CODE_STAMPER_SOURCE_LAST_KNOWN, 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_LTC,
GST_TIME_CODE_STAMPER_SOURCE_RTC, GST_TIME_CODE_STAMPER_SOURCE_RTC,
} GstTimeCodeStamperSource; } GstTimeCodeStamperSource;