static void
gst_audio_ringbuffer_init (GstAudioRingbuffer * ringbuffer,
    GstAudioRingbufferClass * g_class)
{
  ringbuffer->sinkpad =
      gst_pad_new_from_static_template (&sinktemplate, "sink");

  gst_pad_set_chain_function (ringbuffer->sinkpad,
      GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_chain));
  gst_pad_set_activatepush_function (ringbuffer->sinkpad,
      GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_sink_activate_push));
  gst_pad_set_event_function (ringbuffer->sinkpad,
      GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_handle_sink_event));
  gst_pad_set_getcaps_function (ringbuffer->sinkpad,
      GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_getcaps));
  gst_pad_set_setcaps_function (ringbuffer->sinkpad,
      GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_setcaps));
  gst_pad_set_bufferalloc_function (ringbuffer->sinkpad,
      GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_bufferalloc));
  gst_element_add_pad (GST_ELEMENT (ringbuffer), ringbuffer->sinkpad);

  ringbuffer->srcpad = gst_pad_new_from_static_template (&srctemplate, "src");

  gst_pad_set_activatepull_function (ringbuffer->srcpad,
      GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_src_activate_pull));
  gst_pad_set_activatepush_function (ringbuffer->srcpad,
      GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_src_activate_push));
  gst_pad_set_getrange_function (ringbuffer->srcpad,
      GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_get_range));
  gst_pad_set_checkgetrange_function (ringbuffer->srcpad,
      GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_src_checkgetrange_function));
  gst_pad_set_getcaps_function (ringbuffer->srcpad,
      GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_getcaps));
  gst_pad_set_event_function (ringbuffer->srcpad,
      GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_handle_src_event));
  gst_pad_set_query_function (ringbuffer->srcpad,
      GST_DEBUG_FUNCPTR (gst_audio_ringbuffer_handle_src_query));
  gst_element_add_pad (GST_ELEMENT (ringbuffer), ringbuffer->srcpad);

  gst_segment_init (&ringbuffer->sink_segment, GST_FORMAT_TIME);

  ringbuffer->cond = g_cond_new ();

  ringbuffer->is_eos = FALSE;

  ringbuffer->buffer_time = DEFAULT_BUFFER_TIME;
  ringbuffer->segment_time = DEFAULT_SEGMENT_TIME;

  GST_DEBUG_OBJECT (ringbuffer,
      "initialized ringbuffer's not_empty & not_full conditions");
}
Example #2
0
static void
gst_base_video_decoder_init (GstBaseVideoDecoder * base_video_decoder,
    GstBaseVideoDecoderClass * klass)
{
  GstPad *pad;

  GST_DEBUG ("gst_base_video_decoder_init");

  pad = GST_BASE_VIDEO_CODEC_SINK_PAD (base_video_decoder);

  gst_pad_set_activatepush_function (pad,
      gst_base_video_decoder_sink_activate_push);
  gst_pad_set_chain_function (pad, gst_base_video_decoder_chain);
  gst_pad_set_event_function (pad, gst_base_video_decoder_sink_event);
  gst_pad_set_setcaps_function (pad, gst_base_video_decoder_sink_setcaps);
  gst_pad_set_query_function (pad, gst_base_video_decoder_sink_query);

  pad = GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder);

  gst_pad_set_event_function (pad, gst_base_video_decoder_src_event);
  gst_pad_set_query_type_function (pad, gst_base_video_decoder_get_query_types);
  gst_pad_set_query_function (pad, gst_base_video_decoder_src_query);

  base_video_decoder->input_adapter = gst_adapter_new ();
  base_video_decoder->output_adapter = gst_adapter_new ();

  gst_segment_init (&base_video_decoder->state.segment, GST_FORMAT_TIME);
  gst_base_video_decoder_reset (base_video_decoder);

  base_video_decoder->current_frame =
      gst_base_video_decoder_new_frame (base_video_decoder);

  base_video_decoder->sink_clipping = TRUE;
}
static void
gst_live_adder_init (GstLiveAdder * adder, GstLiveAdderClass * klass)
{
    adder->srcpad =
        gst_pad_new_from_static_template (&gst_live_adder_src_template, "src");
    gst_pad_set_getcaps_function (adder->srcpad,
                                  GST_DEBUG_FUNCPTR (gst_pad_proxy_getcaps));
    gst_pad_set_setcaps_function (adder->srcpad,
                                  GST_DEBUG_FUNCPTR (gst_live_adder_setcaps));
    gst_pad_set_query_function (adder->srcpad,
                                GST_DEBUG_FUNCPTR (gst_live_adder_query));
    gst_pad_set_event_function (adder->srcpad,
                                GST_DEBUG_FUNCPTR (gst_live_adder_src_event));
    gst_pad_set_activatepush_function (adder->srcpad,
                                       GST_DEBUG_FUNCPTR (gst_live_adder_src_activate_push));
    gst_element_add_pad (GST_ELEMENT (adder), adder->srcpad);

    adder->format = GST_LIVE_ADDER_FORMAT_UNSET;
    adder->padcount = 0;
    adder->func = NULL;
    adder->not_empty_cond = g_cond_new ();

    adder->next_timestamp = GST_CLOCK_TIME_NONE;

    adder->latency_ms = DEFAULT_LATENCY_MS;

    adder->buffers = g_queue_new ();
}
Example #4
0
static void
gst_ghost_pad_init (GstGhostPad * pad)
{
  gst_pad_set_activatepull_function (GST_PAD_CAST (pad),
      GST_DEBUG_FUNCPTR (gst_ghost_pad_do_activate_pull));
  gst_pad_set_activatepush_function (GST_PAD_CAST (pad),
      GST_DEBUG_FUNCPTR (gst_ghost_pad_do_activate_push));
}
static void
type_instance_init (GTypeInstance *instance,
                    gpointer g_class)
{
    GstOmxBaseFilter21 *self;
    GstElementClass *element_class;
    GstOmxBaseFilter21Class *bclass;
	int i;
	char srcname[10];

    element_class = GST_ELEMENT_CLASS (g_class);
    bclass = GST_OMX_BASE_FILTER21_CLASS (g_class);

    self = GST_OMX_BASE_FILTER21 (instance);

    GST_LOG_OBJECT (self, "begin");


    self->gomx = g_omx_core_new (self, g_class);
    for (i = 0; i < NUM_INPUTS; i++) {
		sprintf(srcname, "in_%02x", i);
		self->input_port_index[i] = OMX_VSWMOSAIC_INPUT_PORT_START_INDEX + i;
		self->in_port[i] = g_omx_core_get_port (self->gomx, srcname, self->input_port_index[i]);
		self->in_port[i]->omx_allocate = TRUE;
		self->in_port[i]->share_buffer = FALSE;
		self->in_port[i]->port_index = self->input_port_index[i];
	}
	self->output_port_index = OMX_VSWMOSAIC_OUTPUT_PORT_START_INDEX;
	self->out_port = g_omx_core_get_port (self->gomx, "out", self->output_port_index);
	self->out_port->buffer_alloc = buffer_alloc;
	self->out_port->omx_allocate = TRUE;
	self->out_port->share_buffer = FALSE;
	self->out_port->port_index = self->output_port_index;
	self->number_eos = 2;
    self->ready_lock = g_mutex_new ();
    self->collectpads = gst_collect_pads_new();
    gst_collect_pads_set_function(self->collectpads, &collected_pads, self);
	for (i = 0; i < NUM_INPUTS; i++) {
		sprintf(srcname, "sink_%02x", i);
		self->sinkpad[i] =	gst_pad_new_from_template (gst_element_class_get_pad_template (element_class, srcname), srcname);

		gst_pad_set_chain_function (self->sinkpad[i], bclass->pad_chain);
		gst_pad_set_event_function (self->sinkpad[i], bclass->pad_event);
		gst_pad_set_setcaps_function (self->sinkpad[i], GST_DEBUG_FUNCPTR (sink_setcaps));
		gst_element_add_pad (GST_ELEMENT (self), self->sinkpad[i]);
		gst_collect_pads_add_pad(self->collectpads, self->sinkpad[i], sizeof(GstCollectData));
	}
	self->srcpad=
		gst_pad_new_from_template (gst_element_class_get_pad_template (element_class, "src"), "src");
	gst_pad_set_activatepush_function (self->srcpad, activate_push);
	gst_pad_set_setcaps_function (self->srcpad, GST_DEBUG_FUNCPTR (src_setcaps));
	gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
    self->duration = GST_CLOCK_TIME_NONE;
    self->sink_camera_timestamp = GST_CLOCK_TIME_NONE;
    self->out_framerate = NULL;

    GST_LOG_OBJECT (self, "end");
}
static void
type_instance_init (GTypeInstance *instance,
                    gpointer g_class)
{
    GstOmxBaseFilter2 *self;
    GstElementClass *element_class;
    GstOmxBaseFilter2Class *bclass;
	int i;
	char srcname[10];

    element_class = GST_ELEMENT_CLASS (g_class);
    bclass = GST_OMX_BASE_FILTER2_CLASS (g_class);

    self = GST_OMX_BASE_FILTER2 (instance);

    GST_LOG_OBJECT (self, "begin");

    /* GOmx */
    self->gomx = g_omx_core_new (self, g_class);
    self->in_port = g_omx_core_get_port (self->gomx, "in", 0);
    self->in_port->omx_allocate = TRUE;
    self->in_port->share_buffer = FALSE;

	for (i = 0; i < NUM_OUTPUTS; i++) {
		sprintf(srcname, "out_%02x", i);
		self->out_port[i] = g_omx_core_get_port (self->gomx, srcname, 1+i);
		self->out_port[i]->buffer_alloc = buffer_alloc;
		self->out_port[i]->omx_allocate = TRUE;
		self->out_port[i]->share_buffer = FALSE;
	}
    self->ready_lock = g_mutex_new ();

    self->sinkpad =
        gst_pad_new_from_template (gst_element_class_get_pad_template (element_class, "sink"), "sink");

    gst_pad_set_chain_function (self->sinkpad, bclass->pad_chain);
    gst_pad_set_event_function (self->sinkpad, bclass->pad_event);

    gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);

	for (i = 0; i < NUM_OUTPUTS; i++) {
		sprintf(srcname, "src_%02x", i);
		self->srcpad[i] =
			gst_pad_new_from_template (gst_element_class_get_pad_template (element_class, srcname), srcname);
		gst_pad_set_activatepush_function (self->srcpad[i], activate_push);
		gst_pad_use_fixed_caps (self->srcpad[i]);
		gst_element_add_pad (GST_ELEMENT (self), self->srcpad[i]);
	}
    self->duration = GST_CLOCK_TIME_NONE;
	self->input_fields_separately = FALSE;

    GST_LOG_OBJECT (self, "end");
}
Example #7
0
static void
type_instance_init (GTypeInstance *instance,
                    gpointer g_class)
{
    GstOmxBaseFilter *self;
    GstElementClass *element_class;

    element_class = GST_ELEMENT_CLASS (g_class);

    self = GST_OMX_BASE_FILTER (instance);

    GST_LOG_OBJECT (self, "begin");

    self->use_timestamps = TRUE;

    /* GOmx */
    {
        GOmxCore *gomx;
        self->gomx = gomx = g_omx_core_new ();
        gomx->object = self;
    }

    self->ready_lock = g_mutex_new ();

    self->sinkpad =
        gst_pad_new_from_template (gst_element_class_get_pad_template (element_class, "sink"), "sink");

    gst_pad_set_chain_function (self->sinkpad, pad_chain);
    gst_pad_set_event_function (self->sinkpad, pad_event);

    self->srcpad =
        gst_pad_new_from_template (gst_element_class_get_pad_template (element_class, "src"), "src");

    gst_pad_set_activatepush_function (self->srcpad, activate_push);

    gst_pad_use_fixed_caps (self->srcpad);

    gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
    gst_element_add_pad (GST_ELEMENT (self), self->srcpad);

    {
        const char *tmp;
        tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
                                g_quark_from_static_string ("library-name"));
        self->omx_library = g_strdup (tmp);
        tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
                                g_quark_from_static_string ("component-name"));
        self->omx_component = g_strdup (tmp);
    }

    GST_LOG_OBJECT (self, "end");
}
Example #8
0
static void
gst_ghost_pad_init (GstGhostPad * pad)
{
  GST_GHOST_PAD_PRIVATE (pad) = G_TYPE_INSTANCE_GET_PRIVATE (pad,
      GST_TYPE_GHOST_PAD, GstGhostPadPrivate);

  gst_pad_set_setcaps_function (GST_PAD_CAST (pad),
      GST_DEBUG_FUNCPTR (gst_ghost_pad_do_setcaps));
  gst_pad_set_activatepull_function (GST_PAD_CAST (pad),
      GST_DEBUG_FUNCPTR (gst_ghost_pad_do_activate_pull));
  gst_pad_set_activatepush_function (GST_PAD_CAST (pad),
      GST_DEBUG_FUNCPTR (gst_ghost_pad_do_activate_push));
}
Example #9
0
static void
gst_rtp_jitter_buffer_init (GstRtpJitterBuffer * jitterbuffer,
    GstRtpJitterBufferClass * klass)
{
  GstRtpJitterBufferPrivate *priv;

  priv = GST_RTP_JITTER_BUFFER_GET_PRIVATE (jitterbuffer);
  jitterbuffer->priv = priv;

  priv->latency_ms = DEFAULT_LATENCY_MS;
  priv->drop_on_latency = DEFAULT_DROP_ON_LATENCY;
  priv->do_lost = DEFAULT_DO_LOST;

  priv->jbuf = rtp_jitter_buffer_new ();
  priv->jbuf_lock = g_mutex_new ();
  priv->jbuf_cond = g_cond_new ();

  priv->srcpad =
      gst_pad_new_from_static_template (&gst_rtp_jitter_buffer_src_template,
      "src");

  gst_pad_set_activatepush_function (priv->srcpad,
      GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_src_activate_push));
  gst_pad_set_query_function (priv->srcpad,
      GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_query));
  gst_pad_set_getcaps_function (priv->srcpad,
      GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_getcaps));
  gst_pad_set_event_function (priv->srcpad,
      GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_src_event));

  priv->sinkpad =
      gst_pad_new_from_static_template (&gst_rtp_jitter_buffer_sink_template,
      "sink");

  gst_pad_set_chain_function (priv->sinkpad,
      GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_chain));
  gst_pad_set_event_function (priv->sinkpad,
      GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_sink_event));
  gst_pad_set_setcaps_function (priv->sinkpad,
      GST_DEBUG_FUNCPTR (gst_jitter_buffer_sink_setcaps));
  gst_pad_set_getcaps_function (priv->sinkpad,
      GST_DEBUG_FUNCPTR (gst_rtp_jitter_buffer_getcaps));

  gst_element_add_pad (GST_ELEMENT (jitterbuffer), priv->srcpad);
  gst_element_add_pad (GST_ELEMENT (jitterbuffer), priv->sinkpad);
}
Example #10
0
GstPad *
gst_vf_src_pad_new (GstStaticPadTemplate * pad_template, const char *name)
{
  GST_DEBUG_CATEGORY_INIT (droidvfsrc_debug, "droidvfsrc", 0,
      "Android camera viewfinder source pad");

  GstPad *pad = gst_pad_new_from_static_template (pad_template, name);

  gst_pad_set_activatepush_function (pad, gst_droid_cam_src_vfsrc_activatepush);
  gst_pad_set_setcaps_function (pad, gst_droid_cam_src_vfsrc_setcaps);
  gst_pad_set_getcaps_function (pad, gst_droid_cam_src_vfsrc_getcaps);
  gst_pad_set_query_type_function (pad, gst_droid_cam_src_vfsrc_query_type);
  gst_pad_set_query_function (pad, gst_droid_cam_src_vfsrc_query);
  gst_pad_set_fixatecaps_function (pad, gst_droid_cam_src_vfsrc_fixatecaps);

  /* TODO: Do we need an event handler via gst_pad_set_event_function() ? */
  return pad;
}
Example #11
0
static void
gst_ghost_pad_dispose (GObject * object)
{
  GstPad *pad;
  GstPad *internal;
  GstPad *peer;

  pad = GST_PAD (object);

  GST_DEBUG_OBJECT (pad, "dispose");

  gst_ghost_pad_set_target (GST_GHOST_PAD (pad), NULL);

  /* Unlink here so that gst_pad_dispose doesn't. That would lead to a call to
   * gst_ghost_pad_do_unlink when the ghost pad is in an inconsistent state */
  peer = gst_pad_get_peer (pad);
  if (peer) {
    if (GST_PAD_IS_SRC (pad))
      gst_pad_unlink (pad, peer);
    else
      gst_pad_unlink (peer, pad);

    gst_object_unref (peer);
  }

  GST_PROXY_LOCK (pad);
  internal = GST_PROXY_PAD_INTERNAL (pad);

  gst_pad_set_activatepull_function (internal, NULL);
  gst_pad_set_activatepush_function (internal, NULL);

  g_signal_handler_disconnect (internal,
      GST_GHOST_PAD_PRIVATE (pad)->notify_id);

  /* disposes of the internal pad, since the ghostpad is the only possible object
   * that has a refcount on the internal pad. */
  gst_object_unparent (GST_OBJECT_CAST (internal));
  GST_PROXY_PAD_INTERNAL (pad) = NULL;

  GST_PROXY_UNLOCK (pad);

  G_OBJECT_CLASS (gst_ghost_pad_parent_class)->dispose (object);
}
Example #12
0
static void
type_instance_init (GTypeInstance *instance,
                    gpointer g_class)
{
    GstOmxBaseFilter *self;
    GstElementClass *element_class;

    element_class = GST_ELEMENT_CLASS (g_class);

    self = GST_OMX_BASE_FILTER (instance);

    GST_LOG_OBJECT (self, "begin");

    self->use_timestamps = TRUE;

    /* GOmx */
    {
        GOmxCore *gomx;
        self->gomx = gomx = g_omx_core_new ();
        gomx->client_data = self;
    }

    self->sinkpad =
        gst_pad_new_from_template (gst_element_class_get_pad_template (element_class, "sink"), "sink");

    gst_pad_set_chain_function (self->sinkpad, pad_chain);
    gst_pad_set_event_function (self->sinkpad, pad_event);

    self->srcpad =
        gst_pad_new_from_template (gst_element_class_get_pad_template (element_class, "src"), "src");

    gst_pad_set_activatepush_function (self->srcpad, activate_push);

    gst_pad_use_fixed_caps (self->srcpad);

    gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
    gst_element_add_pad (GST_ELEMENT (self), self->srcpad);

    self->omx_library = g_strdup (DEFAULT_LIBRARY_NAME);

    GST_LOG_OBJECT (self, "end");
}
Example #13
0
static void
gst_pngdec_init (GstPngDec * pngdec)
{
  pngdec->sinkpad =
      gst_pad_new_from_static_template (&gst_pngdec_sink_pad_template, "sink");
  gst_pad_set_activate_function (pngdec->sinkpad, gst_pngdec_sink_activate);
  gst_pad_set_activatepush_function (pngdec->sinkpad,
      gst_pngdec_sink_activate_push);
  gst_pad_set_activatepull_function (pngdec->sinkpad,
      gst_pngdec_sink_activate_pull);
  gst_pad_set_chain_function (pngdec->sinkpad, gst_pngdec_chain);
  gst_pad_set_event_function (pngdec->sinkpad, gst_pngdec_sink_event);
  gst_pad_set_setcaps_function (pngdec->sinkpad, gst_pngdec_sink_setcaps);
  gst_element_add_pad (GST_ELEMENT (pngdec), pngdec->sinkpad);

  pngdec->srcpad =
      gst_pad_new_from_static_template (&gst_pngdec_src_pad_template, "src");
  gst_pad_use_fixed_caps (pngdec->srcpad);
  gst_element_add_pad (GST_ELEMENT (pngdec), pngdec->srcpad);

  pngdec->buffer_out = NULL;
  pngdec->png = NULL;
  pngdec->info = NULL;
  pngdec->endinfo = NULL;
  pngdec->setup = FALSE;

  pngdec->color_type = -1;
  pngdec->width = -1;
  pngdec->height = -1;
  pngdec->bpp = -1;
  pngdec->fps_n = 0;
  pngdec->fps_d = 1;

  pngdec->in_timestamp = GST_CLOCK_TIME_NONE;
  pngdec->in_duration = GST_CLOCK_TIME_NONE;

  gst_segment_init (&pngdec->segment, GST_FORMAT_UNDEFINED);

  pngdec->image_ready = FALSE;
}
static void
type_instance_init (GTypeInstance * instance, gpointer g_class)
{
  GstOmxBaseFilter *self;
  GstElementClass *element_class;

  element_class = GST_ELEMENT_CLASS (g_class);

  self = GST_OMX_BASE_FILTER (instance);

  GST_LOG_OBJECT (self, "begin");

  self->use_timestamps = TRUE;

  self->gomx = gstomx_core_new (self, G_TYPE_FROM_CLASS (g_class));
  self->in_port = g_omx_core_new_port (self->gomx, 0);
  self->out_port = g_omx_core_new_port (self->gomx, 1);

  self->ready_lock = g_mutex_new ();

  self->sinkpad =
      gst_pad_new_from_template (gst_element_class_get_pad_template
      (element_class, "sink"), "sink");

  gst_pad_set_chain_function (self->sinkpad, pad_chain);
  gst_pad_set_event_function (self->sinkpad, pad_event);

  self->srcpad =
      gst_pad_new_from_template (gst_element_class_get_pad_template
      (element_class, "src"), "src");

  gst_pad_set_activatepush_function (self->srcpad, activate_push);

  gst_pad_use_fixed_caps (self->srcpad);

  gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
  gst_element_add_pad (GST_ELEMENT (self), self->srcpad);

  GST_LOG_OBJECT (self, "end");
}
static void
type_instance_init (GTypeInstance * instance, gpointer g_class)
{
  GstOmxBaseSink *self;

  self = GST_OMX_BASE_SINK (instance);

  GST_LOG_OBJECT (self, "begin");

  self->gomx = gstomx_core_new (self, G_TYPE_FROM_CLASS (g_class));
  self->in_port = g_omx_core_new_port (self->gomx, 0);

  {
    GstPad *sinkpad;
    self->sinkpad = sinkpad = GST_BASE_SINK_PAD (self);
    self->base_activatepush = GST_PAD_ACTIVATEPUSHFUNC (sinkpad);
    gst_pad_set_activatepush_function (sinkpad, activate_push);
    gst_pad_set_link_function (sinkpad, pad_sink_link);
  }

  GST_LOG_OBJECT (self, "end");
}
Example #16
0
static void
gst_real_audio_demux_init (GstRealAudioDemux * demux,
    GstRealAudioDemuxClass * klass)
{
  demux->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");

  gst_pad_set_chain_function (demux->sinkpad,
      GST_DEBUG_FUNCPTR (gst_real_audio_demux_chain));
  gst_pad_set_event_function (demux->sinkpad,
      GST_DEBUG_FUNCPTR (gst_real_audio_demux_sink_event));
  gst_pad_set_activate_function (demux->sinkpad,
      GST_DEBUG_FUNCPTR (gst_real_audio_demux_sink_activate));
  gst_pad_set_activatepull_function (demux->sinkpad,
      GST_DEBUG_FUNCPTR (gst_real_audio_demux_sink_activate_pull));
  gst_pad_set_activatepush_function (demux->sinkpad,
      GST_DEBUG_FUNCPTR (gst_real_audio_demux_sink_activate_push));

  gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad);

  demux->adapter = gst_adapter_new ();
  gst_real_audio_demux_reset (demux);
}
static void
gst_vdp_output_src_pad_init (GstVdpOutputSrcPad * vdp_pad)
{
  GstPad *pad = GST_PAD (vdp_pad);

  vdp_pad->caps = NULL;
  vdp_pad->output_caps = NULL;
  vdp_pad->bpool = NULL;
  vdp_pad->device = NULL;

  vdp_pad->lock_caps = FALSE;

  gst_pad_set_getcaps_function (pad,
      GST_DEBUG_FUNCPTR (gst_vdp_output_src_pad_getcaps));
  gst_pad_set_setcaps_function (pad,
      GST_DEBUG_FUNCPTR (gst_vdp_output_src_pad_setcaps));
  gst_pad_set_acceptcaps_function (pad,
      GST_DEBUG_FUNCPTR (gst_vdp_output_src_pad_acceptcaps));

  gst_pad_set_activatepush_function (pad,
      GST_DEBUG_FUNCPTR (gst_vdp_output_src_pad_activate_push));
}
Example #18
0
static void
gst_ghost_pad_dispose (GObject * object)
{
  GstPad *pad;
  GstPad *internal;
  GstPad *intpeer;

  pad = GST_PAD (object);

  GST_DEBUG_OBJECT (pad, "dispose");

  GST_PROXY_LOCK (pad);
  internal = GST_PROXY_PAD_INTERNAL (pad);

  gst_pad_set_activatepull_function (internal, NULL);
  gst_pad_set_activatepush_function (internal, NULL);

  g_signal_handler_disconnect (internal, GST_GHOST_PAD_CAST (pad)->notify_id);

  intpeer = gst_pad_get_peer (internal);
  if (intpeer) {
    if (GST_PAD_IS_SRC (internal))
      gst_pad_unlink (internal, intpeer);
    else
      gst_pad_unlink (intpeer, internal);

    gst_object_unref (intpeer);
  }

  GST_PROXY_PAD_INTERNAL (internal) = NULL;

  /* disposes of the internal pad, since the ghostpad is the only possible object
   * that has a refcount on the internal pad. */
  gst_object_unparent (GST_OBJECT_CAST (internal));

  GST_PROXY_UNLOCK (pad);

  G_OBJECT_CLASS (gst_ghost_pad_parent_class)->dispose (object);
}
Example #19
0
static void
gst_deinterleave_init (GstDeinterleave * self, GstDeinterleaveClass * klass)
{
  self->channels = 0;
  self->pos = NULL;
  self->keep_positions = FALSE;
  self->width = 0;
  self->func = NULL;

  /* Add sink pad */
  self->sink = gst_pad_new_from_static_template (&sink_template, "sink");
  gst_pad_set_chain_function (self->sink,
      GST_DEBUG_FUNCPTR (gst_deinterleave_chain));
  gst_pad_set_setcaps_function (self->sink,
      GST_DEBUG_FUNCPTR (gst_deinterleave_sink_setcaps));
  gst_pad_set_getcaps_function (self->sink,
      GST_DEBUG_FUNCPTR (gst_deinterleave_sink_getcaps));
  gst_pad_set_activatepush_function (self->sink,
      GST_DEBUG_FUNCPTR (gst_deinterleave_sink_activate_push));
  gst_pad_set_event_function (self->sink,
      GST_DEBUG_FUNCPTR (gst_deinterleave_sink_event));
  gst_element_add_pad (GST_ELEMENT (self), self->sink);
}
static void
type_instance_init (GTypeInstance *instance,
                    gpointer g_class)
{
    GstOmxBaseSink *self;

    self = GST_OMX_BASE_SINK (instance);

    GST_LOG_OBJECT (self, "begin");

    /* GOmx */
    {
        GOmxCore *gomx;
        self->gomx = gomx = g_omx_core_new ();
        gomx->object = self;
    }

    {
        const char *tmp;
        tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
                                g_quark_from_static_string ("library-name"));
        self->omx_library = g_strdup (tmp);
        tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
                                g_quark_from_static_string ("component-name"));
        self->omx_component = g_strdup (tmp);
    }

    {
        GstPad *sinkpad;
        self->sinkpad = sinkpad = GST_BASE_SINK_PAD (self);
        self->base_activatepush = GST_PAD_ACTIVATEPUSHFUNC (sinkpad);
        gst_pad_set_activatepush_function (sinkpad, activate_push);
        gst_pad_set_link_function (sinkpad, pad_sink_link);
    }

    GST_LOG_OBJECT (self, "end");
}
/**
 * hls_progress_buffer_init()
 *
 * Initializer.  Automatically declared in the GST_BOILERPLATE macro above.  Should be
 * only called by GStreamer.
 */
