src/java.desktop/solaris/native/libjsound/PLATFORM_API_SolarisOS_Utils.h
author ihse
Fri, 23 Mar 2018 09:51:02 +0100
changeset 49289 148e29df1644
parent 47216 src/java.desktop/unix/native/libjsound/PLATFORM_API_SolarisOS_Utils.h@71c04702a3d5
permissions -rw-r--r--
8071469: Cleanup include and exclude of sound native libraries Reviewed-by: amenkov, erikj
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 21278
diff changeset
     2
 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1247
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include <Utilities.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include <string.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include <stdlib.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include <fcntl.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/* does not work on Solaris 2.7 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#include <sys/audio.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include <sys/mixer.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#include <sys/types.h>
1165
4e62e945f4eb 6746415: The include file stropts.h is not available in Fedora 9 (STREAMS Kernel Extension?)
ohair
parents: 2
diff changeset
    34
#ifndef __linux__
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include <stropts.h>
1165
4e62e945f4eb 6746415: The include file stropts.h is not available in Fedora 9 (STREAMS Kernel Extension?)
ohair
parents: 2
diff changeset
    36
#endif
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#include <sys/conf.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#include <sys/stat.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#include <unistd.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#ifndef PLATFORM_API_SOLARISOS_UTILS_H_INCLUDED
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#define PLATFORM_API_SOLARISOS_UTILS_H_INCLUDED
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
/* defines for Solaris 2.7
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
   #ifndef AUDIO_AUX1_OUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
   #define AUDIO_AUX1_OUT   (0x08)  // output to aux1 out
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
   #define AUDIO_AUX2_OUT   (0x10)  // output to aux2 out
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
   #define AUDIO_SPDIF_OUT  (0x20)  // output to SPDIF port
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
   #define AUDIO_AUX1_IN    (0x08)    // input from aux1 in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
   #define AUDIO_AUX2_IN    (0x10)    // input from aux2 in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
   #define AUDIO_SPDIF_IN   (0x20)    // input from SPDIF port
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
   #endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
/* input from Codec inter. loopback */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
#ifndef AUDIO_CODEC_LOOPB_IN
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
#define AUDIO_CODEC_LOOPB_IN       (0x40)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
#define MAX_NAME_LENGTH 300
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
typedef struct tag_AudioDevicePath {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    char path[MAX_NAME_LENGTH];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    ino_t st_ino; // inode number to detect duplicate devices
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    dev_t st_dev; // device ID to detect duplicate audio devices
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
} AudioDevicePath;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
typedef struct tag_AudioDeviceDescription {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    INT32 maxSimulLines;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    char path[MAX_NAME_LENGTH+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    char pathctl[MAX_NAME_LENGTH+4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    char name[MAX_NAME_LENGTH+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    char vendor[MAX_NAME_LENGTH+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    char version[MAX_NAME_LENGTH+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    char description[MAX_NAME_LENGTH+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
} AudioDeviceDescription;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
int getAudioDeviceCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * adPath is an array of AudioDevicePath structures
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * count contains initially the number of elements in adPath
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 *       and will be set to the returned number of paths.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
void getAudioDevices(AudioDevicePath* adPath, int* count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * fills adDesc from the audio device given in path
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 5506
diff changeset
    90
 * returns 0 if an error occurred
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * if getNames is 0, only path and pathctl are filled
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
int getAudioDeviceDescription(char* path, AudioDeviceDescription* adDesc, int getNames);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
int getAudioDeviceDescriptionByIndex(int index, AudioDeviceDescription* adDesc, int getNames);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
#endif // PLATFORM_API_SOLARISOS_UTILS_H_INCLUDED