AudioSnifferInterface.cpp revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
/** @file
*
* VirtualBox Driver Interface to Audio Sniffer device
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* 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 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.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
#include "AudioSnifferInterface.h"
#include "ConsoleImpl.h"
#include "ConsoleVRDPServer.h"
#include "Logging.h"
//
// defines
//
//
// globals
//
/**
* Audio Sniffer driver instance data.
*/
typedef struct DRVAUDIOSNIFFER
{
/** Pointer to the Audio Sniffer object. */
/** Pointer to the driver instance structure. */
/** Our VMM device connector interface. */
/** Converts PDMIAUDIOSNIFFERCONNECTOR pointer to a DRVAUDIOSNIFFER pointer. */
#define PDMIAUDIOSNIFFERCONNECTOR_2_MAINAUDIOSNIFFER(pInterface) ( (PDRVAUDIOSNIFFER) ((uintptr_t)pInterface - RT_OFFSETOF(DRVAUDIOSNIFFER, Connector)) )
//
// constructor / destructor
//
{
}
{
if (mpDrv)
{
}
}
{
}
//
// public methods
//
DECLCALLBACK(void) iface_AudioSamplesOut (PPDMIAUDIOSNIFFERCONNECTOR pInterface, void *pvSamples, uint32_t cSamples,
{
/*
* Just call the VRDP server with the data.
*/
pDrv->pAudioSniffer->getParent()->consoleVRDPServer()->SendAudioSamples(pvSamples, cSamples, format);
}
DECLCALLBACK(void) iface_AudioVolumeOut (PPDMIAUDIOSNIFFERCONNECTOR pInterface, uint16_t left, uint16_t right)
{
/*
* Just call the VRDP server with the data.
*/
}
/**
* Queries an interface to the driver.
*
* @returns Pointer to interface.
* @returns NULL if the interface was not supported by the driver.
* @param pInterface Pointer to this interface structure.
* @param enmInterface The requested interface identification.
*/
DECLCALLBACK(void *) AudioSniffer::drvQueryInterface(PPDMIBASE pInterface, PDMINTERFACE enmInterface)
{
switch (enmInterface)
{
case PDMINTERFACE_BASE:
default:
return NULL;
}
}
/**
* Destruct a Audio Sniffer driver instance.
*
* @returns VBox status.
* @param pDrvIns The driver instance data.
*/
{
if (pData->pAudioSniffer)
{
}
}
/**
* Construct a AudioSniffer driver instance.
*
* @returns VBox status.
* @param pDrvIns The driver instance data.
* If the registration structure is needed, pDrvIns->pDrvReg points to it.
* @param pCfgHandle Configuration node handle for the driver. Use this to obtain the configuration
* of the driver instance. It's also found in pDrvIns->pCfgHandle, but like
* iInstance it's expected to be used a bit in this function.
*/
{
/*
* Validate configuration.
*/
{
}
if (rc != VERR_PDM_NO_ATTACHED_DRIVER)
{
AssertMsgFailed(("Configuration error: Not possible to attach anything to this driver!\n"));
return VERR_PDM_DRVINS_NO_ATTACH;
}
/*
* IBase.
*/
/* Audio Sniffer connector. */
/*
*/
pData->pUpPort = (PPDMIAUDIOSNIFFERPORT)pDrvIns->pUpBase->pfnQueryInterface(pDrvIns->pUpBase, PDMINTERFACE_AUDIO_SNIFFER_PORT);
{
AssertMsgFailed(("Configuration error: No Audio Sniffer port interface above!\n"));
return VERR_PDM_MISSING_INTERFACE_ABOVE;
}
/*
* Get the Console object pointer and update the mpDrv member.
*/
void *pv;
if (VBOX_FAILURE(rc))
{
return rc;
}
return VINF_SUCCESS;
}
/**
* Audio Sniffer driver registration record.
*/
{
/* u32Version */
/* szDriverName */
"MainAudioSniffer",
/* pszDescription */
"Main Audio Sniffer driver (Main as in the API).",
/* fFlags */
/* fClass. */
/* cMaxInstances */
~0,
/* cbInstance */
sizeof(DRVAUDIOSNIFFER),
/* pfnConstruct */
/* pfnDestruct */
/* pfnIOCtl */
NULL,
/* pfnPowerOn */
NULL,
/* pfnReset */
NULL,
/* pfnSuspend */
NULL,
/* pfnResume */
NULL,
/* pfnDetach */
};