VirtualBox

Changeset 5063 in vbox for trunk/src/VBox/Devices/Audio


Ignore:
Timestamp:
Sep 26, 2007 6:03:09 PM (17 years ago)
Author:
vboxsync
Message:

Only load the ALSA driver if ALSA audio is selected for the VM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/audio.c

    r5050 r5063  
    15561556        for (i = 0; i < sizeof (drvtab) / sizeof (drvtab[0]); i++) {
    15571557            /* The ALSA entry can be null if we couldn't load the library */
    1558             if (drvtab[i] != NULL)
    1559             {
     1558            if (drvtab[i] != NULL) {
    15601559                if (!strcmp (drvname, drvtab[i]->name)) {
    15611560                    done = !audio_driver_init (s, drvtab[i]);
     
    15731572    if (!done) {
    15741573        for (i = 0; !done && i < sizeof (drvtab) / sizeof (drvtab[0]); i++) {
    1575             if (drvtab[i]->can_be_default) {
    1576                 LogRel(("Audio: Initialization of driver '%s' failed, trying '%s'.\n",
    1577                        drvname, drvtab[i]->name));
    1578                 drvname = drvtab[i]->name;
    1579                 done = !audio_driver_init (s, drvtab[i]);
     1574            if (drvtab[i] != NULL) {
     1575                if (drvtab[i]->can_be_default) {
     1576                    LogRel(("Audio: Initialization of driver '%s' failed, trying '%s'.\n",
     1577                           drvname, drvtab[i]->name));
     1578                    drvname = drvtab[i]->name;
     1579                    done = !audio_driver_init (s, drvtab[i]);
     1580                }
    15801581            }
    15811582        }
     
    18791880    LogFlow(("drvAUDIOConstruct:\n"));
    18801881    /*
    1881      * Load the ALSA driver if needed
    1882      */
    1883 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_ALSA)
    1884     Log2(("Loading ALSA library %s\n", VBOX_LIB_ALSA));
    1885     rc = (RTLdrLoad(VBOX_LIB_ALSA, &hLibVBoxAlsa));
    1886     if (RT_FAILURE(rc))
    1887     {
    1888         Log(("Failed to load ALSA library %s.  Reason: %Rrc\n", VBOX_LIB_ALSA, rc));
    1889     }
    1890     else
    1891     {
    1892         rc = RTLdrGetSymbol(hLibVBoxAlsa, "alsa_audio_driver", (void **) &drvtab[1]);
    1893         if (RT_FAILURE(rc))
    1894         {
    1895             Log(("Failed to get symbol \"alsa_audio_driver\" from library %s.  Reason: %Rrc\n",
    1896                  VBOX_LIB_ALSA, rc));
    1897             drvtab[1] = NULL;
    1898         }
    1899     }
    1900 #endif
    1901     /*
    19021882     * Validate the config.
    19031883     */
     
    19191899    if (VBOX_FAILURE (rc))
    19201900        return rc;
     1901
     1902#if defined(RT_OS_LINUX) && defined(VBOX_WITH_ALSA)
     1903    /*
     1904     * Load the ALSA driver if needed.  This is a hack to remove the
     1905     * hard dependency on libasound.so.
     1906     */
     1907    if (0 == strcmp(drvname, "alsa")) {
     1908        Log2(("Loading ALSA library %s\n", VBOX_LIB_ALSA));
     1909        rc = (RTLdrLoad(VBOX_LIB_ALSA, &hLibVBoxAlsa));
     1910        if (RT_FAILURE(rc)) {
     1911            Log(("Failed to load ALSA library %s.  Reason: %Rrc\n", VBOX_LIB_ALSA, rc));
     1912        } else {
     1913            rc = RTLdrGetSymbol(hLibVBoxAlsa, "alsa_audio_driver", (void **) &drvtab[1]);
     1914            if (RT_FAILURE(rc)) {
     1915                Log(("Failed to get symbol \"alsa_audio_driver\" from library %s.  Reason: %Rrc\n",
     1916                     VBOX_LIB_ALSA, rc));
     1917                drvtab[1] = NULL;
     1918            }
     1919        }
     1920    }
     1921#endif
    19211922
    19221923    rc = AUD_init (pDrvIns, drvname);
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