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
575a5bd0
Commit
575a5bd0
authored
Jan 09, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/null: move functions into the struct
parent
ae4c189e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
75 deletions
+47
-75
NullOutputPlugin.cxx
src/output/plugins/NullOutputPlugin.cxx
+47
-75
No files found.
src/output/plugins/NullOutputPlugin.cxx
View file @
575a5bd0
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include "config.h"
#include "config.h"
#include "NullOutputPlugin.hxx"
#include "NullOutputPlugin.hxx"
#include "../OutputAPI.hxx"
#include "../OutputAPI.hxx"
#include "../Wrapper.hxx"
#include "../Timer.hxx"
#include "../Timer.hxx"
struct
NullOutput
{
struct
NullOutput
{
...
@@ -35,104 +36,75 @@ struct NullOutput {
...
@@ -35,104 +36,75 @@ struct NullOutput {
bool
Initialize
(
const
config_param
&
param
,
Error
&
error
)
{
bool
Initialize
(
const
config_param
&
param
,
Error
&
error
)
{
return
base
.
Configure
(
param
,
error
);
return
base
.
Configure
(
param
,
error
);
}
}
};
static
AudioOutput
*
null_init
(
const
config_param
&
param
,
Error
&
error
)
{
NullOutput
*
nd
=
new
NullOutput
();
if
(
!
nd
->
Initialize
(
param
,
error
))
{
delete
nd
;
return
nullptr
;
}
nd
->
sync
=
param
.
GetBlockValue
(
"sync"
,
true
);
return
&
nd
->
base
;
}
static
void
null_finish
(
AudioOutput
*
ao
)
{
NullOutput
*
nd
=
(
NullOutput
*
)
ao
;
delete
nd
;
static
NullOutput
*
Create
(
const
config_param
&
param
,
Error
&
error
);
}
static
bool
bool
Open
(
AudioFormat
&
audio_format
,
gcc_unused
Error
&
error
)
{
null_open
(
AudioOutput
*
ao
,
AudioFormat
&
audio_format
,
if
(
sync
)
gcc_unused
Error
&
error
)
timer
=
new
Timer
(
audio_format
);
{
NullOutput
*
nd
=
(
NullOutput
*
)
ao
;
if
(
nd
->
sync
)
return
true
;
nd
->
timer
=
new
Timer
(
audio_format
);
}
return
true
;
void
Close
()
{
}
if
(
sync
)
delete
timer
;
}
static
void
unsigned
Delay
()
const
{
null_close
(
AudioOutput
*
ao
)
return
sync
&&
timer
->
IsStarted
()
{
?
timer
->
GetDelay
()
NullOutput
*
nd
=
(
NullOutput
*
)
ao
;
:
0
;
}
if
(
nd
->
sync
)
size_t
Play
(
gcc_unused
const
void
*
chunk
,
size_t
size
,
delete
nd
->
timer
;
gcc_unused
Error
&
error
)
{
}
if
(
sync
)
{
if
(
!
timer
->
IsStarted
())
timer
->
Start
();
timer
->
Add
(
size
);
}
static
unsigned
return
size
;
null_delay
(
AudioOutput
*
ao
)
}
{
NullOutput
*
nd
=
(
NullOutput
*
)
ao
;
return
nd
->
sync
&&
nd
->
timer
->
IsStarted
()
void
Cancel
()
{
?
nd
->
timer
->
GetDelay
()
if
(
sync
)
:
0
;
timer
->
Reset
();
}
}
};
static
size_t
inline
NullOutput
*
null_play
(
AudioOutput
*
ao
,
gcc_unused
const
void
*
chunk
,
size_t
size
,
NullOutput
::
Create
(
const
config_param
&
param
,
Error
&
error
)
gcc_unused
Error
&
error
)
{
{
NullOutput
*
nd
=
(
NullOutput
*
)
ao
;
NullOutput
*
nd
=
new
NullOutput
();
Timer
*
timer
=
nd
->
timer
;
if
(
!
nd
->
sync
)
if
(
!
nd
->
Initialize
(
param
,
error
))
{
return
size
;
delete
nd
;
return
nullptr
;
}
if
(
!
timer
->
IsStarted
())
nd
->
sync
=
param
.
GetBlockValue
(
"sync"
,
true
);
timer
->
Start
();
timer
->
Add
(
size
);
return
size
;
return
nd
;
}
}
static
void
typedef
AudioOutputWrapper
<
NullOutput
>
Wrapper
;
null_cancel
(
AudioOutput
*
ao
)
{
NullOutput
*
nd
=
(
NullOutput
*
)
ao
;
if
(
!
nd
->
sync
)
return
;
nd
->
timer
->
Reset
();
}
const
struct
AudioOutputPlugin
null_output_plugin
=
{
const
struct
AudioOutputPlugin
null_output_plugin
=
{
"null"
,
"null"
,
nullptr
,
nullptr
,
null_i
nit
,
&
Wrapper
::
I
nit
,
null_f
inish
,
&
Wrapper
::
F
inish
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
null_o
pen
,
&
Wrapper
::
O
pen
,
null_c
lose
,
&
Wrapper
::
C
lose
,
null_d
elay
,
&
Wrapper
::
D
elay
,
nullptr
,
nullptr
,
null_p
lay
,
&
Wrapper
::
P
lay
,
nullptr
,
nullptr
,
null_c
ancel
,
&
Wrapper
::
C
ancel
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
};
};
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