嗨,我有一个从 QNetworkReply 获得的 jpeg 图像的 QByteArray。我到处都能看到从文件中读取并解压缩的 jpeg 图像,
FILE * infile;
......
if ((infile = fopen(filename, "rb")) == NULL)
{
fprintf(stderr, "can't open %s\n", filename);
exit(1);
}
jpeg_stdio_src(&cinfo, infile);
jpeg_read_header(&cinfo, 0);
jpeg_start_decompress(&cinfo);
然后
while (scan lines remain to be read)
jpeg_read_scanlines(...);
但是我如何从 QByteArray 而不是文件/stdio 流中读取它?