示例#1
0
/* this function handles sink events */
static gboolean
gst_plugin_template_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
{
  gboolean ret;
  GstPluginTemplate *filter;

  filter = GST_PLUGIN_TEMPLATE (parent);

  switch (GST_EVENT_TYPE (event)) {
    case GST_EVENT_CAPS:
    {
      GstCaps * caps;

      gst_event_parse_caps (event, &caps);
      /* do something with the caps */

      /* and forward */
      ret = gst_pad_event_default (pad, parent, event);
      break;
    }
    default:
      ret = gst_pad_event_default (pad, parent, event);
      break;
  }
  return ret;
}
示例#2
0
static gboolean
gst_plugin_template_setup (GstAudioFilter * filter,
    GstRingBufferSpec * spec)
{
  GstPluginTemplate *plugin_template;

  plugin_template = GST_PLUGIN_TEMPLATE (filter);

  /* if any setup needs to be done, do it here */

  return TRUE;                  /* it's all good */
}
示例#3
0
/* chain function
 * this function does the actual processing
 */
static GstFlowReturn
gst_plugin_template_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
{
  GstPluginTemplate *filter;

  filter = GST_PLUGIN_TEMPLATE (parent);

  if (filter->silent == FALSE)
    g_print ("I'm plugged, therefore I'm in.\n");

  /* just push out the incoming buffer without touching it */
  return gst_pad_push (filter->srcpad, buf);
}
示例#4
0
static void
gst_plugin_template_get_property (GObject * object, guint prop_id,
    GValue * value, GParamSpec * pspec)
{
  GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (object);

  GST_OBJECT_LOCK (filter);
  switch (prop_id) {
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
  GST_OBJECT_UNLOCK (filter);
}
示例#5
0
static void
gst_plugin_template_get_property (GObject * object, guint prop_id,
    GValue * value, GParamSpec * pspec)
{
  GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (object);

  switch (prop_id) {
    case PROP_SILENT:
      g_value_set_boolean (value, filter->silent);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
示例#6
0
static GstFlowReturn
gst_plugin_template_filter_inplace (GstBaseTransform * base_transform,
    GstBuffer * buf)
{
  GstPluginTemplate *plugin_template;
  GstAudioFilter *audiofilter;

  audiofilter = GST_AUDIO_FILTER (base_transform);
  plugin_template = GST_PLUGIN_TEMPLATE (base_transform);

  /* FIXME: do something interesting here.  This simply copies the source
   * to the destination. */

  return GST_FLOW_OK;
}
示例#7
0
/* this function does the actual processing
 */
static GstFlowReturn
gst_plugin_template_transform_ip (GstBaseTransform * base, GstBuffer * outbuf)
{
  GstPluginTemplate *filter = GST_PLUGIN_TEMPLATE (base);

  if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (outbuf)))
    gst_object_sync_values (G_OBJECT (filter), GST_BUFFER_TIMESTAMP (outbuf));

  if (filter->silent == FALSE)
    g_print ("I'm plugged, therefore I'm in.\n");
  
  /* FIXME: do something interesting here.  This simply copies the source
   * to the destination. */

  return GST_FLOW_OK;
}
示例#8
0
static GstFlowReturn
gst_plugin_template_filter (GstBaseTransform * base_transform,
    GstBuffer * inbuf, GstBuffer * outbuf)
{
  GstPluginTemplate *plugin_template;
  GstAudioFilter *audiofilter;

  audiofilter = GST_AUDIO_FILTER (base_transform);
  plugin_template = GST_PLUGIN_TEMPLATE (base_transform);

  /* FIXME: do something interesting here.  This simply copies the source
   * to the destination. */

  memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (inbuf),
      GST_BUFFER_SIZE (inbuf));

  return GST_FLOW_OK;
}