static void hls_progress_buffer_init(HLSProgressBuffer *element, HLSProgressBufferClass *element_klass)
{
    GstElementClass *klass = GST_ELEMENT_CLASS (element_klass);
    int i = 0;

    element->sinkpad = gst_pad_new_from_template (gst_element_class_get_pad_template (klass, "sink"), "sink");
    gst_pad_set_chain_function(element->sinkpad, hls_progress_buffer_chain);
    gst_pad_set_event_function(element->sinkpad, hls_progress_buffer_sink_event);
    gst_element_add_pad (GST_ELEMENT (element), element->sinkpad);

    element->srcpad = gst_pad_new_from_template (gst_element_class_get_pad_template (GST_ELEMENT_GET_CLASS(element), "src"), "src");
    gst_pad_set_activatepush_function(element->srcpad, hls_progress_buffer_activatepush_src);
    gst_pad_set_event_function(element->srcpad, hls_progress_buffer_src_event);
    gst_element_add_pad (GST_ELEMENT (element), element->srcpad);

    element->lock = g_mutex_new();
    element->add_cond = g_cond_new();
    element->del_cond = g_cond_new();

    for (i = 0; i < NUM_OF_CACHED_SEGMENTS; i++)
    {
        element->cache[i] = create_cache();
        element->cache_size[i] = 0;
        element->cache_write_ready[i] = TRUE;
    }

    element->cache_write_index = -1;
    element->cache_read_index = 0;

    element->send_new_segment = TRUE;

    element->is_flushing = FALSE;
    element->is_eos = FALSE;

    element->srcresult = GST_FLOW_OK;
}
Example #22
0
static gboolean
activate_session (GstRDTManager * rdtmanager, GstRDTManagerSession * session,
    guint32 ssrc, guint8 pt)
{
  GstPadTemplate *templ;
  GstElementClass *klass;
  gchar *name;
  GstCaps *caps;
  GValue ret = { 0 };
  GValue args[3] = { {0}
  , {0}
  , {0}
  };

  GST_DEBUG_OBJECT (rdtmanager, "creating stream");

  session->ssrc = ssrc;
  session->pt = pt;

  /* get pt map */
  g_value_init (&args[0], GST_TYPE_ELEMENT);
  g_value_set_object (&args[0], rdtmanager);
  g_value_init (&args[1], G_TYPE_UINT);
  g_value_set_uint (&args[1], session->id);
  g_value_init (&args[2], G_TYPE_UINT);
  g_value_set_uint (&args[2], pt);

  g_value_init (&ret, GST_TYPE_CAPS);
  g_value_set_boxed (&ret, NULL);

  g_signal_emitv (args, gst_rdt_manager_signals[SIGNAL_REQUEST_PT_MAP], 0,
      &ret);

  g_value_unset (&args[0]);
  g_value_unset (&args[1]);
  g_value_unset (&args[2]);
  caps = (GstCaps *) g_value_dup_boxed (&ret);
  g_value_unset (&ret);

  if (caps)
    gst_rdt_manager_parse_caps (rdtmanager, session, caps);

  name = g_strdup_printf ("recv_rtp_src_%d_%u_%d", session->id, ssrc, pt);
  klass = GST_ELEMENT_GET_CLASS (rdtmanager);
  templ = gst_element_class_get_pad_template (klass, "recv_rtp_src_%d_%d_%d");
  session->recv_rtp_src = gst_pad_new_from_template (templ, name);
  g_free (name);

  gst_pad_set_caps (session->recv_rtp_src, caps);
  gst_caps_unref (caps);

  gst_pad_set_element_private (session->recv_rtp_src, session);
  gst_pad_set_query_function (session->recv_rtp_src, gst_rdt_manager_query_src);
  gst_pad_set_activatepush_function (session->recv_rtp_src,
      gst_rdt_manager_src_activate_push);

  gst_pad_set_active (session->recv_rtp_src, TRUE);
  gst_element_add_pad (GST_ELEMENT_CAST (rdtmanager), session->recv_rtp_src);

  return TRUE;
}
static void
gst_decklink_src_init (GstDecklinkSrc * decklinksrc,
                       GstDecklinkSrcClass * decklinksrc_class)
{
    g_static_rec_mutex_init (&decklinksrc->task_mutex);
    decklinksrc->task = gst_task_create (gst_decklink_src_task, decklinksrc);
    gst_task_set_lock (decklinksrc->task, &decklinksrc->task_mutex);

    decklinksrc->audiosrcpad =
        gst_pad_new_from_static_template (&gst_decklink_src_audio_src_template,
                                          "audiosrc");
    gst_pad_set_getcaps_function (decklinksrc->audiosrcpad,
                                  GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_getcaps));
    gst_pad_set_setcaps_function (decklinksrc->audiosrcpad,
                                  GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_setcaps));
    gst_pad_set_acceptcaps_function (decklinksrc->audiosrcpad,
                                     GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_acceptcaps));
    gst_pad_set_fixatecaps_function (decklinksrc->audiosrcpad,
                                     GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_fixatecaps));
    gst_pad_set_activate_function (decklinksrc->audiosrcpad,
                                   GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_activate));
    gst_pad_set_activatepush_function (decklinksrc->audiosrcpad,
                                       GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_activatepush));
    gst_pad_set_activatepull_function (decklinksrc->audiosrcpad,
                                       GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_activatepull));
    gst_pad_set_link_function (decklinksrc->audiosrcpad,
                               GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_link));
    gst_pad_set_getrange_function (decklinksrc->audiosrcpad,
                                   GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_getrange));
    gst_pad_set_event_function (decklinksrc->audiosrcpad,
                                GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_event));
    gst_pad_set_query_function (decklinksrc->audiosrcpad,
                                GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_query));
    gst_pad_set_iterate_internal_links_function (decklinksrc->audiosrcpad,
            GST_DEBUG_FUNCPTR (gst_decklink_src_audio_src_iterintlink));
    gst_element_add_pad (GST_ELEMENT (decklinksrc), decklinksrc->audiosrcpad);



    decklinksrc->videosrcpad =
        gst_pad_new_from_template (gst_element_class_get_pad_template
                                   (GST_ELEMENT_CLASS (decklinksrc_class), "videosrc"), "videosrc");
    gst_pad_set_getcaps_function (decklinksrc->videosrcpad,
                                  GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_getcaps));
    gst_pad_set_setcaps_function (decklinksrc->videosrcpad,
                                  GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_setcaps));
    gst_pad_set_acceptcaps_function (decklinksrc->videosrcpad,
                                     GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_acceptcaps));
    gst_pad_set_fixatecaps_function (decklinksrc->videosrcpad,
                                     GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_fixatecaps));
    gst_pad_set_activate_function (decklinksrc->videosrcpad,
                                   GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_activate));
    gst_pad_set_activatepush_function (decklinksrc->videosrcpad,
                                       GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_activatepush));
    gst_pad_set_activatepull_function (decklinksrc->videosrcpad,
                                       GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_activatepull));
    gst_pad_set_link_function (decklinksrc->videosrcpad,
                               GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_link));
    gst_pad_set_getrange_function (decklinksrc->videosrcpad,
                                   GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_getrange));
    gst_pad_set_event_function (decklinksrc->videosrcpad,
                                GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_event));
    gst_pad_set_query_function (decklinksrc->videosrcpad,
                                GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_query));
    gst_pad_set_iterate_internal_links_function (decklinksrc->videosrcpad,
            GST_DEBUG_FUNCPTR (gst_decklink_src_video_src_iterintlink));
    gst_element_add_pad (GST_ELEMENT (decklinksrc), decklinksrc->videosrcpad);


    decklinksrc->cond = g_cond_new ();
    decklinksrc->mutex = g_mutex_new ();

    decklinksrc->copy_data = TRUE;
    decklinksrc->mode = GST_DECKLINK_MODE_NTSC;
    decklinksrc->connection = GST_DECKLINK_CONNECTION_SDI;
    decklinksrc->audio_connection = GST_DECKLINK_AUDIO_CONNECTION_AUTO;
    decklinksrc->subdevice = 0;

    decklinksrc->stop = FALSE;
    decklinksrc->dropped_frames = 0;
    decklinksrc->dropped_frames_old = 0;
    decklinksrc->frame_num = -1; /* -1 so will be 0 after incrementing */

