GStreamer plugin that writes data from buffers to files in in MLOps Data repository. More...
#include <gst/gst.h>
#include <gst/video/video-info.h>
#include <gst/audio/audio-info.h>
#include <glib/gstdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <nnstreamer_plugin_api.h>
#include <tensor_common.h>
#include <nnstreamer_util.h>
#include "gstdatareposink.h"
Go to the source code of this file.
Macros | |
#define | TENSOR_CAPS GST_TENSORS_CAP_MAKE ("{ static, flexible, sparse }") |
Tensors caps. More... | |
#define | SUPPORTED_VIDEO_FORMAT "{RGB, BGR, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, GRAY8}" |
Video caps. More... | |
#define | VIDEO_CAPS |
#define | SUPPORTED_AUDIO_FORMAT "{S8, U8, S16LE, S16BE, U16LE, U16BE, S32LE, S32BE, U32LE, U32BE, F32LE, F32BE, F64LE, F64BE}" |
Audio caps. More... | |
#define | AUDIO_CAPS |
#define | TEXT_CAPS "text/x-raw, format = (string) utf8" |
Text caps. More... | |
#define | OCTET_CAPS "application/octet-stream" |
Octet caps. More... | |
#define | IMAGE_CAPS |
Image caps. More... | |
#define | GST_CAT_DEFAULT gst_data_repo_sink_debug |
#define | _do_init GST_DEBUG_CATEGORY_INIT (gst_data_repo_sink_debug, "datareposink", 0, "datareposink element"); |
#define | gst_data_repo_sink_parent_class parent_class |
Enumerations | |
enum | { PROP_0, PROP_LOCATION, PROP_JSON } |
datareposink properties. More... | |
Functions | |
GST_DEBUG_CATEGORY_STATIC (gst_data_repo_sink_debug) | |
G_DEFINE_TYPE_WITH_CODE (GstDataRepoSink, gst_data_repo_sink, GST_TYPE_BASE_SINK, _do_init) | |
static void | gst_data_repo_sink_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) |
Setter for datareposink properties. More... | |
static void | gst_data_repo_sink_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) |
Getter datareposink properties. More... | |
static void | gst_data_repo_sink_finalize (GObject *object) |
finalize datareposink. More... | |
static gboolean | gst_data_repo_sink_stop (GstBaseSink *basesink) |
Stop datareposink. More... | |
static GstStateChangeReturn | gst_data_repo_sink_change_state (GstElement *element, GstStateChange transition) |
Change state of datareposink. More... | |
static GstFlowReturn | gst_data_repo_sink_render (GstBaseSink *bsink, GstBuffer *buffer) |
Called when a buffer should be presented or output. More... | |
static GstCaps * | gst_data_repo_sink_get_caps (GstBaseSink *bsink, GstCaps *filter) |
Get caps of datareposink. More... | |
static gboolean | gst_data_repo_sink_set_caps (GstBaseSink *bsink, GstCaps *caps) |
Set caps of datareposink. More... | |
static gboolean | gst_data_repo_sink_query (GstBaseSink *bsink, GstQuery *query) |
Perform a GstQuery on datareposink. More... | |
static void | gst_data_repo_sink_class_init (GstDataRepoSinkClass *klass) |
Initialize datareposink class. More... | |
static void | gst_data_repo_sink_init (GstDataRepoSink *sink) |
Initialize datareposink. More... | |
static GstFlowReturn | gst_data_repo_sink_write_others (GstDataRepoSink *sink, GstBuffer *buffer) |
Function to write others media type (tensors(fixed), video, audio, octet and text) More... | |
static GstFlowReturn | gst_data_repo_sink_write_flexible_or_sparse_tensors (GstDataRepoSink *sink, GstBuffer *buffer) |
Function to write flexible tensors or sparse tensors. More... | |
static gchar * | gst_data_repo_sink_get_image_filename (GstDataRepoSink *sink) |
Get image filename. More... | |
static GstFlowReturn | gst_data_repo_sink_write_multi_images (GstDataRepoSink *sink, GstBuffer *buffer) |
Function to read multi image files. More... | |
static void | gst_data_repo_sink_set_is_static_tensors (GstDataRepoSink *sink) |
Set whether the given pad caps are static or not. More... | |
static gboolean | gst_data_repo_sink_open_file (GstDataRepoSink *sink) |
Function to open file. More... | |
static gboolean | __write_json (JsonObject *object, const gchar *filename) |
Write json to file. More... | |
static gboolean | gst_data_repo_sink_write_json_meta_file (GstDataRepoSink *sink) |
write the meta information to a JSON file More... | |
Variables | |
static GstStaticPadTemplate | sinktemplate |
GStreamer plugin that writes data from buffers to files in in MLOps Data repository.
Copyright (C) 2023 Samsung Electronics Co., Ltd.
//! Example launch line |[ gst-launch-1.0 videotestsrc ! datareposink location=filename json=video.json gst-launch-1.0 videotestsrc ! pngenc ! datareposink location=image_%02d.png json=video.json gst-launch-1.0 audiotestsrc samplesperbuffer=44100 ! audio/x-raw, format=S16LE, layout=interleaved, rate=44100, channels=1 ! \ datareposink location=filename json=audio.json gst-launch-1.0 datareposrc location=file.dat json=file.json tensors-sequence=2,3 start-sample-index=0 stop-sample-index=199 epochs=1 ! \ other/tensors, format=static, num_tensors=2, framerate=0/1, dimensions=1:1:784:1.1:1:10:1, types=float32.float32 ! \ datareposink location=hyunil.dat json=file.json ]|
Copyright (C) 2023 Samsung Electronics Co., Ltd.
Definition in file gstdatareposink.c.
#define _do_init GST_DEBUG_CATEGORY_INIT (gst_data_repo_sink_debug, "datareposink", 0, "datareposink element"); |
Definition at line 92 of file gstdatareposink.c.
#define AUDIO_CAPS |
Definition at line 55 of file gstdatareposink.c.
#define GST_CAT_DEFAULT gst_data_repo_sink_debug |
Definition at line 91 of file gstdatareposink.c.
#define gst_data_repo_sink_parent_class parent_class |
Definition at line 94 of file gstdatareposink.c.
#define IMAGE_CAPS |
Image caps.
Definition at line 68 of file gstdatareposink.c.
#define OCTET_CAPS "application/octet-stream" |
Octet caps.
Definition at line 64 of file gstdatareposink.c.
#define SUPPORTED_AUDIO_FORMAT "{S8, U8, S16LE, S16BE, U16LE, U16BE, S32LE, S32BE, U32LE, U32BE, F32LE, F32BE, F64LE, F64BE}" |
Audio caps.
Definition at line 53 of file gstdatareposink.c.
#define SUPPORTED_VIDEO_FORMAT "{RGB, BGR, RGBx, BGRx, xRGB, xBGR, RGBA, BGRA, ARGB, ABGR, GRAY8}" |
Video caps.
Definition at line 46 of file gstdatareposink.c.
#define TENSOR_CAPS GST_TENSORS_CAP_MAKE ("{ static, flexible, sparse }") |
Tensors caps.
Definition at line 42 of file gstdatareposink.c.
#define TEXT_CAPS "text/x-raw, format = (string) utf8" |
Text caps.
Definition at line 60 of file gstdatareposink.c.
#define VIDEO_CAPS |
Definition at line 48 of file gstdatareposink.c.
anonymous enum |
datareposink properties.
Enumerator | |
---|---|
PROP_0 | |
PROP_LOCATION | |
PROP_JSON |
Definition at line 83 of file gstdatareposink.c.
|
static |
Write json to file.
Definition at line 668 of file gstdatareposink.c.
G_DEFINE_TYPE_WITH_CODE | ( | GstDataRepoSink | , |
gst_data_repo_sink | , | ||
GST_TYPE_BASE_SINK | , | ||
_do_init | |||
) |
|
static |
Change state of datareposink.
Definition at line 750 of file gstdatareposink.c.
|
static |
Initialize datareposink class.
Definition at line 118 of file gstdatareposink.c.
|
static |
finalize datareposink.
Definition at line 195 of file gstdatareposink.c.
|
static |
Get caps of datareposink.
Definition at line 494 of file gstdatareposink.c.
|
static |
Get image filename.
Definition at line 400 of file gstdatareposink.c.
|
static |
Getter datareposink properties.
Definition at line 251 of file gstdatareposink.c.
|
static |
Initialize datareposink.
Definition at line 174 of file gstdatareposink.c.
|
static |
Function to open file.
Definition at line 590 of file gstdatareposink.c.
|
static |
Perform a GstQuery on datareposink.
Definition at line 564 of file gstdatareposink.c.
|
static |
Called when a buffer should be presented or output.
Definition at line 467 of file gstdatareposink.c.
|
static |
Set caps of datareposink.
Definition at line 539 of file gstdatareposink.c.
|
static |
Set whether the given pad caps are static or not.
Definition at line 520 of file gstdatareposink.c.
|
static |
Setter for datareposink properties.
Definition at line 227 of file gstdatareposink.c.
|
static |
Stop datareposink.
Definition at line 652 of file gstdatareposink.c.
|
static |
Function to write flexible tensors or sparse tensors.
Definition at line 317 of file gstdatareposink.c.
|
static |
write the meta information to a JSON file
Definition at line 696 of file gstdatareposink.c.
|
static |
Function to read multi image files.
Definition at line 424 of file gstdatareposink.c.
|
static |
Function to write others media type (tensors(fixed), video, audio, octet and text)
Definition at line 275 of file gstdatareposink.c.
GST_DEBUG_CATEGORY_STATIC | ( | gst_data_repo_sink_debug | ) |
|
static |
Definition at line 75 of file gstdatareposink.c.