Doxygen Book
gstjoin.c File Reference

Select the out that arrived first among the input streams. More...

#include "gstjoin.h"
Include dependency graph for gstjoin.c:

Go to the source code of this file.

Classes

struct  _GstJoinPad
 GstJoinPad data structure. More...
 
struct  _GstJoinPadClass
 _GstJoinPadClass data structure More...
 

Macros

#define GST_CAT_DEFAULT   join_debug
 
#define GST_JOIN_GET_LOCK(sel)   (&((GstJoin*)(sel))->lock)
 
#define GST_JOIN_GET_COND(sel)   (&((GstJoin*)(sel))->cond)
 
#define GST_JOIN_LOCK(sel)   (g_mutex_lock (GST_JOIN_GET_LOCK(sel)))
 
#define GST_JOIN_UNLOCK(sel)   (g_mutex_unlock (GST_JOIN_GET_LOCK(sel)))
 
#define GST_JOIN_WAIT(sel)
 
#define GST_TYPE_JOIN_PAD   (gst_join_pad_get_type())
 
#define GST_JOIN_PAD(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_JOIN_PAD, GstJoinPad))
 
#define GST_JOIN_PAD_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_JOIN_PAD, GstJoinPadClass))
 
#define GST_IS_JOIN_PAD(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_JOIN_PAD))
 
#define GST_IS_JOIN_PAD_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_JOIN_PAD))
 
#define GST_JOIN_PAD_CAST(obj)   ((GstJoinPad *)(obj))
 
#define gst_join_parent_class   parent_class
 
#define PACKAGE   "join"
 

Typedefs

typedef struct _GstJoinPad GstJoinPad
 
typedef struct _GstJoinPadClass GstJoinPadClass
 

Enumerations

enum  { PROP_0, PROP_N_PADS, PROP_ACTIVE_PAD }
 

Functions

 GST_DEBUG_CATEGORY_STATIC (join_debug)
 
static GstPad * gst_join_get_active_sinkpad (GstJoin *sel)
 Get or create the active sinkpad. More...
 
static GstPad * gst_join_get_linked_pad (GstJoin *sel, GstPad *pad, gboolean strict)
 Get linked pad. More...
 
static gboolean gst_join_set_active_pad (GstJoin *self, GstPad *pad)
 set active sink pad. More...
 
GType gst_join_pad_get_type (void)
 
static void gst_join_pad_finalize (GObject *object)
 finalize the join pad More...
 
static void gst_join_pad_reset (GstJoinPad *pad)
 Clear and reset join pad. More...
 
static gboolean gst_join_pad_event (GstPad *pad, GstObject *parent, GstEvent *event)
 event function for sink pad More...
 
static gboolean gst_join_pad_query (GstPad *pad, GstObject *parent, GstQuery *query)
 handlesink sink pad query More...
 
static GstIterator * gst_join_pad_iterate_linked_pads (GstPad *pad, GstObject *parent)
 strictly get the linked pad from the sinkpad. More...
 
static GstFlowReturn gst_join_pad_chain (GstPad *pad, GstObject *parent, GstBuffer *buf)
 Chain function, this function does the actual processing. More...
 
 G_DEFINE_TYPE (GstJoinPad, gst_join_pad, GST_TYPE_PAD)
 
static void gst_join_pad_class_init (GstJoinPadClass *klass)
 initialize the join's pad class More...
 
static void gst_join_pad_init (GstJoinPad *pad)
 initialize the join pad More...
 
static gboolean forward_sticky_events (GstPad *sinkpad, GstEvent **event, gpointer user_data)
 forward sticky event More...
 
static void gst_join_dispose (GObject *object)
 dispose function for join element More...
 
static void gst_join_finalize (GObject *object)
 finalize join element. More...
 
static void gst_join_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 Getter for join properties. More...
 
static GstPad * gst_join_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar *unused, const GstCaps *caps)
 request new sink pad More...
 
 G_DEFINE_TYPE_WITH_CODE (GstJoin, gst_join, GST_TYPE_ELEMENT, GST_DEBUG_CATEGORY_INIT(join_debug, "join", 0, "An input stream join element"))
 
static void gst_join_class_init (GstJoinClass *klass)
 initialize the join's class More...
 
static void gst_join_init (GstJoin *sel)
 initialize the join element More...
 
static gboolean plugin_init (GstPlugin *plugin)
 register this element More...
 

Variables

static GstStaticPadTemplate gst_join_sink_factory
 The capabilities of the inputs. More...
 
static GstStaticPadTemplate gst_join_src_factory
 The capabilities of the outputs. More...
 

Detailed Description

Select the out that arrived first among the input streams.

Copyright (C) 2020 Gichan Jang gicha.nosp@m.n2.j.nosp@m.ang@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m

Date
10 Nov 2020
See also
https://github.com/nnstreamer/nnstreamer
Author
Gichan Jang gicha.nosp@m.n2.j.nosp@m.ang@s.nosp@m.amsu.nosp@m.ng.co.nosp@m.m
Bug:
No known bugs except for NYI items

