V4L2 Camera interface

4,281 views
Skip to first unread message

Androidphan

unread,
May 6, 2009, 10:19:46 AM5/6/09
to android-porting
I'm currently trying to replace the CameraHardwareStub with my own
CameraHardware which uses the v4l2 interface. Now I can capture jpeg
frames from the camera which will be automatically saved onto the SD
card.

I'm having problems with my preview video. I'm not getting a preview
image on my screen. It seems that Android is using some kind of YUV422
format? At the moment I'm getting my frames in YUYV format. How can I
convert this into the format Android is using for it's preview video?

As I get this right, the memory base that's given with
mPreviewCallback is used for preview video?

Harishkumar V

unread,
May 6, 2009, 11:52:43 AM5/6/09
to android...@googlegroups.com
Hi,

Even i am in the course of that only. I am unable to preview video.

YUYV to YUV422 conversion in the capturing layer can be tried.

Thanks and Regards,
HarishKumar.V

teddy.t...@gmail.com

unread,
May 6, 2009, 8:54:25 PM5/6/09
to android...@googlegroups.com
Hi, Androidphan,
Could you please paste ur CameraHardwareStub.cpp ? We are meeting the
exact issue as urs. And we haven't successfully grip our data to be a
jpeg file. So , if we can get that from you, it will be very appreciate.
BTW, seems YUYV is a kind of YUV422. We can ge video from camera but
the image are not correct. We doubt that the YUYV pattern of our camera
is different from android system demanded.
thanks.

Androidphan

unread,
May 7, 2009, 3:59:39 AM5/7/09
to android-porting
I now can get a preview through. But still I would like to know how to
convert my frame to yuv422sp? How is it stored in memory?

Harishkumar V

unread,
May 7, 2009, 4:46:48 AM5/7/09
to android...@googlegroups.com
Hi Androidphan,

Can you share the camera stub source, we are facing the same problem.
It would be appreciated.

Thanks and Regards,
HarishKumar.V

teddy.t...@gmail.com

unread,
May 7, 2009, 4:50:00 AM5/7/09
to android...@googlegroups.com
Hi androidphan,
See my attachment for get preview image.(unfortunately, android app
seems only takes the Y filed but u and v.So our preview image is single
colored)
You should transfer ur raw data YUYV to YYYYUUVV format as our
device.cpp write.

Androidphan 写道:
libcameraservice.tar.gz

Androidphan

unread,
May 7, 2009, 10:41:33 AM5/7/09
to android-porting
My preview video is now black & white only... Anyone from the
developers can give a hint on how to convert YUYV to this YUV420/
YUV422 SP format?

On May 7, 10:50 am, "teddy.teddy...@gmail.com"
>  libcameraservice.tar.gz
> 139KViewDownload

Harishkumar V

unread,
May 7, 2009, 10:59:10 PM5/7/09
to android...@googlegroups.com
Hi Androidplan,

you can see android_build/external/opencore/colorconvert/

there lot of conersions are available.

Thanks and Regards,
HarishKumar.V

Harishkumar V

unread,
May 7, 2009, 11:07:05 PM5/7/09
to android...@googlegroups.com
Hi Androidplan,

ignore previous mail.

you can see android_build/external/opencore/codecs_v2/utilities/colorconvert/src/


there lot of conersions are available.


Thanks and Regards,
HarishKumar.V


2009/5/8 Harishkumar V <harish...@gmail.com>

Androidphan

unread,
May 8, 2009, 2:41:45 AM5/8/09
to android-porting
Thanks for the tip, I'll let you know if it worked.

On May 8, 5:07 am, Harishkumar V <harishpres...@gmail.com> wrote:
> Hi Androidplan,
>
> ignore previous mail.
>
> you can see
> android_build/external/opencore/codecs_v2/utilities/colorconvert/src/
>
> there lot of conersions are available.
>
> Thanks and Regards,
> HarishKumar.V
>
> 2009/5/8 Harishkumar V <harishpres...@gmail.com>
>
> > Hi Androidplan,
>
> > you can see android_build/external/opencore/colorconvert/
>
> > there lot of conersions are available.
>
> > Thanks and Regards,
> > HarishKumar.V
>

Harishkumar V

unread,
May 8, 2009, 4:08:53 AM5/8/09
to android...@googlegroups.com
Hi,

i tried to compile libcameraservice.tgz, but its failing.

Am i need to modify other files. if so, what are the files.

Thanks and Regards,
HarishKumar.V

2009/5/8 Androidphan <niels....@tass.nl>

Androidphan

unread,
May 11, 2009, 10:15:44 AM5/11/09
to android-porting
I'm still not able to get my preview video in color...

Is the preview format YUV420 or YUV422 and is it semi-planar so
something like Y plane then U0 V0 U1 V1 or V0 U0 V1 U1 ?

Can anyone provide details?

Steve Fischer

unread,
May 11, 2009, 10:17:16 AM5/11/09
to android-porting
The reason that the preview is only grayscale is that OpenGLES (which
is used by Surface Flinger for scene composition) does not support YUV
input. Instead, Surface Flinger is only passing in the Y component in
GLES as a lumiance texture, which gives you the grayscale preview. In
order to get a full color preview, the preview frames would have to be
converted to RGB, likely RGB565, but this will take more time per
frame, since the YUV->RGB conversion is more complicated.

Steve.

On May 8, 3:08 am, Harishkumar V <harishpres...@gmail.com> wrote:
> Hi,
>
> i tried to compile libcameraservice.tgz, but its failing.
>
> Am i need to modify other files. if so, what are the files.
>
> Thanks and Regards,
> HarishKumar.V
>
> 2009/5/8 Androidphan <niels.kee...@tass.nl>
> > > >> > 139KViewDownload- Hide quoted text -
>
> - Show quoted text -

Androidphan

unread,
May 12, 2009, 9:29:10 AM5/12/09
to android-porting
I now have a rgb 565 image, but it also shows only grayscale?

blindfold

unread,
May 12, 2009, 9:44:56 AM5/12/09
to android-porting

Androidphan

unread,
May 13, 2009, 5:43:35 AM5/13/09
to android-porting
Thanks for the reply. But I already converted my yuyv frame into
yuv420sp yuv422sp yuv422, rgb 565, no luck at all.

On May 12, 3:44 pm, blindfold <seeingwithso...@gmail.com> wrote:
> http://groups.google.com/group/android-developers/browse_thread/threa...

blindfold

unread,
May 13, 2009, 8:31:05 AM5/13/09
to android-porting
I'm not sure what you are doing: the Android emulator code for
previewing for instance simply ignores all color data and displays
only the Y component, i.e., the first width * height bytes out of the
2 * width * height bytes in the YUV422 data[] in the preview callback.
The G1 hardware code on the other hand does show the color preview,
but uses a quite different (YUV420) encoding with 3/2 * width * height
bytes per preview frame.

Androidphan

unread,
May 13, 2009, 9:00:22 AM5/13/09
to android-porting
I'm porting Android to a x86 netbook. But why is color ignored? Can't
I get this working?

blindfold

unread,
May 13, 2009, 9:21:28 AM5/13/09
to android-porting
Don't know why the Android team dropped color preview from the
emulator with recent SDKs. Color preview was still present and fully
functional in the SDK M5 RC15 emulator, but then it stopped working as
of SDK 0.9 beta even though the color info is still in the preview
callback data[] with the moving checkerboard. See my issue 822
http://code.google.com/p/android/issues/detail?id=822

I think you will have to write/adapt your own camera preview branch to
get color, either by fixing the emulator code or by adapting the G1
hardware code (or better still, submit a patch such that everybody
will benefit).

Steve Fischer

unread,
May 13, 2009, 11:11:15 AM5/13/09
to android-porting
If you are producing RGB565 frames in your CameraHardwareInterface
implementation, then you will likely need to make a format change in
the "framework/base/camera/libcameraservice/CameraService.cpp" file.
Specifically, in the "startPreview" function, the preview frame format
is hardcoded to "YCbCr_420_SP", as in:

