1 | /* $Id: UsbWebcamInterface.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VirtualBox PDM Driver for Emulated USB Webcam
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2011-2023 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 | #ifndef MAIN_INCLUDED_UsbWebcamInterface_h
|
---|
29 | #define MAIN_INCLUDED_UsbWebcamInterface_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #include <VBox/vmm/pdmdrv.h>
|
---|
35 | #define VRDE_VIDEOIN_WITH_VRDEINTERFACE /* Get the VRDE interface definitions. */
|
---|
36 | #include <VBox/RemoteDesktop/VRDEVideoIn.h>
|
---|
37 |
|
---|
38 | class ConsoleVRDPServer;
|
---|
39 | typedef struct EMWEBCAMDRV EMWEBCAMDRV;
|
---|
40 | typedef struct EMWEBCAMREMOTE EMWEBCAMREMOTE;
|
---|
41 |
|
---|
42 | class EmWebcam
|
---|
43 | {
|
---|
44 | public:
|
---|
45 | EmWebcam(ConsoleVRDPServer *pServer);
|
---|
46 | virtual ~EmWebcam();
|
---|
47 |
|
---|
48 | static const PDMDRVREG DrvReg;
|
---|
49 |
|
---|
50 | void EmWebcamConstruct(EMWEBCAMDRV *pDrv);
|
---|
51 | void EmWebcamDestruct(EMWEBCAMDRV *pDrv);
|
---|
52 |
|
---|
53 | /* Callbacks. */
|
---|
54 | void EmWebcamCbNotify(uint32_t u32Id, const void *pvData, uint32_t cbData);
|
---|
55 | void EmWebcamCbDeviceDesc(int rcRequest, void *pDeviceCtx, void *pvUser,
|
---|
56 | const VRDEVIDEOINDEVICEDESC *pDeviceDesc, uint32_t cbDeviceDesc);
|
---|
57 | void EmWebcamCbControl(int rcRequest, void *pDeviceCtx, void *pvUser,
|
---|
58 | const VRDEVIDEOINCTRLHDR *pControl, uint32_t cbControl);
|
---|
59 | void EmWebcamCbFrame(int rcRequest, void *pDeviceCtx,
|
---|
60 | const VRDEVIDEOINPAYLOADHDR *pFrame, uint32_t cbFrame);
|
---|
61 |
|
---|
62 | /* Methods for the PDM driver. */
|
---|
63 | int SendControl(EMWEBCAMDRV *pDrv, void *pvUser, uint64_t u64DeviceId,
|
---|
64 | const VRDEVIDEOINCTRLHDR *pControl, uint32_t cbControl);
|
---|
65 |
|
---|
66 | private:
|
---|
67 | static DECLCALLBACK(void *) drvQueryInterface(PPDMIBASE pInterface, const char *pszIID);
|
---|
68 | static DECLCALLBACK(int) drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags);
|
---|
69 | static DECLCALLBACK(void) drvDestruct(PPDMDRVINS pDrvIns);
|
---|
70 |
|
---|
71 | ConsoleVRDPServer * const mParent;
|
---|
72 |
|
---|
73 | EMWEBCAMDRV *mpDrv;
|
---|
74 | EMWEBCAMREMOTE *mpRemote;
|
---|
75 | uint64_t volatile mu64DeviceIdSrc;
|
---|
76 | };
|
---|
77 |
|
---|
78 | #endif /* !MAIN_INCLUDED_UsbWebcamInterface_h */
|
---|
79 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|