VirtualBox

Changeset 53523 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Dec 12, 2014 1:46:29 PM (10 years ago)
Author:
vboxsync
Message:

PDM/Audio: Add ALSA backend (work in progress).

Location:
trunk/src/VBox
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DrvHostOSSAudio.cpp

    r53511 r53523  
    6868{
    6969    /** Note: Always must come first! */
    70     PDMAUDIOHSTSTRMIN  hw;
     70    PDMAUDIOHSTSTRMIN  pStreamIn;
    7171    int                hFile;
    7272    int                cFragments;
     
    7979{
    8080    /** Note: Always must come first! */
    81     PDMAUDIOHSTSTRMOUT  hw;
     81    PDMAUDIOHSTSTRMOUT  pStreamOut;
    8282    int                 hFile;
    8383    int                 cFragments;
     
    204204}
    205205
    206 static void drvHostOSSAudioClose(int *phFile)
    207 {
    208     if (!phFile)
    209         return;
    210 
    211     if (*phFile)
    212     {
    213         if (close(*phFile))
    214             LogRel(("Audio: Closing descriptor failed: %s\n",
    215                     strerror(errno)));
    216         else
    217             *phFile = -1;
     206static int drvHostOSSAudioClose(int *phFile)
     207{
     208    if (!phFile || !*phFile)
     209        return VINF_SUCCESS;
     210
     211    int rc;
     212    if (close(*phFile))
     213    {
     214        LogRel(("Audio: Closing descriptor failed: %s\n",
     215                strerror(errno)));
     216        rc = VERR_GENERAL_FAILURE; /** @todo */
    218217    }
     218    else
     219    {
     220        *phFile = -1;
     221        rc = VINF_SUCCESS;
     222    }
     223
     224    return rc;
    219225}
    220226
     
    232238    do
    233239    {
    234         const char *pszDSP = fIn ? s_OSSConf.devpath_in : s_OSSConf.devpath_out;
    235         if (!pszDSP)
    236         {
    237             LogRel(("Audio: Invalid or no %s DSP set\n",
     240        const char *pszDev = fIn ? s_OSSConf.devpath_in : s_OSSConf.devpath_out;
     241        if (!pszDev)
     242        {
     243            LogRel(("Audio: Invalid or no %s device name set\n",
    238244                    fIn ? "input" : "output"));
    239245            rc = VERR_INVALID_PARAMETER;
     
    241247        }
    242248
    243         hFile = open(pszDSP, (fIn ? O_RDONLY : O_WRONLY) | O_NONBLOCK);
    244         if (!hFile)
    245         {
    246             LogRel(("Audio: Failed to open %s: %s\n", pszDSP, strerror(errno)));
     249        hFile = open(pszDev, (fIn ? O_RDONLY : O_WRONLY) | O_NONBLOCK);
     250        if (hFile == -1)
     251        {
     252            LogRel(("Audio: Failed to open %s: %s\n", pszDev, strerror(errno)));
    247253            rc = RTErrConvertFromErrno(errno);
    248254            break;
  • trunk/src/VBox/Devices/Makefile.kmk

    r53442 r53523  
    529529
    530530  ifeq ($(KBUILD_TARGET),linux)
    531    VBoxDD_SOURCES  += \
    532                 Audio/DrvHostOssAudio.cpp
     531   VBoxDD_SOURCES += \
     532                Audio/DrvHostOSSAudio.cpp
     533
    533534   ifdef VBOX_WITH_PULSE
    534535    VBoxDD_DEFS    += VBOX_WITH_PULSE
     
    539540
    540541   ifdef VBOX_WITH_ALSA
    541     VBoxDD_DEFS.linux    += VBOX_WITH_ALSA
    542     VBoxDD_SOURCES.linux += \
    543         Audio/DrvHostAlsaAudio.cpp \
    544         Audio/alsa_stubs.c
     542    VBoxDD_DEFS    += VBOX_WITH_ALSA
     543    VBoxDD_SOURCES += \
     544                Audio/DrvHostALSAAudio.cpp \
     545                Audio/alsa_stubs.c
    545546   endif
    546547  endif
     
    548549  ifeq ($(KBUILD_TARGET),freebsd)
    549550   VBoxDD_SOURCES  += \
    550                 Audio/DrvHostOssAudio.cpp
     551                Audio/DrvHostOSSAudio.cpp
    551552   ifdef VBOX_WITH_PULSE
    552553    VBoxDD_DEFS    += VBOX_WITH_PULSE
  • trunk/src/VBox/Devices/build/VBoxDD.cpp

    r53442 r53523  
    125125    if (RT_FAILURE(rc))
    126126        return rc;
    127 #ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    128     //rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioVRDE);
    129     //if (RT_FAILURE(rc))
    130     //    return rc;
    131 #else
     127#ifndef VBOX_WITH_PDM_AUDIO_DRIVER
    132128    rc = pCallbacks->pfnRegister(pCallbacks, &g_DeviceAudioSniffer);
    133129    if (RT_FAILURE(rc))
     
    296292    if (RT_FAILURE(rc))
    297293        return rc;
     294    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostALSAAudio);
     295    if (RT_FAILURE(rc))
     296        return rc;   
     297    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostOSSAudio);
     298    if (RT_FAILURE(rc))
     299        return rc;   
    298300# endif
    299301# if defined(RT_OS_FREEBSD)
    300     rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostOssAudio);
     302    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostOSSAudio);
    301303    if (RT_FAILURE(rc))
    302304        return rc;
     
    308310# endif
    309311# if defined(RT_OS_SOLARIS)
     312    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostOSSAudio);
     313    if (RT_FAILURE(rc))
     314        return rc;   
    310315    rc = pCallbacks->pfnRegister(pCallbacks, &g_DrvHostSolAudio);
    311316    if (RT_FAILURE(rc))
  • trunk/src/VBox/Devices/build/VBoxDD.h

    r53442 r53523  
    125125# if defined(RT_OS_LINUX)
    126126extern const PDMDRVREG g_DrvHostPulseAudio;
     127extern const PDMDRVREG g_DrvHostALSAAudio;
     128extern const PDMDRVREG g_DrvHostOSSAudio;
    127129# endif
    128130# if defined(RT_OS_DARWIN)
     
    130132# endif
    131133# if defined(RT_OS_SOLARIS)
     134extern const PDMDRVREG g_DrvHostOSSAudio;
    132135extern const PDMDRVREG g_DrvHostSolAudio;
    133136# endif
    134137# if defined(RT_OS_FREEBSD)
    135 extern const PDMDRVREG g_DrvHostOssAudio;
     138extern const PDMDRVREG g_DrvHostOSSAudio;
    136139# endif
    137140#endif
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r53486 r53523  
    27212721                {
    27222722# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    2723                     InsertConfigString(pLunL1, "Driver", "AlsaAudio");
     2723                    InsertConfigString(pLunL1, "Driver", "ALSAAudio");
    27242724# else
    27252725                    InsertConfigString(pCfg, "AudioDriver", "alsa");
     
    27432743                {
    27442744# ifdef VBOX_WITH_PDM_AUDIO_DRIVER
    2745 //                    #error "Port OSS audio backend!" /** @todo Port OSS driver. */
     2745                    InsertConfigString(pLunL1, "Driver", "OSSAudio");
    27462746# else
    27472747                    InsertConfigString(pCfg, "AudioDriver", "ossaudio");
Note: See TracChangeset for help on using the changeset viewer.

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