UsbWebcamInterface.cpp revision 3c8ad0020c82e3ff4f3daad0d8cf2ef39085cbca
/* $Id$ */
/** @file
* UsbWebcamInterface - Driver Interface for USB Webcam emulation.
*/
/*
* Copyright (C) 2011-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;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#define LOG_GROUP LOG_GROUP_USB_WEBCAM
#include "UsbWebcamInterface.h"
#include "ConsoleImpl.h"
#include "ConsoleVRDPServer.h"
#include "EmulatedUSBImpl.h"
typedef struct EMWEBCAMREMOTE
{
/* Received from the remote client. */
/* The device identifier for the PDM device.*/
typedef struct EMWEBCAMDRV
{
} EMWEBCAMDRV, *PEMWEBCAMDRV;
typedef struct EMWEBCAMREQCTX
{
void *pvUser;
bool fReady)
{
if (pThis->pIWebcamUp)
{
}
}
void *pvUser,
const PDMIWEBCAM_CTRLHDR *pCtrl,
{
return pRemote->pEmWebcam->SendControl(pThis, pvUser, u64DeviceId, (const VRDEVIDEOINCTRLHDR *)pCtrl, cbCtrl);
}
:
{
}
{
if (mpDrv)
{
}
}
{
}
{
if (mpRemote)
{
mpRemote->cbDeviceDesc = 0;
}
}
{
int rc = VINF_SUCCESS;
switch (u32Id)
{
{
/* Older versions did not report u32Version and fu32Capabilities. */
{
u32Version = p->u32Version;
}
{
}
LogFlowFunc(("ATTACH[%d,%d] version %d, caps 0x%08X\n",
/* Currently only one device is allowed. */
if (mpRemote)
{
AssertFailed();
break;
}
{
rc = VERR_NO_MEMORY;
break;
}
pRemote->cbDeviceDesc = 0;
/* Tell the server that this webcam will be used. */
if (RT_FAILURE(rc))
{
break;
}
/* Get the device description. */
if (RT_FAILURE(rc))
{
break;
}
LogFlowFunc(("sent DeviceDesc\n"));
} break;
{
/* @todo */
if (mpRemote)
{
{
}
/* mpRemote is deallocated in EmWebcamDestruct */
}
} break;
default:
AssertFailed();
break;
}
return;
}
{
LogFlowFunc(("mpDrv %p, rcRequest %Rrc %p %p %p %d\n",
if (RT_SUCCESS(rcRequest))
{
/* Save device description. */
/* Try to attach the device. */
}
else
{
}
}
{
LogFlowFunc(("rcRequest %Rrc %p %p %p %d\n",
{
(const PDMIWEBCAM_CTRLHDR *)pControl,
}
}
{
LogFlowFunc(("rcRequest %Rrc %p %p %d\n",
{
if ( cbFrame >= sizeof(VRDEVIDEOINPAYLOADHDR)
{
cbImage);
}
}
}
{
int rc = VINF_SUCCESS;
/* Verify that there is a remote device. */
if ( !mpRemote
{
}
if (RT_SUCCESS(rc))
{
if (!pCtx)
{
rc = VERR_NO_MEMORY;
}
}
if (RT_SUCCESS(rc))
{
if (RT_FAILURE(rc))
{
}
}
return rc;
}
/* static */ DECLCALLBACK(void *) EmWebcam::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
{
return NULL;
}
{
LogFlowFunc(("iInstance %d, pRemote %p, pIWebcamUp %p\n",
{
}
}
/* static */ DECLCALLBACK(int) EmWebcam::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
{
("Configuration error: Not possible to attach anything to this driver!\n"),
/* Check early that there is a device. No need to init anything if there is no device. */
{
LogRel(("USBWEBCAM: Emulated webcam device does not exist.\n"));
return VERR_PDM_MISSING_INTERFACE;
}
if (!RT_VALID_PTR(pv))
/* Everything ok. Initialize. */
return VINF_SUCCESS;
}
{
/* u32Version */
/* szName[32] */
"EmWebcam",
/* szRCMod[32] */
"",
/* szR0Mod[32] */
"",
/* pszDescription */
"Main Driver communicating with VRDE",
/* fFlags */
/* fClass */
/* cMaxInstances */
1,
/* cbInstance */
sizeof(EMWEBCAMDRV),
/* pfnConstruct */
/* pfnDestruct */
/* pfnRelocate */
NULL,
/* pfnIOCtl */
NULL,
/* pfnPowerOn */
NULL,
/* pfnReset */
NULL,
/* pfnSuspend */
NULL,
/* pfnResume */
NULL,
/* pfnAttach */
NULL,
/* pfnDetach */
NULL,
/* pfnPowerOff */
NULL,
/* pfnSoftReset */
NULL,
/* u32VersionEnd */
};
/* vi: set tabstop=4 shiftwidth=4 expandtab: */