- Timestamp:
- Feb 20, 2013 11:45:18 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83867
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/RemoteDesktop/VRDEVideoIn.h
r44528 r44758 328 328 #define VRDE_VIDEOIN_CTRLSEL_VS(a) VRDE_VIDEOIN_CTRLSEL_MAKE(a, 0x04) 329 329 #define VRDE_VIDEOIN_CTRLSEL_HW(a) VRDE_VIDEOIN_CTRLSEL_MAKE(a, 0x05) 330 #define VRDE_VIDEOIN_CTRLSEL_PROT(a) VRDE_VIDEOIN_CTRLSEL_MAKE(a, 0x06) 330 331 331 332 #define VRDE_VIDEOIN_CTRLSEL_VC_VIDEO_POWER_MODE_CONTROL VRDE_VIDEOIN_CTRLSEL_VC(0x01) … … 381 382 #define VRDE_VIDEOIN_CTRLSEL_HW_BUTTON VRDE_VIDEOIN_CTRLSEL_HW(0x01) 382 383 384 #define VRDE_VIDEOIN_CTRLSEL_PROT_PING VRDE_VIDEOIN_CTRLSEL_PROT(0x01) 385 #define VRDE_VIDEOIN_CTRLSEL_PROT_SAMPLING VRDE_VIDEOIN_CTRLSEL_PROT(0x02) 386 #define VRDE_VIDEOIN_CTRLSEL_PROT_FRAMES VRDE_VIDEOIN_CTRLSEL_PROT(0x03) 387 383 388 typedef struct VRDEVIDEOINCTRL_VIDEO_POWER_MODE 384 389 { … … 673 678 VRDEVIDEOINCTRLHDR hdr; 674 679 uint8_t u8Pressed; 675 } VRDEVIDEOINCTRL_CT_HW_BUTTON; 680 } VRDEVIDEOINCTRL_HW_BUTTON; 681 682 typedef struct VRDEVIDEOINCTRL_PROT_PING 683 { 684 VRDEVIDEOINCTRLHDR hdr; 685 uint32_t u32Timestamp; /* Set in the request and the same value must be send back in the response. */ 686 } VRDEVIDEOINCTRL_PROT_PING; 687 688 typedef struct VRDEVIDEOINCTRL_PROT_SAMPLING 689 { 690 VRDEVIDEOINCTRLHDR hdr; 691 uint32_t fu32SampleStart; /* Which parameters must be sampled VRDEVIDEOINCTRL_F_PROT_SAMPLING_*. */ 692 uint32_t fu32SampleStop; /* Which parameters to disable VRDEVIDEOINCTRL_F_PROT_SAMPLING_*. 693 * If both Start and Stop is set, then restart the sampling. 694 */ 695 uint32_t u32PeriodMS; /* Sampling period in milliseconds. Applies to all samples in fu32SampleStart. 696 * Not mandatory, the actual sampling period may be different. 697 */ 698 } VRDEVIDEOINCTRL_PROT_SAMPLING; 699 700 #define VRDEVIDEOINCTRL_F_PROT_SAMPLING_FRAMES_SOURCE 0x00000001 /* Periodic VRDEVIDEOINCTRL_PROT_FRAMES samples */ 701 #define VRDEVIDEOINCTRL_F_PROT_SAMPLING_FRAMES_CLIENT_OUT 0x00000002 /* Periodic VRDEVIDEOINCTRL_PROT_FRAMES samples */ 702 703 typedef struct VRDEVIDEOINCTRL_PROT_FRAMES 704 { 705 VRDEVIDEOINCTRLHDR hdr; /* Note: the message should be sent as VRDE_VIDEOIN_FN_CONTROL_NOTIFY. */ 706 uint32_t u32Sample; /* Which sample is this, one of VRDEVIDEOINCTRL_F_PROT_SAMPLING_*. */ 707 uint32_t u32TimestampMS; /* When the period started, milliseconds since the start of sampling. */ 708 uint32_t u32PeriodMS; /* Actual period during which the frames were counted in milliseconds. 709 * This may be different from VRDEVIDEOINCTRL_PROT_SAMPLING::u32PeriodMS. 710 */ 711 uint32_t u32FramesCount; /* How many frames per u32PeriodMS milliseconds. */ 712 } VRDEVIDEOINCTRL_PROT_FRAMES; 713 676 714 677 715 /* … … 713 751 */ 714 752 753 /* The dynamic RDP channel name. */ 715 754 #define VRDE_VIDEOIN_CHANNEL "RVIDEOIN" 716 755 … … 719 758 #define VRDE_VIDEOIN_FN_NOTIFY 0x0001 /* Device attach/detach from the client. */ 720 759 #define VRDE_VIDEOIN_FN_DEVICEDESC 0x0002 /* Query device description. */ 721 #define VRDE_VIDEOIN_FN_CONTROL 0x0003 /* Control the device and start/stop video input. */ 722 #define VRDE_VIDEOIN_FN_CONTROL_NOTIFY 0x0004 /* The client reports a control change, etc. */ 760 #define VRDE_VIDEOIN_FN_CONTROL 0x0003 /* Control the device and start/stop video input. 761 * This function is used for sending a request and 762 * the corresponding response. 763 */ 764 #define VRDE_VIDEOIN_FN_CONTROL_NOTIFY 0x0004 /* The client reports a control change, etc. 765 * This function indicated that the message is 766 * not a response to a CONTROL request. 767 */ 723 768 #define VRDE_VIDEOIN_FN_FRAME 0x0005 /* Frame from the client. */ 724 769 … … 747 792 #define VRDE_VIDEOIN_NEGOTIATE_VERSION 1 748 793 749 #define VRDE_VIDEOIN_NEGOTIATE_CAP_VOID 0 794 /* VRDEVIDEOINMSG_NEGOTIATE::fu32Capabilities */ 795 #define VRDE_VIDEOIN_NEGOTIATE_CAP_VOID 0x00000000 796 #define VRDE_VIDEOIN_NEGOTIATE_CAP_PROT 0x00000001 /* Supports VRDE_VIDEOIN_CTRLSEL_PROT_* controls. */ 750 797 751 798 typedef struct VRDEVIDEOINMSG_NEGOTIATE … … 763 810 * already connected to the client when the VIDEOIN channel is established. 764 811 */ 765 #define VRDE_VIDEOIN_NOTIFY_ ATTACH 0766 #define VRDE_VIDEOIN_NOTIFY_ DETACH 1812 #define VRDE_VIDEOIN_NOTIFY_EVENT_ATTACH 0 813 #define VRDE_VIDEOIN_NOTIFY_EVENT_DETACH 1 767 814 768 815 typedef struct VRDEVIDEOINMSG_NOTIFY 769 816 { 770 817 VRDEVIDEOINMSGHDR hdr; 771 uint32_t u32NotifyEvent; /* VRDE_VIDEOIN_NOTIFY_ * */818 uint32_t u32NotifyEvent; /* VRDE_VIDEOIN_NOTIFY_EVENT_* */ 772 819 /* Event specific data may follow. The underlying protocol provides the length of the message. */ 773 820 } VRDEVIDEOINMSG_NOTIFY; … … 906 953 typedef struct VRDEVIDEOINNOTIFYATTACH 907 954 { 908 VRDEVIDEOINDEVICEHANDLE deviceHandle; 955 VRDEVIDEOINDEVICEHANDLE deviceHandle; 956 uint32_t u32Version; /* VRDE_VIDEOIN_NEGOTIATE_VERSION */ 957 uint32_t fu32Capabilities; /* VRDE_VIDEOIN_NEGOTIATE_CAP_* */ 909 958 } VRDEVIDEOINNOTIFYATTACH; 910 959 911 960 typedef struct VRDEVIDEOINNOTIFYDETACH 912 961 { 913 VRDEVIDEOINDEVICEHANDLE deviceHandle;962 VRDEVIDEOINDEVICEHANDLE deviceHandle; 914 963 } VRDEVIDEOINNOTIFYDETACH; 964 965 /* Notification codes, */ 966 #define VRDE_VIDEOIN_NOTIFY_ID_ATTACH 0 967 #define VRDE_VIDEOIN_NOTIFY_ID_DETACH 1 915 968 916 969 … … 918 971 typedef struct VRDEVIDEOINCALLBACKS 919 972 { 920 /* *The header. */973 /* The header. */ 921 974 VRDEINTERFACEHDR header; 922 975 -
trunk/include/VBox/vmm/pdmwebcaminfs.h
r44337 r44758 56 56 57 57 58 #define PDMIWEBCAMUP_IID " 7921e96b-b8e2-4173-a73d-787620fc3cab"58 #define PDMIWEBCAMUP_IID "476c5d41-7bd1-4997-825e-722a72577af3" 59 59 typedef struct PDMIWEBCAMUP *PPDMIWEBCAMUP; 60 60 typedef struct PDMIWEBCAMUP … … 67 67 * @param pDeviceDesc The device description. 68 68 * @param cbDeviceDesc The size of the device description. 69 * @param u32Version The remote video input protocol version. 70 * @param fu32Capabilities The remote video input protocol capabilities. 69 71 */ 70 72 DECLR3CALLBACKMEMBER(int, pfnWebcamUpAttached,(PPDMIWEBCAMUP pInterface, 71 73 uint64_t u64DeviceId, 72 74 const PDMIWEBCAM_DEVICEDESC *pDeviceDesc, 73 uint32_t cbDeviceDesc)); 75 uint32_t cbDeviceDesc, 76 uint32_t u32Version, 77 uint32_t fu32Capabilities)); 74 78 75 79 /* -
trunk/src/VBox/Main/include/UsbWebcamInterface.h
r44337 r44758 34 34 35 35 static const PDMDRVREG DrvReg; 36 EMWEBCAMDRV *mpDrv;37 36 37 void EmWebcamConstruct(EMWEBCAMDRV *pDrv); 38 38 void EmWebcamDestruct(EMWEBCAMDRV *pDrv); 39 39 … … 58 58 Console * const mParent; 59 59 60 EMWEBCAMDRV *mpDrv; 60 61 EMWEBCAMREMOTE *mpRemote; 61 62 uint64_t volatile mu64DeviceIdSrc; -
trunk/src/VBox/Main/src-client/UsbWebcamInterface.cpp
r44440 r44758 25 25 26 26 27 typedef struct EMWEBCAMDRV *PEMWEBCAMDRV; 28 29 struct EMWEBCAMDRV 27 typedef struct EMWEBCAMDRV 30 28 { 31 29 EmWebcam *pEmWebcam; 30 PPDMIWEBCAMUP pIWebcamUp; 32 31 PDMIWEBCAMDOWN IWebcamDown; 33 PPDMIWEBCAMUP pIWebcamUp; 34 35 }; 36 37 struct EMWEBCAMREMOTE 32 } EMWEBCAMDRV, *PEMWEBCAMDRV; 33 34 typedef struct EMWEBCAMREMOTE 38 35 { 39 36 EmWebcam *pEmWebcam; 40 37 41 /* The remote identifier. */ 42 VRDEVIDEOINDEVICEHANDLE deviceHandle; 38 VRDEVIDEOINDEVICEHANDLE deviceHandle; /* The remote identifier. */ 39 uint32_t u32Version; /* VRDE_VIDEOIN_NEGOTIATE_VERSION */ 40 uint32_t fu32Capabilities; /* VRDE_VIDEOIN_NEGOTIATE_CAP_* */ 43 41 44 42 /* The device identifier for the PDM device.*/ 45 43 uint64_t u64DeviceId; 46 } ;44 } EMWEBCAMREMOTE; 47 45 48 46 typedef struct EMWEBCAMREQCTX … … 59 57 uint32_t cbCtrl) 60 58 { 61 LogFlowFunc(("pInterface:%p\n", pInterface));62 63 59 PEMWEBCAMDRV pThis = RT_FROM_MEMBER(pInterface, EMWEBCAMDRV, IWebcamDown); 60 61 LogFlowFunc(("pEmWebcam:%p, u64DeviceId %lld\n", pThis->pEmWebcam, u64DeviceId)); 64 62 65 63 return pThis->pEmWebcam->SendControl(pThis, pvUser, u64DeviceId, (const VRDEVIDEOINCTRLHDR *)pCtrl, cbCtrl); … … 84 82 } 85 83 84 void EmWebcam::EmWebcamConstruct(EMWEBCAMDRV *pDrv) 85 { 86 AssertReturnVoid(mpDrv == NULL); 87 88 mpDrv = pDrv; 89 } 90 86 91 void EmWebcam::EmWebcamDestruct(EMWEBCAMDRV *pDrv) 87 92 { … … 94 99 mpRemote = NULL; 95 100 } 101 102 mpDrv = NULL; 96 103 } 97 104 … … 102 109 switch (u32Id) 103 110 { 104 case VRDE_VIDEOIN_NOTIFY_ ATTACH:111 case VRDE_VIDEOIN_NOTIFY_ID_ATTACH: 105 112 { 106 113 VRDEVIDEOINNOTIFYATTACH *p = (VRDEVIDEOINNOTIFYATTACH *)pvData; 107 Assert(cbData == sizeof(VRDEVIDEOINNOTIFYATTACH)); 108 109 LogFlowFunc(("ATTACH[%d,%d]\n", p->deviceHandle.u32ClientId, p->deviceHandle.u32DeviceId)); 114 115 /* Older versions did not report u32Version and fu32Capabilities. */ 116 uint32_t u32Version = 1; 117 uint32_t fu32Capabilities = VRDE_VIDEOIN_NEGOTIATE_CAP_VOID; 118 119 if (cbData >= RT_OFFSETOF(VRDEVIDEOINNOTIFYATTACH, u32Version) + sizeof(p->u32Version)) 120 { 121 u32Version = p->u32Version; 122 } 123 124 if (cbData >= RT_OFFSETOF(VRDEVIDEOINNOTIFYATTACH, fu32Capabilities) + sizeof(p->fu32Capabilities)) 125 { 126 fu32Capabilities = p->fu32Capabilities; 127 } 128 129 LogFlowFunc(("ATTACH[%d,%d] version %d, caps 0x%08X\n", 130 p->deviceHandle.u32ClientId, p->deviceHandle.u32DeviceId, 131 u32Version, fu32Capabilities)); 110 132 111 133 /* Currently only one device is allowed. */ … … 124 146 } 125 147 126 pRemote->pEmWebcam = this; 127 pRemote->deviceHandle = p->deviceHandle; 128 pRemote->u64DeviceId = ASMAtomicIncU64(&mu64DeviceIdSrc); 148 pRemote->pEmWebcam = this; 149 pRemote->deviceHandle = p->deviceHandle; 150 pRemote->u32Version = u32Version; 151 pRemote->fu32Capabilities = fu32Capabilities; 152 pRemote->u64DeviceId = ASMAtomicIncU64(&mu64DeviceIdSrc); 129 153 130 154 mpRemote = pRemote; … … 153 177 } break; 154 178 155 case VRDE_VIDEOIN_NOTIFY_ DETACH:179 case VRDE_VIDEOIN_NOTIFY_ID_DETACH: 156 180 { 157 181 VRDEVIDEOINNOTIFYDETACH *p = (VRDEVIDEOINNOTIFYDETACH *)pvData; … … 163 187 if (mpRemote) 164 188 { 165 if (mpDrv ->pIWebcamUp)189 if (mpDrv && mpDrv->pIWebcamUp) 166 190 { 167 191 mpDrv->pIWebcamUp->pfnWebcamUpDetached(mpDrv->pIWebcamUp, … … 190 214 Assert(pRemote == mpRemote); 191 215 192 LogFlowFunc((" rcRequest %Rrc %p %p %p %d\n",193 rcRequest, pDeviceCtx, pvUser, pDeviceDesc, cbDeviceDesc));216 LogFlowFunc(("mpDrv %p, rcRequest %Rrc %p %p %p %d\n", 217 mpDrv, rcRequest, pDeviceCtx, pvUser, pDeviceDesc, cbDeviceDesc)); 194 218 195 219 if (RT_SUCCESS(rcRequest)) 196 220 { 197 if (mpDrv ->pIWebcamUp)221 if (mpDrv && mpDrv->pIWebcamUp) 198 222 { 199 223 mpDrv->pIWebcamUp->pfnWebcamUpAttached(mpDrv->pIWebcamUp, 200 224 pRemote->u64DeviceId, 201 225 (const PDMIWEBCAM_DEVICEDESC *)pDeviceDesc, 202 cbDeviceDesc); 226 cbDeviceDesc, 227 pRemote->u32Version, 228 pRemote->fu32Capabilities); 203 229 } 204 230 } … … 222 248 bool fResponse = (pvUser != NULL); 223 249 224 if (mpDrv ->pIWebcamUp)250 if (mpDrv && mpDrv->pIWebcamUp) 225 251 { 226 252 mpDrv->pIWebcamUp->pfnWebcamUpControl(mpDrv->pIWebcamUp, … … 241 267 rcRequest, pDeviceCtx, pFrame, cbFrame)); 242 268 243 if (mpDrv ->pIWebcamUp)269 if (mpDrv && mpDrv->pIWebcamUp) 244 270 { 245 271 mpDrv->pIWebcamUp->pfnWebcamUpFrame(mpDrv->pIWebcamUp, … … 293 319 /* static */ DECLCALLBACK(void *) EmWebcam::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID) 294 320 { 295 LogFlowFunc(("pInterface:%p, pszIID:%s\n", __FUNCTION__, pInterface, pszIID));296 321 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 297 322 PEMWEBCAMDRV pThis = PDMINS_2_DATA(pDrvIns, PEMWEBCAMDRV); 323 324 LogFlowFunc(("pszIID:%s\n", pszIID)); 298 325 299 326 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase); … … 304 331 /* static */ DECLCALLBACK(int) EmWebcam::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags) 305 332 { 306 LogFlow (("%s: iInstance/#d, pCfg:%p, fFlags:%x\n", __FUNCTION__, pDrvIns->iInstance, pCfg, fFlags));333 LogFlowFunc(("iInstance:%d, pCfg:%p, fFlags:%x\n", pDrvIns->iInstance, pCfg, fFlags)); 307 334 308 335 PEMWEBCAMDRV pThis = PDMINS_2_DATA(pDrvIns, PEMWEBCAMDRV); … … 315 342 VERR_PDM_DRVINS_NO_ATTACH); 316 343 344 /* Check early that there is a device. No need to init anything if there is no device. */ 345 pThis->pIWebcamUp = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIWEBCAMUP); 346 if (pThis->pIWebcamUp == NULL) 347 { 348 LogRel(("USBWEBCAM: Emulated webcam device does not exist.\n")); 349 return VERR_PDM_MISSING_INTERFACE; 350 } 351 317 352 void *pv = NULL; 318 353 int rc = CFGMR3QueryPtr(pCfg, "Object", &pv); 319 AssertMsgRCReturn(rc, ("Configuration error: No/bad \"Object\" value! rc=%Rrc\n", rc), rc); 320 354 if (!RT_VALID_PTR(pv)) 355 rc = VERR_INVALID_PARAMETER; 356 AssertMsgReturn(RT_SUCCESS(rc), 357 ("Configuration error: No/bad \"Object\" %p value! rc=%Rrc\n", pv, rc), rc); 358 359 /* Everything ok. Initialize. */ 321 360 pThis->pEmWebcam = (EmWebcam *)pv; 322 pThis->pEmWebcam-> mpDrv = pThis;361 pThis->pEmWebcam->EmWebcamConstruct(pThis); 323 362 324 363 pDrvIns->IBase.pfnQueryInterface = drvQueryInterface; … … 326 365 pThis->IWebcamDown.pfnWebcamDownControl = drvEmWebcamControl; 327 366 328 pThis->pIWebcamUp = PDMIBASE_QUERY_INTERFACE(pDrvIns->pUpBase, PDMIWEBCAMUP);329 330 AssertReturn(pThis->pIWebcamUp, VERR_PDM_MISSING_INTERFACE);331 332 367 return VINF_SUCCESS; 333 368 } … … 335 370 /* static */ DECLCALLBACK(void) EmWebcam::drvDestruct(PPDMDRVINS pDrvIns) 336 371 { 337 LogFlow(("%s: iInstance/#d\n", __FUNCTION__, pDrvIns->iInstance));338 372 PEMWEBCAMDRV pThis = PDMINS_2_DATA(pDrvIns, PEMWEBCAMDRV); 373 374 LogFlowFunc(("iInstance %d, pEmWebcam %p, pIWebcamUp %p\n", 375 pDrvIns->iInstance, pThis->pEmWebcam, pThis->pIWebcamUp)); 376 339 377 if (pThis->pEmWebcam) 340 378 {
Note:
See TracChangeset
for help on using the changeset viewer.