错误:SkImageDe codeR ::厂返回NULL [英] Error: SkImageDecoder::Factory returned null

查看:115
本文介绍了错误:SkImageDe codeR ::厂返回NULL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作这是使用MPEG2 codeC用于视频解码的项目。我的codeC是在C

I am working on a project which is using MPEG2 codec for decoding of a video. My codec is in C.

解码视频它返回RGB缓冲区,是一个指向其存储为字节数组图像位无符号的字符指针后。我的显示功能在Android中,所以我必须使用JNI的信息发送到Android系统。

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.

调用显示功能我已经到Byte数组复制的RGB缓冲区中的数据,并通过它来显示功能之前:

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):SkImageDe codeR ::厂返回null。

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

我不知道为什么bitmapFactory被返回null。由于我与Android初学者,我不知道太多关于Android编程。任何人都可以请帮我..

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..

推荐答案

是的,我解决了这个错误。我做了什么我已经添加的位图头中的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

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...

这篇关于错误:SkImageDe codeR ::厂返回NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