UsbWebcamInterface.cpp revision d0eec04539061d14a7e51f492aea90fa5394615f
/* $Id$ */
/** @file
* UsbWebcamInterface - Driver Interface for USB Webcam emulation.
*/
/*
* Copyright (C) 2011-2013 Oracle Corporation
*
* Oracle Corporation confidential
* All rights reserved
*/
#define LOG_GROUP LOG_GROUP_USB_WEBCAM
#include "UsbWebcamInterface.h"
#include "ConsoleImpl.h"
#include "ConsoleVRDPServer.h"
typedef struct EMWEBCAMDRV *PEMWEBCAMDRV;
struct EMWEBCAMDRV
{
};
struct EMWEBCAMREMOTE
{
/* The remote identifier. */
/* The device identifier for the PDM device.*/
};
typedef struct EMWEBCAMREQCTX
{
void *pvUser;
void *pvUser,
const PDMIWEBCAM_CTRLHDR *pCtrl,
{
return pThis->pEmWebcam->SendControl(pThis, pvUser, u64DeviceId, (const VRDEVIDEOINCTRLHDR *)pCtrl, cbCtrl);
}
{
}
{
if (mpDrv)
{
}
}
{
if (mpRemote)
{
}
}
{
int rc = VINF_SUCCESS;
switch (u32Id)
{
{
/* Currently only one device is allowed. */
if (mpRemote)
{
AssertFailed();
break;
}
{
rc = VERR_NO_MEMORY;
break;
}
/* 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)
{
/* No need to tell the server by calling VideoInDeviceDetach because the server is telling. */
}
} break;
default:
AssertFailed();
break;
}
return;
}
{
LogFlowFunc(("rcRequest %Rrc %p %p %p %d\n",
if (RT_SUCCESS(rcRequest))
{
(const PDMIWEBCAM_DEVICEDESC *)pDeviceDesc,
}
else
{
}
}
{
LogFlowFunc(("rcRequest %Rrc %p %p %p %d\n",
(const PDMIWEBCAM_CTRLHDR *)pControl,
}
{
LogFlowFunc(("rcRequest %Rrc %p %p %d\n",
cbFrame);
}
{
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))
{
rc = mParent->consoleVRDPServer()->VideoInControl(pCtx, &mpRemote->deviceHandle, pControl, cbControl);
if (RT_FAILURE(rc))
{
}
}
return rc;
}
/* static */ DECLCALLBACK(void *) EmWebcam::drvQueryInterface(PPDMIBASE pInterface, const char *pszIID)
{
return NULL;
}
/* static */ DECLCALLBACK(int) EmWebcam::drvConstruct(PPDMDRVINS pDrvIns, PCFGMNODE pCfg, uint32_t fFlags)
{
LogFlow(("%s: iInstance/#d, pCfg:%p, fFlags:%x\n", __FUNCTION__, pDrvIns->iInstance, pCfg, fFlags));
("Configuration error: Not possible to attach anything to this driver!\n"),
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: */