mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 05:01:23 +00:00
timecodestamper: Add running-time source mode
Add a new source mode "running-time". This mode will convert buffer running time into timecode Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7322>
This commit is contained in:
parent
ea59c921d6
commit
8f9a53fa85
3 changed files with 32 additions and 0 deletions
|
@ -240879,6 +240879,11 @@
|
|||
"desc": "Timecode from real time clock",
|
||||
"name": "rtc",
|
||||
"value": "5"
|
||||
},
|
||||
{
|
||||
"desc": "Buffer running time as timecode",
|
||||
"name": "running-time",
|
||||
"value": "6"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -189,6 +189,15 @@ gst_timecodestamper_source_get_type (void)
|
|||
"Linear timecode from an audio device", "ltc"},
|
||||
{GST_TIME_CODE_STAMPER_SOURCE_RTC,
|
||||
"Timecode from real time clock", "rtc"},
|
||||
/**
|
||||
* GstTimeCodeStamperSource::running-time:
|
||||
*
|
||||
* Buffer running time as timecode
|
||||
*
|
||||
* Since: 1.26
|
||||
*/
|
||||
{GST_TIME_CODE_STAMPER_SOURCE_RUNNING_TIME,
|
||||
"Buffer running time as timecode", "running-time"},
|
||||
{0, NULL, NULL},
|
||||
};
|
||||
|
||||
|
@ -1581,6 +1590,23 @@ gst_timecodestamper_transform_ip (GstBaseTransform * vfilter,
|
|||
case GST_TIME_CODE_STAMPER_SOURCE_RTC:
|
||||
tc = timecodestamper->rtc_tc;
|
||||
break;
|
||||
case GST_TIME_CODE_STAMPER_SOURCE_RUNNING_TIME:
|
||||
if (GST_CLOCK_TIME_IS_VALID (running_time)) {
|
||||
guint64 num_frames = gst_util_uint64_scale (running_time,
|
||||
timecodestamper->fps_n, timecodestamper->fps_d * GST_SECOND);
|
||||
guint field_count = 0;
|
||||
|
||||
if (timecodestamper->interlace_mode !=
|
||||
GST_VIDEO_INTERLACE_MODE_PROGRESSIVE) {
|
||||
field_count = 1;
|
||||
}
|
||||
|
||||
tc = gst_video_time_code_new (timecodestamper->fps_n,
|
||||
timecodestamper->fps_d, NULL, tc_flags, 0, 0, 0, 0, field_count);
|
||||
gst_video_time_code_add_frames (tc, num_frames);
|
||||
free_tc = TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
switch (timecodestamper->tc_set) {
|
||||
|
|
|
@ -52,6 +52,7 @@ typedef enum GstTimeCodeStamperSource
|
|||
GST_TIME_CODE_STAMPER_SOURCE_LAST_KNOWN_OR_ZERO,
|
||||
GST_TIME_CODE_STAMPER_SOURCE_LTC,
|
||||
GST_TIME_CODE_STAMPER_SOURCE_RTC,
|
||||
GST_TIME_CODE_STAMPER_SOURCE_RUNNING_TIME,
|
||||
} GstTimeCodeStamperSource;
|
||||
|
||||
typedef enum GstTimeCodeStamperSet {
|
||||
|
|
Loading…
Reference in a new issue