• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java USBMonitor类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中com.serenegiant.usb.USBMonitor的典型用法代码示例。如果您正苦于以下问题:Java USBMonitor类的具体用法?Java USBMonitor怎么用?Java USBMonitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

USBMonitor类属于com.serenegiant.usb包,在下文中一共展示了USBMonitor类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCreate

点赞 3

import com.serenegiant.usb.USBMonitor; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_stream_usb_camera);
    
    mSurfaceView = (SurfaceView) findViewById(R.id.surface);
    mSurfaceView.getHolder().addCallback(this);

    mUVCCameraView = (UVCCameraTextureView) findViewById(R.id.UVCCameraTextureView);
    mUVCCameraView.setAspectRatio(UVCCamera.DEFAULT_PREVIEW_WIDTH * 1.0f / UVCCamera.DEFAULT_PREVIEW_HEIGHT);
    mUVCCameraView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mCamera == null) {
                CameraDialog.showDialog(StreamUsbCamera.this);
            } else {
                releaseUVCCamera();
            }
        }
    });
    mUSBMonitor = new USBMonitor(this, mOnDeviceConnectListener);

    // Initialize RTSP client
    initRtspClient();
}
 

开发者ID:quanhua92,
项目名称:libstreaming_android_studio,
代码行数:26,
代码来源:StreamUsbCamera.java

示例2: onCreate

点赞 3

import com.serenegiant.usb.USBMonitor; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_single_camera_preview);

    mUVCCameraView = (UVCCameraTextureView) findViewById(R.id.UVCCameraTextureView);
    mUVCCameraView.setAspectRatio(UVCCamera.DEFAULT_PREVIEW_WIDTH * 1.0f / UVCCamera.DEFAULT_PREVIEW_HEIGHT);
    mUVCCameraView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if (mCamera == null) {
                CameraDialog.showDialog(SingleCameraPreview.this);
            } else {
                releaseUVCCamera();
            }
        }
    });
    mUSBMonitor = new USBMonitor(this, mOnDeviceConnectListener);
}
 

开发者ID:quanhua92,
项目名称:AndroidUsbCamera,
代码行数:20,
代码来源:SingleCameraPreview.java

示例3: showDialog

点赞 2

import com.serenegiant.usb.USBMonitor; //导入依赖的package包/类
/**
 * Helper method
 * @param parent FragmentActivity
 * @return
 */
public static UVCDialog showDialog(final FragmentActivity parent, USBMonitor mUSBMonitor) {
    UVCDialog dialog = newInstance();
    dialog.mUSBMonitor = mUSBMonitor;
    try {
        dialog.show(parent.getSupportFragmentManager() ,TAG);
    } catch (final IllegalStateException e) {
        dialog = null;
    }
    return dialog;
}
 

开发者ID:mxiao6,
项目名称:Tower-develop,
代码行数:16,
代码来源:UVCDialog.java

示例4: onDisconnect

点赞 2

import com.serenegiant.usb.USBMonitor; //导入依赖的package包/类
@Override
public void onDisconnect(UsbDevice device, USBMonitor.UsbControlBlock ctrlBlock) {
    if(DEBUG) Log.v(TAG, "onDisconnect" + device);
    if(mCameraLeft != null && device.equals(mCameraLeft.getDevice())){
        releaseUVCCamera(0);
    }
    if(mCameraRight != null && device.equals(mCameraRight.getDevice())){
        releaseUVCCamera(1);
    }
}
 

开发者ID:quanhua92,
项目名称:libstreaming_android_studio,
代码行数:11,
代码来源:StreamDualUsbCamera.java

示例5: onDisconnect

点赞 2

import com.serenegiant.usb.USBMonitor; //导入依赖的package包/类
@Override
public void onDisconnect(UsbDevice device, USBMonitor.UsbControlBlock ctrlBlock) {
    if(DEBUG) Log.v(TAG, "onDisconnect" + device);
    if(mCamera != null && device.equals(mCamera.getDevice())){
        releaseUVCCamera();
    }
}
 

开发者ID:quanhua92,
项目名称:libstreaming_android_studio,
代码行数:8,
代码来源:StreamUsbCamera.java

示例6: notifyPermission

点赞 2

import com.serenegiant.usb.USBMonitor; //导入依赖的package包/类
void notifyPermission(final USBMonitor.UsbControlBlock ctrlBlock) {
    mLogger.info("notifyPermission: ctrlBlock = " + ctrlBlock);
    synchronized (mLockPermission) {
        if (mPermissionRequest != null) {
            mPermissionRequest.setResult(ctrlBlock != null);
            mCtrlBlock = ctrlBlock;
        }
        mLockPermission.notifyAll();
    }
}
 

开发者ID:DeviceConnect,
项目名称:DeviceConnect-Android,
代码行数:11,
代码来源:UVCDevice.java

示例7: getUSBMonitor

点赞 2

import com.serenegiant.usb.USBMonitor; //导入依赖的package包/类
public USBMonitor getUSBMonitor() {
	return mUSBMonitor;
}
 

开发者ID:jp1017,
项目名称:UVCCameraZxing,
代码行数:4,
代码来源:QRScanFragment.java

示例8: getUSBMonitor

点赞 2

import com.serenegiant.usb.USBMonitor; //导入依赖的package包/类
@Override
public USBMonitor getUSBMonitor() {
    return mUSBMonitor;
}
 

开发者ID:quanhua92,
项目名称:libstreaming_android_studio,
代码行数:5,
代码来源:StreamDualUsbCamera.java

示例9: onConnect

点赞 2

