Linux C application developer view for Android camera subsystem

Source: Internet
Author: User

Android Camera HAL through v4l2 interface and Kernel Camera Driver interaction. This article examines the Android Camera subsystem from the perspective of Linux application developers .




V4L2 Application Development General process:

1. Open the device file. int Fd=open ("/dev/videoX″,o_rdwr);

2. Get the capability of the device to see what features the device has, such as whether it has video input or audio input and output. Vidioc_querycap,structv4l2_capability

3. Select video input and a video device can have multiple video inputs. Vidioc_s_input,struct V4l2_input

4. Set the format and frame of the video, including PAL,NTSC, the format of the frame includes width and height, etc. Vidioc_s_std,vidioc_s_fmt,structv4l2_std_id,struct V4l2_format

5. Apply frame buffer to the driver, generally no more than 5. Vidioc_reqbufs,struct v4l2_requestbuffers

6. Map the requested frame buffer to the user space so that the captured frames can be manipulated directly without having to replicate. Mmap

7. All the requested frame buffers are queued in order to store the collected data. Vidioc_qbuf,struct V4l2_buffer

8. Start the video collection. Vidioc_streamon

9. Out of the queue to obtain the captured data frame buffer, to obtain the original acquisition data. Vidioc_dqbuf

10. Re-enter the buffer to the end of the queue so that it can be collected in a loop. Vidioc_qbuf

11. Stop the Video collection. Vidioc_streamoff

12. Turn off the video device. Close (FD);


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.