| 163 | } |
| 164 | |
| 165 | void 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 | |
| 198 | bool QVideoInputDevice::getNextEncodedPacket(RsVOIPDataChunk& chunk) |
| 199 | { |
nothing calls this directly
no test coverage detected