Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
8d133f54
Commit
8d133f54
authored
Oct 10, 2011
by
Andrew Eikum
Committed by
Alexandre Julliard
Oct 11, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wineoss.drv: Trim the sub-device part of the device path.
parent
b0652dd8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
10 deletions
+48
-10
mmdevdrv.c
dlls/wineoss.drv/mmdevdrv.c
+48
-10
No files found.
dlls/wineoss.drv/mmdevdrv.c
View file @
8d133f54
...
...
@@ -119,6 +119,7 @@ struct ACImpl {
int
fd
;
oss_audioinfo
ai
;
char
devnode
[
OSS_DEVNODE_SIZE
];
BOOL
initted
,
playing
;
UINT64
written_frames
;
...
...
@@ -281,10 +282,34 @@ int WINAPI AUDDRV_GetPriority(void)
return
Priority_Preferred
;
}
static
const
char
*
oss_clean_devnode
(
const
char
*
devnode
)
{
static
char
ret
[
OSS_DEVNODE_SIZE
];
const
char
*
dot
,
*
slash
;
size_t
len
;
dot
=
strrchr
(
devnode
,
'.'
);
if
(
!
dot
)
return
devnode
;
slash
=
strrchr
(
devnode
,
'/'
);
if
(
slash
&&
dot
<
slash
)
return
devnode
;
len
=
dot
-
devnode
;
memcpy
(
ret
,
devnode
,
len
);
ret
[
len
]
=
'\0'
;
return
ret
;
}
static
UINT
get_default_index
(
EDataFlow
flow
,
char
**
keys
,
UINT
num
)
{
int
fd
=
-
1
,
err
,
i
;
oss_audioinfo
ai
;
const
char
*
devnode
;
if
(
flow
==
eRender
)
fd
=
open
(
"/dev/dsp"
,
O_WRONLY
);
...
...
@@ -306,8 +331,9 @@ static UINT get_default_index(EDataFlow flow, char **keys, UINT num)
close
(
fd
);
TRACE
(
"Default devnode: %s
\n
"
,
ai
.
devnode
);
devnode
=
oss_clean_devnode
(
ai
.
devnode
);
for
(
i
=
0
;
i
<
num
;
++
i
)
if
(
!
strcmp
(
ai
.
devnode
,
keys
[
i
]))
if
(
!
strcmp
(
devnode
,
keys
[
i
]))
return
i
;
WARN
(
"Couldn't find default device! Choosing first.
\n
"
);
...
...
@@ -317,7 +343,7 @@ static UINT get_default_index(EDataFlow flow, char **keys, UINT num)
HRESULT
WINAPI
AUDDRV_GetEndpointIDs
(
EDataFlow
flow
,
WCHAR
***
ids
,
char
***
keys
,
UINT
*
num
,
UINT
*
def_index
)
{
int
i
,
mixer_fd
;
int
i
,
j
,
mixer_fd
;
oss_sysinfo
sysinfo
;
static
int
print_once
=
0
;
...
...
@@ -365,6 +391,7 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, char ***keys,
*
num
=
0
;
for
(
i
=
0
;
i
<
sysinfo
.
numaudios
;
++
i
){
oss_audioinfo
ai
=
{
0
};
const
char
*
devnode
;
int
fd
;
ai
.
dev
=
i
;
...
...
@@ -374,13 +401,22 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, char ***keys,
continue
;
}
devnode
=
oss_clean_devnode
(
ai
.
devnode
);
/* check for duplicates */
for
(
j
=
0
;
j
<
*
num
;
++
j
)
if
(
!
strcmp
(
devnode
,
(
*
keys
)[
j
]))
break
;
if
(
j
!=
*
num
)
continue
;
if
(
flow
==
eRender
)
fd
=
open
(
ai
.
devnode
,
O_WRONLY
,
0
);
fd
=
open
(
devnode
,
O_WRONLY
,
0
);
else
fd
=
open
(
ai
.
devnode
,
O_RDONLY
,
0
);
fd
=
open
(
devnode
,
O_RDONLY
,
0
);
if
(
fd
<
0
){
WARN
(
"Opening device
\"
%s
\"
failed, pretending it doesn't exist: %d (%s)
\n
"
,
ai
.
devnode
,
errno
,
strerror
(
errno
));
devnode
,
errno
,
strerror
(
errno
));
continue
;
}
close
(
fd
);
...
...
@@ -390,7 +426,7 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, char ***keys,
size_t
len
;
(
*
keys
)[
*
num
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
ai
.
devnode
)
+
1
);
strlen
(
devnode
)
+
1
);
if
(
!
(
*
keys
)[
*
num
]){
for
(
i
=
0
;
i
<
*
num
;
++
i
){
HeapFree
(
GetProcessHeap
(),
0
,
(
*
ids
)[
i
]);
...
...
@@ -401,7 +437,7 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, char ***keys,
close
(
mixer_fd
);
return
E_OUTOFMEMORY
;
}
strcpy
((
*
keys
)[
*
num
],
ai
.
devnode
);
strcpy
((
*
keys
)[
*
num
],
devnode
);
len
=
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
ai
.
name
,
-
1
,
NULL
,
0
);
(
*
ids
)[
*
num
]
=
HeapAlloc
(
GetProcessHeap
(),
0
,
...
...
@@ -468,6 +504,8 @@ HRESULT WINAPI AUDDRV_GetAudioEndpoint(char *devnode, IMMDevice *dev,
return
E_FAIL
;
}
strcpy
(
This
->
devnode
,
devnode
);
TRACE
(
"OSS audioinfo:
\n
"
);
TRACE
(
"devnode: %s
\n
"
,
This
->
ai
.
devnode
);
TRACE
(
"name: %s
\n
"
,
This
->
ai
.
name
);
...
...
@@ -1100,12 +1138,12 @@ static HRESULT WINAPI AudioClient_IsFormatSupported(IAudioClient *iface,
dump_fmt
(
pwfx
);
if
(
This
->
dataflow
==
eRender
)
fd
=
open
(
This
->
ai
.
devnode
,
O_WRONLY
,
0
);
fd
=
open
(
This
->
devnode
,
O_WRONLY
,
0
);
else
if
(
This
->
dataflow
==
eCapture
)
fd
=
open
(
This
->
ai
.
devnode
,
O_RDONLY
,
0
);
fd
=
open
(
This
->
devnode
,
O_RDONLY
,
0
);
if
(
fd
<
0
){
ERR
(
"Unable to open device %s: %d (%s)
\n
"
,
This
->
ai
.
devnode
,
errno
,
ERR
(
"Unable to open device %s: %d (%s)
\n
"
,
This
->
devnode
,
errno
,
strerror
(
errno
));
return
AUDCLNT_E_DEVICE_INVALIDATED
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment