diff options
Diffstat (limited to 'src/VBox/Main/src-client/ConsoleVRDPServer.cpp')
| -rw-r--r-- | src/VBox/Main/src-client/ConsoleVRDPServer.cpp | 175 |
1 files changed, 174 insertions, 1 deletions
diff --git a/src/VBox/Main/src-client/ConsoleVRDPServer.cpp b/src/VBox/Main/src-client/ConsoleVRDPServer.cpp index 4ba75ad65..d95c4b1c0 100644 --- a/src/VBox/Main/src-client/ConsoleVRDPServer.cpp +++ b/src/VBox/Main/src-client/ConsoleVRDPServer.cpp @@ -4,7 +4,7 @@ */ /* - * Copyright (C) 2006-2012 Oracle Corporation + * Copyright (C) 2006-2013 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; @@ -28,6 +28,9 @@ #ifdef VBOX_WITH_USB_CARDREADER # include "UsbCardReader.h" #endif +#ifdef VBOX_WITH_USB_VIDEO +# include "UsbWebcamInterface.h" +#endif #include "Global.h" #include "AutoCaller.h" @@ -1380,6 +1383,8 @@ ConsoleVRDPServer::ConsoleVRDPServer(Console *console) RT_ZERO(m_interfaceCallbacksSCard); RT_ZERO(m_interfaceTSMF); RT_ZERO(m_interfaceCallbacksTSMF); + RT_ZERO(m_interfaceVideoIn); + RT_ZERO(m_interfaceCallbacksVideoIn); rc = RTCritSectInit(&mTSMFLock); AssertRC(rc); @@ -1663,6 +1668,31 @@ int ConsoleVRDPServer::Launch(void) RT_ZERO(m_interfaceTSMF); } + /* VideoIn interface. */ + m_interfaceVideoIn.header.u64Version = 1; + m_interfaceVideoIn.header.u64Size = sizeof(m_interfaceVideoIn); + + m_interfaceCallbacksVideoIn.header.u64Version = 1; + m_interfaceCallbacksVideoIn.header.u64Size = sizeof(m_interfaceCallbacksVideoIn); + m_interfaceCallbacksVideoIn.VRDECallbackVideoInNotify = VRDECallbackVideoInNotify; + m_interfaceCallbacksVideoIn.VRDECallbackVideoInDeviceDesc = VRDECallbackVideoInDeviceDesc; + m_interfaceCallbacksVideoIn.VRDECallbackVideoInControl = VRDECallbackVideoInControl; + m_interfaceCallbacksVideoIn.VRDECallbackVideoInFrame = VRDECallbackVideoInFrame; + + vrc = mpEntryPoints->VRDEGetInterface(mhServer, + VRDE_VIDEOIN_INTERFACE_NAME, + &m_interfaceVideoIn.header, + &m_interfaceCallbacksVideoIn.header, + this); + if (RT_SUCCESS(vrc)) + { + LogRel(("VRDE: [%s]\n", VRDE_VIDEOIN_INTERFACE_NAME)); + } + else + { + RT_ZERO(m_interfaceVideoIn); + } + /* Since these interfaces are optional, it is always a success here. */ vrc = VINF_SUCCESS; } @@ -2541,6 +2571,149 @@ void ConsoleVRDPServer::setupTSMF(void) } } +/* static */ DECLCALLBACK(void) ConsoleVRDPServer::VRDECallbackVideoInNotify(void *pvCallback, + uint32_t u32Id, + const void *pvData, + uint32_t cbData) +{ +#ifdef VBOX_WITH_USB_VIDEO + ConsoleVRDPServer *pThis = static_cast<ConsoleVRDPServer*>(pvCallback); + EmWebcam *pWebcam = pThis->mConsole->getEmWebcam(); + pWebcam->EmWebcamCbNotify(u32Id, pvData, cbData); +#else + NOREF(pvCallback); + NOREF(u32Id); + NOREF(pvData); + NOREF(cbData); +#endif +} + +/* static */ DECLCALLBACK(void) ConsoleVRDPServer::VRDECallbackVideoInDeviceDesc(void *pvCallback, + int rcRequest, + void *pDeviceCtx, + void *pvUser, + const VRDEVIDEOINDEVICEDESC *pDeviceDesc, + uint32_t cbDevice) +{ +#ifdef VBOX_WITH_USB_VIDEO + ConsoleVRDPServer *pThis = static_cast<ConsoleVRDPServer*>(pvCallback); + EmWebcam *pWebcam = pThis->mConsole->getEmWebcam(); + pWebcam->EmWebcamCbDeviceDesc(rcRequest, pDeviceCtx, pvUser, pDeviceDesc, cbDevice); +#else + NOREF(pvCallback); + NOREF(rcRequest); + NOREF(pDeviceCtx); + NOREF(pvUser); + NOREF(pDeviceDesc); + NOREF(cbDevice); +#endif +} + +/* static */ DECLCALLBACK(void) ConsoleVRDPServer::VRDECallbackVideoInControl(void *pvCallback, + int rcRequest, + void *pDeviceCtx, + void *pvUser, + const VRDEVIDEOINCTRLHDR *pControl, + uint32_t cbControl) +{ +#ifdef VBOX_WITH_USB_VIDEO + ConsoleVRDPServer *pThis = static_cast<ConsoleVRDPServer*>(pvCallback); + EmWebcam *pWebcam = pThis->mConsole->getEmWebcam(); + pWebcam->EmWebcamCbControl(rcRequest, pDeviceCtx, pvUser, pControl, cbControl); +#else + NOREF(pvCallback); + NOREF(rcRequest); + NOREF(pDeviceCtx); + NOREF(pvUser); + NOREF(pControl); + NOREF(cbControl); +#endif +} + +/* static */ DECLCALLBACK(void) ConsoleVRDPServer::VRDECallbackVideoInFrame(void *pvCallback, + int rcRequest, + void *pDeviceCtx, + const VRDEVIDEOINPAYLOADHDR *pFrame, + uint32_t cbFrame) +{ +#ifdef VBOX_WITH_USB_VIDEO + ConsoleVRDPServer *pThis = static_cast<ConsoleVRDPServer*>(pvCallback); + EmWebcam *pWebcam = pThis->mConsole->getEmWebcam(); + pWebcam->EmWebcamCbFrame(rcRequest, pDeviceCtx, pFrame, cbFrame); +#else + NOREF(pvCallback); + NOREF(rcRequest); + NOREF(pDeviceCtx); + NOREF(pFrame); + NOREF(cbFrame); +#endif +} + +int ConsoleVRDPServer::VideoInDeviceAttach(const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle, void *pvDeviceCtx) +{ + int rc; + + if (mhServer && mpEntryPoints && m_interfaceVideoIn.VRDEVideoInDeviceAttach) + { + rc = m_interfaceVideoIn.VRDEVideoInDeviceAttach(mhServer, pDeviceHandle, pvDeviceCtx); + } + else + { + rc = VERR_NOT_SUPPORTED; + } + + return rc; +} + +int ConsoleVRDPServer::VideoInDeviceDetach(const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle) +{ + int rc; + + if (mhServer && mpEntryPoints && m_interfaceVideoIn.VRDEVideoInDeviceDetach) + { + rc = m_interfaceVideoIn.VRDEVideoInDeviceDetach(mhServer, pDeviceHandle); + } + else + { + rc = VERR_NOT_SUPPORTED; + } + + return rc; +} + +int ConsoleVRDPServer::VideoInGetDeviceDesc(void *pvUser, const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle) +{ + int rc; + + if (mhServer && mpEntryPoints && m_interfaceVideoIn.VRDEVideoInGetDeviceDesc) + { + rc = m_interfaceVideoIn.VRDEVideoInGetDeviceDesc(mhServer, pvUser, pDeviceHandle); + } + else + { + rc = VERR_NOT_SUPPORTED; + } + + return rc; +} + +int ConsoleVRDPServer::VideoInControl(void *pvUser, const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle, + const VRDEVIDEOINCTRLHDR *pReq, uint32_t cbReq) +{ + int rc; + + if (mhServer && mpEntryPoints && m_interfaceVideoIn.VRDEVideoInControl) + { + rc = m_interfaceVideoIn.VRDEVideoInControl(mhServer, pvUser, pDeviceHandle, pReq, cbReq); + } + else + { + rc = VERR_NOT_SUPPORTED; + } + + return rc; +} + void ConsoleVRDPServer::EnableConnections(void) { if (mpEntryPoints && mhServer) |
