//qWarning() << "update"; QPixmap pixmap = this->grab(); QImage image = pixmap.toImage(); //qWarning() << "byteCount " << image.byteCount(); // BYTE * rgb = new BYTE[bufsize]; // BYTE * yuv = new BYTE[bufsize * 3 / 2]; // RGB2YUV(&pStream, &yuv, 4, 640, 480) int w = image.width(); int h = image.height(); // image.invertPixels(QImage::InvertRgb); //============================================================== AVFrame *pFrameRGB = avcodec_alloc_frame(); // Determine required buffer size and allocate buffer int numBytes1 = avpicture_get_size(PIX_FMT_RGB32, w, h); uint8_t *buffer1 = (uint8_t *)av_malloc(numBytes1*sizeof(uint8_t)); avpicture_fill((AVPicture *)pFrameRGB, buffer1, PIX_FMT_RGB32, w, h); pFrameRGB->data[0] = image.bits(); qWarning() << "numBytes1 " << numBytes1; AVFrame *pFrameYUV = av
QImage下 rgb32 转为 yuv420
最新推荐文章于 2025-03-10 15:36:24 发布