Commit 678064d6 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵 Committed by Sebastian Dröge

timecodestamper: Rewrite element API and code flow

We now have a single property to select the timecode source that should
be applied, and for each timecode source the timecode is updated at
every frame. Then based on a set mode, the timecode is added to the
frame if none exists already or all existing timecodes are removed and
the timecode is added.

In addition the real-time clock is considered a proper timecode source
now instead of only allowing to initialize once in the beginning with
it, and also instead of just taking the current time we now take the
current time at the clock time of the video frame.
parent 489ff860
This diff is collapsed.
......@@ -25,6 +25,7 @@
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/audio/audio.h>
#define GST_TYPE_TIME_CODE_STAMPER (gst_timecodestamper_get_type())
#define GST_TIME_CODE_STAMPER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_TIME_CODE_STAMPER,GstTimeCodeStamper))
......@@ -33,9 +34,26 @@
#define GST_IS_TIME_CODE_STAMPER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_TIME_CODE_STAMPER))
#define GST_IS_TIME_CODE_STAMPER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_TIME_CODE_STAMPER))
#define GST_TYPE_TIME_CODE_STAMPER_SOURCE (gst_timecodestamper_source_get_type())
#define GST_TYPE_TIME_CODE_STAMPER_SET (gst_timecodestamper_set_get_type())
typedef struct _GstTimeCodeStamper GstTimeCodeStamper;
typedef struct _GstTimeCodeStamperClass GstTimeCodeStamperClass;
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_RTC,
} GstTimeCodeStamperSource;
typedef enum GstTimeCodeStamperSet {
GST_TIME_CODE_STAMPER_SET_NEVER,
GST_TIME_CODE_STAMPER_SET_KEEP,
GST_TIME_CODE_STAMPER_SET_ALWAYS,
} GstTimeCodeStamperSet;
/**
* GstTimeCodeStamper:
*
......@@ -45,14 +63,30 @@ struct _GstTimeCodeStamper
{
GstBaseTransform videofilter;
/* protected by object lock */
GstPad *ltcpad;
/* < private > */
gboolean override_existing;
/* Properties, protected by object lock */
GstTimeCodeStamperSource tc_source;
GstTimeCodeStamperSet tc_set;
gboolean drop_frame;
GstVideoTimeCode *current_tc;
GstVideoTimeCode *first_tc;
GstVideoInfo vinfo;
gboolean post_messages;
gboolean first_tc_now;
GstVideoTimeCode *set_internal_tc;
GDateTime *ltc_daily_jam;
gboolean ltc_auto_resync;
GstClockTime rtc_max_drift;
gboolean rtc_auto_resync;
gint timecode_offset;
/* Timecode tracking, protected by object lock */
GstVideoTimeCode *internal_tc;
GstVideoTimeCode *last_tc;
GstVideoTimeCode *rtc_tc;
/* Internal state */
GstVideoInfo vinfo; /* protected by object lock, changed only from video streaming thread */
};
struct _GstTimeCodeStamperClass
......@@ -62,5 +96,8 @@ struct _GstTimeCodeStamperClass
GType gst_timecodestamper_get_type (void);
GType gst_timecodestamper_source_get_type (void);
GType gst_timecodestamper_set_get_type (void);
G_END_DECLS
#endif /* __GST_TIME_CODE_STAMPER_H__ */
......@@ -4,11 +4,13 @@ timecode_sources = [
'gstavwait.c'
]
tc_deps = [gstbase_dep, gstaudio_dep, gstvideo_dep]
gsttimecode = library('gsttimecode',
timecode_sources,
c_args : gst_plugins_bad_args,
include_directories : [configinc],
dependencies : [gstbase_dep, gstaudio_dep, gstvideo_dep],
dependencies : tc_deps,
install : true,
install_dir : plugins_install_dir,
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment