A20Camera模块开发说明Copyright©2013AllwinnerTechnology.AllRightsReserved.-1-A20A20A20A20USBUSBUSBUSBCameraCameraCameraCamera开发说明VVVV1111.0.0.0.02012012012014444----06060606----05050505CONFIDENTAILA20USBCamera模块开发说明Copyright©2013AllwinnerTechnology.AllRightsReserved.-2-RevisionRevisionRevisionRevisionHistoryHistoryHistoryHistoryVersionVersionVersionVersionDateDateDateDateChangesChangesChangesChangescomparedcomparedcomparedcomparedtotototopreviouspreviouspreviouspreviousissueissueissueissueV1.02014-06-05初建版本CONFIDENTAILA20USBCamera模块开发说明Copyright©2013AllwinnerTechnology.AllRightsReserved.-3-目录1.前言.................................................................................................................................-4-1.1.编写目的................................................................................................................-4-1.2.适用范围................................................................................................................-4-1.3.相关人员................................................................................................................-4-2.功能与框架介绍.............................................................................................................-5-2.1.功能介绍................................................................................................................-5-2.2.框架及相关目录....................................................................................................-5-3.原厂配置说明.................................................................................................................-6-3.1.启动加载................................................................................................................-6-3.2.参数配置文件........................................................................................................-6-3.2.1.camera.cfg..................................................................................................-6-3.2.2.media_profiles.xml.....................................................................................-6-3.3.USBCamera相关程序说明...................................................................................-7-3.4.新增接口................................................................................................................-8-4.模块调试.........................................................................................................................-9-5.Declaration....................................................................................................................-10-CONFIDENTAILA20USBCamera模块开发说明Copyright©2013AllwinnerTechnology.AllRightsReserved.-4-1.1.1.1.前言1.1.1.1.1.1.1.1.编写目的了解Android系统中USBCamera模块在A20平台上的开发。1.2.1.2.1.2.1.2.适用范围介绍本模块设计适用A20平台。1.3.1.3.1.3.1.3.相关人员TS人员,Camera模块研发人员,方案定制人员。CONFIDENTAILA20Camera模块开发说明Copyright©2013AllwinnerTechnology.AllRightsReserved.-5-2.2.2.2.功能与框架介绍介绍USBCamera功能,以及涉及到的相关文件。2.1.2.1.2.1.2.1.功能介绍A20USBCamera的主要功能:1、原厂配置预装原生Camera应用。主要用于拍照,录像,360度拍照等场景。2、支持TVQQ,Skype等视频通话应用。3、支持大部分横屏显示的第三方CameraAPK。4、支持USB摄像头热插拔。5、支持动态检查USB摄像头个数,以及Camera的支持分辨率。6、支持绝大部分主流USBCamera,参考支持列表见《A20_USB摄像头参考支持列表》。2.2.2.2.2.2.2.2.框架及相关目录CameraAPKFrameworkHALLinuxDriverCameraHAL:android/device/softwinner/common/hardware/cameraV4L2API:lichee/linux-3.4/drivers/media/videoUVC:lichee/linux-3.4/drivers/media/video/uvc原生相机应用:android/packages/apps/CameraCameraAPI:android/frameworks/base/core/java/android/hardwareCameraJNI:android/frameworks/base/core/jniCameraC/S:android/frameworks/av/cameraandroid/frameworks/av/services/camera/libcameraservice图1Camera的框架与相关目录详细的框架介绍请见:《A20_Camera模块开发说明书》。CONFIDENTAILA20USBCamera模块开发说明Copyright©2013AllwinnerTechnology.AllRightsReserved.-6-3.3.3.3.原厂配置说明3.1.3.1.3.1.3.1.启动加载A20方案Android系统的Camera驱动采用模块加载,在init.sun7i.rc文件中配置例如:#USBCamerainsmod/system/vendor/modules/videobuf-core.koinsmod/system/vendor/modules/videobuf-dma-contig.koinsmod/system/vendor/modules/uvcvideo.kouvcvideo.kouvcvideo.kouvcvideo.ko如果驱动成功加载,则会在/dev/目录下面生成节点/dev/video0,要想Android层能使用改设备,需要修改其权限,例如在ueventd.sun7i.rc中:/dev/video00666mediamedia对于非系统开发人员来说不需要关注CameraHAL的具体实现,只要正确的配置两个配置文件即可.3.2.3.2.3.2.3.2.参数配置文件3.2.1.3.2.1.3.2.1.3.2.1.camera.cfgcamera.cfgcamera.cfgcamera.cfgcamera.cfg的具体配置在《A20_Camera模块开发说明书》中有详细介绍。需要说明的是:1.该配置文件主要为CSICamera配置所用。2.USBCamera无需关注该文件的具体配置。3.对应USBCamera的配置只需把number_of_camera=0即可。使用USBCamera时camera.cfg的关键配置文件如下:;-------------------------------------------------------------------------------;1forsinglecamera,2fordoublecamera;-------------------------------------------------------------------------------number_of_camera=03.2.2.3.2.2.3.2.2.3.2.2.media_profiles.xmlmedia_profiles.xmlmedia_profiles.xmlmedia_profiles.xmlmedia_profiles.xml用于配置录像参数。拿到一个模板后,只需要修改几处地方即可.。典型的对于双摄像头如下分了两段分别配置后置摄像头cameraId=0CONFIDENTAILA20USBCamera模块开发说明Copyright©2013AllwinnerTechnology.AllRightsReserved.-7-和前置摄像头cameraId=1.对应USBCamera无需过多关注该配置,按照原厂配置即可。若确实需要配置该文件,请参考《A20_Camera模块开发说明书》的对应说明。这里不做重复介绍。3.3.3.3.3.3.3.3.USBUSBUSBUSBCameraCameraCameraCamera相关程序说明1、修改摄像头的属性相关文件:sugar/android/d