GStreamer plugin to adjust tensor rate. More...
Go to the source code of this file.
Macros | |
#define | DBG (!self->silent) |
Macro for debug mode. More... | |
#define | ABSDIFF(a, b) (((a) > (b)) ? (a) - (b) : (b) - (a)) |
#define | GST_CAT_DEFAULT gst_tensor_rate_debug |
#define | CAPS_STRING GST_TENSOR_CAP_DEFAULT "; " GST_TENSORS_CAP_DEFAULT |
#define | GST_TENSOR_RATE_SCALED_TIME(self, count) |
#define | DEFAULT_SILENT TRUE |
default parameters More... | |
#define | DEFAULT_THROTTLE TRUE |
#define | gst_tensor_rate_parent_class parent_class |
#define | THROTTLE_DELAY_RATIO (0.999) |
#define | MAGIC_LIMIT 25 |
Enumerations | |
enum | { PROP_0, PROP_IN, PROP_OUT, PROP_DUP, PROP_DROP, PROP_SILENT, PROP_THROTTLE, PROP_FRAMERATE } |
tensor_rate properties More... | |
Functions | |
GST_DEBUG_CATEGORY_STATIC (gst_tensor_rate_debug) | |
G_DEFINE_TYPE (GstTensorRate, gst_tensor_rate, GST_TYPE_BASE_TRANSFORM) | |
static void | gst_tensor_rate_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
Setter for tensor_rate properties. More... | |
static void | gst_tensor_rate_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
Getter for tensor_rate properties. More... | |
static void | gst_tensor_rate_finalize (GObject *object) |
Function to finalize instance. (GST Standard) More... | |
static GstFlowReturn | gst_tensor_rate_transform_ip (GstBaseTransform *trans, GstBuffer *buffer) |
in-place transform More... | |
static GstCaps * | gst_tensor_rate_transform_caps (GstBaseTransform *trans, GstPadDirection direction, GstCaps *caps, GstCaps *filter) |
configure tensor-srcpad cap from "proposed" cap. (GST Standard) More... | |
static GstCaps * | gst_tensor_rate_fixate_caps (GstBaseTransform *trans, GstPadDirection direction, GstCaps *caps, GstCaps *othercaps) |
fixate caps. required vmethod of GstBaseTransform. More... | |
static gboolean | gst_tensor_rate_set_caps (GstBaseTransform *trans, GstCaps *in_caps, GstCaps *out_caps) |
set caps. required vmethod of GstBaseTransform. More... | |
static void | gst_tensor_rate_swap_prev (GstTensorRate *self, GstBuffer *buffer, gint64 time) |
swap a previous buffer More... | |
static GstFlowReturn | gst_tensor_rate_flush_prev (GstTensorRate *self, gboolean duplicate, GstClockTime next_intime) |
flush the oldest buffer More... | |
static void | gst_tensor_rate_notify_drop (GstTensorRate *self) |
notify a frame drop event More... | |
static void | gst_tensor_rate_notify_duplicate (GstTensorRate *self) |
notify a frame duplicate event More... | |
static gboolean | gst_tensor_rate_start (GstBaseTransform *trans) |
Called when the element starts processing. optional vmethod of BaseTransform. More... | |
static gboolean | gst_tensor_rate_stop (GstBaseTransform *trans) |
Called when the element stops processing. optional vmethod of BaseTransform. More... | |
static gboolean | gst_tensor_rate_sink_event (GstBaseTransform *trans, GstEvent *event) |
Event handler for sink pad of tensor rate. More... | |
static void | gst_tensor_rate_install_properties (GObjectClass *object_class) |
Installs all the properties for tensor_rate. More... | |
static void | gst_tensor_rate_class_init (GstTensorRateClass *klass) |
initialize the tensor_rate's class (GST Standard) More... | |
static GstFlowReturn | gst_tensor_rate_push_buffer (GstTensorRate *self, GstBuffer *outbuf, gboolean duplicate, GstClockTime next_intime) |
push the buffer to src pad More... | |
static void | gst_tensor_rate_reset (GstTensorRate *self) |
reset variables of the element (GST Standard) More... | |
static void | gst_tensor_rate_init (GstTensorRate *self) |
initialize the new element (GST Standard) More... | |
static void | gst_tensor_rate_send_qos_throttle (GstTensorRate *self, GstClockTime timestamp) |
send throttling qos event to upstream elements More... | |
Variables | |
static GstStaticPadTemplate | sink_factory |
The capabilities of the inputs. More... | |
static GstStaticPadTemplate | src_factory |
The capabilities of the outputs. More... | |
static GParamSpec * | pspec_drop = NULL |
static GParamSpec * | pspec_duplicate = NULL |
GStreamer plugin to adjust tensor rate.
GStreamer/NNStreamer Tensor-Rate Copyright (C) 2020 Dongju Chae dongj u.ch ae@sa msun g.com
Definition in file gsttensor_rate.c.
#define ABSDIFF | ( | a, | |
b | |||
) | (((a) > (b)) ? (a) - (b) : (b) - (a)) |
Definition at line 60 of file gsttensor_rate.c.
#define CAPS_STRING GST_TENSOR_CAP_DEFAULT "; " GST_TENSORS_CAP_DEFAULT |
Definition at line 66 of file gsttensor_rate.c.
#define DBG (!self->silent) |
Macro for debug mode.
SECTION:element-tensor_rate
This element controls a frame rate of tensor streams in the pipeline.
Basically, this element takes an incoming stream of tensor frames, and produces an adjusted stream that matches the source pad's framerate. The adjustment is performed by dropping and duplicating tensor frames. By default the element will simply negotiate the same framerate on its source and sink pad.
Also, when 'throttle' property is set, it propagates a specified frame-rate to upstream elements by sending qos events, which prevents unnecessary data from upstream elements.
<refsect2> <title>Example launch line with tensor rate</title> gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480,framerate=15/1 ! tensor_converter ! tensor_rate framerate=10/1 throttle=true ! tensor_decoder mode=direct_video ! videoconvert ! autovideosink </refsect2>
Definition at line 56 of file gsttensor_rate.c.
#define DEFAULT_SILENT TRUE |
default parameters
Definition at line 73 of file gsttensor_rate.c.
#define DEFAULT_THROTTLE TRUE |
Definition at line 74 of file gsttensor_rate.c.
#define GST_CAT_DEFAULT gst_tensor_rate_debug |
Definition at line 64 of file gsttensor_rate.c.
#define gst_tensor_rate_parent_class parent_class |
Definition at line 110 of file gsttensor_rate.c.
#define GST_TENSOR_RATE_SCALED_TIME | ( | self, | |
count | |||
) |
Definition at line 68 of file gsttensor_rate.c.
#define MAGIC_LIMIT 25 |
Definition at line 773 of file gsttensor_rate.c.
#define THROTTLE_DELAY_RATIO (0.999) |
Definition at line 449 of file gsttensor_rate.c.
anonymous enum |
tensor_rate properties
Enumerator | |
---|---|
PROP_0 | |
PROP_IN | |
PROP_OUT | |
PROP_DUP | |
PROP_DROP | |
PROP_SILENT | |
PROP_THROTTLE | |
PROP_FRAMERATE |
Definition at line 79 of file gsttensor_rate.c.
G_DEFINE_TYPE | ( | GstTensorRate | , |
gst_tensor_rate | , | ||
GST_TYPE_BASE_TRANSFORM | |||
) |
GST_DEBUG_CATEGORY_STATIC | ( | gst_tensor_rate_debug | ) |
|
static |
initialize the tensor_rate's class (GST Standard)
Definition at line 148 of file gsttensor_rate.c.
|
static |
Function to finalize instance. (GST Standard)
Definition at line 341 of file gsttensor_rate.c.
|
static |
fixate caps. required vmethod of GstBaseTransform.
Definition at line 680 of file gsttensor_rate.c.
|
static |
flush the oldest buffer
Definition at line 259 of file gsttensor_rate.c.
|
static |
Getter for tensor_rate properties.
Definition at line 407 of file gsttensor_rate.c.
|
static |
initialize the new element (GST Standard)
Definition at line 317 of file gsttensor_rate.c.
|
static |
Installs all the properties for tensor_rate.
[in] | gobject_class | Glib object class whose properties will be set |
Definition at line 953 of file gsttensor_rate.c.
|
static |
notify a frame drop event
[in] | self | "this" pointer |
Definition at line 758 of file gsttensor_rate.c.
|
static |
notify a frame duplicate event
[in] | self | "this" pointer |
Definition at line 768 of file gsttensor_rate.c.
|
static |
push the buffer to src pad
There must always be a valid duration on prevbuf if rate > 0, it is ensured in the transform_ip function
Definition at line 202 of file gsttensor_rate.c.
|
static |
reset variables of the element (GST Standard)
Definition at line 295 of file gsttensor_rate.c.
|
static |
send throttling qos event to upstream elements
unused
Definition at line 455 of file gsttensor_rate.c.
|
static |
set caps. required vmethod of GstBaseTransform.
After a setcaps, our caps may have changed. In that case, we can't use the old buffer, if there was one (it might have different dimensions)
Definition at line 705 of file gsttensor_rate.c.
|
static |
Setter for tensor_rate properties.
Definition at line 350 of file gsttensor_rate.c.
|
static |
Event handler for sink pad of tensor rate.
[in] | trans | "this" pointer |
[in] | event | a passed event object |
fill up to the end of current segment, or only send out the stored buffer if there is no specific stop. regardless, prevent going loopy in strange cases
fill up to the end of current segment, or only send out the stored buffer if there is no specific stop. regardless, prevent going loopy in strange cases
Output at least one frame but if the buffer duration is valid, output enough frames to use the complete buffer duration
Definition at line 781 of file gsttensor_rate.c.
|
static |
Called when the element starts processing. optional vmethod of BaseTransform.
[in] | trans | "this" pointer |
Definition at line 928 of file gsttensor_rate.c.
|
static |
Called when the element stops processing. optional vmethod of BaseTransform.
[in] | trans | "this" pointer |
Definition at line 941 of file gsttensor_rate.c.
|
static |
swap a previous buffer
Definition at line 280 of file gsttensor_rate.c.
|
static |
configure tensor-srcpad cap from "proposed" cap. (GST Standard)
@trans ("this" pointer) @direction (why do we need this?) @caps sinkpad cap (if direction GST_PAD_SINK) @filter this element's cap (don't know specifically.)
Be careful not to fix/set caps at this stage. Negotiation not completed yet.
Definition at line 634 of file gsttensor_rate.c.
|
static |
in-place transform
continue while the first one was the best, if they were equal avoid going into an infinite loop
Definition at line 477 of file gsttensor_rate.c.
|
static |
Definition at line 107 of file gsttensor_rate.c.
|
static |
Definition at line 108 of file gsttensor_rate.c.
|
static |
The capabilities of the inputs.
Definition at line 94 of file gsttensor_rate.c.
|
static |
The capabilities of the outputs.
Definition at line 102 of file gsttensor_rate.c.