简体   繁体   English

错误:SkImageDecoder :: Factory返回null

[英]Error: SkImageDecoder::Factory returned null

I am working on a project which is using MPEG2 codec for decoding of a video. 我正在使用MPEG2编解码器解码视频的项目。 My codec is in C. 我的编解码器在C中。

After decoding a video it is returning unsigned char pointer of RGB buffer which is a pointer to an image bits which are stored as an byte Array. 解码视频后,它将返回RGB缓冲区的无符号char指针,该指针是指向存储为字节数组的图像位的指针。 My display function is in Android, so I have to send that information to Android using JNI. 我的显示功能在Android中,因此我必须使用JNI将信息发送到Android。

Before calling to display function I have copied that RGB buffer data in to byte Array and pass it to display function: 在调用显示功能之前,我已将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);

But when I am running the application the message is coming: 但是,当我运行该应用程序时,消息来了:

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

I don't know why bitmapFactory is returning null. 我不知道为什么bitmapFactory返回null。 Since I am beginner with Android, I don't know too much about Android programming. 由于我是Android的初学者,所以我对Android编程了解不多。 Can anybody please help me.. 有人可以帮我吗..

Yes I solved this error. 是的,我解决了这个错误。 What I have done I have added bitmap header before the RGB data and then copied that data into byte array and then pass it to the display function which is in android. 我所做的是在RGB数据之前添加位图标头,然后将该数据复制到字节数组中,然后将其传递给android中的显示功能。 And then use 然后用

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

It will return the bitmap and draw that image... 它将返回位图并绘制该图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM