MCPcopy Create free account
hub / github.com/RetroShare/RetroShare / grabFrame

Method grabFrame

plugins/VOIP/gui/QVideoDevice.cpp:165–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165void QVideoInputDevice::grabFrame(int id,QVideoFrame frame)
166{
167 if(frame.size().isEmpty())
168 {
169 std::cerr << "Empty frame!" ;
170 return;
171 }
172
173 frame.map(QAbstractVideoBuffer::ReadOnly);
174 QByteArray data((const char *)frame.bits(), frame.mappedBytes());
175 QBuffer buffer;
176 buffer.setData(data);
177 buffer.open(QIODevice::ReadOnly);
178 QImageReader reader(&buffer, "JPG");
179 reader.setScaledSize(QSize(640,480));
180 QImage image(reader.read());
181
182#ifdef DEBUG_QVIDEODEVICE
183 std::cerr << "Frame " << id << ". Pixel format: " << frame.pixelFormat() << ". Size: " << image.size().width() << " x " << image.size().height() << std::endl; // if(frame.pixelFormat() != QVideoFrame::Format_Jpeg)
184#else
185 Q_UNUSED(id);
186#endif
187
188 if(_video_processor != NULL)
189 {
190 _video_processor->processImage(image) ;
191
192 emit networkPacketReady() ;
193 }
194 if(_echo_output_device != NULL)
195 _echo_output_device->showFrame(image) ;
196}
197
198bool QVideoInputDevice::getNextEncodedPacket(RsVOIPDataChunk& chunk)
199{

Callers

nothing calls this directly

Calls 4

processImageMethod · 0.80
showFrameMethod · 0.80
sizeMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected