Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
9aa70728
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9aa70728
编写于
12月 30, 2010
作者:
A
amenkov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6989702: sound native code compiler warnings
Reviewed-by: bae
上级
7a8f80f2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
45 addition
and
84 deletion
+45
-84
src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_CommonUtils.c
...m/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_CommonUtils.c
+32
-30
src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c
...com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c
+2
-2
src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c
...ative/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c
+7
-49
src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCMUtils.h
.../com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCMUtils.h
+2
-1
src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_Ports.c
...ive/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_Ports.c
+2
-2
未找到文件。
src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_CommonUtils.c
浏览文件 @
9aa70728
...
...
@@ -137,41 +137,43 @@ void getALSAVersion(char* buffer, int len) {
file
=
fopen
(
ALSA_VERSION_PROC_FILE
,
"r"
);
ALSAVersionString
[
0
]
=
0
;
if
(
file
)
{
fgets
(
ALSAVersionString
,
ALSAVersionString_LENGTH
,
file
);
// parse for version number
totalLen
=
strlen
(
ALSAVersionString
);
inVersionString
=
FALSE
;
len
=
0
;
curr
=
0
;
while
(
curr
<
totalLen
)
{
if
(
!
inVersionString
)
{
// is this char the beginning of a version string ?
if
(
ALSAVersionString
[
curr
]
>=
'0'
&&
ALSAVersionString
[
curr
]
<=
'9'
)
{
inVersionString
=
TRUE
;
if
(
NULL
!=
fgets
(
ALSAVersionString
,
ALSAVersionString_LENGTH
,
file
))
{
// parse for version number
totalLen
=
strlen
(
ALSAVersionString
);
inVersionString
=
FALSE
;
len
=
0
;
curr
=
0
;
while
(
curr
<
totalLen
)
{
if
(
!
inVersionString
)
{
// is this char the beginning of a version string ?
if
(
ALSAVersionString
[
curr
]
>=
'0'
&&
ALSAVersionString
[
curr
]
<=
'9'
)
{
inVersionString
=
TRUE
;
}
}
}
if
(
inVersionString
)
{
// the version string ends with white space
if
(
ALSAVersionString
[
curr
]
<=
32
)
{
break
;
}
if
(
curr
!=
len
)
{
// copy this char to the beginning of the string
ALSAVersionString
[
len
]
=
ALSAVersionString
[
curr
];
if
(
inVersionString
)
{
// the version string ends with white space
if
(
ALSAVersionString
[
curr
]
<=
32
)
{
break
;
}
if
(
curr
!=
len
)
{
// copy this char to the beginning of the string
ALSAVersionString
[
len
]
=
ALSAVersionString
[
curr
];
}
len
++
;
}
len
++
;
curr
++
;
}
curr
++
;
}
// remove trailing dots
while
((
len
>
0
)
&&
(
ALSAVersionString
[
len
-
1
]
==
'.'
))
{
len
--
;
// remove trailing dots
while
((
len
>
0
)
&&
(
ALSAVersionString
[
len
-
1
]
==
'.'
))
{
len
--
;
}
// null terminate
ALSAVersionString
[
len
]
=
0
;
}
// null terminate
ALSAVersionString
[
len
]
=
0
;
fclose
(
file
);
hasGottenALSAVersion
=
TRUE
;
}
hasGottenALSAVersion
=
TRUE
;
}
strncpy
(
buffer
,
ALSAVersionString
,
len
);
}
...
...
src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_MidiUtils.c
浏览文件 @
9aa70728
/*
* Copyright (c) 2003, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
10
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -372,7 +372,7 @@ INT32 openMidiDevice(snd_rawmidi_stream_t direction, INT32 deviceIndex,
snd_rawmidi_t
*
native_handle
;
snd_midi_event_t
*
event_parser
=
NULL
;
int
err
;
UINT32
deviceID
;
UINT32
deviceID
=
0
;
char
devicename
[
100
];
#ifdef ALSA_MIDI_USE_PLUGHW
int
usePlugHw
=
1
;
...
...
src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCM.c
浏览文件 @
9aa70728
/*
* Copyright (c) 2002, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 20
10
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -127,7 +127,7 @@ void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* cre
int
ret
;
int
sampleSizeInBytes
,
significantBits
,
isSigned
,
isBigEndian
,
enc
;
int
origSampleSizeInBytes
,
origSignificantBits
;
int
channels
,
minChannels
,
maxChannels
;
unsigned
int
channels
,
minChannels
,
maxChannels
;
int
rate
,
bitIndex
;
for
(
bitIndex
=
0
;
bitIndex
<=
MAX_BIT_INDEX
;
bitIndex
++
)
handledBits
[
bitIndex
]
=
FALSE
;
...
...
@@ -152,7 +152,6 @@ void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* cre
}
}
snd_pcm_hw_params_get_format_mask
(
hwParams
,
formatMask
);
#ifdef ALSA_PCM_NEW_HW_PARAMS_API
if
(
ret
==
0
)
{
ret
=
snd_pcm_hw_params_get_channels_min
(
hwParams
,
&
minChannels
);
if
(
ret
!=
0
)
{
...
...
@@ -165,13 +164,6 @@ void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* cre
ERROR1
(
"snd_pcm_hw_params_get_channels_max returned error %d
\n
"
,
ret
);
}
}
#else
minChannels
=
snd_pcm_hw_params_get_channels_min
(
hwParams
);
maxChannels
=
snd_pcm_hw_params_get_channels_max
(
hwParams
);
if
(
minChannels
>
maxChannels
)
{
ERROR2
(
"MinChannels=%d, maxChannels=%d
\n
"
,
minChannels
,
maxChannels
);
}
#endif
// since we queried the hw: device, for many soundcards, it will only
// report the maximum number of channels (which is the only way to talk
...
...
@@ -222,7 +214,7 @@ void DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* cre
}
else
{
for
(
channels
=
minChannels
;
channels
<=
maxChannels
;
channels
++
)
{
DAUDIO_AddAudioFormat
(
creator
,
significantBits
,
(
channels
<
0
)
?-
1
:
(
sampleSizeInBytes
*
channels
)
,
sampleSizeInBytes
*
channels
,
channels
,
rate
,
enc
,
isSigned
,
isBigEndian
);
}
...
...
@@ -254,7 +246,7 @@ typedef struct tag_AlsaPcmInfo {
snd_pcm_sw_params_t
*
swParams
;
int
bufferSizeInBytes
;
int
frameSize
;
// storage size in Bytes
int
periods
;
unsigned
int
periods
;
snd_pcm_uframes_t
periodSize
;
#ifdef GET_POSITION_METHOD2
// to be used exclusively by getBytePosition!
...
...
@@ -305,8 +297,8 @@ int setHWParams(AlsaPcmInfo* info,
int
channels
,
int
bufferSizeInFrames
,
snd_pcm_format_t
format
)
{
unsigned
int
rrate
;
int
ret
,
dir
,
periods
,
periodTime
;
unsigned
int
rrate
,
periodTime
,
periods
;
int
ret
,
dir
;
snd_pcm_uframes_t
alsaBufferSizeInFrames
=
(
snd_pcm_uframes_t
)
bufferSizeInFrames
;
/* choose all parameters */
...
...
@@ -335,12 +327,8 @@ int setHWParams(AlsaPcmInfo* info,
}
/* set the stream rate */
rrate
=
(
int
)
(
sampleRate
+
0
.
5
f
);
#ifdef ALSA_PCM_NEW_HW_PARAMS_API
dir
=
0
;
ret
=
snd_pcm_hw_params_set_rate_near
(
info
->
handle
,
info
->
hwParams
,
&
rrate
,
&
dir
);
#else
ret
=
snd_pcm_hw_params_set_rate_near
(
info
->
handle
,
info
->
hwParams
,
rrate
,
0
);
#endif
if
(
ret
<
0
)
{
ERROR2
(
"Rate %dHz not available for playback: %s
\n
"
,
(
int
)
(
sampleRate
+
0
.
5
f
),
snd_strerror
(
ret
));
return
FALSE
;
...
...
@@ -350,12 +338,7 @@ int setHWParams(AlsaPcmInfo* info,
return
FALSE
;
}
/* set the buffer time */
#ifdef ALSA_PCM_NEW_HW_PARAMS_API
ret
=
snd_pcm_hw_params_set_buffer_size_near
(
info
->
handle
,
info
->
hwParams
,
&
alsaBufferSizeInFrames
);
#else
ret
=
snd_pcm_hw_params_set_buffer_size_near
(
info
->
handle
,
info
->
hwParams
,
alsaBufferSizeInFrames
);
#endif
if
(
ret
<
0
)
{
ERROR2
(
"Unable to set buffer size to %d frames: %s
\n
"
,
(
int
)
alsaBufferSizeInFrames
,
snd_strerror
(
ret
));
...
...
@@ -366,12 +349,7 @@ int setHWParams(AlsaPcmInfo* info,
if
(
bufferSizeInFrames
>
1024
)
{
dir
=
0
;
periodTime
=
DEFAULT_PERIOD_TIME
;
#ifdef ALSA_PCM_NEW_HW_PARAMS_API
ret
=
snd_pcm_hw_params_set_period_time_near
(
info
->
handle
,
info
->
hwParams
,
&
periodTime
,
&
dir
);
#else
periodTime
=
snd_pcm_hw_params_set_period_time_near
(
info
->
handle
,
info
->
hwParams
,
periodTime
,
&
dir
);
ret
=
periodTime
;
#endif
if
(
ret
<
0
)
{
ERROR2
(
"Unable to set period time to %d: %s
\n
"
,
DEFAULT_PERIOD_TIME
,
snd_strerror
(
ret
));
return
FALSE
;
...
...
@@ -380,12 +358,7 @@ int setHWParams(AlsaPcmInfo* info,
/* set the period count for very small buffer sizes to 2 */
dir
=
0
;
periods
=
2
;
#ifdef ALSA_PCM_NEW_HW_PARAMS_API
ret
=
snd_pcm_hw_params_set_periods_near
(
info
->
handle
,
info
->
hwParams
,
&
periods
,
&
dir
);
#else
periods
=
snd_pcm_hw_params_set_periods_near
(
info
->
handle
,
info
->
hwParams
,
periods
,
&
dir
);
ret
=
periods
;
#endif
if
(
ret
<
0
)
{
ERROR2
(
"Unable to set period count to %d: %s
\n
"
,
/*periods*/
2
,
snd_strerror
(
ret
));
return
FALSE
;
...
...
@@ -421,12 +394,6 @@ int setSWParams(AlsaPcmInfo* info) {
ERROR1
(
"Unable to set avail min for playback: %s
\n
"
,
snd_strerror
(
ret
));
return
FALSE
;
}
/* align all transfers to 1 sample */
ret
=
snd_pcm_sw_params_set_xfer_align
(
info
->
handle
,
info
->
swParams
,
1
);
if
(
ret
<
0
)
{
ERROR1
(
"Unable to set transfer align: %s
\n
"
,
snd_strerror
(
ret
));
return
FALSE
;
}
/* write the parameters to the playback device */
ret
=
snd_pcm_sw_params
(
info
->
handle
,
info
->
swParams
);
if
(
ret
<
0
)
{
...
...
@@ -448,7 +415,6 @@ void* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource,
int
ret
=
0
;
AlsaPcmInfo
*
info
=
NULL
;
/* snd_pcm_uframes_t is 64 bit on 64-bit systems */
snd_pcm_uframes_t
alsaPeriodSize
=
0
;
snd_pcm_uframes_t
alsaBufferSizeInFrames
=
0
;
...
...
@@ -484,21 +450,13 @@ void* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource,
bufferSizeInBytes
/
frameSize
,
format
))
{
info
->
frameSize
=
frameSize
;
#ifdef ALSA_PCM_NEW_HW_PARAMS_API
ret
=
snd_pcm_hw_params_get_period_size
(
info
->
hwParams
,
&
alsaPeriodSize
,
&
dir
);
info
->
periodSize
=
(
int
)
alsaPeriodSize
;
ret
=
snd_pcm_hw_params_get_period_size
(
info
->
hwParams
,
&
info
->
periodSize
,
&
dir
);
if
(
ret
<
0
)
{
ERROR1
(
"ERROR: snd_pcm_hw_params_get_period: %s
\n
"
,
snd_strerror
(
ret
));
}
snd_pcm_hw_params_get_periods
(
info
->
hwParams
,
&
(
info
->
periods
),
&
dir
);
snd_pcm_hw_params_get_buffer_size
(
info
->
hwParams
,
&
alsaBufferSizeInFrames
);
info
->
bufferSizeInBytes
=
(
int
)
alsaBufferSizeInFrames
*
frameSize
;
#else
info
->
periodSize
=
snd_pcm_hw_params_get_period_size
(
info
->
hwParams
,
&
dir
);
info
->
periods
=
snd_pcm_hw_params_get_periods
(
info
->
hwParams
,
&
dir
);
info
->
bufferSizeInBytes
=
snd_pcm_hw_params_get_buffer_size
(
info
->
hwParams
)
*
frameSize
;
ret
=
0
;
#endif
TRACE3
(
" DAUDIO_Open: period size = %d frames, periods = %d. Buffer size: %d bytes.
\n
"
,
(
int
)
info
->
periodSize
,
info
->
periods
,
info
->
bufferSizeInBytes
);
}
...
...
src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_PCMUtils.h
浏览文件 @
9aa70728
/*
* Copyright (c) 2003, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
10
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -24,6 +24,7 @@
*/
// define this with a later version of ALSA than 0.9.0rc3
// (starting from 1.0.0 it became default behaviour)
#define ALSA_PCM_NEW_HW_PARAMS_API
#include <alsa/asoundlib.h>
#include "Utilities.h"
...
...
src/solaris/native/com/sun/media/sound/PLATFORM_API_LinuxOS_ALSA_Ports.c
浏览文件 @
9aa70728
/*
* Copyright (c) 2003, 20
07
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 20
10
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -380,7 +380,7 @@ void PORT_GetControls(void* id, INT32 portIndex, PortControlCreator* creator) {
void
*
controls
[
10
];
int
numControls
;
char
*
portName
;
int
isPlayback
;
int
isPlayback
=
0
;
int
isMono
;
int
isStereo
;
char
*
type
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录