<span class="gmail_quote"></span><span class="gmail_quote"></span>Hello,<br><div><span class="e" id="q_11bd5e18ac8e7c9a_0"><br>I&#39;m sorry, wanted to send the previous message to the list but I just sent it to Stefan.<br>
<br>So my VIDEO_ defines are :<br><br>#define VIDEO_SRC &quot;v4l2src&quot;<br>
#define VIDEO_SINK &quot;xvimagesink&quot;<br>
<br>I removed the second caps part, I pasted it from the original code I was using has an example but that has nothing to do in my pipeline ;)<br><br><br>But the problem don&#39;t come from this, actually my pipeline is working, I have a start/stop button, and when I press it, the video from the camera appears on the screen.<br>


<br>Now I&#39;d like to run some code continuously, calculating a result with the current image buffer, and doing it with the next frame when it&#39;s done.<br><br>Bruno<br><br><br><div><span class="gmail_quote">2008/8/18, Stefan Kost &lt;<a href="mailto:ensonic@hora-obscura.de" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ensonic@hora-obscura.de</a>&gt;:</span><div>

<span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Bruno schrieb:<br> <br>&gt; Hi Steph,<br> &gt;<br> &gt; - By video_sink I meant screen_sink, which contain the current frame<br> &gt; buffer from the camera.<br> &gt; - The video/x-raw-rgb seems to configure the input of the sensor, I<br>


 &gt; just took it like this in the maemo camera example.<br> <br> <br>Please reply to the list. I am not mr. gstreamer support, right.<br> <br> Then please read my comments again. There is no element called<br> &quot;screen_sink&quot;, so please also show that #define VIDEO_SINK ....<br>


 2nd the first video/x-raw-rgb is for the camera format, but you define<br> another caps futher below, but not using it in the code snippet.<br> <br> Stefan<br> <br>&gt;<br> &gt;<br> &gt; Actually, I&#39;m just trying to find a place where I can put my image<br>


 &gt; processing stuff so it can proceed the frames from the camera.<br> &gt; I&#39;d like that the program process one frame from the camera, ignore<br> &gt; the others till it finishs image processing on it, and then process<br>


 &gt; the next one :<br> &gt;<br> &gt;&nbsp;&nbsp;* |Camera|&nbsp;&nbsp;&nbsp;&nbsp; |CSP |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|Screen|&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|Screen|&nbsp;&nbsp;&nbsp;&nbsp; | Calculate |<br> &gt;&nbsp;&nbsp;* |src&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | -&gt; |Filter| -&gt;&nbsp;&nbsp;|queue&nbsp;&nbsp;| -&gt;&nbsp;&nbsp;|&nbsp;&nbsp;sink&nbsp;&nbsp;| -&gt;<br> &gt; |expression| -&gt;&nbsp;&nbsp;Display<br>


 &gt;<br> &gt;<br> &gt; Here is my pipeline with some useless stuff removed :<br> &gt;<br> &gt; static gboolean initialize_pipeline(AppData *appdata,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int *argc, char ***argv)<br> &gt; {<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; GstElement *pipeline, *camera_src, *screen_sink;<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp; GstElement *screen_queue;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; GstElement *csp_filter;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; GstCaps *caps;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; GstBus *bus;<br> &gt;<br> &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Initialize Gstreamer */<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; gst_init(argc, argv);<br>


 &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Create pipeline and attach a callback to it&#39;s<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* message bus */<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; pipeline = gst_pipeline_new(&quot;test-camera&quot;);<br> &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp; gst_bus_add_watch(bus, (GstBusFunc)bus_callback, appdata);<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; gst_object_unref(GST_OBJECT(bus));<br> &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Save pipeline to the AppData structure */<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; appdata-&gt;pipeline = pipeline;<br>


 &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Create elements */<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Camera video stream comes from a Video4Linux driver */<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; camera_src = gst_element_factory_make(VIDEO_SRC, &quot;camera_src&quot;);<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Colorspace filter is needed to make sure that sinks understands<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* the stream coming from the camera */<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; csp_filter = gst_element_factory_make(&quot;ffmpegcolorspace&quot;,<br> &gt; &quot;csp_filter&quot;);<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Queue creates new thread for the stream */<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp; screen_queue = gst_element_factory_make(&quot;queue&quot;, &quot;screen_queue&quot;);<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Sink that shows the image on screen. Xephyr doesn&#39;t support XVideo<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* extension, so it needs to use ximagesink, but the device uses<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* xvimagesink */<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; screen_sink = gst_element_factory_make(VIDEO_SINK, &quot;screen_sink&quot;);<br> &gt;<br> &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Check that elements are correctly initialized */<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; if(!(pipeline &amp;&amp; camera_src &amp;&amp; screen_sink &amp;&amp; csp_filter &amp;&amp;<br>


 &gt; screen_queue))<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_critical(&quot;Couldn&#39;t create pipeline elements&quot;);<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return FALSE;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &gt;<br> &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Add elements to the pipeline. This has to be done prior to<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* linking them */<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; gst_bin_add_many(GST_BIN(pipeline), camera_src, csp_filter,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; screen_queue, screen_sink, NULL);<br> &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Specify what kind of video is wanted from the camera */<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp; caps = gst_caps_new_simple(&quot;video/x-raw-rgb&quot;,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;width&quot;, G_TYPE_INT, 640,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;height&quot;, G_TYPE_INT, 480,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;framerate&quot;, GST_TYPE_FRACTION, 25, 1,<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL);<br> &gt;<br> &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Link the camera source and colorspace filter using capabilities<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* specified */<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; if(!gst_element_link_filtered(camera_src, csp_filter, caps))<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return FALSE;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; gst_caps_unref(caps);<br> &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Connect Colorspace Filter -&gt; Tee -&gt; Screen Queue -&gt; Screen Sink<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* This finalizes the initialization of the screen-part of the<br>


 &gt; pipeline */<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; if(!gst_element_link_many(csp_filter, screen_queue, screen_sink,<br> &gt; NULL))<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return FALSE;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* gdkpixbuf requires 8 bits per sample which is 24 bits per<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* pixel */<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; caps = gst_caps_new_simple(&quot;video/x-raw-rgb&quot;,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;width&quot;, G_TYPE_INT, 640,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;height&quot;, G_TYPE_INT, 480,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;bpp&quot;, G_TYPE_INT, 24,<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;depth&quot;, G_TYPE_INT, 24,<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NULL);<br> &gt;<br> &gt;<br> &gt;<br> &gt;<br> &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* As soon as screen is exposed, window ID will be advised to the<br> &gt; sink */<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp; g_signal_connect(appdata-&gt;screen, &quot;expose-event&quot;,<br> &gt; G_CALLBACK(expose_cb),<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;screen_sink);<br> &gt;<br> &gt;<br> &gt;<br> &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; gst_element_set_state(pipeline, GST_STATE_PAUSED);<br>


 &gt;<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; return TRUE;<br> &gt; }<br> &gt;<br> &gt;<br> &gt; I tried to have a printf(&quot;hello&quot;) on each video frame. I put the<br> &gt; printf in the pipeline initialisation, in the main, and in the expose<br>


 &gt; cb function which is :<br> &gt;<br> &gt; /* Callback to be called when the screen-widget is exposed */<br> &gt; static gboolean expose_cb(GtkWidget * widget, GdkEventExpose * event,<br> &gt; gpointer data)<br> &gt; {<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp; /* Tell the xvimagesink/ximagesink the x-window-id of the screen<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* widget in which the video is shown. After this the video<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* is shown in the correct widget */<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(data),<br>


 &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GDK_WINDOW_XWINDOW(widget-&gt;window));<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp; return FALSE;<br> &gt; }<br> &gt;<br> &gt; And no success. the printf is showed only one when I start the<br> &gt; pipeline. (I have a button to start and stop it)<br>


 &gt;<br> &gt; Maybe I can make a function with the processing part in it, and tell<br> &gt; the pipeline to run it with a g_signal_connect call.<br> &gt;<br> &gt; Thanks in advance,<br> &gt; Bruno<br> <br> </blockquote>
</span></div></div>
</span></div>