Hello! I&#39;m doing my first steps with GStreamer :)<br><br>I&#39;d like to draw lines in a RGB space before show it. I let you a simple c++ program that shows a webcam. I&#39;ve add a callback to get the buffer after convert it, but it&#39;s in YUY2 and not in RGB. What am I doing wrong?<br>
<br>Notes:<br>width x height x bits_per_pixel / 8 = buffer size (in bytes)<br>YUY2: 640x480x16/8 = 614400<br>RGB: 640x480x24/8 = 921600<br><br>Program output &quot;ch_havedata: buffer size 614400&quot; :(<br><br><br>Thanks,<br>
Juan Pablo<br><br><br>[code]<br><br>// Compile: g++ -Wall `pkg-config --cflags --libs gstreamer-0.10` pipeline03.cpp -o pipeline03<br>#include &lt;gst/gst.h&gt;<br><br>static GMainLoop *loop;<br><br>static gboolean cb_have_data(GstPad *pad, GstBuffer *buffer, gpointer u_data)<br>
{<br>  g_print(&quot;ch_havedata: buffer size %d\n&quot;,GST_BUFFER_SIZE(buffer));<br>  return TRUE;<br>}<br><br><br>gint main (gint argc, gchar *argv[])<br>{<br>  GstElement *pipeline, *webcamsrc, *flt, *colorspace, *videosink;<br>
  GstPad *pad;<br><br>  // init GStreamer<br>  gst_init (&amp;argc, &amp;argv);<br><br>  // create pipeline<br>  pipeline = gst_pipeline_new (&quot;pipeline&quot;);<br>  <br>  // configure pipeline<br>  webcamsrc = gst_element_factory_make (&quot;v4l2src&quot;, &quot;webcamsrc&quot;);<br>
  flt = gst_element_factory_make (&quot;capsfilter&quot;, &quot;flt&quot;);<br>  colorspace = gst_element_factory_make (&quot;ffmpegcolorspace&quot;, &quot;colorspace&quot;);<br>  videosink = gst_element_factory_make (&quot;xvimagesink&quot;, &quot;videosink&quot;);<br>
<br>  // setup capsfilter<br>  g_object_set (G_OBJECT (flt), &quot;caps&quot;,<br>    gst_caps_new_simple (&quot;video/x-raw-yuv&quot;,<br>      &quot;format&quot;, GST_TYPE_FOURCC, GST_MAKE_FOURCC (&#39;Y&#39;, &#39;U&#39;, &#39;Y&#39;, &#39;2&#39;),<br>
      &quot;width&quot;, G_TYPE_INT, 640,<br>      &quot;height&quot;, G_TYPE_INT, 480,<br>      &quot;framerate&quot;, GST_TYPE_FRACTION, 20, 1,<br>      &quot;bpp&quot;, G_TYPE_INT, 16,<br>      &quot;depth&quot;, G_TYPE_INT, 16,<br>
      &quot;endianness&quot;, G_TYPE_INT, G_BYTE_ORDER,<br>      NULL), NULL);<br><br>  // add two callback<br>  pad = gst_element_get_pad(videosink, &quot;sink&quot;);<br>  gst_pad_add_buffer_probe (pad, G_CALLBACK (cb_have_data), NULL);<br>
  gst_object_unref (pad);<br><br>  // link<br>  gst_bin_add_many (GST_BIN (pipeline), webcamsrc, flt, colorspace, videosink, NULL);<br>  gst_element_link_many (webcamsrc, flt, videosink, NULL);<br><br>  // play pipeline<br>
  gst_element_set_state (pipeline, GST_STATE_PLAYING);<br><br>  // create mainloop<br>  loop = g_main_loop_new (NULL, FALSE);<br>  g_main_loop_run (loop);<br>  <br>  // clean up<br>  gst_element_set_state (pipeline, GST_STATE_NULL);<br>
  gst_object_unref (pipeline);<br>  g_main_loop_unref (loop);<br><br>  return 0;<br>}<br><br>