Transform function not working

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Transform function not working

vaishnavi
Hi,

I'm using basetransform as parent class for my plugin.
I have implemented transform function,set_caps,get_unit_size and prepare_output_buffer of parent class. Here im taking the in_buf contents passing to driver and reading the processed data to out_buf.
The driver works fine...
But i get error and warning saying the caps are not negotiated. This happens when i launch the application.
The caps are set to any.
If i only use transform function the i get an error,after implementing set_caps and get_unit_size i receive warning.
The warning message is
 WARN           basetransform gstbasetransform.c:1969:gst_base_transform_handle_buffer:<dummy0> error: not negotiated
0:00:00.076602538  2989  0x9b73038 WARN           basetransform gstbasetransform.c:1969:gst_base_transform_handle_buffer:<dummy0> error: not negotiated
WARN                 basesrc gstbasesrc.c:2507:gst_base_src_loop:<filesrc0> error: Internal data flow error.
0:00:00.076898043  2989  0x9b73038 WARN                 basesrc gstbasesrc.c:2507:gst_base_src_loop:<filesrc0> error: streaming task paused, reason not-negotiated (-4)


static gboolean
gst_dummy_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
    guint * size)
{
*size=1;
return TRUE;
}

static GstFlowReturn
gst_dummy_transform (GstBaseTransform * trans, GstBuffer * inbuf, GstBuffer * outbuf)
{
  GstFlowReturn ret = GST_FLOW_OK;
return ret;
}

static gboolean gst_dummy_set_caps(GstBaseTransform *trans, GstCaps *incaps, GstCaps *outcaps)
{
outcaps=incaps;
return TRUE;
}

static GstFlowReturn
gst_dummy_prepare_output_buffer (GstBaseTransform * trans,
    GstBuffer * in_buf, gint out_size, GstCaps * out_caps, GstBuffer ** out_buf)
{

  GstDummy *dummy = GST_DUMMY (trans);

  guint size;
  gint n,x;
  out_caps=GST_CAPS_ANY;

  GstClockTime runtimestamp = G_GINT64_CONSTANT (0);

  g_print("The input buffer contents are%d\t%d\t%d\t",in_buf->data[0],in_buf->data[1],in_buf->data[2]);

  size=GST_BUFFER_SIZE(in_buf);
  g_print("size of inbuf is %d\n",size);

  gst_buffer_make_writable(dummy->cpybuf);
  n=write(dummy->pf_handle,GST_BUFFER_DATA(in_buf),size);
  if(n<0)
{
g_print("could not write\n");
}
x=read(dummy->pf_handle,GST_BUFFER_DATA(dummy->cpybuf),n);
if(x<0)
{
g_print("could not read\n");
}
else
{
g_print("the size of output buffer is %d\n",x);
}
if (dummy->silent == FALSE)
    g_print ("I'm plugged, therefore I'm in Dummy TC.\n");


  *out_buf=gst_buffer_copy(dummy->cpybuf);
  gst_dummy_set_caps(trans,GST_PAD_CAPS(dummy->srcpad),GST_PAD_CAPS(dummy->sinkpad));
  return GST_FLOW_OK;
}