| 753 | }; |
| 754 | |
| 755 | static QImage QImageFromRgbaFrame(const AVFrame* frame) { |
| 756 | if (!frame || frame->format != AV_PIX_FMT_RGBA) |
| 757 | throw std::runtime_error("Expected an RGBA software frame"); |
| 758 | |
| 759 | QImage image(frame->width, frame->height, QImage::Format_RGBA8888); |
| 760 | for (int y = 0; y < frame->height; ++y) { |
| 761 | std::memcpy(image.scanLine(y), |
| 762 | frame->data[0] + y * frame->linesize[0], |
| 763 | static_cast<size_t>(frame->width) * 4); |
| 764 | } |
| 765 | return image; |
| 766 | } |
| 767 | |
| 768 | static void ForceOpaqueAlpha(AVFrame* frame) { |
| 769 | if (!frame || frame->format != AV_PIX_FMT_RGBA) |
no outgoing calls
no test coverage detected