GstBaseTransform

GstBaseTransform — Base class for simple tranform filters

Synopsis


#include <gst/base/gstbasetransform.h>


            GstBaseTransform;
            GstBaseTransformClass;
gboolean    gst_base_transform_is_passthrough
                                            (GstBaseTransform *trans);
void        gst_base_transform_set_passthrough
                                            (GstBaseTransform *trans,
                                             gboolean passthrough);
#define     GST_BASE_TRANSFORM_SINK_NAME
#define     GST_BASE_TRANSFORM_SRC_NAME


Object Hierarchy


  GObject
   +----GstObject
         +----GstElement
               +----GstBaseTransform

Description

This base class is for filter elements that process data.

  • one sinkpad and one srcpad

  • possible formats on sink and source pad implemented with custom transform_caps function. By default uses same format on sink and source.

  • handles state changes

  • does flushing

  • push mode

  • pull mode if transform can operate on arbitrary data

Details

GstBaseTransform

typedef struct _GstBaseTransform GstBaseTransform;


GstBaseTransformClass

typedef struct {
  GstElementClass parent_class;

  /* virtual methods for subclasses */

  /* given the (non-)fixed simple caps on the pad in the given direction,
   * what can I do on the other pad ? */
  GstCaps*	(*transform_caps) (GstBaseTransform *trans,
                                   GstPadDirection direction,
                                   GstCaps *caps);

  /* given caps on one pad, how would you fixate caps on the other pad ? */
  void		(*fixate_caps)	  (GstBaseTransform *trans,
                                   GstPadDirection direction, GstCaps *caps,
                                   GstCaps *othercaps);

  /* given the size of a buffer in the given direction with the given caps,
   * calculate the byte size of an buffer on the other side with the given
   * other caps; the default
   * implementation uses get_size and keeps the number of units the same */
  gboolean      (*transform_size) (GstBaseTransform *trans,
                                   GstPadDirection direction,
                                   GstCaps *caps, guint size,
                                   GstCaps *othercaps, guint *othersize);

  /* get the byte size of one unit for a given caps.
   * Always needs to be implemented if the transform is not in-place. */
  gboolean      (*get_unit_size)  (GstBaseTransform *trans, GstCaps *caps,
                                   guint *size);

  /* notify the subclass of new caps */
  gboolean      (*set_caps)     (GstBaseTransform *trans, GstCaps *incaps,
                                 GstCaps *outcaps);

  /* start and stop processing, ideal for opening/closing the resource */
  gboolean      (*start)        (GstBaseTransform *trans);
  gboolean      (*stop)         (GstBaseTransform *trans);

  gboolean      (*event)        (GstBaseTransform *trans, GstEvent *event);

  /* transform one incoming buffer to one outgoing buffer.
   * Always needs to be implemented.
   * transform function is allowed to change size/timestamp/duration of
   * the outgoing buffer. */
  GstFlowReturn (*transform)    (GstBaseTransform *trans, GstBuffer *inbuf,
                                 GstBuffer *outbuf);

  /* transform a buffer inplace */
  GstFlowReturn (*transform_ip) (GstBaseTransform *trans, GstBuffer *buf);
} GstBaseTransformClass;


gst_base_transform_is_passthrough ()

gboolean    gst_base_transform_is_passthrough
                                            (GstBaseTransform *trans);

See if trans is configured as a passthrough transform.

trans : the GstBaseTransform to query
Returns : TRUE is the transform is configured in passthrough mode. MT safe.

gst_base_transform_set_passthrough ()

void        gst_base_transform_set_passthrough
                                            (GstBaseTransform *trans,
                                             gboolean passthrough);

Set passthrough mode for this filter by default. This is mostly usefull for filters that do not care about negotiation.

MT safe.

trans : the GstBaseTransform to set
passthrough : boolean indicating passthrough mode.

GST_BASE_TRANSFORM_SINK_NAME

#define GST_BASE_TRANSFORM_SINK_NAME	"sink"


GST_BASE_TRANSFORM_SRC_NAME

#define GST_BASE_TRANSFORM_SRC_NAME	"src"

See Also

GstBaseSrc, GstBaseSink