mSurface->registerBuffers(w, h, w, h,
PIXEL_FORMAT_YCbCr_420_SP, ... );

You will need to change this hardcoded value to match the pixel format
of the frames you are producing. I think in there are only a couple
of supported format choices. I believe "RGB_565" is supported. Give
it a try.

Steve.

On May 13, 8:21 am, blindfold <seeingwithso...@gmail.com> wrote:
> Don't know why the Android team dropped color preview from the
> emulator with recent SDKs. Color preview was still present and fully
> functional in the SDK M5 RC15 emulator, but then it stopped working as
> of SDK 0.9 beta even though the color info is still in the preview
> callback data[] with the moving checkerboard. See my issue 822http://code.google.com/p/android/issues/detail?id=822
>
> I think you will have to write/adapt your own camera preview branch to
> get color, either by fixing the emulator code or by adapting the G1
> hardware code (or better still, submit a patch such that everybody
> will benefit).
>
> On May 13, 3:00 pm, Androidphan <niels.kee...@tass.nl> wrote:
>
>
>
> > I'm porting Android to a x86 netbook. But why is color ignored? Can't
> > I get this working?
>
> > On May 13, 2:31 pm, blindfold <seeingwithso...@gmail.com> wrote:
>
> > > I'm not sure what you are doing: the Android emulator code for
> > > previewing for instance simply ignores all color data and displays
> > > only the Y component, i.e., the first width * height bytes out of the
> > > 2 * width * height bytes in the YUV422 data[] in the preview callback.
> > > The G1 hardware code on the other hand does show the color preview,
> > > but uses a quite different (YUV420) encoding with 3/2 * width * height
> > > bytes per preview frame.
>
> > > On May 13, 11:43 am, Androidphan <niels.kee...@tass.nl> wrote:
>
> > > > Thanks for the reply. But I already converted my yuyv frame into
> > > > yuv420sp yuv422sp yuv422, rgb 565, no luck at all.
>
> > > > On May 12, 3:44 pm, blindfold <seeingwithso...@gmail.com> wrote:
>
> > > > >http://groups.google.com/group/android-developers/browse_thread/threa...- Hide quoted text -

Androidphan

unread,
Jun 17, 2009, 4:16:08 AM6/17/09
to android-porting
A bit late, but that solved it.

I converted my YUYV to rgb 565 and it worked.
> > > > > >http://groups.google.com/group/android-developers/browse_thread/threa...Hide quoted text -

Harishkumar V

unread,
Jun 21, 2009, 9:45:16 AM6/21/09
to android...@googlegroups.com
Hi AndroidPlan,

Can u update the latest source and share or attach it.

Thanks and Regards,
HarishKumar.V

Androidphan

unread,
Jun 22, 2009, 2:53:44 AM6/22/09
to android-porting
Source can be found here:
http://android-m912.googlecode.com/files/v4l2_camera_v2.patch

This is a V4L2 implementation for a UVC camera with mmap support and
output format V4L2_PIX_FMT_YUYV.
> >http://groups.google.com/group/android-developers/browse_thread/threa...text -

Androidphan

unread,
Jun 23, 2009, 6:46:49 AM6/23/09
to android-porting
Was it useful?

On Jun 21, 3:45 pm, Harishkumar V <harishpres...@gmail.com> wrote:
> >http://groups.google.com/group/android-developers/browse_thread/threa...text -

Harishkumar V

unread,
Jun 23, 2009, 8:31:05 AM6/23/09
to android...@googlegroups.com
Hi Androidplan,

I downloaded and during compiling its showing errors,arget thumb C++: libcamera <= frameworks/base/camera/libcameraservice/CameraHardware.cpp
In file included from frameworks/base/camera/libcameraservice/CameraHardware.cpp:21:
frameworks/base/camera/libcameraservice/CameraHardware.h:28:21: error: jpeglib.h: No such file or directory
In file included from frameworks/base/camera/libcameraservice/CameraHardware.cpp:21:
frameworks/base/camera/libcameraservice/CameraHardware.h:42: error: 'recording_callback' has not been declared
frameworks/base/camera/libcameraservice/CameraHardware.cpp:162: error: 'android::status_t android::CameraHardware::startRecording' is not a static member of 'class android::CameraHardware'
frameworks/base/camera/libcameraservice/CameraHardware.cpp:162: error: 'recording_callback' was not declared in this scope
frameworks/base/camera/libcameraservice/CameraHardware.cpp:162: error: expected primary-expression before 'void'
frameworks/base/camera/libcameraservice/CameraHardware.cpp:162: error: initializer expression list treated as compound expression
frameworks/base/camera/libcameraservice/CameraHardware.cpp:163: error: expected ',' or ';' before '{' token
make: *** [out/target/product/beagle/obj/SHARED_LIBRARIES/libcamera_intermediates/CameraHardware.o] Error 1

I also attach my Android.mk file.

Thanks and Regards,
HarishKumar.V
Android.mk

Harishkumar V

unread,
Jun 23, 2009, 8:51:19 AM6/23/09
to android...@googlegroups.com
Hi Androidplan,

I am able to provide jpeg headers and its compiling, during linking it reports errors,

1) external/jpeg instead of external/jpeg/include solved the jpeg header problem.
2) As recording_callback was not defined and Start_recording was not used, it returns only Error, i commented out that part.

after doing the above things, it compiled, during linking, it reports the following,

target SharedLib: libcamera (out/target/product/beagle/obj/SHARED_LIBRARIES/libcamera_intermediates/LINKED/libcamera.so)
out/target/product/beagle/obj/SHARED_LIBRARIES/libcamera_intermediates/V4L2Camera.o: In function `android::V4L2Camera::saveYUYVtoJPEG(unsigned char*, int, int, __sFILE*, int)':
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:320: undefined reference to `jpeg_std_error(jpeg_error_mgr*)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:321: undefined reference to `jpeg_CreateCompress(jpeg_compress_struct*, int, unsigned int)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:322: undefined reference to `jpeg_stdio_dest(jpeg_compress_struct*, __sFILE*)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:331: undefined reference to `jpeg_set_defaults(jpeg_compress_struct*)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:332: undefined reference to `jpeg_set_quality(jpeg_compress_struct*, int, int)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:334: undefined reference to `jpeg_start_compress(jpeg_compress_struct*, int)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:368: undefined reference to `jpeg_write_scanlines(jpeg_compress_struct*, unsigned char**, unsigned int)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:371: undefined reference to `jpeg_finish_compress(jpeg_compress_struct*)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:373: undefined reference to `jpeg_destroy_compress(jpeg_compress_struct*)'
collect2: ld returned 1 exit status

Thanks and Regards,
HarishKumar.V

Androidphan

unread,
Jun 23, 2009, 8:53:57 AM6/23/09
to android-porting
Here it doesn't complain about a missing jpeglib.h, maybe that's
because I build it for a x86 target.
> > > > > > - Show quoted text -
>
>  Android.mk
> 1KViewDownload

Harishkumar V

unread,
Jun 23, 2009, 8:55:50 AM6/23/09
to android...@googlegroups.com

Hi Androidplan,

I am able to provide jpeg headers and its compiling, during linking it reports errors,

1) external/jpeg instead of external/jpeg/include solved the jpeg header problem.
2) As recording_callback was not defined and Start_recording was not used, it returns only Error, i commented out that part.

after doing the above things, it compiled, during linking, it reports the following,

target SharedLib: libcamera (out/target/product/beagle/
obj/SHARED_LIBRARIES/libcamera_intermediates/LINKED/libcamera.so)
out/target/product/beagle/obj/SHARED_LIBRARIES/libcamera_intermediates/V4L2Camera.o: In function `android::V4L2Camera::saveYUYVtoJPEG(unsigned char*, int, int, __sFILE*, int)':
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:320: undefined reference to `jpeg_std_error(jpeg_error_mgr*)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:321: undefined reference to `jpeg_CreateCompress(jpeg_compress_struct*, int, unsigned int)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:322: undefined reference to `jpeg_stdio_dest(jpeg_compress_struct*, __sFILE*)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:331: undefined reference to `jpeg_set_defaults(jpeg_compress_struct*)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:332: undefined reference to `jpeg_set_quality(jpeg_compress_struct*, int, int)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:334: undefined reference to `jpeg_start_compress(jpeg_compress_struct*, int)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:368: undefined reference to `jpeg_write_scanlines(jpeg_compress_struct*, unsigned char**, unsigned int)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:371: undefined reference to `jpeg_finish_compress(jpeg_compress_struct*)'
frameworks/base/camera/libcameraservice/V4L2Camera.cpp:373: undefined reference to `jpeg_destroy_compress(jpeg_compress_struct*)'
collect2: ld returned 1 exit status


