[gst-devel] Using BaseTransform class

vaishnavi vaish05_s at yahoo.com
Tue Dec 7 11:31:39 CET 2010


Hi,
I'm using BaseTransform as parent class. I'm using transform_ip to
communicate with the driver.
The incoming buffer will be passed to driver and read back from driver the
processed data into the same buffer.
The issue is that it is the buffer contents coming from driver is not pushed
out.
The contents to be wriiten and read out of driver is verified using print
statements..driver works fine..but somehow the data read from driver is not
getting pushed.
I have include the code i have used for transform_ip and
prepare_output_buffer
Can you tel me why the contents are not getting changed.

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);
    *out_buf = gst_buffer_ref (in_buf);
     *out_buf=gst_buffer_copy(dummy->cpybuf);

  return GST_FLOW_OK;
}


static GstFlowReturn
gst_dummy_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
{
  GstFlowReturn ret = GST_FLOW_OK;
  guint size =1024;
   gint n,x;

  GstDummy *dummy = GST_DUMMY (trans);
g_print("pf_handle_ip%d\n",dummy->pf_handle);
g_print("the first few bytes of
buffer%d\t%d\t%d\t",buf->data[0],buf->data[1],buf->data[2]);
  GstClockTime runtimestamp = G_GINT64_CONSTANT (0);

g_print("size before allocation%d\n",GST_BUFFER_SIZE(buf));


 dummy->cpybuf=gst_buffer_copy(buf);
g_print("the first few bytes of cpy
buffer%d\t%d\t%d\t",dummy->cpybuf->data[0],dummy->cpybuf->data[1],dummy->cpybuf->data[2]);
  n=write(dummy->pf_handle,GST_BUFFER_DATA(dummy->cpybuf),size);
  if(n<0)
{
g_print("could not write; the contents of cpybuf %d and n is
%d\n,GST_BUFFER_DATA(cpybuf),n");
}
x=read(dummy->pf_handle,GST_BUFFER_DATA(dummy->cpybuf),n);
g_print("the first few bytes of buffer after
read%d\t%d\t%d\t",dummy->cpybuf->data[0],dummy->cpybuf->data[1],dummy->cpybuf->data[2]);

if(x<0)
{
g_print("could not read\n");
}


if (GST_CLOCK_TIME_IS_VALID (GST_BUFFER_TIMESTAMP (buf)))
    gst_object_sync_values (G_OBJECT (dummy), GST_BUFFER_TIMESTAMP (buf));

  if (dummy->silent == FALSE)
    g_print ("I'm plugged, therefore I'm in Dummy TC.\n");
buf=gst_buffer_copy(dummy->cpybuf);
g_print("the first few bytes of buffer befor
return%d\t%d\t%d\t",buf->data[0],buf->data[1],buf->data[2]);

  return ret;
}


-- 
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Using-BaseTransform-class-tp3076117p3076117.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.




More information about the gstreamer-devel mailing list