[FFmpeg-user] Passing Compressed bitmap from C to Android
s.rawat
imsaurabhrawat at gmail.com
Fri Dec 16 14:21:27 CET 2011
Hi,
I am trying to send the bitmap of v4l2 buffer(from an external UVC camera)
converted to "jpg from the yuv" to the android code but no success .Here is
my few code snippets.The code snippet below is more design oriented so plz
forgive the syntactics.
*Android Code : *
Bitmap mBitmap = Bitmap.createBitmap(
holder.getSurfaceFrame().right-holder.getSurfaceFrame().left,
holder.getSurfaceFrame().bottom-holder.getSurfaceFrame().top,Bitmap.Config.RGB_565
);
*uvcConvert2Bitmap*(mBitmap);
*Native Code : *
struct vdIn *v4l2buff = 0;
JNI_inside_my_package_name>_*uvcConvert2Bitmap*(JNIEnv *env, jobject obj,
jobject bitmap)
{
char* buffer;
//grab the buffer using the V4l2 call :
uvcGrab (<v4l2buff);
buf = malloc(v4l2buff->framesizeIn);
//encoding to jpeg :
compress_yuyv_to_jpeg(v4l2buff, buf, v4l2buff->framesizeIn, 80,
v4l2buff->formatIn);
if (AndroidBitmap_lockPixels(env, jbitmap, buffer)< 0)
{
}
else
{
//i am assuming that the jbitmap has the buffer inside it
jbmp = jbitmap;
}
}
*Android code:*
DrawCanvas.this.onDraw(c, mBitmap);
protected void onDraw(Canvas canvas,Bitmap bmp) {
// TODO Auto-generated method stub
canvas.drawColor(color.black);
canvas.drawBitmap(bmp, 0,0, null);
}
I am not able to get any bitmap in my android application .Can some one plz
tell what I m doing wrong.
Rgds,
Saurabh
"..pain is temporary.....quitting lasts forever......"
More information about the ffmpeg-user
mailing list