Thanks and Regards,
HarishKumar.V

Androidphan

unread,
Jun 23, 2009, 8:55:57 AM6/23/09
to android-porting
Hmm, the Android.mk does says to include the static library libjpeg...

Harishkumar V

unread,
Jun 23, 2009, 8:57:58 AM6/23/09
to android...@googlegroups.com
Hi Androidplan,

can u send ur Android.mk file.

Thanks and Regards,
HarishKumar.V

Androidphan

unread,
Jun 23, 2009, 9:09:27 AM6/23/09
to android-porting
It can be found here
http://android-m912.googlecode.com/files/Android.mk

On Jun 23, 2:57 pm, Harishkumar V <harishpres...@gmail.com> wrote:
> Hi Androidplan,
>
> can u send ur Android.mk file.
>
> Thanks and Regards,
> HarishKumar.V
>

Harishkumar V

unread,
Jun 23, 2009, 9:15:51 AM6/23/09
to android...@googlegroups.com
Hi Androidplan,

I think its problem with the linking of static library with the android.

but, in the same android source, the skia includes local static libraries like jpeg.

Its mystery.

Thanks and Regards,
HarishKumar.V

Harishkumar V

unread,
Jun 23, 2009, 9:20:17 AM6/23/09
to android...@googlegroups.com
Hi Androidplan,

The libcamera.so and libcameraservice.so got created.

In V4l2Camera.cpp, adding this solves the linking problem,

extern "C" {
#include "jpeglib.h"
}

instead of <jpeglib.h>

Thanks and Regards,
HarishKumar.V

Androidphan

unread,
Jun 23, 2009, 10:31:48 AM6/23/09
to android-porting
And does it work for your camera?

On Jun 23, 3:20 pm, Harishkumar V <harishpres...@gmail.com> wrote:
> Hi Androidplan,
>
> The libcamera.so and libcameraservice.so got created.
>
> In V4l2Camera.cpp, adding this solves the linking problem,
>
> extern "C" {
> #include "jpeglib.h"
>
> }
>
> instead of <jpeglib.h>
>
> Thanks and Regards,
> HarishKumar.V
>
> On Tue, Jun 23, 2009 at 6:45 PM, Harishkumar V <harishpres...@gmail.com>wrote:
>
>
>
> > Hi Androidplan,
>
> > I think its problem with the linking of static library with the android.
>
> > but, in the same android source, the skia includes local static libraries
> > like jpeg.
>
> > Its mystery.
>
> > Thanks and Regards,
> > HarishKumar.V
>
> >> > > .....
>
> read more »

crazygenie

unread,
Jun 24, 2009, 12:40:34 AM6/24/09
to android-porting
I tried building it. Build was complete and I could install the image
on my X86 netbook. But, when I open the Camera application it shows
blank screen with a Camera button in the usual position (Top-Right)!!
There seems to be some binder related error that shows up in the
console

binder: 1435:1731 transaction failed 29201, size 48-0
(Is the error related to Camera?)

Moreover the camera LED doesn't glow but I can see /dev/video0 file!
Any pointers/ help?

Thanks in advance,
Ravi
> ...
>
> read more »

Harishkumar V

unread,
Jun 24, 2009, 1:07:20 AM6/24/09
to android...@googlegroups.com
Hi Androidplan,

My BB got damaged, i do not have hardware for now, it will come in a week's time.

But, ur code looks like standard v4l2 interface using mmap. It should work with any normal usb webcam with the resolution alone changing.

Anyway, i test it and confirm u.

Thanks and Regards,
HarishKumar.V

Atsuo Igarashi

unread,
Jun 24, 2009, 1:59:15 AM6/24/09
to android-porting
Hi Androidphan,

My Beagle(ARM based board) is working camcorder and camera app with
your v4l2 camera.

Points in my environment,

1. change permission of video device. (or change owner?)

chmod 666 /dev/video0

2. free space of 1st dos partition on the SD card is made 4Gbyte or
less.

AuthorDriver and MediaRecorder are failed with max-filesize error.

3. change resolution to 352x288 in CameraHardware.cpp.

Thank you Androidphan!

Regards,
Atsuo

On 6月24日, 午後2:07, Harishkumar V <harishpres...@gmail.com> wrote:
> Hi Androidplan,
>
> My BB got damaged, i do not have hardware for now, it will come in a week's
> time.
>
> But, ur code looks like standard v4l2 interface using mmap. It should work
> with any normal usb webcam with the resolution alone changing.
>
> Anyway, i test it and confirm u.
>
> Thanks and Regards,
> HarishKumar.V
>
> ...
>
> もっと読む >>

Androidphan

unread,
Jun 24, 2009, 2:49:31 AM6/24/09
to android-porting
I got a patch that fixes the permissions for the video device and the
sound device files:
http://android-m912.googlecode.com/files/device_permissions.patch

I knew that already.

The resolution is a fixed and can only be changed by recompiling in
CameraHardware.cpp.

