错误:SkImageDecoder::Factory 返回 null
我正在开发一个使用 MPEG2 编解码器来解码视频的项目。我的编解码器使用 C 语言。
解码视频后,它返回 RGB 缓冲区的无符号字符指针,该指针指向存储为字节数组的图像位。我的显示功能是在 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编程了解不多。有人可以帮我吗..
I am working on a project which is using MPEG2 codec for decoding of a video. My codec is in 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. My display function is in Android, so I have to send that information to Android using JNI.
Before calling to display function I have copied that RGB buffer data in to byte Array and pass it to display function:
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.
I don't know why bitmapFactory is returning null. Since I am beginner with Android, I don't know too much about Android programming. Can anybody please help me..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,我解决了这个错误。我所做的就是在 RGB 数据之前添加位图标头,然后将该数据复制到字节数组中,然后将其传递给 android 中的显示函数。然后使用
它将返回位图并绘制该图像......
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. And then use
It will return the bitmap and draw that image...