예제 #1
0
static GstPad *
gst_gl_mixer_bin_request_new_pad (GstElement * element, GstPadTemplate * templ,
    const gchar * req_name, const GstCaps * caps)
{
  GstGLMixerBin *self = GST_GL_MIXER_BIN (element);
  GstPadTemplate *mixer_templ;
  struct input_chain *chain;
  GstPad *mixer_pad;

  chain = g_new0 (struct input_chain, 1);

  mixer_templ = _find_element_pad_template (self->mixer,
      GST_PAD_TEMPLATE_DIRECTION (templ), GST_PAD_TEMPLATE_PRESENCE (templ));
  g_return_val_if_fail (mixer_templ, NULL);

  mixer_pad =
      gst_element_request_pad (self->mixer, mixer_templ, req_name, NULL);
  g_return_val_if_fail (mixer_pad, NULL);

  if (!_create_input_chain (self, chain, mixer_pad)) {
    gst_element_release_request_pad (self->mixer, mixer_pad);
    _free_input_chain (chain);
    return NULL;
  }

  GST_OBJECT_LOCK (element);
  self->priv->input_chains = g_list_prepend (self->priv->input_chains, chain);
  GST_OBJECT_UNLOCK (element);

  gst_child_proxy_child_added (GST_CHILD_PROXY (self),
      G_OBJECT (chain->ghost_pad), GST_OBJECT_NAME (chain->ghost_pad));

  return GST_PAD (chain->ghost_pad);
}
/* Function for process the request pads */
GstPad *
gst_tidmai_base_video_dualencoder_request_new_pad (GstElement * element,
    GstPadTemplate * templ, const gchar * req_name) {
  
  GstPad *new_sink_pad = NULL;
  GstTIDmaiBaseVideoDualEncoder *video_dualencoder = 
	GST_TI_DMAI_BASE_VIDEO_DUALENCODER(element);
  gchar *pad_name = NULL; 
  GstTIDmaiBaseDualEncoder *base_dualencoder = 
	GST_TI_DMAI_BASE_DUALENCODER(video_dualencoder);
  GstTIDmaiDualEncInstance *actual_instance;
  	
  
  	
  if (G_UNLIKELY (templ->direction != GST_PAD_SINK)) {
    g_warning ("base_video_dualencoder: request pad that is not a SINK pad");
    return NULL;
  }
  
  /*if(!(templ == gst_element_class_get_pad_template (klass, "sink"))) {
	GST_WARNING ("This is not our template!");
	return NULL; 
  }*/
  
  /* Determine the sink pad name */
  if(NULL == base_dualencoder->low_resolution_encoder->collect) {
	 pad_name = "sinkA";
	 //src_pad_name =  "srcA";
	 actual_instance = base_dualencoder->low_resolution_encoder; 
  }
  else if(NULL == base_dualencoder->high_resolution_encoder->collect) {
	 pad_name = "sinkB";
	 //src_pad_name =  "srcB";
	 actual_instance = base_dualencoder->high_resolution_encoder;
  }
  else {
	 GST_WARNING ("Can't determine the pad name or number of request is more than 2!");
	 return NULL;
  }
	
  /* Get the pad and set it*/
  new_sink_pad = gst_tidmai_base_video_dualencoder_construct_pad(video_dualencoder, pad_name);
  actual_instance->collect = gst_collect_pads_add_pad (base_dualencoder->collect_sink_pads,  new_sink_pad,
                                                         sizeof(GstCollectData));
  gst_pad_set_setcaps_function(
        new_sink_pad, GST_DEBUG_FUNCPTR(gst_tidmai_base_video_dualencoder_sink_set_caps));
  //actual_instance->src_pad = gst_tidmai_base_video_dualencoder_construct_pad(video_dualencoder, src_pad_name);
  
  /* Add the pads to the dualencoder element */		
  gst_element_add_pad (element, new_sink_pad);
  gst_child_proxy_child_added (GST_OBJECT (element), GST_OBJECT (new_sink_pad));
  
  //gst_element_add_pad (element, actual_instance->src_pad);
  
  
  return new_sink_pad;

}
예제 #3
0
static void
gst_deinterlace2_set_method (GstDeinterlace2 * self,
    GstDeinterlace2Methods method)
{

  if (self->method) {
    gst_child_proxy_child_removed (GST_OBJECT (self),
        GST_OBJECT (self->method));
    gst_object_unparent (GST_OBJECT (self->method));
    self->method = NULL;
  }

  switch (method) {
    case GST_DEINTERLACE2_TOMSMOCOMP:
      self->method = g_object_new (GST_TYPE_DEINTERLACE_TOMSMOCOMP, NULL);
      break;
    case GST_DEINTERLACE2_GREEDY_H:
      self->method = g_object_new (GST_TYPE_DEINTERLACE_GREEDY_H, NULL);
      break;
    case GST_DEINTERLACE2_GREEDY_L:
      self->method = g_object_new (GST_TYPE_DEINTERLACE_GREEDY_L, NULL);
      break;
    case GST_DEINTERLACE2_VFIR:
      self->method = g_object_new (GST_TYPE_DEINTERLACE_VFIR, NULL);
      break;
    case GST_DEINTERLACE2_LINEAR:
      self->method = g_object_new (GST_TYPE_DEINTERLACE_LINEAR, NULL);
      break;
    case GST_DEINTERLACE2_LINEAR_BLEND:
      self->method = g_object_new (GST_TYPE_DEINTERLACE_LINEAR_BLEND, NULL);
      break;
    case GST_DEINTERLACE2_SCALER_BOB:
      self->method = g_object_new (GST_TYPE_DEINTERLACE_SCALER_BOB, NULL);
      break;
    case GST_DEINTERLACE2_WEAVE:
      self->method = g_object_new (GST_TYPE_DEINTERLACE_WEAVE, NULL);
      break;
    case GST_DEINTERLACE2_WEAVE_TFF:
      self->method = g_object_new (GST_TYPE_DEINTERLACE_WEAVE_TFF, NULL);
      break;
    case GST_DEINTERLACE2_WEAVE_BFF:
      self->method = g_object_new (GST_TYPE_DEINTERLACE_WEAVE_BFF, NULL);
      break;
    default:
      GST_WARNING ("Invalid Deinterlacer Method");
      return;
  }

  self->method_id = method;

  gst_object_set_name (GST_OBJECT (self->method), "method");
  gst_object_set_parent (GST_OBJECT (self->method), GST_OBJECT (self));
  gst_child_proxy_child_added (GST_OBJECT (self), GST_OBJECT (self->method));
}
예제 #4
0
static GstPad *
gst_audiomixer_request_new_pad (GstElement * element, GstPadTemplate * templ,
    const gchar * req_name, const GstCaps * caps)
{
  GstAudioMixerPad *newpad;

  newpad = (GstAudioMixerPad *)
      GST_ELEMENT_CLASS (parent_class)->request_new_pad (element,
      templ, req_name, caps);

  if (newpad == NULL)
    goto could_not_create;

  gst_child_proxy_child_added (GST_CHILD_PROXY (element), G_OBJECT (newpad),
      GST_OBJECT_NAME (newpad));

  return GST_PAD_CAST (newpad);

could_not_create:
  {
    GST_DEBUG_OBJECT (element, "could not create/add  pad");
    return NULL;
  }
}
예제 #5
0
void
gst_iir_equalizer_compute_frequencies (GstIirEqualizer * equ, guint new_count)
{
  guint old_count, i;
  gdouble freq0, freq1, step;
  gchar name[20];

  if (equ->freq_band_count == new_count)
    return;

  BANDS_LOCK (equ);

  if (G_UNLIKELY (equ->freq_band_count == new_count)) {
    BANDS_UNLOCK (equ);
    return;
  }

  old_count = equ->freq_band_count;
  equ->freq_band_count = new_count;
  GST_DEBUG ("bands %u -> %u", old_count, new_count);

  if (old_count < new_count) {
    /* add new bands */
    equ->bands = g_realloc (equ->bands, sizeof (GstObject *) * new_count);
    for (i = old_count; i < new_count; i++) {
      /* otherwise they get names like 'iirequalizerband5' */
      sprintf (name, "band%u", i);
      equ->bands[i] = g_object_new (GST_TYPE_IIR_EQUALIZER_BAND,
          "name", name, NULL);
      GST_DEBUG ("adding band[%d]=%p", i, equ->bands[i]);

      gst_object_set_parent (GST_OBJECT (equ->bands[i]), GST_OBJECT (equ));
      gst_child_proxy_child_added (GST_OBJECT (equ),
          GST_OBJECT (equ->bands[i]));
    }
  } else {
    /* free unused bands */
    for (i = new_count; i < old_count; i++) {
      GST_DEBUG ("removing band[%d]=%p", i, equ->bands[i]);
      gst_child_proxy_child_removed (GST_OBJECT (equ),
          GST_OBJECT (equ->bands[i]));
      gst_object_unparent (GST_OBJECT (equ->bands[i]));
      equ->bands[i] = NULL;
    }
  }

  alloc_history (equ);

  /* set center frequencies and name band objects
   * FIXME: arg! we can't change the name of parented objects :(
   *   application should read band->freq to get the name
   */

  step = pow (HIGHEST_FREQ / LOWEST_FREQ, 1.0 / new_count);
  freq0 = LOWEST_FREQ;
  for (i = 0; i < new_count; i++) {
    freq1 = freq0 * step;

    if (i == 0)
      equ->bands[i]->type = BAND_TYPE_LOW_SHELF;
    else if (i == new_count - 1)
      equ->bands[i]->type = BAND_TYPE_HIGH_SHELF;
    else
      equ->bands[i]->type = BAND_TYPE_PEAK;

    equ->bands[i]->freq = freq0 + ((freq1 - freq0) / 2.0);
    equ->bands[i]->width = freq1 - freq0;
    GST_DEBUG ("band[%2d] = '%lf'", i, equ->bands[i]->freq);

    g_object_notify (G_OBJECT (equ->bands[i]), "bandwidth");
    g_object_notify (G_OBJECT (equ->bands[i]), "freq");
    g_object_notify (G_OBJECT (equ->bands[i]), "type");

    /*
       if(equ->bands[i]->freq<10000.0)
       sprintf (name,"%dHz",(gint)equ->bands[i]->freq);
       else
       sprintf (name,"%dkHz",(gint)(equ->bands[i]->freq/1000.0));
       gst_object_set_name( GST_OBJECT (equ->bands[i]), name);
       GST_DEBUG ("band[%2d] = '%s'",i,name);
     */
    freq0 = freq1;
  }

  equ->need_new_coefficients = TRUE;
  BANDS_UNLOCK (equ);
}