精华内容
下载资源
问答
  • MTK USB camera patch

    2018-12-11 18:14:23
    MTK实现UVC camera的patch,可以实现Preview ,拍照,录像。支持USB摄像头,可以下载USB摄像头APP验证,此Patch针对MTK平台,官网释放
  • 包含安卓各个版本的 libusb100.so libuvc.so libUVCCamera.so以及USBCamera使用案例
  • Android USBCamera,UVCCamera开发通用库 https://blog.csdn.net/qq_31939617/article/details/82347939
  • MTK USB camera patch UVC

    2018-03-03 17:25:13
    MTK usb camera patch MTK usb camera patch MTK usb camera patch MTK usb camera patch
  • C#实现USB Camera的连接

    2017-12-26 09:54:45
    利用AForge实现USB Camera的连接官方SDK,并且包含了AForge(含手册、源码、示例代码、引用库)所有资源,以及自己调试通过的例子。
  • 这是UVC apk,可以支持各种分辨率设置。
  • Hi3518EV300 linux USB-Camera
  • AndroidUsbCamera:适用于GNULinux的Android USB Camera DriverBridge
  • android 连接多个usb camera的demo

    热门讨论 2017-09-11 15:59:24
    这个项目最好运行在平板上,项目中写了6个usb摄像头,具体能带起几个摄像头得根据实际情况来定,一般两三个应该是没有问题。这里面有代码和apk,可以先运行看下效果。
  • 海思Hi3518EV300芯片SDK,Hi3516EV200_SDK_V1.0.1.2版本,linux系统配置USB Camera功能步骤详解!
  • usbcamera.apk

    2015-03-14 10:04:43
    这是一个Android应用程序连接到智能手机或平板设备的USB摄像头,显示和记录视频。赶快来下载吧!
  • RK7.1摄像头方向旋转
  • usb camera trial_1.4.8

    2015-06-27 21:54:23
    手机连接USB摄像头USB camera
  • Android USBCamera,UVCCamera开发通用库

    热门讨论 2018-09-03 15:25:58
    Android USBCamera,UVCCamera开发通用库 https://blog.csdn.net/qq_31939617/article/details/82347939
  • 用DirectShow 的方式,视频输入设备枚举、视频支持格式枚举、视频预览、视频录像、视频截图。Delphi 源代码,
  • Android USB Camera .zip

    2019-12-24 14:35:57
    这个demo不是调用系统本身的摄像头,而是调用USB外接摄像头的,请根据需要下载.该demo能够拍照,录制视频以及调整分辨率
  • Android usb Camera源码

    热门讨论 2014-05-27 14:56:24
    最近在调试Android支持USB摄像头的问题!一直没什么进展!公司的网速又慢!开发环境都搭建不起来!都从家里下载了安装包再拷贝到公司用!这个资源是网站下载的一份Android usb摄像头的源码!我在我的Exynos4412...
  • 基于Toybrick TB-RK3399ProD实现USBcamera通过V4L2图像采集+RKMPP编码成H264+OpenCV显示采集的图像
  • string [] devices = UsbCamera . FindDevices (); if ( devices . Length == 0 ) return ; // no camera. // check format. int cameraIndex = 0 ; UsbCamera . VideoFormat [] formats = UsbCamera . ...
  • Delphi 源码,用DirectShow 的方式,进行视频输入设备枚举、视频支持格式枚举、视频预览、视频录像。
  • 免驱的usb camera通过V4L2获取图像。具体操作如下:直接解压,make编译,V4L2的封装类会直接被编译成so库,test.cpp为程序程序,调用封装的v4l2接口获取50帧图像并保存为camera.yuv里面,使用7yuv软件可以查看帧图像...
  • AndroidUSBCamera.zip

    2019-12-09 16:21:47
    根据项目需求安卓板卡调用usb摄像头,调分辨率,拍照保存图片的实现,av摄像头也可以调用起来,在github找的项目,经过修改实现摄像头拍照等功能,亲测有效!
  • usb camera (uvc) on android

    2015-09-10 20:00:54
    UVC device on android
  • AndroidUSBCamera-master.zip

    2020-03-13 16:14:57
    android外接的USB摄像头,可以进行调用查看预览摄像头信息
  • usb camera APK

    2014-06-17 11:05:43
    一个简单的usb camera previw 功能的APK。
  • AndroidUSBCamera 使用步骤

    千次阅读 热门讨论 2020-03-10 11:12:21
    1、git下载:https://github.com/jiangdongguo/AndroidUSBCamera 2、下载后解压,将模块 libusbcamera、libutils集成到自已的项目中,直接拷贝到项目根目录下,相关配置 settings.gradle 后添加 , ':libusbcamera'...

    1、git下载:https://github.com/jiangdongguo/AndroidUSBCamera

    2、下载后解压,将模块 libusbcamera、libutils集成到自已的项目中,直接拷贝到项目根目录下,相关配置

    settings.gradle 后添加   , ':libusbcamera', ':libutils'

    app build.gradle 文件   implementation project(':libusbcamera')

    project build.gradle 文件   

    allprojects {
        repositories {
            jcenter()
            google()
            maven { url 'https://jitpack.io' }
            maven { url 'https://raw.githubusercontent.com/saki4510t/libcommon/master/repository/' }
    
        }
    }

    AndroidManifest.xml 文件开启相关权限

        <uses-permission android:name="android.permission.RECORD_AUDIO"/>
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    
        <uses-feature android:name="android.hardware.usb.host"/>

    项目ndk 要设置上 最后项目async

    3、MainActivity

    public class MainActivity extends AppCompatActivity implements CameraViewInterface.Callback {
    
        private final String TAG = MainActivity.class.getSimpleName();
    
        public View mTextureView;
        private UVCCameraHelper mCameraHelper;
        private CameraViewInterface mUVCCameraView;
    
        private boolean isRequest = false;
        private boolean isPreview = false;
        private boolean isRecording = false;
        private UVCCameraHelper.OnMyDevConnectListener listener = new UVCCameraHelper.OnMyDevConnectListener() {
    
            @Override
            public void onAttachDev(UsbDevice device) {
                // request open permission
                Log.d(TAG, "camera: usb 设备 " + device.getProductName() + " 新连接");
                if (mCameraHelper == null || mCameraHelper.getUsbDeviceCount() == 0) {
                    showShortMsg("未检测到USB摄像头设备");
                    return;
                }
                List<UsbDevice> devList = mCameraHelper.getUsbDeviceList();
                /*
                 * usb连接时,判断是不是这个摄像头,是就打开,实现了热插拔,插拔一次,
                 * 设备的id就加一,所以地址就改变,机器重启id初始化,getProductName()获得的是摄像头 
                 * 名称 
                 * */
                if (!isRequest)
                    for (int i = 0; i < devList.size(); i++) {
                        UsbDevice _device = devList.get(i);
                        if (_device.getProductName().indexOf("camera") > -1) {
                            isRequest = true;
                            mCameraHelper.requestPermission(i);//打开usb摄像头
                        }
                    }
            }
    
            @Override
            public void onDettachDev(UsbDevice device) {
                // close camera
                Log.d(TAG, "camera: usb 设备 " + device.getProductName() + " 已拔出");
                if (isRequest) {
                    isRequest = false;
                    mCameraHelper.closeCamera();
                    showShortMsg(device.getProductName() + " 已拨出");
                }
            }
    
            @Override
            public void onConnectDev(UsbDevice device, boolean isConnected) {
                Log.d(TAG, "camera: usb 设备 " + device.getProductName() + " 连接失败");
                if (!isConnected) {
                    showShortMsg("连接失败,请检查分辨率参数是否正确");
                    isPreview = false;
                } else {
                    isPreview = true;
                    showShortMsg("usb 设备正在连接");
                    // need to wait UVCCamera initialize over
                    Log.d(TAG, "camera is connected");
                }
            }
    
            @Override
            public void onDisConnectDev(UsbDevice device) {
                Log.d(TAG, "camera: usb disconnecting");
                showShortMsg("usb设备连接断开");
            }
        };
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            mContext = this;
            // step.1 initialize UVCCameraHelper
            mTextureView = findViewById(R.id.camera_view);
            mUVCCameraView = (CameraViewInterface) mTextureView;
            mUVCCameraView.setCallback(this);
            mCameraHelper = UVCCameraHelper.getInstance();
            mCameraHelper.setDefaultFrameFormat(UVCCameraHelper.FRAME_FORMAT_YUYV);
            /*
             * 初始化分辨率,一定是设备支持的分辨率,否则摄像不能正常使用
             * */
            mCameraHelper.setDefaultPreviewSize(640, 480);
            mCameraHelper.initUSBMonitor(this, mUVCCameraView, listener);
            mCameraHelper.setOnPreviewFrameListener(new AbstractUVCCameraHandler.OnPreViewResultListener() {
                int printNum = 0;
    
                @Override
                public void onPreviewResult(byte[] nv21Yuv) {
                    printNum++;
                    if (printNum == 300) {
                        printNum = 0;
                        Log.d(TAG, "onPreviewResult: " + nv21Yuv.length + "摄像头预览");
                    }
    
                }
            });
        }
    
        //录像
        private void cameraRecording(Boolean isStartRecording, String Name) {
            isRecording = isStartRecording;
            if (mCameraHelper == null || !mCameraHelper.isCameraOpened() || !isPreview) {
                showShortMsg("摄像头异常,请重新更换插口并重启app");
                return;
            }
            String OrderRecordStr = prefs.getString(Config.ORDER_RECORDING, "");
            Log.d(TAG, "OrderRecorde1=" + OrderRecordStr);
            if (!mCameraHelper.isPushing() && isStartRecording) {
                //文件地址自已设置
                String videoPath = Config.VIDEO_DIRECTORY + "/ " + Name;
                OrderRecordStr = OrderRecordStr + "&" + Name;
                prefs.edit().putString(Config.ORDER_RECORDING, OrderRecordStr).apply();
                RecordParams params = new RecordParams();
                params.setRecordPath(videoPath);
                params.setRecordDuration(0);                        // auto divide saved,default 0 means not divided
                params.setVoiceClose(true);    // is close voice
                params.setSupportOverlay(true); // overlay only support armeabi-v7a & arm64-v8a
                mCameraHelper.startPusher(params, new AbstractUVCCameraHandler.OnEncodeResultListener() {
                    @Override
                    public void onEncodeResult(byte[] data, int offset, int length, long timestamp, int type) {
                        // type = 1,h264 video stream
                        if (type == 1) {
                            FileUtils.putFileStream(data, offset, length);
                        }
                        // type = 0,aac audio stream
                        if (type == 0) {
    
                        }
                    }
    
                    @Override
                    public void onRecordResult(String videoPath) {
                        if (TextUtils.isEmpty(videoPath)) {
                            return;
                        }
                        new Handler(getMainLooper()).post(() -> Toast.makeText(MainActivity.this, "save videoPath:" + videoPath, Toast.LENGTH_SHORT).show());
                    }
                });
                // if you only want to push stream,please call like this
                // mCameraHelper.startPusher(listener);
                showShortMsg("开始录制视频");
            } else if (mCameraHelper.isPushing() && !isStartRecording) {
                FileUtils.releaseFile();
                mCameraHelper.stopPusher();
                showShortMsg("停止录制视频");
                String[] OrderRecordArr = OrderRecordStr.split("&");
                if (OrderRecordArr.length > 5) {
                    String order = OrderRecordArr[1];
                    String filePath = Config.VIDEO_DIRECTORY + "/ " + order + ".mp4";
                    deleteFile(filePath);
                    String _OrderRecordStr = "";
                    for (int i = 0; i < OrderRecordArr.length; i++) {
                        if (OrderRecordArr[i] != order && OrderRecordArr[i].length() > 0)
                            _OrderRecordStr = _OrderRecordStr + "&" + OrderRecordArr[i];
                    }
                    prefs.edit().putString(Config.ORDER_RECORDING, _OrderRecordStr).apply();
                    Log.d(TAG, "OrderRecorde=" + prefs.getString(Config.ORDER_RECORDING, ""));
                }
            }
        }
    
        //删除文件
        public boolean deleteFile(String filePath) {
            File file = new File(filePath);
            if (file.isFile() && file.exists()) return file.delete();
            else if (file.isFile() && !file.exists()) return true;
            return false;
        }
        @Override
        public void onResume() {
            super.onResume();
            // 恢复Camera预览
            if (mUVCCameraView != null) mUVCCameraView.onResume();
        }
    
        @Override
        protected void onStart() {
            super.onStart();
            // step.2 register USB event broadcast
            if (mCameraHelper != null) {
                mCameraHelper.registerUSB();
            }
        }
    
        @Override
        protected void onStop() {
            super.onStop();
            // step.3 unregister USB event broadcast
            if (mCameraHelper != null) {
                mCameraHelper.unregisterUSB();
            }
        }
    
        @Override
        protected void onPause() {
            super.onPause();
            
            if (mUVCCameraView != null) mUVCCameraView.onPause();
        }
    
        private void showShortMsg(String msg) {
            Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
        }
    
        @Override
        public USBMonitor getUSBMonitor() {
            return mCameraHelper.getUSBMonitor();
        }
    
        @Override
        public void onDialogResult(boolean canceled) {
    
        }
    
        public boolean isCameraOpened() {
            return mCameraHelper.isCameraOpened();
        }
    
        @Override
        public void onSurfaceCreated(CameraViewInterface view, Surface surface) {
            isPreview = false;
            new Thread(new Runnable() {
                @Override
                public void run() {
                    // wait for camera created
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    Log.d(TAG, "camera: surface start preview " + isPreview + "  " + isCameraOpened());
                    if (!isPreview && isCameraOpened()) {
                        mCameraHelper.startPreview(mUVCCameraView);
                        isPreview = true;
                        Log.d(TAG, "camera: surface start preview");
                    }
                }
            }).start();
        }
    
        @Override
        public void onSurfaceChanged(CameraViewInterface view, Surface surface, int width, int height) {
    
        }
    
        @Override
        public void onSurfaceDestroy(CameraViewInterface view, Surface surface) {
            if (isPreview && isCameraOpened()) {
                mCameraHelper.stopPreview();
                Log.d(TAG, "surface:" + "is destroy");
            }
            isPreview = false;
        }
    
        @Override
        protected void onDestroy() {
            super.onDestroy();
            FileUtils.releaseFile();
            // step.4 release uvc camera resources
            if (mCameraHelper != null) {
                mCameraHelper.release();
                Log.d(TAG, "camera is release");
            }
            isPreview = false;
            isRequest = false;
        }
    
    }

    activity_main.xml      

    <com.serenegiant.usb.widget.UVCCameraTextureView
        android:id="@+id/camera_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"/>

    4、需要注意

    (1)mCameraHelper.requestPermission(int index) 是打开usb设备,有的usb不是摄像头设备,需要对usb设备名称进行过滤,可控制需要打开特定的usb摄像头, 可以热插拔显示

    (2)app关闭或后台运行  isPreview 需要重置为 false 不然再次进入app 预览无画面因为startPreview 未执行

    (3)设备重启后第一次打开app, 预览画面可能没有,但实际是可以录制的,重新进入app就可以了

    展开全文
  • 需要支持三个USB Camera,系统默认支持的是两颗。 解决方法: 以下是rockchip给的patch,不过是有缺失的: diff --git a/CameraHal/CameraHal_Module.cpp b/CameraHal/CameraHal_Module.cpp index 2...

    Platform: RK3399
    OS: Android 7.1
    Kernel: v4.4.83

    需求

    需要支持三个USB Camera,系统默认支持的是两颗。


    解决方法:

    以下是rockchip给的patch,不过是有缺失的:

    diff --git a/CameraHal/CameraHal_Module.cpp b/CameraHal/CameraHal_Module.cpp
    index 27e0f54..fa99a38 100755
    --- a/CameraHal/CameraHal_Module.cpp
    +++ b/CameraHal/CameraHal_Module.cpp
    @@ -684,6 +684,7 @@ int camera_get_number_of_cameras(void)
         
         memset(&camInfoTmp[0],0x00,sizeof(rk_cam_info_t));
         memset(&camInfoTmp[1],0x00,sizeof(rk_cam_info_t));
    +    memset(&camInfoTmp[2],0x00,sizeof(rk_cam_info_t));
     
         profiles = camera_board_profiles::getInstance();
         nCamDev = profiles->mDevieVector.size();
    @@ -691,25 +692,25 @@ int camera_get_number_of_cameras(void)
         if (nCamDev>0) {
             camera_board_profiles::LoadSensor(profiles);
             char sensor_ver[32];
    -		
    +
             for (i=0; (i<nCamDev); i++) 
             {  
             	LOGE("load sensor name(%s) connect %d\n", profiles->mDevieVector[i]->mHardInfo.mSensorInfo.mSensorName, profiles->mDevieVector[i]->mIsConnect);
             	if(profiles->mDevieVector[i]->mIsConnect==1){
         	        rk_sensor_info *pSensorInfo = &(profiles->mDevieVector[i]->mHardInfo.mSensorInfo);
         	        
    -    	        camInfoTmp[cam_cnt&0x01].pcam_total_info = profiles->mDevieVector[i];     
    -    	        strncpy(camInfoTmp[cam_cnt&0x01].device_path, pSensorInfo->mCamsysDevPath, sizeof(camInfoTmp[cam_cnt&0x01].device_path));
    -    	        strncpy(camInfoTmp[cam_cnt&0x01].driver, pSensorInfo->mSensorDriver, sizeof(camInfoTmp[cam_cnt&0x01].driver));
    +    	        camInfoTmp[cam_cnt].pcam_total_info = profiles->mDevieVector[i];
    +    	        strncpy(camInfoTmp[cam_cnt].device_path, pSensorInfo->mCamsysDevPath, sizeof(camInfoTmp[cam_cnt].device_path));
    +    	        strncpy(camInfoTmp[cam_cnt].driver, pSensorInfo->mSensorDriver, sizeof(camInfoTmp[cam_cnt].driver));
     				unsigned int SensorDrvVersion = profiles->mDevieVector[i]->mLoadSensorInfo.mpI2cInfo->sensor_drv_version;
     				memset(version,0x00,sizeof(version));
         	        sprintf(version,"%d.%d.%d",((SensorDrvVersion&0xff0000)>>16),
     	    	            ((SensorDrvVersion&0xff00)>>8),SensorDrvVersion&0xff);
     						 
         	        if(pSensorInfo->mFacing == RK_CAM_FACING_FRONT){     
    -    	            camInfoTmp[cam_cnt&0x01].facing_info.facing = CAMERA_FACING_FRONT;	    	        
    +    	            camInfoTmp[cam_cnt].facing_info.facing = CAMERA_FACING_FRONT;        
         	        } else {
    -    	            camInfoTmp[cam_cnt&0x01].facing_info.facing = CAMERA_FACING_BACK;
    +    	            camInfoTmp[cam_cnt].facing_info.facing = CAMERA_FACING_BACK;
         	        } 
     
                     memset(sensor_ver,0x00,sizeof(sensor_ver));
    @@ -719,7 +720,7 @@ int camera_get_number_of_cameras(void)
                         sprintf(sensor_ver,"%s",pSensorInfo->mSensorName);                
                     property_set(sensor_ver, version);	
                     
    -    	        camInfoTmp[cam_cnt&0x01].facing_info.orientation = pSensorInfo->mOrientation;
    +    	        camInfoTmp[cam_cnt].facing_info.orientation = pSensorInfo->mOrientation;
         	        cam_cnt++;
     
         			unsigned int CamsysDrvVersion = profiles->mDevieVector[i]->mCamsysVersion.drv_ver;
    @@ -762,22 +763,22 @@ int camera_get_number_of_cameras(void)
             	    LOGD("Video device(%s): video capture not supported.\n",cam_path);
                 } else {
                 	rk_cam_total_info* pNewCamInfo = new rk_cam_total_info();
    -                memset(camInfoTmp[cam_cnt&0x01].device_path,0x00, sizeof(camInfoTmp[cam_cnt&0x01].device_path));
    -                strcat(camInfoTmp[cam_cnt&0x01].device_path,cam_path);
    -                memset(camInfoTmp[cam_cnt&0x01].fival_list,0x00, sizeof(camInfoTmp[cam_cnt&0x01].fival_list));
    -                memcpy(camInfoTmp[cam_cnt&0x01].driver,capability.driver, sizeof(camInfoTmp[cam_cnt&0x01].driver));
    -                camInfoTmp[cam_cnt&0x01].version = capability.version;
    +                memset(camInfoTmp[cam_cnt].device_path,0x00, sizeof(camInfoTmp[cam_cnt].device_path));
    +                strcat(camInfoTmp[cam_cnt].device_path,cam_path);
    +                memset(camInfoTmp[cam_cnt].fival_list,0x00, sizeof(camInfoTmp[cam_cnt].fival_list));
    +                memcpy(camInfoTmp[cam_cnt].driver,capability.driver, sizeof(camInfoTmp[cam_cnt].driver));
    +                camInfoTmp[cam_cnt].version = capability.version;
                     if (strstr((char*)&capability.card[0], "front") != NULL) {
    -                    camInfoTmp[cam_cnt&0x01].facing_info.facing = CAMERA_FACING_FRONT;
    +                    camInfoTmp[cam_cnt].facing_info.facing = CAMERA_FACING_FRONT;
                     } else {
    -                    camInfoTmp[cam_cnt&0x01].facing_info.facing = CAMERA_FACING_BACK;
    +                    camInfoTmp[cam_cnt].facing_info.facing = CAMERA_FACING_BACK;
                     }  
                     ptr = strstr((char*)&capability.card[0],"-");
                     if (ptr != NULL) {
                         ptr++;
    -                    camInfoTmp[cam_cnt&0x01].facing_info.orientation = atoi(ptr);
    +                    camInfoTmp[cam_cnt].facing_info.orientation = atoi(ptr);
                     } else {
    -                    camInfoTmp[cam_cnt&0x01].facing_info.orientation = 0;
    +                    camInfoTmp[cam_cnt].facing_info.orientation = 0;
                     }
     
                     memset(version,0x00,sizeof(version));
    @@ -1031,6 +1032,7 @@ int camera_get_number_of_cameras(void)
     					
     					strcpy(pNewCamInfo->mHardInfo.mSensorInfo.mSensorName, SOC_CAM_NAME);
     					pNewCamInfo->mIsIommuEnabled = capability.reserved[0];
    +                    LOGD("mIsIommuEnabled=%d----------",pNewCamInfo->mIsIommuEnabled);
     					if (strstr((char*)&capability.card[0], "front") != NULL) {
                         	pNewCamInfo->mHardInfo.mSensorInfo.mFacing = 1;
                     	} else {
    @@ -1095,6 +1097,7 @@ int camera_get_number_of_cameras(void)
         
         memcpy(&gCamInfos[0], &camInfoTmp[0], sizeof(rk_cam_info_t));
         memcpy(&gCamInfos[1], &camInfoTmp[1], sizeof(rk_cam_info_t));
    +    memcpy(&gCamInfos[2], &camInfoTmp[2], sizeof(rk_cam_info_t));
     
     
         property_get("ro.sf.hwrotation", property, "0");
    diff --git a/CameraHal/CameraHal_Module.h b/CameraHal/CameraHal_Module.h
    index bac86d6..66bcd81 100755
    --- a/CameraHal/CameraHal_Module.h
    +++ b/CameraHal/CameraHal_Module.h
    @@ -11,8 +11,8 @@ using namespace android;
     #define CAMERA_DEFAULT_PREVIEW_FPS_MIN    8000        //8 fps
     #define CAMERA_DEFAULT_PREVIEW_FPS_MAX    15000
     #endif
    -#define CAMERAS_SUPPORT_MAX             2
    -#define CAMERAS_SUPPORTED_SIMUL_MAX     1
    +#define CAMERAS_SUPPORT_MAX             3
    +#define CAMERAS_SUPPORTED_SIMUL_MAX     3
     #define CAMERA_DEVICE_NAME              "/dev/video"
     #define CAMERA_MODULE_NAME              "RK29_ICS_CameraHal_Module"
     
    diff --git a/CameraHal/CameraHal_board_xml_parse.cpp b/CameraHal/CameraHal_board_xml_parse.cpp
    old mode 100644
    new mode 100755
    index fcbab39..35e4d72
    --- a/CameraHal/CameraHal_board_xml_parse.cpp
    +++ b/CameraHal/CameraHal_board_xml_parse.cpp
    @@ -1519,11 +1519,12 @@ int camera_board_profiles::CheckSensorSupportDV(rk_cam_total_info* pCamInfo)
     					ALOGD("(%s) UVC camera resolution(%dx%d) is support \n", pCamInfo->mHardInfo.mSensorInfo.mSensorName, pDVInfo->mWidth, pDVInfo->mHeight);
     			}
     			else if(strcmp(pCamInfo->mHardInfo.mSensorInfo.mSensorName, SOC_CAM_NAME)==0){
    -				if(pDVInfo->mIsSupport)
    +				if(pDVInfo->mIsSupport){
     					pDVInfo->mAddMask = 0;
    -				else{
    +                    ALOGD("(%s) SOC camera resolution(%dx%d) is support \n", pCamInfo->mHardInfo.mSensorInfo.mSensorName, pDVInfo->mWidth, pDVInfo->mHeight);
    +				}else{
     					pDVInfo->mAddMask = 1;
    -					ALOGD("(%s) SOC camera resolution(%dx%d) is support \n", pCamInfo->mHardInfo.mSensorInfo.mSensorName, pDVInfo->mWidth, pDVInfo->mHeight);
    +					//ALOGD("(%s) SOC camera resolution(%dx%d) is support \n", pCamInfo->mHardInfo.mSensorInfo.mSensorName, pDVInfo->mWidth, pDVInfo->mHeight);
     				}
     			}
     			else{ 
    @@ -1543,6 +1544,7 @@ int camera_board_profiles::CheckSensorSupportDV(rk_cam_total_info* pCamInfo)
                                     if ((unsigned int)(ISI_FPS_GET(pCaps->caps.Resolution)) >= pDVInfo->mFps) {
                                         pDVInfo->mFps = ISI_FPS_GET(pCaps->caps.Resolution);
                                         pDVInfo->mAddMask = 0;
    +                                    ALOGD("(%s) mipi camera resolution(%dx%d) is support \n", pCamInfo->mHardInfo.mSensorInfo.mSensorName, pDVInfo->mWidth, pDVInfo->mHeight);
                                     }
                                 }
                                 l = l->p_next;
    @@ -1603,10 +1605,12 @@ int camera_board_profiles::WriteDevNameTOXML(camera_board_profiles* profiles, ch
     				continue;
     			}
     
    -			for(i=0; (i<(int)nCamNum && i<2); i++){
    +			for(i=0; (i<(int)nCamNum /*&& i<2*/); i++){
     				fprintf(fpdst, "<!--  videoname%d=\"%s\" index=%d facing=%d -->  \n", 
                         i, profiles->mDevideConnectVector[i]->mHardInfo.mSensorInfo.mSensorName,
                         profiles->mDevideConnectVector[i]->mDeviceIndex, profiles->mDevideConnectVector[i]->mHardInfo.mSensorInfo.mFacing);
    +                LOGD("videoname%d=\"%s\" index=%d facing=%d-----rk",i, profiles->mDevideConnectVector[i]->mHardInfo.mSensorInfo.mSensorName,
    +                    profiles->mDevideConnectVector[i]->mDeviceIndex, profiles->mDevideConnectVector[i]->mHardInfo.mSensorInfo.mFacing);
     			}
     			isWrite=1;	
     		}
    @@ -1811,7 +1815,7 @@ int camera_board_profiles::ModifyMediaProfileXML( camera_board_profiles* profile
     	long front_fptmp = 0,back_fptmp = 0;
         char *leave_line, *leave_line1, *leave_line2;
         
    -	xml_fp_pos_s fp_pos[2];  
    +	xml_fp_pos_s fp_pos[3];  
     	xml_video_element_s find_element;
     
     	src_fp = fopen(src_xml_file, "r");
    @@ -1848,12 +1852,24 @@ int camera_board_profiles::ModifyMediaProfileXML( camera_board_profiles* profile
     		goto alter_exit;	
     	}
     
    +	fp_pos[2].camid = 2;
    +    fp_pos[2].camid_start = 0;
    +    fp_pos[2].camid_end = 0;
    +	ret = XMLFseekCamIDPos(src_fp, &fp_pos[2]);
    +	if(ret < 0 || fp_pos[2].camid_end <= fp_pos[2].camid_start){
    +		ALOGE("find camid(%d) failed\n", fp_pos[2].camid);
    +		err = -3;
    +		goto alter_exit;	
    +	}
    +
         find_element.isAddMark = 1;
         find_element.n_cameraId = -1;
         find_element.n_frameRate = 0;
         find_element.n_width = 0;
         find_element.n_height = 0;
    -	if(fp_pos[0].camid_end>0 && fp_pos[0].camid_start>0 && fp_pos[1].camid_end>0 && fp_pos[1].camid_start>0){
    +	if(fp_pos[0].camid_end>0 && fp_pos[0].camid_start>0 && 
    +       fp_pos[1].camid_end>0 && fp_pos[1].camid_start>0 &&
    +       fp_pos[2].camid_end>0 && fp_pos[2].camid_start>0){
     		fseek(src_fp,0,SEEK_SET); 
     		fseek(dst_fp,0,SEEK_SET);
     			
    @@ -1945,6 +1961,8 @@ int camera_board_profiles::ModifyMediaProfileXML( camera_board_profiles* profile
     					find_element.n_cameraId = 0;
     				else if(now_fp_pos>fp_pos[1].camid_start && now_fp_pos<fp_pos[1].camid_end)
     					find_element.n_cameraId = 1;
    +				else if(now_fp_pos>fp_pos[2].camid_start && now_fp_pos<fp_pos[2].camid_end)
    +					find_element.n_cameraId = 2;
     				else
     					find_element.n_cameraId = -1;
     				
    @@ -2033,7 +2051,7 @@ int camera_board_profiles::ProduceNewXml(camera_board_profiles* profiles)
     	size_t nCamNum =profiles->mDevideConnectVector.size();
     	
     	//verrify media_xml_device is supported by board xml 
    -    for(int i=0; (i<profiles->xml_device_count && i<2); i++)
    +    for(int i=0; (i<profiles->xml_device_count && i<nCamNum); i++)
         {
         	res |= ConnectDevHaveDev(profiles, (profiles->mXmlDevInfo + i));
         }
    @@ -2047,6 +2065,7 @@ int camera_board_profiles::ProduceNewXml(camera_board_profiles* profiles)
         //if((int)nCamNum>=1){ 
         if((int)nCamNum>=1 && fileexit == -1){
             LOG1("enter produce new xml\n");
    +        LOGD("nCamNum=%d",nCamNum);
             //new xml file name
             strlcpy(default_file, RK_DEFAULT_MEDIA_PROFILES_XML_PATH, sizeof(default_file));
             strlcpy(dst_file, RK_DST_MEDIA_PROFILES_XML_PATH, sizeof(dst_file));
    
    

    开机后Camera HAL层模块函数ModifyMediaProfileXML()会提示找不到 camid(2), 这是由于系统的media_profiles.xml是基于 media_profiles_default.xml创建的, 此文件位于 device/rockchip/common下面。
    因此,只要在此文件中添加对应camera id 2的 CamcorderProfiles栏位就可以正常了。

    添加四颗以上的USB Camera方法同理。

    展开全文
  • USBCamera.zip

    2020-04-13 09:30:10
    1.支持USB Camera设备检测,画面实时预览 2.支持jpg格式图片抓拍 仅提供了基础的功能,大家需要的功能可以根据需求进行自行添加
  • USBcamera2020.zip

    2021-05-25 12:05:20
    USBcamera2020摄像头显示软件,支持各种品牌摄像显示,调试和运行,支持云台摄像管理

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 19,993
精华内容 7,997
关键字:

usbcamera