Пример #1
0
static void
gst_aiff_parse_init (GstAiffParse * aiffparse, GstAiffParseClass * g_class)
{
  gst_aiff_parse_reset (aiffparse);

  /* sink */
  aiffparse->sinkpad =
      gst_pad_new_from_static_template (&sink_template_factory, "sink");
  gst_pad_set_activate_function (aiffparse->sinkpad,
      GST_DEBUG_FUNCPTR (gst_aiff_parse_sink_activate));
  gst_pad_set_activatepull_function (aiffparse->sinkpad,
      GST_DEBUG_FUNCPTR (gst_aiff_parse_sink_activate_pull));
  gst_pad_set_chain_function (aiffparse->sinkpad,
      GST_DEBUG_FUNCPTR (gst_aiff_parse_chain));
  gst_element_add_pad (GST_ELEMENT_CAST (aiffparse), aiffparse->sinkpad);

  /* source */
  aiffparse->srcpad =
      gst_pad_new_from_static_template (&src_template_factory, "src");
  gst_pad_use_fixed_caps (aiffparse->srcpad);
  gst_pad_set_query_type_function (aiffparse->srcpad,
      GST_DEBUG_FUNCPTR (gst_aiff_parse_get_query_types));
  gst_pad_set_query_function (aiffparse->srcpad,
      GST_DEBUG_FUNCPTR (gst_aiff_parse_pad_query));
  gst_pad_set_event_function (aiffparse->srcpad,
      GST_DEBUG_FUNCPTR (gst_aiff_parse_srcpad_event));
  gst_element_add_pad (GST_ELEMENT_CAST (aiffparse), aiffparse->srcpad);
}
static void
gst_tta_parse_init (GstTtaParse * ttaparse)
{
  GstElementClass *klass = GST_ELEMENT_GET_CLASS (ttaparse);

  ttaparse->sinkpad =
      gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
          "sink"), "sink");

  ttaparse->srcpad =
      gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
          "src"), "src");
  gst_pad_use_fixed_caps (ttaparse->srcpad);
  gst_pad_set_query_type_function (ttaparse->srcpad,
      gst_tta_parse_get_query_types);
  gst_pad_set_query_function (ttaparse->srcpad, gst_tta_parse_query);
  gst_pad_set_event_function (ttaparse->srcpad, gst_tta_parse_src_event);

  gst_element_add_pad (GST_ELEMENT (ttaparse), ttaparse->sinkpad);
  gst_element_add_pad (GST_ELEMENT (ttaparse), ttaparse->srcpad);
  gst_pad_set_activate_function (ttaparse->sinkpad, gst_tta_parse_activate);
  gst_pad_set_activatepull_function (ttaparse->sinkpad,
      gst_tta_parse_activate_pull);

  gst_tta_parse_reset (ttaparse);
}
Пример #3
0
static void
gst_cdxa_parse_init (GstCDXAParse * cdxaparse, GstCDXAParseClass * klass)
{
  GstCaps *caps;

  cdxaparse->sinkpad =
      gst_pad_new_from_static_template (&sink_template_factory, "sink");
  gst_pad_set_activate_function (cdxaparse->sinkpad,
      GST_DEBUG_FUNCPTR (gst_cdxa_parse_sink_activate));
  gst_pad_set_activatepull_function (cdxaparse->sinkpad,
      GST_DEBUG_FUNCPTR (gst_cdxa_parse_sink_activate_pull));

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

  cdxaparse->srcpad =
      gst_pad_new_from_static_template (&src_template_factory, "src");

  gst_pad_set_event_function (cdxaparse->srcpad,
      GST_DEBUG_FUNCPTR (gst_cdxa_parse_src_event));
  gst_pad_set_query_function (cdxaparse->srcpad,
      GST_DEBUG_FUNCPTR (gst_cdxa_parse_src_query));

  caps = gst_caps_new_simple ("video/mpeg",
      "systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
  gst_pad_use_fixed_caps (cdxaparse->srcpad);
  gst_pad_set_caps (cdxaparse->srcpad, caps);
  gst_caps_unref (caps);
  gst_element_add_pad (GST_ELEMENT (cdxaparse), cdxaparse->srcpad);


  cdxaparse->state = GST_CDXA_PARSE_START;
  cdxaparse->offset = 0;
  cdxaparse->datasize = 0;
  cdxaparse->datastart = -1;
}
Пример #4
0
/* initialize the new element
 * instantiate pads and add them to element
 * set functions
 * initialize structure
 */
static void
gst_wildmidi_init (GstWildmidi * filter)
{
  filter->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");

  gst_pad_set_activatemode_function (filter->sinkpad,
      gst_wildmidi_activatemode);
  gst_pad_set_activate_function (filter->sinkpad, gst_wildmidi_activate);
  gst_pad_set_event_function (filter->sinkpad, gst_wildmidi_sink_event);
  gst_pad_set_chain_function (filter->sinkpad, gst_wildmidi_chain);
  gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);

  filter->srcpad = gst_pad_new_from_static_template (&src_factory, "src");

  gst_pad_set_query_function (filter->srcpad, gst_wildmidi_src_query);
  gst_pad_set_event_function (filter->srcpad, gst_wildmidi_src_event);
  gst_pad_use_fixed_caps (filter->srcpad);

  gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);

  gst_segment_init (filter->o_segment, GST_FORMAT_DEFAULT);

  filter->adapter = gst_adapter_new ();

  filter->bytes_per_frame = WILDMIDI_BPS;

  filter->high_quality = DEFAULT_HIGH_QUALITY;
  filter->linear_volume = DEFAULT_LINEAR_VOLUME;
}
Пример #5
0
/* initialize the new element
 * instantiate pads and add them to element
 * set functions
 * initialize structure
 */
