Update on the thread:
Question 3 solved:
The application does not crash any more. Instead of calling gst_app_sink_pull_buffer in a new_buffer callback function, I call it inside the paintEvent. In this way all is done in the same thread and I avoid unreferencing the buffer before the image is drawn on the screen, however, the performance drops slightly (from 30 FPS to 25 FPS at 320×240).
1 and 2 remaining.
Any help will be meat by great joy and happiness that will fill the room of my office .
//callback function of appsink (Gstreamer thread)
void CameraN900::new_buffer (GstAppSink *_appsink, gpointer user_data)
//initialize appsink and disable emit new_buffer signal
*image_buffer=QImage(CameraN900::image_data, buffer_width, buffer_height,3*buffer_width, QImage::Format_RGB888); // loads data into an buffer_image
buffer = gst_app_sink_pull_buffer(appsink); //buffer us a static GstBuffer *
//GUI thread. Repinat triggered by a timer.
void CameraField::paintEvent(QPaintEvent * event)
CameraN900::refresh_buffer(); //manually call appsink, not through the callback function
unsigned char* data=(unsigned char *) GST_BUFFER_DATA (CameraN900::buffer);
QImage img(data, buffer_width, buffer_height,3*buffer_width, QImage::Format_RGB888); // 2 pixels width, 2 pixels height, 6 bytes per line, RGB888 format