It is indeed a standard implementation of v4l2 using mmap. Feel free
to change the code, I'm not going anything more on that code, because
my internship and my Android assignment ends this week :) :(
> > > > >> issue 822...
>
> read more >>

Harishkumar V

unread,
Jun 24, 2009, 3:18:39 AM6/24/09
to android...@googlegroups.com
Thats gr8...

As per Atsuo mail, we have working Standard V4l2 HAL Implementation for android on x-86 and ARM-based BB.

Thanks to Androidplan for achieving this milestone.

Thanks and Regards,
HarishKumar.V

2009/6/24 Androidphan <niels....@tass.nl>

Ravishankar Haranath

unread,
Jun 24, 2009, 10:04:19 AM6/24/09
to android...@googlegroups.com
Hi Androidphan,

Thanks for this great effort. I will re-build with the changes included and test it again on my netbook.

2009/6/24 Harishkumar V <harish...@gmail.com>



--
Ravishankar Haranath
http://www.linmaya.net

crazygenie

unread,
Jun 26, 2009, 5:22:33 AM6/26/09
to android-porting
It's working! Thanks Androidphan :-)

On Jun 24, 7:04 pm, Ravishankar Haranath <rav...@gmail.com> wrote:
> Hi Androidphan,
>
> Thanks for this great effort. I will re-build with the changes included and
> test it again on my netbook.
>
> 2009/6/24 Harishkumar V <harishpres...@gmail.com>
>
> > Thats gr8...
>
> > As per Atsuo mail, we have working Standard V4l2 HAL Implementation for
> > android on x-86 and ARM-based BB.
>
> > Thanks to Androidplan for achieving this milestone.
>
> > Thanks and Regards,
> > HarishKumar.V
>
> > 2009/6/24 Androidphan <niels.kee...@tass.nl>
> ...
>
> read more »

Harishkumar V

unread,
Jun 26, 2009, 7:03:04 AM6/26/09
to android...@googlegroups.com
Hi Androidphan,

I have one doubt, i have one logitech QuickCam Connect which supports jpeg as raw pixel format unlike other camera's which support RGB or yuv as raw pixel format.

whether i needs to change anything in v4l2-camera.patch to make this work with android or it straight forward works.

Because, in ur camera module, u are doing conversion fro yuv to jpeg during saving the picture. i need to modify this.

Thanks and Regards,
HarishKumar.V

Androidphan

unread,
Jun 26, 2009, 7:21:07 AM6/26/09
to android-porting
Your input frames for the camera are jpeg? Then you should change
pixel format to V4L2_PIX_FMT_JPEG probably. Also you need to change
the size of the buffers. At the moment they are 2 bytes per pixel:
width * height * 2.
> > > >> > > > > >> > > > > 'recording_callback' was not declared in this scope...
>
> read more >>

Harishkumar V

unread,
Jun 26, 2009, 8:20:24 AM6/26/09
to android...@googlegroups.com
Androidphan,

Thanks,

Also, i am using kernel version 2.6.29 and using v4l2, now-a-days i see of lot of applications seems to be working only if u do preloading of libv4l2convert , otherwise the pixel format or the conversion is not happening, the display screen is black.

Whether i need to do anything like that in android.

Thanks and Regards,
HarishKumar.V

2009/6/26 Androidphan <niels....@tass.nl>

Androidphan

unread,
Jun 26, 2009, 9:46:06 AM6/26/09
to android-porting
I don't know, I never heard of libv4l2convert before.

On Jun 26, 2:20 pm, Harishkumar V <harishpres...@gmail.com> wrote:
> Androidphan,
>
> Thanks,
>
> Also, i am using kernel version 2.6.29 and using v4l2, now-a-days i see of
> lot of applications seems to be working only if u do preloading of
> libv4l2convert , otherwise the pixel format or the conversion is not
> happening, the display screen is black.
>
> Whether i need to do anything like that in android.
>
> Thanks and Regards,
> HarishKumar.V
>
> 2009/6/26 Androidphan <niels.kee...@tass.nl>
> > > > > >> > > > > >> > > > On Tue, Jun 23, 2009 at 6:01 PM, Harishkumar V <...
>
> read more >>

Harishkumar V

unread,
Jul 1, 2009, 3:23:15 AM7/1/09
to android...@googlegroups.com
Hi Androidphan,

I use Logitech Quickcam Connect Webcam whose raw pix format is JPEG.

I tried to change pixel format in the macro
#define PIXEL_FORMAT        V4L2_PIX_FMT_JPEG instead of YUYV.

I also changed minimum width and height to 320x240 instead of 640x480.

Now, i have one doubt where to change the size of the buffers, i have seen this framesize=width*heght*2 , here is the place i have to change or at other point.

Can we do this kind of stuff, using VIDIOC_G_FMT get the format that hardware supports and set this using VIDIOC_S_FORMAT.

Also, u are having functions GrabPreviewFrame and GrabJpegFrame where conversion of yuv to jpeg happens.
Commenting out of conversion in above functions will work.

i have seen in v4l2 cam applications using "fmt.fmt.pix.field = V4L2_FIELD_INTERLACED". Is this to be added in v4l2_camera patch.

Thanks and Regards,
HarishKumar.V



2009/6/26 Androidphan <niels....@tass.nl>

Alexguitar

unread,
Jul 10, 2009, 5:08:00 AM7/10/09
to android-porting
Hi Harishkumar,

I'm Alex.
I tried Androidphan'patch(v4l2_camera_v2.patch) and your Android.mk to
compile.
I got a lot of error.

frameworks/base/camera/libcameraservice/V4L2Camera.cpp:24:27: error:
linux/jpeglib.h: No such file or directory
frameworks/base/camera/libcameraservice/CameraHardware.h:28:27: error:
linux/jpeglib.h: No such file or directory

Can you tell me What is the location of jpeglib.h should be placed on?

Thanks a lot.

Alex

On 6月23日, 下午9時20分, Harishkumar V <harishpres...@gmail.com> wrote:
> Hi Androidplan,
>
> The libcamera.so and libcameraservice.so got created.
>
> In V4l2Camera.cpp, adding this solves the linking problem,
>
> extern "C" {
> #include "jpeglib.h"
>
> }
>
> instead of <jpeglib.h>
>
> Thanks and Regards,
> HarishKumar.V
>
> On Tue, Jun 23, 2009 at 6:45 PM, Harishkumar V <harishpres...@gmail.com>wrote:
>
>
>
> > Hi Androidplan,
>
> > I think its problem with the linking of static library with the android.
>
> > but, in the same android source, the skia includes local static libraries
> > like jpeg.
>
> > Its mystery.
>
> > Thanks and Regards,
> > HarishKumar.V
>
> ...
>
> 閱讀更多 »

Yi Sun

unread,
Jul 10, 2009, 2:46:30 PM7/10/09
to android...@googlegroups.com

get rid of inux/ use <jpeglib.h>

Yi Sun

unread,
Jul 10, 2009, 2:47:06 PM7/10/09
to android...@googlegroups.com
BTW-- you should take the latest patch from his site.
Yi

2009/7/10 Yi Sun <bey...@gmail.com>

Harishkumar V

unread,
Jul 11, 2009, 4:17:34 AM7/11/09
to android...@googlegroups.com
Hi Atsuo Igarashi,

I am trying the same patch on my beagle board. i am using android kernel 2.6.29.
my usb webcam is not uvc. my resolution is 320x240.

my webcam is v4l2. it got detected and using v4l-info i can see it.

when i click the camcorder application, only green colour or some random dotted pixels coming.

Is there any thing other than this patch, we have to put for beagleboard.

Thanks and Regards,
HarishKumar.V

2009/6/24 Atsuo Igarashi <atsuoi...@gmail.com>

Atsuo Igarashi

unread,
Jul 11, 2009, 5:46:27 AM7/11/09
to android-porting
Hi HarishKumar.V,

I'm using uvc webcam.(Logitech's QCam)
my beagleboard is rev C2,
and using kernel is 2.6.28 based + some patches for android from
android-2.6.29.

http://code.google.com/p/beagleboard/wiki/BeagleboardRevCValidation

http://www.youtube.com/watch?v=L7LfVTv02cg

Regards,
Atsuo

On 7月11日, 午後5:17, Harishkumar V <harishpres...@gmail.com> wrote:
> Hi Atsuo Igarashi,
>
> I am trying the same patch on my beagle board. i am using android kernel
> 2.6.29.
> my usb webcam is not uvc. my resolution is 320x240.
>
> my webcam is v4l2. it got detected and using v4l-info i can see it.
>
> when i click the camcorder application, only green colour or some random
> dotted pixels coming.
>
> Is there any thing other than this patch, we have to put for beagleboard.
>
> Thanks and Regards,
> HarishKumar.V
>
> 2009/6/24 Atsuo Igarashi <atsuoigara...@gmail.com>
> ...
>
> もっと読む »

Harishkumar V

unread,
Jul 12, 2009, 10:19:26 AM7/12/09
to android...@googlegroups.com
Hi,

That's cool, i am using android-2.6.29 kernel, so kernel would not pose the problem.

the v4l2 patch given by androidplan is enough, or do i need to enable any thing in android stuff .

Thanks and Regards,
HarishKumar.V

> ...
>
> もっと読む ≫


Marcus

unread,
Jul 13, 2009, 5:28:32 PM7/13/09
to android-porting
Hello, everybody!

I am trying to run the Androidphan's patch with Android+BeagleBoard.
My results until now:

1) I got a green screen with some crazy pixels changing. The camera is
working, because the pixels change according to the camera movement.
In this case, I am using a PAC207 chipset camera.
2) I got a black screen. In this case, I am using UVCvideo driver.

