view src/solaris/native/com/sun/media/sound/PLATFORM_API_SolarisOS_Utils.h @ 594:14f50aee4989

6754988: Update copyright year Summary: Update for files that have been modified starting July 2008 Reviewed-by: ohair, tbell
author xdono
date Thu, 02 Oct 2008 19:58:32 -0700
parents c7ab37f5976d
children 00cd9dc3c2b5
line wrap: on
line source
 * Copyright 2002-2008 Sun Microsystems, Inc.  All Rights Reserved.
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Sun designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Sun in the LICENSE file that accompanied this code.
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 * CA 95054 USA or visit if you need additional information or
 * have any questions.

#include <Utilities.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
/* does not work on Solaris 2.7 */
#include <sys/audio.h>
#include <sys/mixer.h>
#include <sys/types.h>
#ifndef __linux__
#include <stropts.h>
#include <sys/conf.h>
#include <sys/stat.h>
#include <unistd.h>


/* defines for Solaris 2.7
   #ifndef AUDIO_AUX1_OUT
   #define AUDIO_AUX1_OUT   (0x08)  // output to aux1 out
   #define AUDIO_AUX2_OUT   (0x10)  // output to aux2 out
   #define AUDIO_SPDIF_OUT  (0x20)  // output to SPDIF port
   #define AUDIO_AUX1_IN    (0x08)    // input from aux1 in
   #define AUDIO_AUX2_IN    (0x10)    // input from aux2 in
   #define AUDIO_SPDIF_IN   (0x20)    // input from SPDIF port

/* input from Codec inter. loopback */
#define AUDIO_CODEC_LOOPB_IN       (0x40)

#define MAX_NAME_LENGTH 300

typedef struct tag_AudioDevicePath {
    char path[MAX_NAME_LENGTH];
    ino_t st_ino; // inode number to detect duplicate devices
    dev_t st_dev; // device ID to detect duplicate audio devices
} AudioDevicePath;

typedef struct tag_AudioDeviceDescription {
    INT32 maxSimulLines;
    char path[MAX_NAME_LENGTH+1];
    char pathctl[MAX_NAME_LENGTH+4];
    char name[MAX_NAME_LENGTH+1];
    char vendor[MAX_NAME_LENGTH+1];
    char version[MAX_NAME_LENGTH+1];
    char description[MAX_NAME_LENGTH+1];
} AudioDeviceDescription;

int getAudioDeviceCount();

 * adPath is an array of AudioDevicePath structures
 * count contains initially the number of elements in adPath
 *       and will be set to the returned number of paths.
void getAudioDevices(AudioDevicePath* adPath, int* count);

 * fills adDesc from the audio device given in path
 * returns 0 if an error occured
 * if getNames is 0, only path and pathctl are filled
int getAudioDeviceDescription(char* path, AudioDeviceDescription* adDesc, int getNames);
int getAudioDeviceDescriptionByIndex(int index, AudioDeviceDescription* adDesc, int getNames);