Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
dd8a5649
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dd8a5649
编写于
9月 12, 2009
作者:
M
malc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
oss: poll mode handling
Signed-off-by:
N
malc
<
av1474@comtv.ru
>
上级
713a98f8
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
74 addition
and
5 deletion
+74
-5
audio/ossaudio.c
audio/ossaudio.c
+74
-5
未找到文件。
audio/ossaudio.c
浏览文件 @
dd8a5649
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include <sys/soundcard.h>
#include <sys/soundcard.h>
#endif
#endif
#include "qemu-common.h"
#include "qemu-common.h"
#include "qemu-char.h"
#include "audio.h"
#include "audio.h"
#define AUDIO_CAP "oss"
#define AUDIO_CAP "oss"
...
@@ -114,9 +115,36 @@ static void oss_anal_close (int *fdp)
...
@@ -114,9 +115,36 @@ static void oss_anal_close (int *fdp)
if
(
err
)
{
if
(
err
)
{
oss_logerr
(
errno
,
"Failed to close file(fd=%d)
\n
"
,
*
fdp
);
oss_logerr
(
errno
,
"Failed to close file(fd=%d)
\n
"
,
*
fdp
);
}
}
qemu_set_fd_handler
(
*
fdp
,
NULL
,
NULL
,
NULL
);
*
fdp
=
-
1
;
*
fdp
=
-
1
;
}
}
static
void
oss_helper_poll_out
(
void
*
opaque
)
{
(
void
)
opaque
;
audio_run
(
"oss_poll_out"
);
}
static
void
oss_helper_poll_in
(
void
*
opaque
)
{
(
void
)
opaque
;
audio_run
(
"oss_poll_in"
);
}
static
int
oss_poll_out
(
HWVoiceOut
*
hw
)
{
OSSVoiceOut
*
oss
=
(
OSSVoiceOut
*
)
hw
;
return
qemu_set_fd_handler
(
oss
->
fd
,
NULL
,
oss_helper_poll_out
,
NULL
);
}
static
int
oss_poll_in
(
HWVoiceIn
*
hw
)
{
OSSVoiceIn
*
oss
=
(
OSSVoiceIn
*
)
hw
;
return
qemu_set_fd_handler
(
oss
->
fd
,
oss_helper_poll_in
,
NULL
,
NULL
);
}
static
int
oss_write
(
SWVoiceOut
*
sw
,
void
*
buf
,
int
len
)
static
int
oss_write
(
SWVoiceOut
*
sw
,
void
*
buf
,
int
len
)
{
{
return
audio_pcm_sw_write
(
sw
,
buf
,
len
);
return
audio_pcm_sw_write
(
sw
,
buf
,
len
);
...
@@ -547,15 +575,26 @@ static int oss_init_out (HWVoiceOut *hw, struct audsettings *as)
...
@@ -547,15 +575,26 @@ static int oss_init_out (HWVoiceOut *hw, struct audsettings *as)
static
int
oss_ctl_out
(
HWVoiceOut
*
hw
,
int
cmd
,
...)
static
int
oss_ctl_out
(
HWVoiceOut
*
hw
,
int
cmd
,
...)
{
{
int
trig
;
int
trig
;
va_list
ap
;
int
poll_mode
;
OSSVoiceOut
*
oss
=
(
OSSVoiceOut
*
)
hw
;
OSSVoiceOut
*
oss
=
(
OSSVoiceOut
*
)
hw
;
if
(
!
oss
->
mmapped
)
{
va_start
(
ap
,
cmd
);
return
0
;
poll_mode
=
va_arg
(
ap
,
int
)
;
}
va_end
(
ap
);
switch
(
cmd
)
{
switch
(
cmd
)
{
case
VOICE_ENABLE
:
case
VOICE_ENABLE
:
ldebug
(
"enabling voice
\n
"
);
ldebug
(
"enabling voice
\n
"
);
if
(
poll_mode
&&
oss_poll_out
(
hw
))
{
poll_mode
=
0
;
}
hw
->
poll_mode
=
poll_mode
;
if
(
!
oss
->
mmapped
)
{
return
0
;
}
audio_pcm_info_clear_buf
(
&
hw
->
info
,
oss
->
pcm_buf
,
hw
->
samples
);
audio_pcm_info_clear_buf
(
&
hw
->
info
,
oss
->
pcm_buf
,
hw
->
samples
);
trig
=
PCM_ENABLE_OUTPUT
;
trig
=
PCM_ENABLE_OUTPUT
;
if
(
ioctl
(
oss
->
fd
,
SNDCTL_DSP_SETTRIGGER
,
&
trig
)
<
0
)
{
if
(
ioctl
(
oss
->
fd
,
SNDCTL_DSP_SETTRIGGER
,
&
trig
)
<
0
)
{
...
@@ -568,6 +607,15 @@ static int oss_ctl_out (HWVoiceOut *hw, int cmd, ...)
...
@@ -568,6 +607,15 @@ static int oss_ctl_out (HWVoiceOut *hw, int cmd, ...)
break
;
break
;
case
VOICE_DISABLE
:
case
VOICE_DISABLE
:
if
(
hw
->
poll_mode
)
{
qemu_set_fd_handler
(
oss
->
fd
,
NULL
,
NULL
,
NULL
);
hw
->
poll_mode
=
0
;
}
if
(
!
oss
->
mmapped
)
{
return
0
;
}
ldebug
(
"disabling voice
\n
"
);
ldebug
(
"disabling voice
\n
"
);
trig
=
0
;
trig
=
0
;
if
(
ioctl
(
oss
->
fd
,
SNDCTL_DSP_SETTRIGGER
,
&
trig
)
<
0
)
{
if
(
ioctl
(
oss
->
fd
,
SNDCTL_DSP_SETTRIGGER
,
&
trig
)
<
0
)
{
...
@@ -723,8 +771,29 @@ static int oss_read (SWVoiceIn *sw, void *buf, int size)
...
@@ -723,8 +771,29 @@ static int oss_read (SWVoiceIn *sw, void *buf, int size)
static
int
oss_ctl_in
(
HWVoiceIn
*
hw
,
int
cmd
,
...)
static
int
oss_ctl_in
(
HWVoiceIn
*
hw
,
int
cmd
,
...)
{
{
(
void
)
hw
;
va_list
ap
;
(
void
)
cmd
;
int
poll_mode
;
OSSVoiceIn
*
oss
=
(
OSSVoiceIn
*
)
hw
;
va_start
(
ap
,
cmd
);
poll_mode
=
va_arg
(
ap
,
int
);
va_end
(
ap
);
switch
(
cmd
)
{
case
VOICE_ENABLE
:
if
(
poll_mode
&&
oss_poll_in
(
hw
))
{
poll_mode
=
0
;
}
hw
->
poll_mode
=
poll_mode
;
break
;
case
VOICE_DISABLE
:
if
(
hw
->
poll_mode
)
{
hw
->
poll_mode
=
0
;
qemu_set_fd_handler
(
oss
->
fd
,
NULL
,
NULL
,
NULL
);
}
break
;
}
return
0
;
return
0
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录