错误:SkImageDecoder::Factory返回null



我正在做一个使用MPEG2编解码器解码视频的项目。我的编解码器是c。

解码视频后,它返回RGB缓冲区的unsigned char指针,该指针指向存储为字节数组的图像位。我的显示功能在Android中,所以我必须使用JNI将该信息发送给Android。

在调用显示函数之前,我已经将RGB缓冲区数据复制到字节数组中,并将其传递给显示函数:

BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inDither = false;
opt.inPreferredConfig = Bitmap.Config.RGB_565;
Bitmap bit=BitmapFactory.decodeByteArray(data, 0,   data.length,opt);
canvas.drawBitmap(bit, draw_x, draw_y, null);

但是当我运行应用程序时,消息来了:

DEBUG/skia(327):SkImageDecoder::Factory返回null。

我不知道为什么bitmapFactory返回null。因为我是Android的初学者,所以我不太了解Android编程。

是我解决了这个错误。我所做的是在RGB数据之前添加位图头,然后将该数据复制到字节数组中,然后将其传递给android中的显示函数。然后使用

Bitmap bit=BitmapFactory.decodeByteArray(data, 0, data.length);
canvas.drawBitmap(bit, draw_x, draw_y, null);

它将返回位图并绘制该图像…

最新更新