#ifdef _MSC_VER
    decklinksrc->com_init_lock = g_mutex_new();
    decklinksrc->com_deinit_lock = g_mutex_new();
    decklinksrc->com_initialized = g_cond_new();
    decklinksrc->com_uninitialize = g_cond_new();
    decklinksrc->com_uninitialized = g_cond_new();

    g_mutex_lock (decklinksrc->com_init_lock);

    /* create the COM initialization thread */
    g_thread_create ((GThreadFunc)gst_decklink_src_com_thread,
                     decklinksrc, FALSE, NULL);

    /* wait until the COM thread signals that COM has been initialized */
    g_cond_wait (decklinksrc->com_initialized, decklinksrc->com_init_lock);
    g_mutex_unlock (decklinksrc->com_init_lock);
#endif /* _MSC_VER */
}
static void
gst_decklink_sink_init (GstDecklinkSink * decklinksink,
    GstDecklinkSinkClass * decklinksink_class)
{

  decklinksink->videosinkpad =
      gst_pad_new_from_static_template (&gst_decklink_sink_videosink_template,
      "sink");
  gst_pad_set_getcaps_function (decklinksink->videosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_getcaps));
  gst_pad_set_setcaps_function (decklinksink->videosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_setcaps));
  gst_pad_set_acceptcaps_function (decklinksink->videosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_acceptcaps));
  gst_pad_set_activate_function (decklinksink->videosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_activate));
  gst_pad_set_activatepush_function (decklinksink->videosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_activatepush));
  gst_pad_set_activatepull_function (decklinksink->videosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_activatepull));
  gst_pad_set_link_function (decklinksink->videosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_link));
  gst_pad_set_chain_function (decklinksink->videosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_chain));
  gst_pad_set_chain_list_function (decklinksink->videosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_chainlist));
  gst_pad_set_event_function (decklinksink->videosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_event));
  gst_pad_set_query_function (decklinksink->videosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_query));
  gst_pad_set_bufferalloc_function (decklinksink->videosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_bufferalloc));
  gst_pad_set_iterate_internal_links_function (decklinksink->videosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_videosink_iterintlink));
  gst_element_add_pad (GST_ELEMENT (decklinksink), decklinksink->videosinkpad);



  decklinksink->audiosinkpad =
      gst_pad_new_from_static_template (&gst_decklink_sink_audiosink_template,
      "audiosink");
  gst_pad_set_getcaps_function (decklinksink->audiosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_getcaps));
  gst_pad_set_setcaps_function (decklinksink->audiosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_setcaps));
  gst_pad_set_acceptcaps_function (decklinksink->audiosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_acceptcaps));
  gst_pad_set_activate_function (decklinksink->audiosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_activate));
  gst_pad_set_activatepush_function (decklinksink->audiosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_activatepush));
  gst_pad_set_activatepull_function (decklinksink->audiosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_activatepull));
  gst_pad_set_link_function (decklinksink->audiosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_link));
  gst_pad_set_chain_function (decklinksink->audiosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_chain));
  gst_pad_set_chain_list_function (decklinksink->audiosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_chainlist));
  gst_pad_set_event_function (decklinksink->audiosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_event));
  gst_pad_set_query_function (decklinksink->audiosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_query));
  gst_pad_set_bufferalloc_function (decklinksink->audiosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_bufferalloc));
  gst_pad_set_iterate_internal_links_function (decklinksink->audiosinkpad,
      GST_DEBUG_FUNCPTR (gst_decklink_sink_audiosink_iterintlink));
  gst_element_add_pad (GST_ELEMENT (decklinksink), decklinksink->audiosinkpad);


  decklinksink->cond = g_cond_new ();
  decklinksink->mutex = g_mutex_new ();
  decklinksink->audio_mutex = g_mutex_new ();

  decklinksink->mode = GST_DECKLINK_MODE_NTSC;

  decklinksink->callback = new Output;
  decklinksink->callback->decklinksink = decklinksink;