static void
gst_wildmidi_init (GstWildmidi * filter, GstWildmidiClass * g_class)
{
  GstElementClass *klass = GST_ELEMENT_GET_CLASS (filter);

  filter->sinkpad =
      gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
          "sink"), "sink");

  gst_pad_set_activatepull_function (filter->sinkpad,
      gst_wildmidi_activatepull);
  gst_pad_set_activate_function (filter->sinkpad, gst_wildmidi_activate);
  gst_pad_set_event_function (filter->sinkpad, gst_wildmidi_sink_event);
  gst_pad_set_chain_function (filter->sinkpad, gst_wildmidi_chain);
  gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);

  filter->srcpad =
      gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
          "src"), "src");

  gst_pad_set_query_function (filter->srcpad, gst_wildmidi_src_query);
  gst_pad_set_event_function (filter->srcpad, gst_wildmidi_src_event);
  gst_pad_use_fixed_caps (filter->srcpad);

  gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);

  gst_segment_init (filter->o_segment, GST_FORMAT_DEFAULT);

  filter->adapter = gst_adapter_new ();

  filter->bytes_per_frame = WILDMIDI_BPS;
}
Пример #6
0
static void
gst_rnd_buffer_size_init (GstRndBufferSize * self)
{
  self->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
  gst_pad_set_activate_function (self->sinkpad,
      GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_activate));
  gst_pad_set_activatemode_function (self->sinkpad,
      GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_activate_mode));
  gst_pad_set_event_function (self->sinkpad,
      GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_sink_event));
  gst_pad_set_chain_function (self->sinkpad,
      GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_chain));
  GST_OBJECT_FLAG_SET (self->sinkpad, GST_PAD_FLAG_PROXY_CAPS);
  GST_OBJECT_FLAG_SET (self->sinkpad, GST_PAD_FLAG_PROXY_ALLOCATION);
  GST_OBJECT_FLAG_SET (self->sinkpad, GST_PAD_FLAG_PROXY_SCHEDULING);
  gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);

  self->srcpad = gst_pad_new_from_static_template (&src_template, "src");
  gst_pad_set_event_function (self->srcpad,
      GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_src_event));
  GST_OBJECT_FLAG_SET (self->srcpad, GST_PAD_FLAG_PROXY_CAPS);
  GST_OBJECT_FLAG_SET (self->srcpad, GST_PAD_FLAG_PROXY_ALLOCATION);
  GST_OBJECT_FLAG_SET (self->srcpad, GST_PAD_FLAG_PROXY_SCHEDULING);
  gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
}
Пример #7
0
static void
gst_freeze_init (GstFreeze * freeze, GstFreezeClass * klass)
{
  freeze->sinkpad =
      gst_pad_new_from_static_template (&gst_freeze_sink_template, "sink");
  gst_element_add_pad (GST_ELEMENT (freeze), freeze->sinkpad);
  gst_pad_set_activate_function (freeze->sinkpad, gst_freeze_sink_activate);
  gst_pad_set_activatepull_function (freeze->sinkpad,
      gst_freeze_sink_activate_pull);
  gst_pad_set_chain_function (freeze->sinkpad, gst_freeze_chain);
  gst_pad_set_getcaps_function (freeze->sinkpad, gst_pad_proxy_getcaps);
  gst_pad_set_event_function (freeze->sinkpad, gst_freeze_sink_event);

  freeze->srcpad =
      gst_pad_new_from_static_template (&gst_freeze_src_template, "src");
  gst_element_add_pad (GST_ELEMENT (freeze), freeze->srcpad);
  gst_pad_set_getcaps_function (freeze->srcpad, gst_pad_proxy_getcaps);

  freeze->timestamp_offset = 0;
  freeze->running_time = 0;
  freeze->current = NULL;
  freeze->max_buffers = 1;
  freeze->on_flush = FALSE;
  freeze->buffers = g_queue_new ();
}
Пример #8
0
static void
gst_musepackdec_init (GstMusepackDec * musepackdec)
{
  musepackdec->offset = 0;
  musepackdec->rate = 0;
  musepackdec->bps = 0;

  musepackdec->r = g_new (mpc_reader, 1);

  musepackdec->sinkpad =
      gst_pad_new_from_static_template (&sink_template, "sink");
  gst_pad_set_activate_function (musepackdec->sinkpad,
      GST_DEBUG_FUNCPTR (gst_musepackdec_sink_activate));
  gst_pad_set_activatemode_function (musepackdec->sinkpad,
      GST_DEBUG_FUNCPTR (gst_musepackdec_sink_activate_mode));
  gst_element_add_pad (GST_ELEMENT (musepackdec), musepackdec->sinkpad);

  musepackdec->srcpad = gst_pad_new_from_static_template (&src_template, "src");
  gst_pad_set_event_function (musepackdec->srcpad,
      GST_DEBUG_FUNCPTR (gst_musepackdec_src_event));
  gst_pad_set_query_function (musepackdec->srcpad,
      GST_DEBUG_FUNCPTR (gst_musepackdec_src_query));
  gst_pad_use_fixed_caps (musepackdec->srcpad);
  gst_element_add_pad (GST_ELEMENT (musepackdec), musepackdec->srcpad);
}
Пример #9
0
static void
gst_musepackdec_init (GstMusepackDec * musepackdec, GstMusepackDecClass * klass)
{
    musepackdec->offset = 0;
    musepackdec->rate = 0;
    musepackdec->bps = 0;

    musepackdec->r = g_new (mpc_reader, 1);
#ifdef MPC_IS_OLD_API
    musepackdec->d = g_new (mpc_decoder, 1);
#endif

    musepackdec->sinkpad =
        gst_pad_new_from_static_template (&sink_template, "sink");
    gst_pad_set_activate_function (musepackdec->sinkpad,
                                   GST_DEBUG_FUNCPTR (gst_musepackdec_sink_activate));
    gst_pad_set_activatepull_function (musepackdec->sinkpad,
                                       GST_DEBUG_FUNCPTR (gst_musepackdec_sink_activate_pull));
    gst_element_add_pad (GST_ELEMENT (musepackdec), musepackdec->sinkpad);

    musepackdec->srcpad = gst_pad_new_from_static_template (&src_template, "src");
    gst_pad_set_event_function (musepackdec->srcpad,
                                GST_DEBUG_FUNCPTR (gst_musepackdec_src_event));
    gst_pad_set_query_function (musepackdec->srcpad,
                                GST_DEBUG_FUNCPTR (gst_musepackdec_src_query));
    gst_pad_set_query_type_function (musepackdec->srcpad,
                                     GST_DEBUG_FUNCPTR (gst_musepackdec_get_src_query_types));
    gst_pad_use_fixed_caps (musepackdec->srcpad);
    gst_element_add_pad (GST_ELEMENT (musepackdec), musepackdec->srcpad);
}
Пример #10
0
static void
mpegts_base_init (MpegTSBase * base)
{
  base->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
  gst_pad_set_activate_function (base->sinkpad, mpegts_base_sink_activate);
  gst_pad_set_activatemode_function (base->sinkpad,
      mpegts_base_sink_activate_mode);
  gst_pad_set_chain_function (base->sinkpad, mpegts_base_chain);
  gst_pad_set_event_function (base->sinkpad, mpegts_base_sink_event);
  gst_element_add_pad (GST_ELEMENT (base), base->sinkpad);

  base->disposed = FALSE;
  base->packetizer = mpegts_packetizer_new ();
  base->programs = g_hash_table_new_full (g_direct_hash, g_direct_equal,
      NULL, (GDestroyNotify) mpegts_base_free_program);

  base->parse_private_sections = FALSE;
  base->is_pes = g_new0 (guint8, 1024);
  base->known_psi = g_new0 (guint8, 1024);
  base->program_size = sizeof (MpegTSBaseProgram);
  base->stream_size = sizeof (MpegTSBaseStream);

  base->push_data = TRUE;
  base->push_section = TRUE;

  mpegts_base_reset (base);
}
Пример #11
0
static void
gst_rnd_buffer_size_init (GstRndBufferSize * self,
    GstRndBufferSizeClass * g_class)
{
  self->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
  gst_pad_set_activate_function (self->sinkpad,
      GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_activate));
  gst_pad_set_activatepull_function (self->sinkpad,
      GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_activate_pull));
  gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);

  self->srcpad = gst_pad_new_from_static_template (&src_template, "src");
  gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
}
Пример #12
0
static void
gst_raw_parse_init (GstRawParse * rp, GstRawParseClass * g_class)
{
  GstPadTemplate *src_pad_template;
  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);

  rp->sinkpad =
      gst_pad_new_from_static_template (&gst_raw_parse_sink_pad_template,
      "sink");
  gst_pad_set_chain_function (rp->sinkpad,
      GST_DEBUG_FUNCPTR (gst_raw_parse_chain));
  gst_pad_set_event_function (rp->sinkpad,
      GST_DEBUG_FUNCPTR (gst_raw_parse_sink_event));
  gst_pad_set_activate_function (rp->sinkpad,
      GST_DEBUG_FUNCPTR (gst_raw_parse_sink_activate));
  gst_pad_set_activatepull_function (rp->sinkpad,
      GST_DEBUG_FUNCPTR (gst_raw_parse_sink_activatepull));
  gst_element_add_pad (GST_ELEMENT (rp), rp->sinkpad);

  src_pad_template = gst_element_class_get_pad_template (element_class, "src");

  if (src_pad_template) {
    rp->srcpad = gst_pad_new_from_template (src_pad_template, "src");
  } else {
    g_warning ("Subclass didn't specify a src pad template");
    g_assert_not_reached ();
  }

  gst_pad_set_event_function (rp->srcpad,
      GST_DEBUG_FUNCPTR (gst_raw_parse_src_event));
  gst_pad_set_query_type_function (rp->srcpad,
      GST_DEBUG_FUNCPTR (gst_raw_parse_src_query_type));
  gst_pad_set_query_function (rp->srcpad,
      GST_DEBUG_FUNCPTR (gst_raw_parse_src_query));
  gst_element_add_pad (GST_ELEMENT (rp), rp->srcpad);

  rp->adapter = gst_adapter_new ();

  rp->fps_n = 1;
  rp->fps_d = 0;
  rp->framesize = 1;

  gst_raw_parse_reset (rp);
}
Пример #13
0
static void
gst_real_audio_demux_init (GstRealAudioDemux * demux)
{
  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_activatemode_function (demux->sinkpad,
      GST_DEBUG_FUNCPTR (gst_real_audio_demux_sink_activate_mode));

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

  demux->adapter = gst_adapter_new ();
  gst_real_audio_demux_reset (demux);
}
Пример #14
0
static void
gst_type_find_element_init (GstTypeFindElement * typefind,
    GstTypeFindElementClass * g_class)
{
  /* sinkpad */
  typefind->sink =
      gst_pad_new_from_static_template (&type_find_element_sink_template,
      "sink");

  gst_pad_set_activate_function (typefind->sink,
      GST_DEBUG_FUNCPTR (gst_type_find_element_activate));
  gst_pad_set_setcaps_function (typefind->sink,
      GST_DEBUG_FUNCPTR (gst_type_find_element_setcaps));
  gst_pad_set_chain_function (typefind->sink,
      GST_DEBUG_FUNCPTR (gst_type_find_element_chain));
  gst_pad_set_event_function (typefind->sink,
      GST_DEBUG_FUNCPTR (gst_type_find_element_handle_event));
  gst_element_add_pad (GST_ELEMENT (typefind), typefind->sink);

  /* srcpad */
  typefind->src =
      gst_pad_new_from_static_template (&type_find_element_src_template, "src");

  gst_pad_set_activatepull_function (typefind->src,
      GST_DEBUG_FUNCPTR (gst_type_find_element_activate_src_pull));
  gst_pad_set_checkgetrange_function (typefind->src,
      GST_DEBUG_FUNCPTR (gst_type_find_element_checkgetrange));
  gst_pad_set_getrange_function (typefind->src,
      GST_DEBUG_FUNCPTR (gst_type_find_element_getrange));
  gst_pad_set_event_function (typefind->src,
      GST_DEBUG_FUNCPTR (gst_type_find_element_src_event));
  gst_pad_set_query_function (typefind->src,
      GST_DEBUG_FUNCPTR (gst_type_find_handle_src_query));
  gst_pad_use_fixed_caps (typefind->src);
  gst_element_add_pad (GST_ELEMENT (typefind), typefind->src);

  typefind->mode = MODE_TYPEFIND;
  typefind->caps = NULL;
  typefind->min_probability = 1;
  typefind->max_probability = GST_TYPE_FIND_MAXIMUM;

  typefind->store = NULL;
}
Пример #15
0
static void
gst_rnd_buffer_size_init (GstRndBufferSize * self)
{
  self->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
  gst_pad_set_activate_function (self->sinkpad,
      GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_activate));
  gst_pad_set_activatemode_function (self->sinkpad,
      GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_activate_mode));
  gst_pad_set_event_function (self->sinkpad,
      GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_sink_event));
  gst_pad_set_chain_function (self->sinkpad,
      GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_chain));
  gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);

  self->srcpad = gst_pad_new_from_static_template (&src_template, "src");
  gst_pad_set_event_function (self->srcpad,
      GST_DEBUG_FUNCPTR (gst_rnd_buffer_size_src_event));
  gst_element_add_pad (GST_ELEMENT (self), self->srcpad);
}
Пример #16
0
/* initialize the new element
 * instantiate pads and add them to element
 * set functions
 * initialize structure
 */