import com.serenegiant.usb.USBMonitor; //导入依赖的package包/类
@Override
        public void onConnect(UsbDevice device, final USBMonitor.UsbControlBlock ctrlBlock, boolean createNew) {
            if(mCamera != null) return;

            if (DEBUG) Log.v(TAG, "onConnect: " + device);

            final UVCCamera camera = new  UVCCamera();

            EXECUTER.execute(new Runnable() {
                @Override
                public void run() {
                    // Open Camera
                    camera.open(ctrlBlock);


                    // Set Preview Mode
                    try {
                        if (DEBUG) Log.v(TAG, "MJPEG MODE");
                        camera.setPreviewSize(UVCCamera.DEFAULT_PREVIEW_WIDTH, UVCCamera.DEFAULT_PREVIEW_HEIGHT, UVCCamera.FRAME_FORMAT_MJPEG, 0.5f);
                    } catch (IllegalArgumentException e1) {
                        e1.printStackTrace();

                        if (DEBUG) Log.v(TAG, "PREVIEW MODE");
                        try {
                            camera.setPreviewSize(UVCCamera.DEFAULT_PREVIEW_WIDTH, UVCCamera.DEFAULT_PREVIEW_HEIGHT, UVCCamera.DEFAULT_PREVIEW_MODE, 0.5f);
                        } catch (IllegalArgumentException e2) {
                            if (DEBUG) Log.v(TAG, "CAN NOT ENTER PREVIEW MODE");
//                            camera.destroy();
                            releaseUVCCamera();
                            e2.printStackTrace();
                        }
                    }

                    // Start Preview
                    if (mCamera == null) {
                        mCamera = camera;
                        if (mPreviewSurface != null) {
                            if (DEBUG) Log.v(TAG, "mPreviewSurface.release()");
                            mPreviewSurface.release();
                            mPreviewSurface = null;
                        }

                        final SurfaceTexture st = mUVCCameraView.getSurfaceTexture();
                        if (st != null) {
                            if (DEBUG) Log.v(TAG, "mPreviewSurface = new Surface(st);");
                            mPreviewSurface = new Surface(st);
                        }

                        camera.setPreviewDisplay(mPreviewSurface);
                        camera.setFrameCallback(mIFrameCallback, UVCCamera.PIXEL_FORMAT_RGB565);
                        camera.startPreview();
                    }
                }
            });

        }
 

开发者ID:quanhua92,
项目名称:libstreaming_android_studio,
代码行数:57,
代码来源:StreamUsbCamera.java

示例10: getUSBMonitor

点赞 2

import com.serenegiant.usb.USBMonitor; //导入依赖的package包/类
public USBMonitor getUSBMonitor() {
    return mUSBMonitor;
}
 

开发者ID:DeviceConnect,
项目名称:DeviceConnect-Android,
代码行数:4,
代码来源:UVCDeviceManager.java

示例11: onConnect

点赞 2

import com.serenegiant.usb.USBMonitor; //导入依赖的package包/类
@Override
        public void onConnect(UsbDevice device, final USBMonitor.UsbControlBlock ctrlBlock, boolean createNew) {
            if(mCamera != null) return;

            if (DEBUG) Log.v(TAG, "onConnect: " + device);

            final UVCCamera camera = new  UVCCamera();

            EXECUTER.execute(new Runnable() {
                @Override
                public void run() {
                    // Open Camera
                    camera.open(ctrlBlock);


                    // Set Preview Mode
                    try {
                        if (DEBUG) Log.v(TAG, "MJPEG MODE");
                        camera.setPreviewSize(UVCCamera.DEFAULT_PREVIEW_WIDTH, UVCCamera.DEFAULT_PREVIEW_HEIGHT, UVCCamera.FRAME_FORMAT_MJPEG, 0.5f);
                    } catch (IllegalArgumentException e1) {
                        e1.printStackTrace();

                        if (DEBUG) Log.v(TAG, "PREVIEW MODE");
                        try {
                            camera.setPreviewSize(UVCCamera.DEFAULT_PREVIEW_WIDTH, UVCCamera.DEFAULT_PREVIEW_HEIGHT, UVCCamera.DEFAULT_PREVIEW_MODE, 0.5f);
                        } catch (IllegalArgumentException e2) {
                            if (DEBUG) Log.v(TAG, "CAN NOT ENTER PREVIEW MODE");
//                            camera.destroy();
                            releaseUVCCamera();
                            e2.printStackTrace();
                        }
                    }

                    // Start Preview
                    if (mCamera == null) {
                        mCamera = camera;
                        if (mPreviewSurface != null) {
                            if (DEBUG) Log.v(TAG, "mPreviewSurface.release()");
                            mPreviewSurface.release();
                            mPreviewSurface = null;
                        }

                        final SurfaceTexture st = mUVCCameraView.getSurfaceTexture();
                        if (st != null) {
                            if (DEBUG) Log.v(TAG, "mPreviewSurface = new Surface(st);");
                            mPreviewSurface = new Surface(st);
                        }

                        camera.setPreviewDisplay(mPreviewSurface);
                        camera.startPreview();
                    }
                }
            });

        }
 

开发者ID:quanhua92,
项目名称:AndroidUsbCamera,
代码行数:56,
代码来源:SingleCameraPreview.java

示例12: getUSBMonitor

点赞 1

import com.serenegiant.usb.USBMonitor; //导入依赖的package包/类
public USBMonitor getUSBMonitor(); 

开发者ID:jp1017,
项目名称:UVCCameraZxing,
代码行数:2,
代码来源:CameraDialog.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)