Definition in file gstjoin.c.

Macro Definition Documentation

◆ GST_CAT_DEFAULT

#define GST_CAT_DEFAULT   join_debug

Definition at line 35 of file gstjoin.c.

◆ GST_IS_JOIN_PAD

#define GST_IS_JOIN_PAD (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_JOIN_PAD))

Definition at line 80 of file gstjoin.c.

◆ GST_IS_JOIN_PAD_CLASS

#define GST_IS_JOIN_PAD_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_JOIN_PAD))

Definition at line 82 of file gstjoin.c.

◆ GST_JOIN_GET_COND

#define GST_JOIN_GET_COND (   sel)    (&((GstJoin*)(sel))->cond)

Definition at line 38 of file gstjoin.c.

◆ GST_JOIN_GET_LOCK

#define GST_JOIN_GET_LOCK (   sel)    (&((GstJoin*)(sel))->lock)

Definition at line 37 of file gstjoin.c.

◆ GST_JOIN_LOCK

#define GST_JOIN_LOCK (   sel)    (g_mutex_lock (GST_JOIN_GET_LOCK(sel)))

Definition at line 39 of file gstjoin.c.

◆ GST_JOIN_PAD

#define GST_JOIN_PAD (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_JOIN_PAD, GstJoinPad))

Definition at line 76 of file gstjoin.c.

◆ GST_JOIN_PAD_CAST

#define GST_JOIN_PAD_CAST (   obj)    ((GstJoinPad *)(obj))

Definition at line 84 of file gstjoin.c.

◆ GST_JOIN_PAD_CLASS

#define GST_JOIN_PAD_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_JOIN_PAD, GstJoinPadClass))

Definition at line 78 of file gstjoin.c.

◆ gst_join_parent_class

#define gst_join_parent_class   parent_class

Definition at line 428 of file gstjoin.c.

◆ GST_JOIN_UNLOCK

#define GST_JOIN_UNLOCK (   sel)    (g_mutex_unlock (GST_JOIN_GET_LOCK(sel)))

Definition at line 40 of file gstjoin.c.

◆ GST_JOIN_WAIT

#define GST_JOIN_WAIT (   sel)
Value:
(g_cond_wait (GST_JOIN_GET_COND(sel), \

Definition at line 41 of file gstjoin.c.

◆ GST_TYPE_JOIN_PAD

#define GST_TYPE_JOIN_PAD   (gst_join_pad_get_type())

Definition at line 74 of file gstjoin.c.

◆ PACKAGE

#define PACKAGE   "join"

Definition at line 701 of file gstjoin.c.

Typedef Documentation

◆ GstJoinPad

typedef struct _GstJoinPad GstJoinPad

Definition at line 87 of file gstjoin.c.

◆ GstJoinPadClass

Definition at line 88 of file gstjoin.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PROP_0 
PROP_N_PADS 
PROP_ACTIVE_PAD 

Definition at line 62 of file gstjoin.c.

Function Documentation

◆ forward_sticky_events()

static gboolean forward_sticky_events ( GstPad *  sinkpad,
GstEvent **  event,
gpointer  user_data 
)
static

forward sticky event

Definition at line 198 of file gstjoin.c.

Here is the caller graph for this function:

◆ G_DEFINE_TYPE()

G_DEFINE_TYPE ( GstJoinPad  ,
gst_join_pad  ,
GST_TYPE_PAD   
)

◆ G_DEFINE_TYPE_WITH_CODE()

G_DEFINE_TYPE_WITH_CODE ( GstJoin  ,
gst_join  ,
GST_TYPE_ELEMENT  ,
GST_DEBUG_CATEGORY_INIT(join_debug, "join", 0, "An input stream join element")   
)

◆ GST_DEBUG_CATEGORY_STATIC()

GST_DEBUG_CATEGORY_STATIC ( join_debug  )

SECTION:element-join @see_also #GstInputSelector

Note
A join has reduced and changed input-selector's function.

Connect recently arrived buffer from N input streams to the output pad. N streams should not operate at the same time. All capabilities (input stream i and output stream) should be the same. For example, If one sinkpad is receiving buffer, the others should be stopped. <refsect2> <title>Example launch line</title> gst-launch-1.0 ... (input stream 0) ! join.sink_0 \ ... (input stream 1) ! join.sink_1 \ ... \ ... (input stream N) ! join.sink_n \ join name=join ! (arrived input stream) ... </refsect2>

◆ gst_join_class_init()

static void gst_join_class_init ( GstJoinClass klass)
static

initialize the join's class

Definition at line 437 of file gstjoin.c.

Here is the call graph for this function:

◆ gst_join_dispose()

static void gst_join_dispose ( GObject *  object)
static

dispose function for join element

Definition at line 494 of file gstjoin.c.

Here is the caller graph for this function:

◆ gst_join_finalize()

static void gst_join_finalize ( GObject *  object)
static

finalize join element.

Definition at line 509 of file gstjoin.c.

Here is the caller graph for this function:

◆ gst_join_get_active_sinkpad()

static GstPad * gst_join_get_active_sinkpad ( GstJoin sel)
static

Get or create the active sinkpad.

Note
must be called with JOIN_LOCK.

If no pad is currently selected, we return the first usable pad to guarantee consistency

Definition at line 612 of file gstjoin.c.

Here is the caller graph for this function:

◆ gst_join_get_linked_pad()

static GstPad * gst_join_get_linked_pad ( GstJoin sel,
GstPad *  pad,
gboolean  strict 
)
static

Get linked pad.

Definition at line 591 of file gstjoin.c.

Here is the caller graph for this function:

◆ gst_join_get_property()

static void gst_join_get_property ( GObject *  object,
guint  prop_id,
GValue *  value,
GParamSpec *  pspec 
)
static

Getter for join properties.

Definition at line 565 of file gstjoin.c.

Here is the caller graph for this function:

◆ gst_join_init()

static void gst_join_init ( GstJoin sel)
static

initialize the join element

Definition at line 474 of file gstjoin.c.

Here is the call graph for this function:

◆ gst_join_pad_chain()

static GstFlowReturn gst_join_pad_chain ( GstPad *  pad,
GstObject *  parent,
GstBuffer *  buf 
)
static

Chain function, this function does the actual processing.

Definition at line 357 of file gstjoin.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_join_pad_class_init()

static void gst_join_pad_class_init ( GstJoinPadClass klass)
static

initialize the join's pad class

Definition at line 129 of file gstjoin.c.

Here is the call graph for this function:

◆ gst_join_pad_event()

static gboolean gst_join_pad_event ( GstPad *  pad,
GstObject *  parent,
GstEvent *  event 
)
static

event function for sink pad

Definition at line 233 of file gstjoin.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_join_pad_finalize()

static void gst_join_pad_finalize ( GObject *  object)
static

finalize the join pad

Definition at line 151 of file gstjoin.c.

Here is the caller graph for this function:

◆ gst_join_pad_get_type()

GType gst_join_pad_get_type ( void  )

◆ gst_join_pad_init()

static void gst_join_pad_init ( GstJoinPad pad)
static

initialize the join pad

Definition at line 142 of file gstjoin.c.

Here is the call graph for this function:

◆ gst_join_pad_iterate_linked_pads()

static GstIterator * gst_join_pad_iterate_linked_pads ( GstPad *  pad,
GstObject *  parent 
)
static

strictly get the linked pad from the sinkpad.

Returns
If the pad is active, return the srcpad else return NULL.

Definition at line 173 of file gstjoin.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_join_pad_query()

static gboolean gst_join_pad_query ( GstPad *  pad,
GstObject *  parent,
GstQuery *  query 
)
static

handlesink sink pad query

Returns
TRUE if the query was performed successfully.

always proxy caps/position/duration/context queries, regardless of active pad or not See https://bugzilla.gnome.org/show_bug.cgi?id=775445

Only do the allocation query for the active sinkpad, after switching a reconfigure event is sent and upstream should reconfigure and do a new allocation query

Definition at line 307 of file gstjoin.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_join_pad_reset()

static void gst_join_pad_reset ( GstJoinPad pad)
static

Clear and reset join pad.

Note
must be called with the JOIN_LOCK

Definition at line 161 of file gstjoin.c.

Here is the caller graph for this function:

◆ gst_join_request_new_pad()

static GstPad * gst_join_request_new_pad ( GstElement *  element,
GstPadTemplate *  templ,
const gchar *  unused,
const GstCaps *  caps 
)
static

request new sink pad

Definition at line 646 of file gstjoin.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gst_join_set_active_pad()

static gboolean gst_join_set_active_pad ( GstJoin self,
GstPad *  pad 
)
static

set active sink pad.

Returns
TRUE when the active pad changed.
Note
this function must be called with the JOIN_LOCK.

Definition at line 525 of file gstjoin.c.

Here is the caller graph for this function:

◆ plugin_init()

static gboolean plugin_init ( GstPlugin *  plugin)
static

register this element

Definition at line 688 of file gstjoin.c.

Variable Documentation

◆ gst_join_sink_factory

GstStaticPadTemplate gst_join_sink_factory
static
Initial value:
=
GST_STATIC_PAD_TEMPLATE ("sink_%u",
GST_PAD_SINK,
GST_PAD_REQUEST,
GST_STATIC_CAPS_ANY)

The capabilities of the inputs.

Definition at line 47 of file gstjoin.c.

◆ gst_join_src_factory

GstStaticPadTemplate gst_join_src_factory
static
Initial value:
=
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY)

The capabilities of the outputs.

Definition at line 56 of file gstjoin.c.

GST_JOIN_GET_LOCK
#define GST_JOIN_GET_LOCK(sel)
Definition: gstjoin.c:37
GST_JOIN_GET_COND
#define GST_JOIN_GET_COND(sel)
Definition: gstjoin.c:38