VirtualBox

Changeset 58983 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Dec 4, 2015 2:15:30 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
104507
Message:

Audio: Added support for dynamically enabling/disabling host audio backends, more code for audio callback support (still disabled).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmaudioifs.h

    r58600 r58983  
    309309/** No flags being set. */
    310310#define PDMAUDIOSTRMSTS_FLAG_NONE            0
    311 /** Whether this stream General Enabled or disabled flag. */
     311/** Whether this stream is enabled or disabled. */
    312312#define PDMAUDIOSTRMSTS_FLAG_ENABLED         RT_BIT_32(0)
    313313/** Whether this stream has been paused or not. This also implies
     
    422422/** Pointer to a audio connector interface. */
    423423typedef struct PDMIAUDIOCONNECTOR *PPDMIAUDIOCONNECTOR;
     424
     425#ifdef VBOX_WITH_AUDIO_CALLBACKS
     426/**
     427 * Audio callback types. These are all kept generic as those
     428 * are used by all device emulations across all backends.
     429 */
     430typedef enum PDMAUDIOCALLBACKTYPE
     431{
     432    PDMAUDIOCALLBACKTYPE_GENERIC = 0,
     433    PDMAUDIOCALLBACKTYPE_INPUT,
     434    PDMAUDIOCALLBACKTYPE_OUTPUT
     435} PDMAUDIOCALLBACKTYPE;
     436
     437/**
     438 * Callback data for audio input.
     439 */
     440typedef struct PDMAUDIOCALLBACKDATAIN
     441{
     442    /** Input: How many bytes are availabe as input for passing
     443     *         to the device emulation. */
     444    uint32_t cbInAvail;
     445    /** Output: How many bytes have been read. */
     446    uint32_t cbOutRead;
     447} PDMAUDIOCALLBACKDATAIN, *PPDMAUDIOCALLBACKDATAIN;
     448
     449/**
     450 * Callback data for audio output.
     451 */
     452typedef struct PDMAUDIOCALLBACKDATAOUT
     453{
     454    /** Input:  How many bytes are free for the device emulation to write. */
     455    uint32_t cbInFree;
     456    /** Output: How many bytes were written by the device emulation. */
     457    uint32_t cbOutWritten;
     458} PDMAUDIOCALLBACKDATAOUT, *PPDMAUDIOCALLBACKDATAOUT;
     459
     460/**
     461 * Structure for keeping an audio callback.
     462 */
     463typedef struct PDMAUDIOCALLBACK
     464{
     465    RTLISTANCHOR          Node;
     466    PDMAUDIOCALLBACKTYPE  enmType;
     467    void                 *pvCtx;
     468    size_t                cbCtx;
     469    DECLR3CALLBACKMEMBER(int, pfnCallback, (PDMAUDIOCALLBACKTYPE enmType, void *pvCtx, size_t cbCtx, void *pvUser, size_t cbUser));
     470} PDMAUDIOCALLBACK, *PPDMAUDIOCALLBACK;
     471#endif
     472
    424473/**
    425474 * Audio connector interface (up).
     
    436485     * @param   pGstStrmIn      Pointer to guest input stream to write to.
    437486     * @param   pvBuf           Where to store the read data.
    438      * @param   cbSize          Number of bytes to read.
     487     * @param   cbBuf           Number of bytes to read.
    439488     * @param   pcbRead         Bytes of audio data read. Optional.
    440489     */
    441     DECLR3CALLBACKMEMBER(int, pfnRead, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn, void *pvBuf, uint32_t cbSize, uint32_t *pcbRead));
     490    DECLR3CALLBACKMEMBER(int, pfnRead, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMIN pGstStrmIn, void *pvBuf, uint32_t cbBuf, uint32_t *pcbRead));
    442491
    443492    /**
     
    448497     * @param   pGstStrmOut     Pointer to guest output stream to read from.
    449498     * @param   pvBuf           Audio data to be written.
    450      * @param   cbSize          Number of bytes to be written.
     499     * @param   cbBuf           Number of bytes to be written.
    451500     * @param   pcbWritten      Bytes of audio data written. Optional.
    452501     */
    453     DECLR3CALLBACKMEMBER(int, pfnWrite, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut, const void *pvBuf, uint32_t cbSize, uint32_t *pcbWritten));
     502    DECLR3CALLBACKMEMBER(int, pfnWrite, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOGSTSTRMOUT pGstStrmOut, const void *pvBuf, uint32_t cbBuf, uint32_t *pcbWritten));
    454503
    455504    /**
     
    568617    DECLR3CALLBACKMEMBER(int, pfnPlayOut, (PPDMIAUDIOCONNECTOR pInterface, uint32_t *pcSamplesPlayed));
    569618
     619#ifdef VBOX_WITH_AUDIO_CALLBACKS
     620    DECLR3CALLBACKMEMBER(int, pfnRegisterCallbacks, (PPDMIAUDIOCONNECTOR pInterface, PPDMAUDIOCALLBACK paCallbacks, size_t cCallbacks));
     621    DECLR3CALLBACKMEMBER(int, pfnCallback, (PPDMIAUDIOCONNECTOR pInterface, PDMAUDIOCALLBACKTYPE enmType, void *pvUser, size_t cbUser));
     622#endif
     623
    570624} PDMIAUDIOCONNECTOR;
    571625
     
    575629
    576630/**
    577  * Assign all needed interface callbacks for an audio backend.
     631 * Assigns all needed interface callbacks for an audio backend.
    578632 *
    579633 * @param   a_NamePrefix        The function name prefix.
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette