开发者

need help to draw bitmaps for video streaming

I am trying to play video, where I get frames as bitmaps from the native code and I want to display the video on the screen. I do not understand how to display them, as there are view, surface, animation and graphics and I have no idea, which one to use from these. I am very beginn开发者_JAVA百科er to android. Please help me choosing and let me know if there are any samples.

Thanks for any help


I am able to solve it myself. Answer is as follows

C Code :

in renderbitmap function

AndroidBitmapInfo  info;
void*              pixels;
int                ret;

if ((ret = AndroidBitmap_getInfo(env, bitmap, &info)) < 0) {
return;
}

if (info.format != ANDROID_BITMAP_FORMAT_RGB_565) {
return;
}

if ((ret =AndroidBitmap_lockPixels(env, bitmap, &pixels)) < 0) {
}

memcpy(pixels, pictureRGB, 480*320);

AndroidBitmap_unlockPixels(env, bitmap);

Java Code

 Bitmap mBitmap = Bitmap.createBitmap(480, 320, Bitmap.Config.RGB_565);
 renderbitmap(mBitmap, 0);
 canvas.drawBitmap(mBitmap, 0, 0, null);


Ok, so displaying bitmaps can be done using imageviews that can be embedded in your layout.

ImageView bmImage = (ImageView)findViewById(R.id.image);
bmImage.setImageBitmap(bitmap); // insert bitmap that you get from video

Did i understand you correctly?)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