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
6c8d86bb
Commit
6c8d86bb
authored
Sep 19, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/sndio: rename the "sio_hdl" variable to avoid clash with struct name
parent
b253a6b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
SndioOutputPlugin.cxx
src/output/plugins/SndioOutputPlugin.cxx
+15
-17
No files found.
src/output/plugins/SndioOutputPlugin.cxx
View file @
6c8d86bb
...
...
@@ -50,7 +50,7 @@ class SndioOutput {
AudioOutput
base
;
const
char
*
const
device
;
const
unsigned
buffer_time
;
/* in ms */
struct
sio_hdl
*
sio_
hdl
;
struct
sio_hdl
*
hdl
;
public
:
SndioOutput
(
const
ConfigBlock
&
block
);
...
...
@@ -80,16 +80,14 @@ SndioOutput::Create(const ConfigBlock &block)
static
bool
sndio_test_default_device
()
{
struct
sio_hdl
*
sio_hdl
;
sio_hdl
=
sio_open
(
SIO_DEVANY
,
SIO_PLAY
,
0
);
if
(
!
sio_hdl
)
{
auto
*
hdl
=
sio_open
(
SIO_DEVANY
,
SIO_PLAY
,
0
);
if
(
!
hdl
)
{
FormatError
(
sndio_output_domain
,
"Error opening default sndio device"
);
return
false
;
}
sio_close
(
sio_
hdl
);
sio_close
(
hdl
);
return
true
;
}
...
...
@@ -99,8 +97,8 @@ SndioOutput::Open(AudioFormat &audio_format)
struct
sio_par
par
;
unsigned
bits
,
rate
,
chans
;
sio_
hdl
=
sio_open
(
device
,
SIO_PLAY
,
0
);
if
(
!
sio_
hdl
)
hdl
=
sio_open
(
device
,
SIO_PLAY
,
0
);
if
(
!
hdl
)
throw
std
::
runtime_error
(
"Failed to open default sndio device"
);
switch
(
audio_format
.
format
)
{
...
...
@@ -130,9 +128,9 @@ SndioOutput::Open(AudioFormat &audio_format)
par
.
le
=
SIO_LE_NATIVE
;
par
.
appbufsz
=
rate
*
buffer_time
/
1000
;
if
(
!
sio_setpar
(
sio_
hdl
,
&
par
)
||
!
sio_getpar
(
sio_
hdl
,
&
par
))
{
sio_close
(
sio_
hdl
);
if
(
!
sio_setpar
(
hdl
,
&
par
)
||
!
sio_getpar
(
hdl
,
&
par
))
{
sio_close
(
hdl
);
throw
std
::
runtime_error
(
"Failed to set/get audio params"
);
}
...
...
@@ -142,12 +140,12 @@ SndioOutput::Open(AudioFormat &audio_format)
par
.
pchan
!=
chans
||
par
.
sig
!=
1
||
par
.
le
!=
SIO_LE_NATIVE
)
{
sio_close
(
sio_
hdl
);
sio_close
(
hdl
);
throw
std
::
runtime_error
(
"Requested audio params cannot be satisfied"
);
}
if
(
!
sio_start
(
sio_
hdl
))
{
sio_close
(
sio_
hdl
);
if
(
!
sio_start
(
hdl
))
{
sio_close
(
hdl
);
throw
std
::
runtime_error
(
"Failed to start audio device"
);
}
}
...
...
@@ -155,7 +153,7 @@ SndioOutput::Open(AudioFormat &audio_format)
void
SndioOutput
::
Close
()
{
sio_close
(
sio_
hdl
);
sio_close
(
hdl
);
}
size_t
...
...
@@ -163,8 +161,8 @@ SndioOutput::Play(const void *chunk, size_t size)
{
size_t
n
;
n
=
sio_write
(
sio_
hdl
,
chunk
,
size
);
if
(
n
==
0
&&
sio_eof
(
sio_
hdl
)
!=
0
)
n
=
sio_write
(
hdl
,
chunk
,
size
);
if
(
n
==
0
&&
sio_eof
(
hdl
)
!=
0
)
throw
std
::
runtime_error
(
"sndio write failed"
);
return
n
;
}
...
...
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