#ifdef _MSC_VER
  decklinksink->com_init_lock = g_mutex_new();
  decklinksink->com_deinit_lock = g_mutex_new();
  decklinksink->com_initialized = g_cond_new();
  decklinksink->com_uninitialize = g_cond_new();
  decklinksink->com_uninitialized = g_cond_new();

  g_mutex_lock (decklinksink->com_init_lock);

  /* create the COM initialization thread */
  g_thread_create ((GThreadFunc)gst_decklink_sink_com_thread,
    decklinksink, FALSE, NULL);

  /* wait until the COM thread signals that COM has been initialized */
  g_cond_wait (decklinksink->com_initialized, decklinksink->com_init_lock);
  g_mutex_unlock (decklinksink->com_init_lock);
#endif /* _MSC_VER */
}
Example #25
0
static GstPad *
gst_ghost_pad_new_full (const gchar * name, GstPadDirection dir,
    GstPadTemplate * templ)
{
  GstPad *ret;
  GstPad *internal;
  GstPadDirection otherdir;

  g_return_val_if_fail (dir != GST_PAD_UNKNOWN, NULL);

  /* OBJECT CREATION */
  if (templ) {
    ret = g_object_new (GST_TYPE_GHOST_PAD, "name", name,
        "direction", dir, "template", templ, NULL);
  } else {
    ret = g_object_new (GST_TYPE_GHOST_PAD, "name", name,
        "direction", dir, NULL);
  }

  /* Set directional padfunctions for ghostpad */
  if (dir == GST_PAD_SINK) {
    gst_pad_set_bufferalloc_function (ret,
        GST_DEBUG_FUNCPTR (gst_proxy_pad_do_bufferalloc));
    gst_pad_set_chain_function (ret,
        GST_DEBUG_FUNCPTR (gst_proxy_pad_do_chain));
  } else {
    gst_pad_set_getrange_function (ret,
        GST_DEBUG_FUNCPTR (gst_proxy_pad_do_getrange));
    gst_pad_set_checkgetrange_function (ret,
        GST_DEBUG_FUNCPTR (gst_proxy_pad_do_checkgetrange));
  }

  /* link/unlink functions */
  gst_pad_set_link_function (ret, GST_DEBUG_FUNCPTR (gst_ghost_pad_do_link));
  gst_pad_set_unlink_function (ret,
      GST_DEBUG_FUNCPTR (gst_ghost_pad_do_unlink));


  /* INTERNAL PAD, it always exists and is child of the ghostpad */
  otherdir = (dir == GST_PAD_SRC) ? GST_PAD_SINK : GST_PAD_SRC;
  if (templ) {
    internal =
        g_object_new (GST_TYPE_PROXY_PAD, "name", NULL,
        "direction", otherdir, "template", templ, NULL);
  } else {
    internal =
        g_object_new (GST_TYPE_PROXY_PAD, "name", NULL,
        "direction", otherdir, NULL);
  }
  GST_PAD_UNSET_FLUSHING (internal);

  /* Set directional padfunctions for internal pad */
  if (dir == GST_PAD_SRC) {
    gst_pad_set_bufferalloc_function (internal,
        GST_DEBUG_FUNCPTR (gst_proxy_pad_do_bufferalloc));
    gst_pad_set_chain_function (internal,
        GST_DEBUG_FUNCPTR (gst_proxy_pad_do_chain));
  } else {
    gst_pad_set_getrange_function (internal,
        GST_DEBUG_FUNCPTR (gst_proxy_pad_do_getrange));
    gst_pad_set_checkgetrange_function (internal,
        GST_DEBUG_FUNCPTR (gst_proxy_pad_do_checkgetrange));
  }

  GST_PROXY_LOCK (ret);

  /* now make the ghostpad a parent of the internal pad */
  if (!gst_object_set_parent (GST_OBJECT_CAST (internal),
          GST_OBJECT_CAST (ret)))
    goto parent_failed;

  /* The ghostpad is the parent of the internal pad and is the only object that
   * can have a refcount on the internal pad.
   * At this point, the GstGhostPad has a refcount of 1, and the internal pad has
   * a refcount of 1.
   * When the refcount of the GstGhostPad drops to 0, the ghostpad will dispose
   * it's refcount on the internal pad in the dispose method by un-parenting it.
   * This is why we don't take extra refcounts in the assignments below
   */
  GST_PROXY_PAD_INTERNAL (ret) = internal;
  GST_PROXY_PAD_INTERNAL (internal) = ret;

  /* could be more general here, iterating over all writable properties...
   * taking the short road for now tho */
  GST_GHOST_PAD_CAST (ret)->notify_id =
      g_signal_connect (internal, "notify::caps", G_CALLBACK (on_int_notify),
      ret);

  /* call function to init values of the pad caps */
  on_int_notify (internal, NULL, GST_GHOST_PAD_CAST (ret));

  /* special activation functions for the internal pad */
  gst_pad_set_activatepull_function (internal,
      GST_DEBUG_FUNCPTR (gst_ghost_pad_internal_do_activate_pull));
  gst_pad_set_activatepush_function (internal,
      GST_DEBUG_FUNCPTR (gst_ghost_pad_internal_do_activate_push));

  GST_PROXY_UNLOCK (ret);

  return ret;

  /* ERRORS */
parent_failed:
  {
    GST_WARNING_OBJECT (ret, "Could not set internal pad %s:%s",
        GST_DEBUG_PAD_NAME (internal));
    g_critical ("Could not set internal pad %s:%s",
        GST_DEBUG_PAD_NAME (internal));
    GST_PROXY_UNLOCK (ret);
    gst_object_unref (ret);
    gst_object_unref (internal);
    return NULL;
  }
}