Unsolved Regarding the live streaming and how to Show it on Widget
-
Hi,
I am working on the Camera streaming , we have the 3 party api, which is providing the stream, the api will provide us the bitmap, my question is?.
how can we add Bitmap to Qt widgets, should we use Qpainter to draw, or Qlabel to show continuous streams?.
Suggestions would help me,
Thanks,
-
Hi,
How does this 3rd party work ?
-
We have certain api's which will provide to initialize , based on the api call callback is called. then we get continous streaming , we have the return result also.
In the callback we get the data in Bitmap.
Thanks,
-
You could create a QtMultimedia backend for QCamera using these APIs.
-
it is a contiuous live streaming, how can i show in QtMultimedia class?.
which classes should i use and i need to convert bitmap also then display.
Thanks,
-
Take a look at the plugins sources.
You can create QImage from Bitmap.
-
K then i need to show the streaming , do i need to use QPainter to show live streaming, because we have drawImage() method, and is my understanding right?.
u mentioned about plugin sources, where in docs, which topic?.
Thanks,
-
If you implement a backend for QtMultimedia, you'll use QCamera with a QViewFinder in your application.
I mean Qt's sources, directly.
-
after getting the bitmap data , how can i add to Qcamera and QCameraviewfinder?.
using 3 party API's can we add the streaming to Qcamera?.
Thanks,
-
That's what I've been telling you: you can make a custom backend (plugin) for QtMultimedia using that 3rd party API. You'll manipulate the data in the plugin and in your software you'll just create a QCamera using the device(s) provided by your plugin.
-
Hi,
I have used QPainter and drawImage() method to draw image on QWidget, i am getting the live streams, populating on to the Widget.
Thanks,
-
Hi,
i am using update() method in a slot to call paintevent() . But when using update(), their is a lag in the frames painting on to the widget.
void MyWidget::getImageBuf(unsigned char* buf) { m_data = QByteArray((char*)buf, size + 54); this->update(); }
void MyWidget::paintEvent(QPaintEvent *) { image->loadFromData(m_data); QRect rect(m_widget->x(),m_widget->y(),m_widget->width(),m_widget->height()); QPainter painter(this); painter.setPen(Qt::SolidLine); painter.drawImage(rect,*image,image->rect()); }
i even used repaint() , but the app is crashing. Is their any option to make update() call paintevent frequently as we get the frames.
Thanks,
-
You should rather first identify your bottleneck. You might not need quicker painting but quicker loading.
-
Hi,
checked with the buffer frame rate and paintevent called . the lag was due to update(), as it was not immediately painting on to the widget.
How can i resolve, any alternative?.
Thanks,
-
What frame rate and image size are you supposed to be handling ?
-
hi,
if we want to have Qt multimedia backend, which classes should we use and we need to customize and then add to the QCameraViewfinder?.
Thanks,
-
Take a look at the QtMultimedia plugins more specifically the camera part.
The idea is to create a plugin that will provide the camera related interfaces.
-
How can we do it, do we need to subclass any of the classes?.
Is their an example or link for the plugins?.Thanks,
-
No there's no examples, you have to take a look at Qt's sources.
Yes you'll have to do some subclassing, however, the list of the classes to use will depend on what controls you will want to provide. Hence take a look at the sources of one of the cameras implementation.