| | |
| | | import com.runt.live.data.UVCMonitor |
| | | import com.runt.live.enum.ErrorCode |
| | | import com.runt.live.enum.LiveState |
| | | import com.runt.live.ui.stream.LiveLayoutView.Companion.uvcList |
| | | import com.runt.live.ui.stream.LiveLayoutView |
| | | import java.util.Date |
| | | import kotlin.concurrent.thread |
| | | |
| | | |
| | | /** |
| | | * @author Runt(qingingrunt2010@qq.com) |
| | | * @purpose |
| | | * @purpose usb相机,视频采集卡等 |
| | | * @date 3/6/25 |
| | | */ |
| | | class UVCHelper : USBHelper { |
| | |
| | | } |
| | | } |
| | | monitor.streamWindow.sizeState.value = Point(camera.previewSize.width,camera.previewSize.height ) |
| | | monitor.streamWindow.hasVideoState.value = true; |
| | | monitor.streamWindow.listener?.onStarted?.invoke() |
| | | if (monitor.streamWindow.surfaceHolder != null) { |
| | | camera.setPreviewDisplay(monitor.streamWindow.surfaceHolder!!.surface) |
| | |
| | | |
| | | override fun onUsbRgister(intent : Intent) { |
| | | for ( device in usbManager!!.deviceList.values){ |
| | | if(hasCamera(device) && !uvcList.value.contains(device)){ |
| | | uvcList.value+=device; |
| | | if(hasCamera(device) && ! LiveLayoutView.usbDevices.value.contains(device)){ |
| | | LiveLayoutView.usbDevices.value+=device; |
| | | } |
| | | } |
| | | } |
| | | |
| | | override fun onDeviceOut(device : UsbDevice) { |
| | | Log.i(TAG , "onReceive: 外设已经移除") |
| | | if(uvcList.value.contains(device)){ |
| | | uvcList.value-=device; |
| | | if(LiveLayoutView.usbDevices.value.contains(device)){ |
| | | LiveLayoutView.usbDevices.value-=device; |
| | | } |
| | | } |
| | | |
| | |
| | | Log.d(TAG , "This device is a USB Camera.") |
| | | //判断外设 |
| | | Log.i(TAG , "onReceive: 外设连接") |
| | | if(!uvcList.value.contains(device)){ |
| | | uvcList.value+=device; |
| | | if(! LiveLayoutView.usbDevices.value.contains(device)){ |
| | | LiveLayoutView.usbDevices.value+=device; |
| | | } |
| | | } |
| | | } |