So ... I wonder if anyone knows what I am missing :( ! Thanks a lot!

Marcus.

On 11 jul, 05:17, Harishkumar V <harishpres...@gmail.com> wrote:
> Hi Atsuo Igarashi,
>
> I am trying the same patch on my beagle board. i am using android kernel
> 2.6.29.
> my usb webcam is not uvc. my resolution is 320x240.
>
> my webcam is v4l2. it got detected and using v4l-info i can see it.
>
> when i click the camcorder application, only green colour or some random
> dotted pixels coming.
>
> Is there any thing other than this patch, we have to put for beagleboard.
>
> Thanks and Regards,
> HarishKumar.V
>
> 2009/6/24 Atsuo Igarashi <atsuoigara...@gmail.com>
> ...
>
> mais »

Atsuo Igarashi

unread,
Jul 13, 2009, 11:39:05 PM7/13/09
to android-porting
Hi Marcus.

Are you using Android's Camcorder app?
If so, did you try to change resolution to 352x288 in
CameraHardware.cpp.

Regards,
Atsuo
> ...
>
> もっと読む »

Alexguitar

unread,
Jul 14, 2009, 12:21:49 AM7/14/09
to android-porting
Hi, Harishkumar V & Marcus or everybody

You use the v4l2 patch given by androidplan.
Do you implement cameraHardwareInterface.h?
If you do,can you share your code for me?
Thanks a lot.


On 7月12日, 下午10時19分, Harishkumar V <harishpres...@gmail.com> wrote:
> Hi,
>
> That's cool, i am using android-2.6.29 kernel, so kernel would not pose the
> problem.
>
> the v4l2 patch given by androidplan is enough, or do i need to enable any
> thing in android stuff .
>
> Thanks and Regards,
> HarishKumar.V
>
> ...
>
> 閱讀更多 »

Harishkumar V

unread,
Jul 14, 2009, 2:13:51 AM7/14/09
to android...@googlegroups.com
Marcus,

Even i am facing the same problem, i got the green screen with some crazy pixels changing.

Whether u able to fix this by changing resolution to 352x288 in camerahardware.cpp as told by atsuo lgarshi.

Thanks and Regards,
HarishKumar.V

Alexguitar

unread,
Jul 14, 2009, 3:48:37 AM7/14/09
to android-porting
Hi, everybody!

I am trying to run the Androidphan's patch .
My results :

build/core/base_rules.mk:117: *** hardware/msm7k/libcamera:
MODULE.TARGET.SHARED_LIBRARIES.libcamera already defined by frameworks/
base/camera/libcameraservice. Stop.

Anyone knows what I solve it?
> ...
>
> 閱讀更多 >>

Alexguitar

unread,
Jul 14, 2009, 5:22:04 AM7/14/09
to android-porting
Hi everybody,
Above problem had solved,but i tried to compile again
The results:

frameworks/base/camera/libcameraservice/CameraHardware.cpp: In member
function 'int android::CameraHardware::previewThread()':
frameworks/base/camera/libcameraservice/CameraHardware.cpp:94: error:
invalid conversion from 'void*' to 'int'
frameworks/base/camera/libcameraservice/CameraHardware.cpp:94: error:
too few arguments to function
frameworks/base/camera/libcameraservice/CameraHardware.cpp: In static
member function 'static android::sp<android::CameraHardwareInterface>
android::CameraHardware::createInstance()':
frameworks/base/camera/libcameraservice/CameraHardware.cpp:353: error:
cannot allocate an object of abstract type 'android::CameraHardware'

Anyone knows how to solve it?
> ...
>
> 閱讀更多 >>

Marcus

unread,
Jul 14, 2009, 7:30:56 AM7/14/09
to android-porting
Hi, Atsuo.

I have already changed the resolution. But the screen continues green
for the PAC207 camera.

Best regards,

Marcus.
> ...
>
> mais »

Alexguitar

unread,
Jul 15, 2009, 2:02:35 AM7/15/09
to android-porting
Hi everybody,

Above problem had solved,but i tried to compile again
The results:

frameworks/base/camera/libcameraservice/CameraHardware.cpp:356: error:
cannot allocate an object of abstract type 'android::CameraHardware'

Anyone knows how to solve it?

> ...
>
> 閱讀更多 >>

Atsuo Igarashi

unread,
Jul 15, 2009, 7:54:06 AM7/15/09
to android-porting
Hi, Marcus.

Can you try 176x144 resolution?
then you have to modify a following line.

./packages/apps/Camera/src/com/android/camera/VideoCamera.java:750:
mMediaRecorder.setVideoSize(352,288);

Regards,
Atsuo
> ...
>
> もっと読む »

Alexguitar

unread,
Jul 16, 2009, 1:58:28 AM7/16/09
to android-porting
Hi everybody,

I put all the error messages in here

frameworks/base/camera/libcameraservice/CameraHardware.cpp: In static
member function 'static android::sp<android::CameraHardwareInterface>
android::CameraHardware::createInstance()':
frameworks/base/camera/libcameraservice/CameraHardware.cpp:356: error:
cannot allocate an object of abstract type 'android::CameraHardware'
frameworks/base/camera/libcameraservice/CameraHardware.h:33: note:
because the following virtual functions are pure within
'android::CameraHardware':
frameworks/base/include/ui/CameraHardwareInterface.h:89: note:
virtual android::sp<android::IMemoryHeap>
android::CameraHardwareInterface::getPreviewHeapnew(int) const
make: *** [out/target/product/qsd8250_surf/obj/SHARED_LIBRARIES/
libcamera_intermediates/CameraHardware.o] Error 1

Can anybody help me?
> ...
>
> 閱讀更多 >>

Alexguitar

unread,
Jul 17, 2009, 6:14:53 AM7/17/09
to android-porting
Hi,
I build code successfully
but i opened android camera app
ddms show error

01-21 02:08:35.889: ERROR/Camera(1277): _getParameters: picture-
format=jpeg;picture-size=640x480;preview-format=yuv422sp;preview-frame-
rate=15;preview-size=640x480
01-21 02:08:35.889: ERROR/Camera(1277): setParameters()
01-21 02:08:36.909: ERROR/V4L2Camera(995): Open: VIDIOC_S_FMT Failed:
I/O error
01-21 02:08:37.919: ERROR/V4L2Camera(995): StartStreaming: Unable to
start capture: I/O error

Anyone knows how to solve it?

> ...
>
> 閱讀更多 »

suresh

unread,
Jul 18, 2009, 11:34:25 AM7/18/09
to android-porting
Hi All,

I tried V4L convert option after reading from camera + Android YUV to
JPEG conversion(patch from Androidplan), I got blurred Green colour
Image with proper data i.e., Image with greenish dots. V4L is giving
raw format output but Androids conversion is working with YUV to
JPEG.

So i request Androidplan to light up with ideas on how to get RAW to
JPEG instead of YUV to JPEG.

Thanks,
Suresh Kalidasan.
> ...
>
> read more »

Suresh Kalidasan

unread,
Jul 21, 2009, 3:03:00 AM7/21/09
to android-porting
Hi all,
 
I got things happening, my sample test application worked fine i tried initializing my camera in JPEG and saved as direct file in .jpg format, i didn't do any conversion algorithm. I am not sure whether the same can be used for Android's camera application since general gtk display requires RGB data to be display real time image data in screen i believe.
 
Pls do give your comment
 
Cheers,
Suresh Kalidasan.

--
beagleboard.org@gmail.com is maintained by Suresh Kalidasan to develop Linux Community in India.

Alexguitar

unread,
Jul 24, 2009, 6:26:18 AM7/24/09
to android-porting
Hi, everyone.
CameraHardwareInterface.h adds virtual sp<IMemoryHeap>
getPreviewHeapnew(int i) const = 0 and
modifies typedef void (*preview_callback)(const sp<IMemory>& mem, int
index, void* user);.

I used the Androidphan's patch and built code.
The result had error.

frameworks/base/camera/libcameraservice/CameraHardware.cpp:94: error:
invalid conversion from 'void*' to 'int'
frameworks/base/camera/libcameraservice/CameraHardware.cpp:94: error:
too few arguments to function

Anyone knows how to solve it?


> > > > > my webcam isv4l2. it got detected and using v4l-info i can see it.
>
> > > > > when i click the camcorder application, only green colour or some random
> > > > > dotted pixels coming.
>
> > > > > Is there any thing other than this patch, we have to put for beagleboard.
>
> > > > > Thanks and Regards,
> > > > > HarishKumar.V
>
> > > > > 2009/6/24 Atsuo Igarashi <atsuoigara...@gmail.com>
>
> > > > > > Hi Androidphan,
>
> > > > > > My Beagle(ARM based board) is working camcorder andcameraapp with
> > > > > > yourv4l2camera.
>
> > > > > > Points in my environment,
>
> > > > > > 1. change permission of video device. (or change owner?)
>
> > > > > > chmod 666 /dev/video0
>
> > > > > > 2. free space of 1st dos partition on the SD card is made 4Gbyte or
> > > > > > less.
>
> > > > > > AuthorDriver and MediaRecorder are failed with max-filesize error.
>
> > > > > > 3. change resolution to 352x288 in CameraHardware.cpp.
>
> > > > > > Thank you Androidphan!
>
> > > > > > Regards,
> > > > > > Atsuo
>
> > > > > > On 6月24日, 午後2:07, Harishkumar V <harishpres...@gmail.com> wrote:
> > > > > > > Hi Androidplan,
>
> > > > > > > My BB got damaged, i do not have hardware for now, it will come in a
> > > > > > week's
> > > > > > > time.
>
> > > > > > > But, ur code looks like standardv4l2interfaceusing mmap. It should
> ...
>
> 閱讀更多 »

Suresh Kalidasan

unread,
Jul 25, 2009, 11:48:23 PM7/25/09
to android...@googlegroups.com
Sorry i cant help you on this, i tried the same with v4l and it worked for me. If you want some information related to v4l then let me know.
 
Cheers,
SK

Alexguitar

unread,
Jul 26, 2009, 11:52:17 AM7/26/09
to android-porting
Do you use v4l to open android camera application?
Can you share your camera hal code?
Thanks to your help.

On 7月26日, 上午11時48分, Suresh Kalidasan <beagleboard....@gmail.com>
wrote:
> ...
>
> 閱讀更多 >>

Suresh Kalidasan

unread,
Jul 27, 2009, 1:33:41 PM7/27/09
to android...@googlegroups.com
Hi Alex,

Find the attachment, Let me know if it is useful.

For info. the attachment includes README and log files.

Regards,
Suresh Kalidasan

2009/7/26 Alexguitar <alexg...@gmail.com>
cameraLibx86.tar.gz

deepak singal

unread,
Aug 6, 2009, 8:21:20 AM8/6/09
to android...@googlegroups.com
Hi all,

I'm trying the Androidphan patch on my beagle board.
I'm using android kernel 2.6.29.
I use USB HP Webcam.
/********* Kernel msg **********/
usb 1-1.2: new full speed USB device using musb_hdrc and address 6
usb 1-1.2: configuration #1 chosen from 1 choice
gspca: probing 093a:2460
pac207: Pixart Sensor ID 0x27 Chips ID 0x00
pac207: Pixart PAC207BCA Image Processor and Control Chip detected (vid/pid 0x093A:0x2460)
gspca: probe ok
/********************************/

bash-3.2# ls -l /dev/video*
crwxrwxrwx root     root      81,   0 2000-01-01 04:24 video0
crw------- root     root      81,   1 2000-01-01 05:37 video1

change permission of video device in init.rc
chmod 777 /dev/video0
chmod 777 /dev/video1

change resolution to 352x288 and node in CameraHardware.cpp
#define VIDEO_DEVICE        "/dev/video1"
#define MIN_WIDTH           352
#define MIN_HEIGHT          288

when i click the camera application, only green colour or some random dotted pixels coming.

/************************** LOG MSG **************************************/
bash-3.2# I/ActivityManager(  954): Starting activity: Intent { action=android.intent.action.MAIN categories={android.intent}
I/ActivityManager(  954): Start proc com.android.camera for activity com.android.camera/.Camera: pid=1105 uid=10000 gids={10}
D/dalvikvm(  954): GC freed 5297 objects / 223840 bytes in 172ms
I/WindowManager(  954): Setting rotation to 1, animFlags=0
I/ARMAssembler(  954): generated scanline__00000077:03010104_00000004_00000000 [ 22 ipp] (41 ins) at [0x209ab0:0x209b54] in s
I/WindowManager(  954): Config changed: { scale=1.0 imsi=0/0 locale=en_US touch=1 key=2/1/2 nav=1 orien=1 }
W/WindowManager(  954): performLayoutAndPlaceSurfacesLocked called while in layout
W/WindowManager(  954): performLayoutAndPlaceSurfacesLocked called while in layout
W/WindowManager(  954): performLayoutAndPlaceSurfacesLocked called while in layout
I/ARMAssembler(  954): generated scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at [0x209b58:0x209c64] in s
D/CameraService(  941): Connect E from ICameraClient 0x20c20
D/CameraService(  941): Client E constructor
D/CameraHardware(  941): PREVIEW SIZE: w=352 h=288 framerate=15
D/LocationManager( 1105): Constructor: service = android.location.ILocationManager$Stub$Proxy@435d06f8
E/MediaPlayer(  941): Unable to to create media player
E/CameraService(  941): Failed to load CameraService sounds.
E/MediaPlayer(  941): Unable to to create media player
E/CameraService(  941): Failed to load CameraService sounds.
D/CameraService(  941): Client X constructor
D/CameraService(  941): Connect X
W/HAL     ( 1105): load: module=/system/lib/hw/sensors.omap3.so error=Cannot find library
W/HAL     ( 1105): load: module=/system/lib/hw/sensors.default.so error=Cannot find library
D/SensorManager( 1105): found sensor: null, handle=0
V/ImageManager( 1105): storage state is mounted
W/OrientationEventListener( 1105): Cannot detect sensors. Not enabled
V/ImageManager( 1105): storage state is mounted
V/ImageManager( 1105): storage writable is true
D/StatusBar(  954): updateResources
V/ImageManager( 1105): storage writable is true
D/CameraService(  941): setPreviewDisplay(0x27050)
D/CameraService(  941): getParameters
E/Camera  ( 1105): _getParameters: picture-format=jpeg;picture-size=352x288;preview-format=yuv422sp;preview-frame-rate=15;pr8
E/Camera  ( 1105): setParameters()
D/CameraService(  941): setParameters(picture-size=352x288;preview-frame-rate=15;preview-size=480x640;picture-format=jpeg;pr)
D/CameraHardware(  941): PREVIEW SIZE: w=480 h=640 framerate=15
W/IInputConnectionWrapper(  996): showStatusIcon on inactive InputConnection
I/ActivityManager(  954): Displayed activity com.android.camera/.Camera: 1266 ms
I/ARMAssembler(  954): generated scanline__00000077:03515104_00000001_00000000 [ 46 ipp] (65 ins) at [0x206ca0:0x206da4] in s
D/dalvikvm(  954): GC freed 1795 objects / 104344 bytes in 122ms

D/dalvikvm(  996): GC freed 730 objects / 30488 bytes in 115ms
E/ALSALib (  941): external/alsa-lib/src/pcm/pcm.c:2201:(snd_pcm_open_noupdate) Unknown PCM AndroidPlayback_Speaker_normal
E/ALSALib (  941): external/alsa-lib/src/pcm/pcm.c:2201:(snd_pcm_open_noupdate) Unknown PCM AndroidPlayback_Speaker
E/ALSALib (  941): external/alsa-lib/src/pcm/pcm.c:2201:(snd_pcm_open_noupdate) Unknown PCM AndroidPlayback
I/AudioHardwareALSA(  941): Initialized ALSA PLAYBACK device default
D/AudioHardwareALSA(  941): Set PLAYBACK PCM format to S16_LE (Signed 16 bit Little Endian)
D/AudioHardwareALSA(  941): Using 2 channels for PLAYBACK.
D/AudioHardwareALSA(  941): Set PLAYBACK sample rate to 44100 HZ
D/AudioHardwareALSA(  941): Buffer size: 16384
D/AudioHardwareALSA(  941): Latency: 371519
E/Camera  ( 1105): setParameters()
D/CameraService(  941): setParameters(picture-size=352x288;preview-frame-rate=15;preview-size=480x640;picture-format=jpeg;jp)
D/CameraHardware(  941): PREVIEW SIZE: w=480 h=640 framerate=15
D/CameraService(  941): takePicture
E/V4L2Camera(  941): GrabPreviewFrame: VIDIOC_QBUF Failed
D/CameraHardware(  941): Picture Size: Width = 352       Height = 288
D/CameraHardware(  941): mRawPictureCallback
D/CameraHardware(  941): mJpegPictureCallback
I/V4L2Camera(  941): GrabJpegFrame: Generated a frame from capture device
I/V4L2Camera(  941): JPEG PICTURE WIDTH AND HEIGHT: 352x288
D/CameraService(  941): postJpeg
D/dalvikvm( 1105): Trying to load lib /system/lib/libexif.so 0x435bd488
D/dalvikvm( 1105): Added shared lib /system/lib/libexif.so 0x435bd488
I/VideoPreview( 1105): ar 1.2222222 setting size: 480x392
D/CameraService(  941): setPreviewDisplay(0x2a4f8)
D/CameraService(  941): getParameters
E/Camera  ( 1105): _getParameters: jpeg-quality=85;picture-format=jpeg;picture-size=352x288;preview-format=yuv422sp;preview-0
E/Camera  ( 1105): setParameters()
D/CameraService(  941): setParameters(picture-size=352x288;preview-frame-rate=15;preview-size=480x640;picture-format=jpeg;jp)
D/CameraHardware(  941): PREVIEW SIZE: w=480 h=640 framerate=15
V/ImageManager( 1105): storage state is mounted
V/ImageManager( 1105): storage writable is true
/************************************************************************************/

whether i needs to change anything in v4l2-camera.patch?
Can anybody help me?

Thanks & Regards
Deepak

Harishkumar V

unread,
Aug 6, 2009, 12:53:12 PM8/6/09
to android...@googlegroups.com
Hi Deepak,

u can observe the error "VIDIOC_QBUF Failed" that's causing one of the problem.

Also androidphan patch is meant for yuyv cameras. if ur camera is jpeg or other, it wont work.

u have to modify the androidphan's patch.

Thanks and Regards,
HarishKumar.V

deepak singal

unread,
Aug 10, 2009, 7:20:03 AM8/10/09
to android...@googlegroups.com
Hi Harish,

Thanks for reply,

my webcam information :

/*********************************************/

# v4l-conf

v4l-conf: using X11 display :0.0

dga: version 2.0

mode: 1024x768, depth=24, bpp=32, bpl=4096, base=0xc0400000

/dev/video0 [v4l2]: ioctl VIDIOC_QUERYCAP: Invalid argument

/dev/video0 [v4l]: no overlay support

# v4l-info

### video4linux device info [/dev/video0] ###

general info

VIDIOCGCAP

name : "Qtec Webcam 100"

type : 0x1 [CAPTURE]

channels : 1

audios : 0

maxwidth : 352

maxheight : 288

minwidth : 160

minheight : 120

channels

VIDIOCGCHAN(0)

channel : 0

name : "PAC207BCA"

tuners : 0

flags : 0x0 []

type : CAMERA

norm : 0

picture

VIDIOCGPICT

brightness : 10496

hue : 0

colour : 0

contrast : 30720

whiteness : 0

depth : 24

palette : RGB24

/******************************************/

I tried to change pixel format in the macro

#define PIXEL_FORMAT V4L2_PIX_FMT_RGB24

i needs to change anything in v4l2-camera.patch to make this work with android or it straight forward works.


Thanks & Regards

Deepak


Michael Trimarchi

unread,
Sep 1, 2009, 2:31:27 PM9/1/09
to android...@googlegroups.com
Hi,

Great work here. I just add to the freerunner and I will test
on it using an usb camera

Michael

deepak singal

unread,
Sep 9, 2009, 6:30:11 AM9/9/09
to android...@googlegroups.com
Hi Harish,

Can you share your USB Webcam name and specification.

Thanks & Regards
Deepak

Harishkumar V

unread,
Sep 13, 2009, 4:55:10 AM9/13/09
to android...@googlegroups.com
Hi,
i am using logitech webcam

Thanks and Regards,
HarishKumar.V
--
Thanks and Regards,
Harish Kumar. V

praj

unread,
Oct 1, 2009, 8:03:02 AM10/1/09
to android-porting
Hi Harish,

I'm trying out something similar. I'm able to see /dev/video0.

Can you pass me a link to the V4L2 patch?

Thanks in advance.


On Sep 13, 1:55 pm, Harishkumar V <harishpres...@gmail.com> wrote:
> Hi,
> i am using logitech webcam
>
> Thanks and Regards,
> HarishKumar.V
>

Michael Trimarchi

unread,
Oct 1, 2009, 3:36:18 PM10/1/09
to android...@googlegroups.com
v4l2_camera_v2.patch

Harishkumar V

unread,
Oct 5, 2009, 4:47:06 AM10/5/09
to android...@googlegroups.com
Hi,

u also look at 0xdorid camera HAL implementation

Raju Sana

unread,
Sep 21, 2010, 2:41:37 AM9/21/10
to android...@googlegroups.com
Hi

I have ported the similar V4L2 stuff to android2.2 on beagle board , it builds for me but when I click on Camera application it says please insert the SD card . Are there any  vold issues in android2.2 ?
I guess  the media scanner or vold some how unable to detect/mount the SD card such that the camera application was not aware of SD card.

please find  me some pointers on this.
 
Thanks & Regards,
Venkat.

On Sat, Jul 11, 2009 at 1:47 PM, Harishkumar V <harish...@gmail.com> wrote:
Hi Atsuo Igarashi,

I am trying the same patch on my beagle board. i am using android kernel 2.6.29.
my usb webcam is not uvc. my resolution is 320x240.

my webcam is v4l2. it got detected and using v4l-info i can see it.

when i click the camcorder application, only green colour or some random dotted pixels coming.


Is there any thing other than this patch, we have to put for beagleboard.


Thanks and Regards,
HarishKumar.V

2009/6/24 Atsuo Igarashi <atsuoi...@gmail.com>


Hi Androidphan,

My Beagle(ARM based board) is working camcorder and camera app with
your v4l2 camera.

Points in my environment,

1. change permission of video device. (or change owner?)

chmod 666 /dev/video0

2. free space of 1st dos partition on the SD card is made 4Gbyte or
less.

AuthorDriver and MediaRecorder are failed with max-filesize error.

3. change resolution to 352x288 in CameraHardware.cpp.

Thank you Androidphan!

Regards,
Atsuo

On 6月24日, 午後2:07, Harishkumar V <harishpres...@gmail.com> wrote:
> Hi Androidplan,
>
> My BB got damaged, i do not have hardware for now, it will come in a week's
> time.
>
> But, ur code looks like standard v4l2 interface using mmap. It should work

> with any normal usb webcam with the resolution alone changing.
>
> Anyway, i test it and confirm u.
>
> Thanks and Regards,
> HarishKumar.V
>
> On Tue, Jun 23, 2009 at 8:01 PM, Androidphan <niels.kee...@tass.nl> wrote:
>
> > And does it work for your camera?
>
> > On Jun 23, 3:20 pm, Harishkumar V <harishpres...@gmail.com> wrote:
> > > Hi Androidplan,
>
> > > The libcamera.so and libcameraservice.so got created.
>
> > > In V4l2Camera.cpp, adding this solves the linking problem,
>
> > > extern "C" {
> > > #include "jpeglib.h"
>
> > > }
>
> > > instead of <jpeglib.h>
>
> > > Thanks and Regards,
> > > HarishKumar.V
>

> > > On Tue, Jun 23, 2009 at 6:45 PM, Harishkumar V <harishpres...@gmail.com
> > >wrote:
>
> > > > Hi Androidplan,
>
> > > > I think its problem with the linking of static library with the
> > android.
>
> > > > but, in the same android source, the skia includes local static
> > libraries
> > > > like jpeg.
>
> > > > Its mystery.
>
> > > > Thanks and Regards,
> > > > HarishKumar.V
>

> > > > On Tue, Jun 23, 2009 at 6:39 PM, Androidphan <niels.kee...@tass.nl>
> > wrote:
>
> > > >> It can be found here
> > > >>http://android-m912.googlecode.com/files/Android.mk
>
> > > >> On Jun 23, 2:57 pm, Harishkumar V <harishpres...@gmail.com> wrote:
> > > >> > Hi Androidplan,
>
> > > >> > can u send ur Android.mk file.
>
> > > >> > Thanks and Regards,
> > > >> > HarishKumar.V
>

> > > >> > On Tue, Jun 23, 2009 at 6:25 PM, Androidphan <niels.kee...@tass.nl>
> > > >> wrote:
>
> > > >> > > Hmm, the Android.mk does says to include the static library
> > libjpeg...
>
> > > >> > > On Jun 23, 2:51 pm, Harishkumar V <harishpres...@gmail.com>
> > > >> > > > reference to `jpeg_finish_compress(jpeg_compress_struct*)'
> > > >> > > > frameworks/base/camera/libcameraservice/V4L2Camera.cpp:373:
> > > >> undefined
> > > >> > > > reference to `jpeg_destroy_compress(jpeg_compress_struct*)'
> > > >> > > > collect2: ld returned 1 exit status
>
> > > >> > > > Thanks and Regards,
> > > >> > > > HarishKumar.V
>
> > > >> > > > On Tue, Jun 23, 2009 at 6:01 PM, Harishkumar V <
> > > >> harishpres...@gmail.com
> > > >> > > >wrote:
>
> > > >> > > > > Hi Androidplan,
>

> > > >> > > > > I downloaded and during compiling its showing errors,arget
> > thumb
> > > >> C++:
> > > >> > > > > libcamera <=
> > > >> frameworks/base/camera/libcameraservice/CameraHardware.cpp
> > > >> > > > > In file included from
> > > >> > > > > frameworks/base/camera/libcameraservice/CameraHardware.cpp:21:
>
> > frameworks/base/camera/libcameraservice/CameraHardware.h:28:21:
> > > >> error:
> > > >> > > > > jpeglib.h: No such file or directory
> > > >> > > > > In file included from
> > > >> > > > > frameworks/base/camera/libcameraservice/CameraHardware.cpp:21:
> > > >> > > > > frameworks/base/camera/libcameraservice/CameraHardware.h:42:
> > > >> error:
> > > >> > > > > 'recording_callback' has not been declared
>
> > frameworks/base/camera/libcameraservice/CameraHardware.cpp:162:
> > > >> error:
> > > >> > > > > 'android::status_t android::CameraHardware::startRecording' is
> > not
> > > >> a
> > > >> > > static
> > > >> > > > > member of 'class android::CameraHardware'
>
> > frameworks/base/camera/libcameraservice/CameraHardware.cpp:162:
> > > >> error:
> > > >> > > > > 'recording_callback' was not declared in this scope
>
> > frameworks/base/camera/libcameraservice/CameraHardware.cpp:162:
> > > >> error:
> > > >> > > > > expected primary-expression before 'void'
>
> > frameworks/base/camera/libcameraservice/CameraHardware.cpp:162:
> > > >> error:
> > > >> > > > > initializer expression list treated as compound expression
>
> > frameworks/base/camera/libcameraservice/CameraHardware.cpp:163:
> > > >> error:
> > > >> > > > > expected ',' or ';' before '{' token
> > > >> > > > > make: ***
>
> > [out/target/product/beagle/obj/SHARED_LIBRARIES/libcamera_intermediates/Cam
> > > >> > > eraHardware.o]
> > > >> > > > > Error 1
>
> > > >> > > > > I also attach my Android.mk file.
>
> > > >> > > > > Thanks and Regards,
> > > >> > > > > HarishKumar.V
>

> > > >> > > > > On Tue, Jun 23, 2009 at 4:16 PM, Androidphan <
> > > >> niels.kee...@tass.nl>
> > > >> > > wrote:
>
> > > >> > > > >> Was it useful?
>
> > > >> > > > >> On Jun 21, 3:45 pm, Harishkumar V <harishpres...@gmail.com>
> > > >> wrote:
> > > >> > > > >> > Hi AndroidPlan,
>
> > > >> > > > >> > Can u update the latest source and share or attach it.
>
> > > >> > > > >> > Thanks and Regards,
> > > >> > > > >> > HarishKumar.V
>

> > > >> > > > >> > On Wed, Jun 17, 2009 at 1:46 PM, Androidphan <
> > > >> niels.kee...@tass.nl>
> > > >> > > > >> wrote:
>
> > > >> > > > >> > > A bit late, but that solved it.
>
> > > >> > > > >> > > I converted my YUYV to rgb 565 and it worked.
>
> > > >> > > > >> > > On May 13, 5:11 pm, Steve Fischer <steve2...@gmail.com>
> > > >> wrote:
> > > >> > > > >> > > > If you are producing RGB565 frames in your
> > > >> > > CameraHardwareInterface
> > > >> > > > >> > > > implementation, then you will likely need to make a
> > format
> > > >> > > change in
> > > >> > > > >> > > > the
> > > >> "framework/base/camera/libcameraservice/CameraService.cpp"
> > > >> > > file.
> > > >> > > > >> > > > Specifically, in the "startPreview" function, the
> > preview
> > > >> frame
> > > >> > > > >> format
> > > >> > > > >> > > > is hardcoded to "YCbCr_420_SP", as in:
>
> > > >> > > > >> > > > mSurface->registerBuffers(w, h, w, h,
> > > >> > > > >> > > > PIXEL_FORMAT_YCbCr_420_SP, ... );
>
> > > >> > > > >> > > > You will need to change this hardcoded value to match
> > the
> > > >> pixel
> > > >> > > > >> format
> > > >> > > > >> > > > of the frames you are producing.  I think in there are
> > only
> > > >> a
> > > >> > > couple
> > > >> > > > >> > > > of supported format choices.  I believe "RGB_565" is
> > > >> supported.
> > > >> > > > >>  Give
> > > >> > > > >> > > > it a try.
>
> > > >> > > > >> > > > Steve.
>
> > > >> > > > >> > > > On May 13, 8:21 am, blindfold <
> > seeingwithso...@gmail.com>
> > > >> > > wrote:
>
> > > >> > > > >> > > > > Don't know why the Android team dropped color preview
> > > >> from the
> > > >> > > > >> > > > > emulator with recent SDKs. Color preview was still
> > > >> present and
> > > >> > > > >> fully
> > > >> > > > >> > > > > functional in the SDK M5 RC15 emulator, but then it
> > > >> stopped
> > > >> > > > >> working as
> > > >> > > > >> > > > > of SDK 0.9 beta even though the color info is still
> > in
> > > >> the
> > > >> > > preview
> > > >> > > > >> > > > > callback data[] with the moving checkerboard. See my
> > > >> issue 822
> > > >> > > > >> > >http://code.google.com/p/android/issues/detail?id=822
>
> > > >> > > > >> > > > > I think you will have to write/adapt your own camera
> > > >> preview
> > > >> > > > >> branch to
> > > >> > > > >> > > > > get color, either by fixing the emulator code or by
> > > >> adapting
> > > >> > > the
> > > >> > > > >> G1
> > > >> > > > >> > > > > hardware code (or better still, submit a patch such
> > that
> > > >> > > everybody
> > > >> > > > >> > > > > will benefit).
>
> > > >> > > > >> > > > > On May 13, 3:00 pm, Androidphan <
> > niels.kee...@tass.nl>
> > > >> wrote:
>
> > > >> > > > >> > > > > > I'm porting Android to a x86 netbook. But why is
> > color
> > > >> > > ignored?
> > > >> > > > >> Can't
> > > >> > > > >> > > > > > I get this working?
>
> > > >> > > > >> > > > > > On
>
> ...
>
> もっと読む >>



--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porti...@googlegroups.com
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---


Paul Chu

unread,
Jul 12, 2011, 5:51:44 AM7/12/11
to android...@googlegroups.com
Hi Harish,

I am sorry that the thread is so long ago... but I got the same problem that the functions of libjpeg "undefined reference" errors too

What I don't understand is that "jpeglib.h" or <jpeglib.h> is compiler problem, however the "undefined reference" error is linker problem

How could you resolve it by changing <> to ""??

Thank you,
Paul,
Reply all
Reply to author
Forward
0 new messages