static void
gst_timidity_init (GstTimidity * filter, GstTimidityClass * g_class)
{
  GstElementClass *klass = GST_ELEMENT_GET_CLASS (filter);

  /* initialise timidity library */
  if (mid_init ((char *) TIMIDITY_CFG) == 0) {
    filter->initialized = TRUE;
  } else {
    GST_WARNING ("can't initialize timidity with config: " TIMIDITY_CFG);
  }

  filter->sinkpad =
      gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
          "sink"), "sink");

  gst_pad_set_activatepull_function (filter->sinkpad,
      gst_timidity_activatepull);
  gst_pad_set_activate_function (filter->sinkpad, gst_timidity_activate);
  gst_pad_set_setcaps_function (filter->sinkpad, gst_pad_set_caps);
  gst_pad_use_fixed_caps (filter->sinkpad);
  gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);

  filter->srcpad =
      gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
          "src"), "src");

  gst_pad_set_query_function (filter->srcpad, gst_timidity_src_query);
  gst_pad_set_event_function (filter->srcpad, gst_timidity_src_event);
  gst_pad_use_fixed_caps (filter->srcpad);
  gst_pad_set_setcaps_function (filter->srcpad, gst_pad_set_caps);

  gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);

  filter->song_options->buffer_size = 2048;
  filter->song_options->rate = 44100;
  filter->song_options->format = MID_AUDIO_S16LSB;
  filter->song_options->channels = 2;

  gst_timidity_set_song_options (filter, filter->song_options);

  gst_segment_init (filter->o_segment, GST_FORMAT_DEFAULT);
}
Пример #17
0
static void
gst_asf_parse_init (GstAsfParse * asfparse)
{
  asfparse->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");
  gst_pad_set_chain_function (asfparse->sinkpad, gst_asf_parse_chain);
  gst_pad_set_activate_function (asfparse->sinkpad,
      gst_asf_parse_sink_activate);
  gst_pad_set_activatemode_function (asfparse->sinkpad,
      gst_asf_parse_sink_activate_mode);
  gst_element_add_pad (GST_ELEMENT (asfparse), asfparse->sinkpad);

  asfparse->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
  gst_pad_use_fixed_caps (asfparse->srcpad);
  gst_element_add_pad (GST_ELEMENT (asfparse), asfparse->srcpad);

  asfparse->adapter = gst_adapter_new ();
  asfparse->outcaps = gst_caps_new_empty_simple ("video/x-ms-asf");
  asfparse->asfinfo = gst_asf_file_info_new ();
  asfparse->packetinfo = g_new0 (GstAsfPacketInfo, 1);
  gst_asf_parse_reset (asfparse);
}
Пример #18
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
gst_type_find_element_init (GstTypeFindElement * typefind)
{
  /* sinkpad */
  typefind->sink =
      gst_pad_new_from_static_template (&type_find_element_sink_template,
      "sink");

  gst_pad_set_activate_function (typefind->sink,
      GST_DEBUG_FUNCPTR (gst_type_find_element_activate_sink));
  gst_pad_set_activatemode_function (typefind->sink,
      GST_DEBUG_FUNCPTR (gst_type_find_element_activate_sink_mode));
  gst_pad_set_chain_function (typefind->sink,
      GST_DEBUG_FUNCPTR (gst_type_find_element_chain));
  gst_pad_set_event_function (typefind->sink,
      GST_DEBUG_FUNCPTR (gst_type_find_element_sink_event));
  GST_PAD_SET_PROXY_ALLOCATION (typefind->sink);
  gst_element_add_pad (GST_ELEMENT (typefind), typefind->sink);

  /* srcpad */
  typefind->src =
      gst_pad_new_from_static_template (&type_find_element_src_template, "src");

  gst_pad_set_activatemode_function (typefind->src,
      GST_DEBUG_FUNCPTR (gst_type_find_element_activate_src_mode));
  gst_pad_set_getrange_function (typefind->src,
      GST_DEBUG_FUNCPTR (gst_type_find_element_getrange));
  gst_pad_set_event_function (typefind->src,
      GST_DEBUG_FUNCPTR (gst_type_find_element_src_event));
  gst_pad_set_query_function (typefind->src,
      GST_DEBUG_FUNCPTR (gst_type_find_handle_src_query));
  gst_pad_use_fixed_caps (typefind->src);
  gst_element_add_pad (GST_ELEMENT (typefind), typefind->src);

  typefind->mode = MODE_TYPEFIND;
  typefind->caps = NULL;
  typefind->min_probability = 1;

  typefind->adapter = gst_adapter_new ();
}
Пример #20
0
static void
gst_wavpack_parse_init (GstWavpackParse * parse, GstWavpackParseClass * gclass)
{
  GstElementClass *klass = GST_ELEMENT_GET_CLASS (parse);
  GstPadTemplate *tmpl;

  tmpl = gst_element_class_get_pad_template (klass, "sink");
  parse->sinkpad = gst_pad_new_from_template (tmpl, "sink");

  gst_pad_set_activate_function (parse->sinkpad,
      GST_DEBUG_FUNCPTR (gst_wavpack_parse_sink_activate));
  gst_pad_set_activatepull_function (parse->sinkpad,
      GST_DEBUG_FUNCPTR (gst_wavpack_parse_sink_activate_pull));
  gst_pad_set_event_function (parse->sinkpad,
      GST_DEBUG_FUNCPTR (gst_wavpack_parse_sink_event));
  gst_pad_set_chain_function (parse->sinkpad,
      GST_DEBUG_FUNCPTR (gst_wavpack_parse_chain));

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

  parse->srcpad = NULL;
  gst_wavpack_parse_reset (parse);
}
Пример #21
0
static void
gst_nuv_demux_init (GstNuvDemux * nuv, GstNuvDemuxClass * nuv_class)
{
  nuv->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");

  gst_pad_set_activate_function (nuv->sinkpad, gst_nuv_demux_sink_activate);

  gst_pad_set_activatepull_function (nuv->sinkpad,
      gst_nuv_demux_sink_activate_pull);

  gst_pad_set_chain_function (nuv->sinkpad,
      GST_DEBUG_FUNCPTR (gst_nuv_demux_chain));

  gst_pad_set_event_function (nuv->sinkpad, gst_nuv_demux_handle_sink_event);

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

  nuv->adapter = NULL;
  nuv->mpeg_buffer = NULL;
  nuv->h = NULL;
  nuv->eh = NULL;
  nuv->fh = NULL;
  gst_nuv_demux_reset (nuv);
}
Пример #22
0
/* initialize the new element
 * instantiate pads and add them to element
 * set functions
 * initialize structure
 */
static void
gst_midi_parse_init (GstMidiParse * filter)
{
  filter->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");

  gst_pad_set_activatemode_function (filter->sinkpad,
      gst_midi_parse_activatemode);
  gst_pad_set_activate_function (filter->sinkpad, gst_midi_parse_activate);
  gst_pad_set_event_function (filter->sinkpad, gst_midi_parse_sink_event);
  gst_pad_set_chain_function (filter->sinkpad, gst_midi_parse_chain);
  gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);

  filter->srcpad = gst_pad_new_from_static_template (&src_factory, "src");

  gst_pad_set_query_function (filter->srcpad, gst_midi_parse_src_query);
  gst_pad_set_event_function (filter->srcpad, gst_midi_parse_src_event);
  gst_pad_use_fixed_caps (filter->srcpad);

  gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);

  gst_segment_init (&filter->segment, GST_FORMAT_TIME);

  filter->adapter = gst_adapter_new ();
}
Пример #23
0
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 */
}
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 */
}