appsrc and caps

gledan gl at abankos.com
Thu Apr 10 06:24:55 PDT 2014


Hi,

I'm facing some troubles to make the appsrc element work ( I use
gstreamer-0.10 due to some "restrictions" on an embedded platform).

Actually, I want to insert buffers grabbed from my camera. The output of the
camera is an 8 bits RGB image.

When my pipeline is launching, I get an Internal data flow error and the
pipeline and the debug output is : 
WARN                 basesrc gstbasesrc.c:2830:gst_base_src_start:<mysource>
error: Could not negotiate format
WARN                 basesrc gstbasesrc.c:2830:gst_base_src_start:<mysource>
error: Check your filtered caps, if any
...
INFO        GST_ERROR_SYSTEM
gstelement.c:1964:gst_element_message_full:<mysource> posting message: Could
not negotiate format
WARN                 basesrc
gstbasesrc.c:3039:gst_base_src_activate_push:<mysource> Failed to start in
push mode
WARN                GST_PADS gstpad.c:737:gst_pad_set_active:<mysource:src>
Failed to activate pad
...
DEBUG                 appsrc
gstappsrc.c:1499:gst_app_src_push_buffer_full:<mysource> refuse buffer
0x101f8e0, we are flushing

My guess is that my caps is not correctly configured but I can't figure out
why...

Here is the concerned part of my code : 

gboolean RobotVision::push_data (GstreamerData *data) {
  ...

  ms = g_timer_elapsed(data->timer,NULL);

  if(ms>1.0){
  g_print ("allocating memory\n");
  TVFU_VFIMAGE vfImage;
  int errCode=0;
  double t;
  /*allocate the camera buffer*/
  errCode =
VFU_Image_Alloc(hCam,usbWidth,usbHeight,VFU_VFIMAGEFORMAT_RGB888,&vfImage);
  if(errCode>=0){
	  /*getting frame from cam*/
	  g_print ("getting frame\n");
	  errCode=VFU_Image_Get(hCam,VFU_VFIMAGEFORMAT_RGB888,&vfImage);
	  if(errCode<0){std::cout<<"error getting an image : "<<  errCode
<<std::endl;
	  return FALSE;}
  }
  else std::cout<<"error allocating the VFU buffer :
"<<errCode<<std::endl;
  
  g_print ("allocating gst memory\n");
  buffer = gst_buffer_new_and_alloc (vfImage.ImageBufferSize);
  GST_BUFFER_DATA(buffer) = vfImage.ImageData;
  GST_BUFFER_SIZE(buffer) = vfImage.ImageBufferSize;

  /* Push the buffer into the appsrc */
  g_print ("pushing data\n");
  g_signal_emit_by_name (data->source, "push-buffer", buffer, &ret);

  /* Free buffers */
  gst_buffer_unref (buffer);
  VFU_Image_Free(hCam,&vfImage);
  if (ret != GST_FLOW_OK) {
	  g_print ("ERROR : pushing data\n");
    return FALSE;
  }
  g_timer_start(data->timer);
  return TRUE;
  }
  return TRUE;
}
...

int RobotVision::init(){

	...

	m_gstreamerData.pipeline = gst_parse_launch("appsrc name=mysource !
ffmpegcolorspace ! videoscale method=1 ! xvimagesink", NULL);
	if(!m_gstreamerData.pipeline){
		g_print("Parse Error \n");
				exit(1);
	}
	...
	/* add watch for messages */
	//g_signal_connect (bus, "message", G_CALLBACK (messageHandler),
&m_gstreamerData);
	gst_bus_add_watch (bus, (GstBusFunc) messageHandler, &m_gstreamerData);
	/* get the appsrc and connecting signals */
	m_gstreamerData.source = gst_bin_get_by_name
(GST_BIN(m_gstreamerData.pipeline), "mysource");
	g_assert(m_gstreamerData.source);
	g_assert(GST_IS_APP_SRC(m_gstreamerData.source));
	...
	/* set the caps on the source */
	caps = gst_caps_new_simple ("video/x-raw-rgb",
	//"format", G_TYPE_STRING, "GREY",
	"bpp",G_TYPE_INT,(gint)24,
	"depth",G_TYPE_INT,(gint)24,
	"width", G_TYPE_INT, (gint)748,
	"height", G_TYPE_INT, (gint)480,
	"framerate", GST_TYPE_FRACTION, 40, 1,
	NULL);

	gst_app_src_set_caps(GST_APP_SRC(m_gstreamerData.source), caps);
	g_object_set(G_OBJECT(m_gstreamerData.source),"is-live",TRUE,NULL);
	g_object_set(G_OBJECT(m_gstreamerData.source),"block",FALSE,NULL);
	g_object_set(G_OBJECT(m_gstreamerData.source),"do-timestamp",TRUE,NULL);

	/* go to playing and wait in a mainloop. */
	gst_element_set_state (m_gstreamerData.pipeline, GST_STATE_PLAYING);
	...
}

Does anyone have an idea to fix my issue ? 

Thanks in advance!

Best Regards,
Greg




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/appsrc-and-caps-tp4666409.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list