Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
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
Иван Мажукин
mpd
Commits
1cf7f3d8
Commit
1cf7f3d8
authored
Aug 10, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/Solaris: use class FileDescriptor
parent
9c9a9ccd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
SolarisOutputPlugin.cxx
src/output/plugins/SolarisOutputPlugin.cxx
+12
-15
No files found.
src/output/plugins/SolarisOutputPlugin.cxx
View file @
1cf7f3d8
...
...
@@ -21,7 +21,7 @@
#include "SolarisOutputPlugin.hxx"
#include "../OutputAPI.hxx"
#include "../Wrapper.hxx"
#include "system/
fd_util.h
"
#include "system/
FileDescriptor.hxx
"
#include "system/Error.hxx"
#include <sys/stropts.h>
...
...
@@ -58,7 +58,7 @@ class SolarisOutput {
/* configuration */
const
char
*
const
device
;
int
fd
;
FileDescriptor
fd
;
explicit
SolarisOutput
(
const
ConfigBlock
&
block
)
:
base
(
solaris_output_plugin
),
...
...
@@ -89,7 +89,7 @@ void
SolarisOutput
::
Open
(
AudioFormat
&
audio_format
)
{
struct
audio_info
info
;
int
ret
,
flags
;
int
ret
;
/* support only 16 bit mono/stereo for now; nothing else has
been tested */
...
...
@@ -97,23 +97,20 @@ SolarisOutput::Open(AudioFormat &audio_format)
/* open the device in non-blocking mode */
fd
=
open_cloexec
(
device
,
O_WRONLY
|
O_NONBLOCK
,
0
);
if
(
fd
<
0
)
if
(
!
fd
.
Open
(
device
,
O_WRONLY
|
O_NONBLOCK
))
throw
FormatErrno
(
"Failed to open %s"
,
device
);
/* restore blocking mode */
flags
=
fcntl
(
fd
,
F_GETFL
);
if
(
flags
>
0
&&
(
flags
&
O_NONBLOCK
)
!=
0
)
fcntl
(
fd
,
F_SETFL
,
flags
&
~
O_NONBLOCK
);
fd
.
SetBlocking
();
/* configure the audio device */
ret
=
ioctl
(
fd
,
AUDIO_GETINFO
,
&
info
);
ret
=
ioctl
(
fd
.
Get
()
,
AUDIO_GETINFO
,
&
info
);
if
(
ret
<
0
)
{
const
int
e
=
errno
;
close
(
fd
);
fd
.
Close
(
);
throw
MakeErrno
(
e
,
"AUDIO_GETINFO failed"
);
}
...
...
@@ -122,10 +119,10 @@ SolarisOutput::Open(AudioFormat &audio_format)
info
.
play
.
precision
=
16
;
info
.
play
.
encoding
=
AUDIO_ENCODING_LINEAR
;
ret
=
ioctl
(
fd
,
AUDIO_SETINFO
,
&
info
);
ret
=
ioctl
(
fd
.
Get
()
,
AUDIO_SETINFO
,
&
info
);
if
(
ret
<
0
)
{
const
int
e
=
errno
;
close
(
fd
);
fd
.
Close
(
);
throw
MakeErrno
(
e
,
"AUDIO_SETINFO failed"
);
}
}
...
...
@@ -133,13 +130,13 @@ SolarisOutput::Open(AudioFormat &audio_format)
void
SolarisOutput
::
Close
()
{
close
(
fd
);
fd
.
Close
(
);
}
size_t
SolarisOutput
::
Play
(
const
void
*
chunk
,
size_t
size
)
{
ssize_t
nbytes
=
write
(
fd
,
chunk
,
size
);
ssize_t
nbytes
=
fd
.
Write
(
chunk
,
size
);
if
(
nbytes
<=
0
)
throw
MakeErrno
(
"Write failed"
);
...
...
@@ -149,7 +146,7 @@ SolarisOutput::Play(const void *chunk, size_t size)
void
SolarisOutput
::
Cancel
()
{
ioctl
(
fd
,
I_FLUSH
);
ioctl
(
fd
.
Get
()
,
I_FLUSH
);
}
typedef
AudioOutputWrapper
<
SolarisOutput
>
Wrapper
;
...
...
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