GStreamer plugin to capture sensor data as tensor(s) More...
#include <gst/gstinfo.h>
#include <gst/gst.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <string.h>
#include <endian.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <nnstreamer_util.h>
#include "gsttensor_srciio.h"
Go to the source code of this file.
Macros | |
#define | DBG (!self->silent) |
Macro for debug mode. More... | |
#define | GST_CAT_DEFAULT gst_tensor_src_iio_debug |
#define | PROCESS_SCANNED_DATA(DTYPE_UNSIGNED, DTYPE_SIGNED) |
Macro to generate data processing functions for various types. More... | |
#define | DEFAULT_PROP_BASE_DIRECTORY "/sys/bus/iio/devices" |
IIO system paths. More... | |
#define | DEFAULT_PROP_DEV_DIRECTORY "/dev" |
#define | CHANNELS_ENABLED_AUTO_CHAR "auto" |
iio device channel enabled mode More... | |
#define | CHANNELS_ENABLED_ALL_CHAR "all" |
#define | DEFAULT_OPERATING_CHANNELS_ENABLED CHANNELS_ENABLED_AUTO_CHAR |
#define | MODE_ONE_SHOT "one-shot" |
tensor_src_iio device modes More... | |
#define | MODE_CONTINUOUS "continuous" |
#define | DEFAULT_OPERATING_MODE MODE_CONTINUOUS |
#define | DEFAULT_PROP_SILENT TRUE |
Flag to print minimized log. More... | |
#define | DEFAULT_PROP_STRING NULL |
Flag for general default value of string. More... | |
#define | MIN_BUFFER_CAPACITY 1 |
Minimum and maximum buffer length for iio. More... | |
#define | MAX_BUFFER_CAPACITY G_MAXUINT |
#define | DEFAULT_BUFFER_CAPACITY 1 |
#define | MIN_FREQUENCY 0 |
Minimum and maximum operating frequency for the device Frequency 0 chooses the first available frequency supported by device. More... | |
#define | MAX_FREQUENCY G_MAXULONG |
#define | DEFAULT_FREQUENCY 0 |
#define | MIN_POLL_TIMEOUT -1 |
Minimum and maximum polling timeout for the buffered reading. More... | |
#define | MAX_POLL_TIMEOUT G_MAXINT |
#define | DEFAULT_POLL_TIMEOUT 10000 |
#define | DEFAULT_MERGE_CHANNELS TRUE |
Default behavior on merging channels. More... | |
#define | DEFAULT_PROP_DEVICE_NUM -1 |
default trigger and device numbers More... | |
#define | DEFAULT_PROP_TRIGGER_NUM -1 |
#define | BLOCKSIZE 1 |
#define | DEVICE "device" |
IIO devices/triggers. More... | |
#define | BUFFER "buffer" |
#define | TRIGGER "trigger" |
#define | CHANNELS "scan_elements" |
#define | IIO "iio:" |
#define | TIMESTAMP "timestamp" |
#define | DEVICE_PREFIX IIO DEVICE |
#define | TRIGGER_PREFIX IIO TRIGGER |
#define | CURRENT_TRIGGER "current_trigger" |
#define | EN_SUFFIX "_en" |
IIO device channels. More... | |
#define | INDEX_SUFFIX "_index" |
#define | TYPE_SUFFIX "_type" |
#define | SCALE_SUFFIX "_scale" |
#define | OFFSET_SUFFIX "_offset" |
#define | NAME_FILE "name" |
filenames for IIO devices/triggers characteristics More... | |
#define | AVAIL_FREQUENCY_FILE "sampling_frequency_available" |
#define | SAMPLING_FREQUENCY "sampling_frequency" |
#define | gst_tensor_src_iio_parent_class parent_class |
Enumerations | |
enum | { PROP_0, PROP_MODE, PROP_SILENT, PROP_BASE_DIRECTORY, PROP_DEV_DIRECTORY, PROP_DEVICE, PROP_DEVICE_NUM, PROP_TRIGGER, PROP_TRIGGER_NUM, PROP_CHANNELS, PROP_BUFFER_CAPACITY, PROP_FREQUENCY, PROP_MERGE_CHANNELS, PROP_POLL_TIMEOUT } |
tensor_src_iio properties. More... | |
Functions | |
GST_DEBUG_CATEGORY_STATIC (gst_tensor_src_iio_debug) | |
g_assert (sizeof(DTYPE_UNSIGNED)==sizeof(DTYPE_SIGNED)) | |
value_unsigned & | if (prop->is_signed) |
PROCESS_SCANNED_DATA (guint8, gint8) | |
PROCESS_SCANNED_DATA (guint16, gint16) | |
PROCESS_SCANNED_DATA (guint32, gint32) | |
PROCESS_SCANNED_DATA (guint64, gint64) | |
static void | gst_tensor_src_iio_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
set tensor_src_iio properties More... | |
static void | gst_tensor_src_iio_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
get tensor_src_iio properties More... | |
static void | gst_tensor_src_iio_finalize (GObject *object) |
finalize the instance More... | |
static gboolean | gst_tensor_src_iio_start (GstBaseSrc *src) |
start function, called when state changed null to ready. load the device and init the device resources More... | |
static gboolean | gst_tensor_src_iio_stop (GstBaseSrc *src) |
stop function, called when state changed ready to null. More... | |
static GstStateChangeReturn | gst_tensor_src_iio_change_state (GstElement *element, GstStateChange transition) |
Perform state change. More... | |
static gboolean | gst_tensor_src_iio_event (GstBaseSrc *src, GstEvent *event) |
handle events More... | |
static gboolean | gst_tensor_src_iio_set_caps (GstBaseSrc *src, GstCaps *caps) |
set new caps More... | |
static GstCaps * | gst_tensor_src_iio_get_caps (GstBaseSrc *src, GstCaps *filter) |
get caps of subclass More... | |
static GstCaps * | gst_tensor_src_iio_fixate (GstBaseSrc *src, GstCaps *caps) |
fixate the caps when needed during negotiation More... | |
static gboolean | gst_tensor_src_iio_is_seekable (GstBaseSrc *src) |
check if source supports seeking More... | |
static GstFlowReturn | gst_tensor_src_iio_create (GstBaseSrc *src, guint64 offset, guint size, GstBuffer **buffer) |
create a buffer with requested size and offset More... | |
static GstFlowReturn | gst_tensor_src_iio_fill (GstBaseSrc *src, guint64 offset, guint size, GstBuffer *buffer) |
fill the buffer with data More... | |
static void | gst_tensor_src_iio_get_times (GstBaseSrc *basesrc, GstBuffer *buffer, GstClockTime *start, GstClockTime *end) |
returns the time for the buffers More... | |
G_DEFINE_TYPE (GstTensorSrcIIO, gst_tensor_src_iio, GST_TYPE_BASE_SRC) | |
static void | gst_tensor_src_iio_class_init (GstTensorSrcIIOClass *klass) |
initialize the tensor_src_iio class. More... | |
static void | gst_tensor_src_iio_channel_properties_free (gpointer data) |
delete GstTensorSrcIIODeviceProperties structure More... | |
static void | gst_tensor_src_iio_device_properties_init (GstTensorSrcIIODeviceProperties *prop) |
initialize GstTensorSrcIIODeviceProperties structure More... | |
static void | gst_tensor_src_iio_init (GstTensorSrcIIO *self) |
initialize tensor_src_iio element. More... | |
static gint | gst_tensor_src_merge_tensor_by_type (GstTensorInfo *info, guint size, guint dir) |
merge multiple other/tensor More... | |
static gint | gst_tensor_src_iio_get_id_by_name (const gchar *dir_name, const gchar *name, const gchar *prefix) |
check if device/trigger with the given name exists More... | |
static gchar * | gst_tensor_src_iio_get_name_by_id (const gchar *dir_name, const gint id, const gchar *prefix) |
check if device/trigger with the given id exists More... | |
static gboolean | gst_tensor_src_iio_get_float_from_file (const gchar *dirname, const gchar *name, const gchar *suffix, gfloat *value) |
parse float value from the file More... | |
static gboolean | gst_tensor_src_iio_set_channel_type (GstTensorSrcIIOChannelProperties *prop, const gchar *contents) |
get type info about the channel from the string More... | |
static gchar * | gst_tensor_src_iio_get_generic_name (const gchar *channel_name) |
get generic name for channel from the string More... | |
static gint | gst_tensor_channel_list_sort_cmp (gconstpointer a, gconstpointer b) |
compare channels for sort based on their indices More... | |
static void | gst_tensor_channel_list_filter_enabled (gpointer data, gpointer user_data) |
compare channels for filtering if enabled More... | |
static gint | gst_tensor_src_iio_get_all_channel_info (GstTensorSrcIIO *self, const gchar *dir_name) |
get info about all the channels in the device More... | |
static gint64 | gst_tensor_src_iio_get_available_frequency (const gchar *base_dir, const guint64 frequency) |
return sampling frequency given the frequency input from user More... | |
static gboolean | gst_tensor_write_sysfs_string (GstTensorSrcIIO *self, const gchar *file, const gchar *base_dir, const gchar *contents) |
write the string in to the file More... | |
static gboolean | gst_tensor_write_sysfs_int (GstTensorSrcIIO *self, const gchar *file, const gchar *base_dir, const gint contents) |
write the int in to the file More... | |
static gboolean | gst_tensor_set_all_channels (GstTensorSrcIIO *self, const gint contents) |
set value to all the channels More... | |
static guint | gst_tensor_get_size_from_channels (GList *channels) |
get the size of the combined data from channels More... | |
static gboolean | gst_tensor_src_iio_create_config (GstTensorSrcIIO *tensor_src_iio) |
create the structure for the caps to update the src pad caps More... | |
static gboolean | gst_tensor_src_iio_setup_device_properties (GstTensorSrcIIO *self) |
setup device using name/id More... | |
static gboolean | gst_tensor_src_iio_setup_trigger_properties (GstTensorSrcIIO *self) |
setup trigger using name/id More... | |
static gboolean | gst_tensor_src_iio_setup_sampling_frequency (GstTensorSrcIIO *self) |
setup device sampling frequency More... | |
static gboolean | gst_tensor_src_iio_setup_scan_channels (GstTensorSrcIIO *self) |
setup scan channels for the device More... | |
static gboolean | gst_tensor_src_iio_setup_device_buffer (GstTensorSrcIIO *self) |
setup device using name/id More... | |
static void | gst_tensor_src_restore_iio_device (GstTensorSrcIIO *self) |
restore the iio device to its original device. More... | |
static gboolean | gst_tensor_src_iio_process_scanned_data (GstTensorSrcIIOChannelProperties *prop, gchar *data, gfloat *buffer_map) |
process the scanned data from IIO device More... | |
Variables | |
GstTensorSrcIIOChannelProperties * | prop |
DTYPE_UNSIGNED ( . More... | |
GstTensorSrcIIOChannelProperties DTYPE_UNSIGNED | value_unsigned |
else | |
return | value_float |
GStreamer plugin to capture sensor data as tensor(s)
GStreamer Tensor_Source_IIO Copyright (C) 2005 Thomas Vander Stichele thoma Copyright (C) 2005 Ronald S. Bultje s@ap estaa rt.o rgrbult Copyright (C) 2019 Parichay Kapoor je@r onald .bit freak .netpk.ka poor @sams ung. com
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; version 2.1 of the License.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
support specific channels as input
handle timestamp received from device
This is the plugin to capture data from sensors and convert them to tensor format. Current implementation will support accelerators, light and gyro sensors.
Definition in file gsttensor_srciio.c.
#define AVAIL_FREQUENCY_FILE "sampling_frequency_available" |
Definition at line 244 of file gsttensor_srciio.c.
#define BLOCKSIZE 1 |
blocksize for buffer
Definition at line 216 of file gsttensor_srciio.c.
#define BUFFER "buffer" |
Definition at line 222 of file gsttensor_srciio.c.
#define CHANNELS "scan_elements" |
Definition at line 224 of file gsttensor_srciio.c.
#define CHANNELS_ENABLED_ALL_CHAR "all" |
Definition at line 160 of file gsttensor_srciio.c.
#define CHANNELS_ENABLED_AUTO_CHAR "auto" |
iio device channel enabled mode
Definition at line 159 of file gsttensor_srciio.c.
#define CURRENT_TRIGGER "current_trigger" |
Definition at line 229 of file gsttensor_srciio.c.
#define DBG (!self->silent) |
Macro for debug mode.
SECTION:element-tensor_src_iio
#tensor_src_iio extends #gstbasesrc source element to handle Linux Industrial I/O sensors as input. IIO sources are only supported in buffered mode. Source elements only support push mode scheduling as a live source.
#tensor_src_iio supports configuring the device as well as the trigger via properties. Buffer capacity, frequency and scan channels to be read can be configured before PLAYING the stream. The configuration is supported only in states <= READY. Setting the state back to NULL restores the original configuration of the IIO device. The source can be configured to work with trigger for the source or read the data from the device at regular time intervals. Device name/number is the only necessary configuration needed to run the element (other configuration parameters is optional).
The output caps is either of other/tensor or other/tensors.
Data from various channels can be merged to form 1 other/tensor. Final caps of the src pad is of the following format: <itemizedlist> <listitem>
Dimension 0 : Channel number</listitem>
<listitem>
Dimension 1 : buffer capacity</listitem>
</itemizedlist> Other dimensions are not utilized. The data in the dimension 0 is sorted on the basis of the indexing of the channels provided by the IIO device.
The enabling of buffer for data capture is performed when transitioning from PAUSED to PLAYING state. This leads to automated synchronization handled by gstreamer. Buffer duration and timestamps set by #gstbasesrc remain in sync with linux IIO timestamps.
<refsect2> <title>Example launch line</title> |[ gst-launch -v -m tensor_src_iio device-number=0 ! fakesink ]| </refsect2>
Definition at line 97 of file gsttensor_srciio.c.
#define DEFAULT_BUFFER_CAPACITY 1 |
Definition at line 185 of file gsttensor_srciio.c.
#define DEFAULT_FREQUENCY 0 |
Definition at line 193 of file gsttensor_srciio.c.
#define DEFAULT_MERGE_CHANNELS TRUE |
Default behavior on merging channels.
Definition at line 205 of file gsttensor_srciio.c.
#define DEFAULT_OPERATING_CHANNELS_ENABLED CHANNELS_ENABLED_AUTO_CHAR |
Definition at line 161 of file gsttensor_srciio.c.
#define DEFAULT_OPERATING_MODE MODE_CONTINUOUS |
Definition at line 168 of file gsttensor_srciio.c.
#define DEFAULT_POLL_TIMEOUT 10000 |
Definition at line 200 of file gsttensor_srciio.c.
#define DEFAULT_PROP_BASE_DIRECTORY "/sys/bus/iio/devices" |
IIO system paths.
Definition at line 153 of file gsttensor_srciio.c.
#define DEFAULT_PROP_DEV_DIRECTORY "/dev" |
Definition at line 154 of file gsttensor_srciio.c.
#define DEFAULT_PROP_DEVICE_NUM -1 |
default trigger and device numbers
Definition at line 210 of file gsttensor_srciio.c.
#define DEFAULT_PROP_SILENT TRUE |
Flag to print minimized log.
Definition at line 173 of file gsttensor_srciio.c.
#define DEFAULT_PROP_STRING NULL |
Flag for general default value of string.
Definition at line 178 of file gsttensor_srciio.c.
#define DEFAULT_PROP_TRIGGER_NUM -1 |
Definition at line 211 of file gsttensor_srciio.c.
#define DEVICE "device" |
IIO devices/triggers.
Definition at line 221 of file gsttensor_srciio.c.
Definition at line 227 of file gsttensor_srciio.c.
#define EN_SUFFIX "_en" |
IIO device channels.
Definition at line 234 of file gsttensor_srciio.c.
#define GST_CAT_DEFAULT gst_tensor_src_iio_debug |
Definition at line 101 of file gsttensor_srciio.c.
#define gst_tensor_src_iio_parent_class parent_class |
internal functions
Definition at line 280 of file gsttensor_srciio.c.
#define IIO "iio:" |
Definition at line 225 of file gsttensor_srciio.c.
#define INDEX_SUFFIX "_index" |
Definition at line 235 of file gsttensor_srciio.c.
#define MAX_BUFFER_CAPACITY G_MAXUINT |
Definition at line 184 of file gsttensor_srciio.c.
#define MAX_FREQUENCY G_MAXULONG |
Definition at line 192 of file gsttensor_srciio.c.
#define MAX_POLL_TIMEOUT G_MAXINT |
Definition at line 199 of file gsttensor_srciio.c.
#define MIN_BUFFER_CAPACITY 1 |
Minimum and maximum buffer length for iio.
Definition at line 183 of file gsttensor_srciio.c.
#define MIN_FREQUENCY 0 |
Minimum and maximum operating frequency for the device Frequency 0 chooses the first available frequency supported by device.
Definition at line 191 of file gsttensor_srciio.c.
#define MIN_POLL_TIMEOUT -1 |
Minimum and maximum polling timeout for the buffered reading.
Definition at line 198 of file gsttensor_srciio.c.
#define MODE_CONTINUOUS "continuous" |
Definition at line 167 of file gsttensor_srciio.c.
#define MODE_ONE_SHOT "one-shot" |
tensor_src_iio device modes
Definition at line 166 of file gsttensor_srciio.c.
#define NAME_FILE "name" |
filenames for IIO devices/triggers characteristics
Definition at line 243 of file gsttensor_srciio.c.
#define OFFSET_SUFFIX "_offset" |
Definition at line 238 of file gsttensor_srciio.c.
#define PROCESS_SCANNED_DATA | ( | DTYPE_UNSIGNED, | |
DTYPE_SIGNED | |||
) |
Macro to generate data processing functions for various types.
Definition at line 106 of file gsttensor_srciio.c.
#define SAMPLING_FREQUENCY "sampling_frequency" |
Definition at line 245 of file gsttensor_srciio.c.
#define SCALE_SUFFIX "_scale" |
Definition at line 237 of file gsttensor_srciio.c.
#define TIMESTAMP "timestamp" |
Definition at line 226 of file gsttensor_srciio.c.
#define TRIGGER "trigger" |
Definition at line 223 of file gsttensor_srciio.c.
Definition at line 228 of file gsttensor_srciio.c.
#define TYPE_SUFFIX "_type" |
Definition at line 236 of file gsttensor_srciio.c.
anonymous enum |
tensor_src_iio properties.
Definition at line 132 of file gsttensor_srciio.c.
g_assert | ( | sizeof(DTYPE_UNSIGNED) | = =sizeof(DTYPE_SIGNED) | ) |
G_DEFINE_TYPE | ( | GstTensorSrcIIO | , |
gst_tensor_src_iio | , | ||
GST_TYPE_BASE_SRC | |||
) |
GST_DEBUG_CATEGORY_STATIC | ( | gst_tensor_src_iio_debug | ) |
|
static |
compare channels for filtering if enabled
[in] | data | Pointer of the data of the element |
[in/out] | user_data Pointer to the address of the list to be filtered |
Definition at line 836 of file gsttensor_srciio.c.
|
static |
compare channels for sort based on their indices
[in] | a | First param to be compared |
[in] | b | Second param to be compared |
Definition at line 822 of file gsttensor_srciio.c.
|
static |
get the size of the combined data from channels
[in] | channels | List of all the channels |
Also evaluates the location of each channel in the buffer
Definition at line 1499 of file gsttensor_srciio.c.
|
static |
set value to all the channels
[in] | self | Tensor src IIO object |
[in] | contents | Data to be written to the file |
Definition at line 1469 of file gsttensor_srciio.c.
|
static |
Perform state change.
enable the buffer for the data to be captured
disable the buffer
Definition at line 2228 of file gsttensor_srciio.c.
|
static |
delete GstTensorSrcIIODeviceProperties structure
[in] | data | Data pointer to be freed |
Definition at line 411 of file gsttensor_srciio.c.
|
static |
initialize the tensor_src_iio class.
GObject methods
pad template
GstBaseSrcIIO methods
Definition at line 287 of file gsttensor_srciio.c.
|
static |
create a buffer with requested size and offset
all the data, if unermged should be of the same size
Definition at line 2325 of file gsttensor_srciio.c.
|
static |
create the structure for the caps to update the src pad caps
[in/out] | structure Caps structure which will filled |
create a bigger array, insert info in it and then merge tensors with same type+size
compile tensor info data
merge info about the tensors with same type
verify the merging of the array
tensors config data
buffer_capacity number of data samples are captured at once, packed together and sent downstream
Definition at line 1527 of file gsttensor_srciio.c.
|
static |
initialize GstTensorSrcIIODeviceProperties structure
[in] | data | Device properties pointer to be initialized |
Definition at line 427 of file gsttensor_srciio.c.
|
static |
handle events
No events to be handled yet
Definition at line 2132 of file gsttensor_srciio.c.
|
static |
fill the buffer with data
Only supporting tensors made of 1 tensor for now
get writable buffer
memory to data from file
wait for the data to arrive
sleep for a device tick
using read for non-blocking access
parse the read data
current assumption is that the all data is float and merged to form a 1 dimension data. 2nd dimension comes from buffer capacity.
for other/tensor, only 1 map exist as there is only 1 mem
for other/tensors, multiple maps exist as there are multiple mem
Definition at line 2462 of file gsttensor_srciio.c.
|
static |
finalize the instance
Definition at line 1358 of file gsttensor_srciio.c.
|
static |
fixate the caps when needed during negotiation
Caps are fixated based on the device source in _start().
Definition at line 2186 of file gsttensor_srciio.c.
|
static |
get info about all the channels in the device
[in/out] | self Tensor src IIO object | |
[in] | dir_name | Directory name with all the scan elements for device |
check for enable
not enabling and handling buffer timestamps for now
set the name and base_dir
find and set the current state
find and set the index
find and set the type information
if specific type info unavailable, use generic type info
find and setup offset info
find and setup scale info
sort the list with the order of the indices
Definition at line 860 of file gsttensor_srciio.c.
|
static |
return sampling frequency given the frequency input from user
[in] | base_dir | Device base directory (containing sampling freq file) |
[in] | frequency | Frequency specified by user (else 0) |
get frequency list supported by the device
if the frequency is set 0, set the first available frequency else verify the frequency received from user is supported by the device
Definition at line 1036 of file gsttensor_srciio.c.
|
static |
get caps of subclass
Definition at line 2160 of file gsttensor_srciio.c.
|
static |
parse float value from the file
[in] | dirname | Directory containing the file |
[in] | name | Filename of the file |
[in] | suffix | Suffix to be attached to the filename |
[in/out] | value Output value returned via value |
Definition at line 677 of file gsttensor_srciio.c.
|
static |
get generic name for channel from the string
[in] | channel_name | Name of the channel with its id embedded in it |
Definition at line 799 of file gsttensor_srciio.c.
|
static |
check if device/trigger with the given name exists
[in] | dir_name | Directory containing all the devices |
[in] | name | Name of the device to be found |
[in] | prefix | Prefix to match with the filename of the device |
check for prefix and the next digit should be a number
Definition at line 576 of file gsttensor_srciio.c.
|
static |
check if device/trigger with the given id exists
[in] | dir_name | Directory containing all the devices |
[in] | id | ID of the device to be found |
[in] | prefix | Prefix to match with the filename of the device |
Definition at line 640 of file gsttensor_srciio.c.
|
static |
get tensor_src_iio properties
interface of frequency is kept long for outside but uint64 inside
Definition at line 1264 of file gsttensor_srciio.c.
|
static |
returns the time for the buffers
can't sync using DTS, use PTS
Definition at line 2298 of file gsttensor_srciio.c.
|
static |
initialize tensor_src_iio element.
init properties
format of the source since IIO device as a source is live and operates at a fixed frequency, GST_FORMAT_TIME is used
set the source to be live
set the timestamps on each buffer
set async is necessary to make state change async sync state changes does not need calling _start_complete() from _start()
Definition at line 439 of file gsttensor_srciio.c.
|
static |
check if source supports seeking
iio sensors are live source without any support for seeking
Definition at line 2287 of file gsttensor_srciio.c.
|
static |
process the scanned data from IIO device
[in] | prop | Properties of one of the enabled channels |
[in] | data | Data read from the IIO device |
[in/out] | buffer_map Gst buffer map to write data to |
assumes each data starting point is byte aligned
right shift the extra storage bits
right shift the extra storage bits for big endian
mask out the extra storage bits for little endian
follow through
right shift the extra storage bits for big endian
mask out the extra storage bits for little endian
follow through
follow through
follow through
right shift the extra storage bits for big endian
mask out the extra storage bits for little endian
Definition at line 2376 of file gsttensor_srciio.c.
|
static |
set new caps
Definition at line 2142 of file gsttensor_srciio.c.
|
static |
get type info about the channel from the string
[in/out] | prop Channel properties where type info will be set | |
[in] | contents | Contains type unparsed information to be set |
check endian
verify static parts of the contents
check sign
used bits
verify static parts of the contents
storage bits
verify static parts of the contents
Definition at line 718 of file gsttensor_srciio.c.
|
static |
set tensor_src_iio properties
GObject method implementation
No support for setting properties in PAUSED/PLAYING state as it needs to reset the device. To change the properties, user should stop the pipeline and set element state to READY/NULL and then change the properties
using direct as we only need to store keys and keys form a unique set
this means val is duplicated. just skip it, then.
Definition at line 1098 of file gsttensor_srciio.c.
|
static |
setup device using name/id
[in/out] | self Tensor src iio object |
once all these are set, set the buffer related thingies
open the buffer to read and ready the file descriptor
Definition at line 1913 of file gsttensor_srciio.c.
|
static |
setup device using name/id
[in/out] | self Tensor src iio object |
Find the device
Definition at line 1623 of file gsttensor_srciio.c.
|
static |
setup device sampling frequency
[in/out] | self Tensor src iio object |
check if sampling frequency file exists
reset the sampling frequency set by the user if any, as it cant be set
store the default frequency
verify the frequency given by the user if any from the list of available sampling frequencies
if sampling frequency file does not exist, no error
if sampling frequency file does not exist, sampling frequency is first value from the list of available sampling frequencies. So, we can ignore setting it
interface of frequency is kept long for outside but uint64 inside
Definition at line 1735 of file gsttensor_srciio.c.
|
static |
setup scan channels for the device
[in/out] | self Tensor src iio object |
get all the channels that exist and then set enable on them
if enabling all channels failed, disable all channels
enable the custom channels and disable the rest
filter out disabled channels
set fixed caps for the src pad
create tensor_config
Definition at line 1822 of file gsttensor_srciio.c.
|
static |
setup trigger using name/id
[in/out] | self Tensor src iio object |
register the trigger
verify if trigger is supported by our device
find if the provided trigger exists
get the default trigger, if any
set the trigger
Definition at line 1659 of file gsttensor_srciio.c.
|
static |
start function, called when state changed null to ready. load the device and init the device resources
GstBaseSrc method implementation
load and init resources
no support one shot mode for now
bytes every buffer will be fixed
complete the start of the base src
complete the start of the base src
Definition at line 1977 of file gsttensor_srciio.c.
|
static |
stop function, called when state changed ready to null.
free resources related to the device
restore the iio device
Definition at line 2097 of file gsttensor_srciio.c.
|
static |
merge multiple other/tensor
[in/out] | info Tensor info to be merged | |
[in] | size | Info array size |
[in] | dir | Innermost/outermost/innermost-outer (0/1/2) available dimension |
base error control check
verify extra dimension (innermost to outermost)
verify that all the types and shapes match
return original if cant be merged and size within limits
If there are multiple available dimensions to merge along, we use dir to choose which the dimension to merge. If there is just 1 dimension, dir variable has no effect
No outer dimension available to merge
Now merge into 1 tensor using the selected dimension
Definition at line 491 of file gsttensor_srciio.c.
|
static |
restore the iio device to its original device.
reset enabled channels
reset sampling_frequency
converting to long as setting interface to device
reset buffer_capacity
reset current trigger
Definition at line 2049 of file gsttensor_srciio.c.
|
static |
write the int in to the file
[in] | self | Tensor src IIO object |
[in] | file | Destination file for the data |
[in] | base_dir | Directory containing the file |
[in] | contents | Data to be written to the file |
Definition at line 1449 of file gsttensor_srciio.c.
|
static |
write the string in to the file
[in] | self | Tensor src IIO object |
[in] | file | Destination file for the data |
[in] | base_dir | Directory containing the file |
[in] | contents | Data to be written to the file |
Definition at line 1384 of file gsttensor_srciio.c.
value_unsigned& if | ( | prop-> | is_signed | ) |
Definition at line 117 of file gsttensor_srciio.c.
PROCESS_SCANNED_DATA | ( | guint16 | , |
gint16 | |||
) |
PROCESS_SCANNED_DATA | ( | guint32 | , |
gint32 | |||
) |
PROCESS_SCANNED_DATA | ( | guint64 | , |
gint64 | |||
) |
PROCESS_SCANNED_DATA | ( | guint8 | , |
gint8 | |||
) |
Define data processing functions for various types
else |
Definition at line 123 of file gsttensor_srciio.c.
DTYPE_UNSIGNED ( .
Definition at line 110 of file gsttensor_srciio.c.
return value_float |
Definition at line 126 of file gsttensor_srciio.c.
value_unsigned |
Definition at line 110 of file gsttensor_srciio.c.