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
e2425592
Commit
e2425592
authored
Dec 31, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/httpd: move Cast() into the class
parent
964b2661
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
25 deletions
+23
-25
HttpdInternal.hxx
src/output/HttpdInternal.hxx
+13
-0
HttpdOutputPlugin.cxx
src/output/HttpdOutputPlugin.cxx
+10
-25
No files found.
src/output/HttpdInternal.hxx
View file @
e2425592
...
...
@@ -129,6 +129,19 @@ struct HttpdOutput final : private ServerSocket {
HttpdOutput
(
EventLoop
&
_loop
);
~
HttpdOutput
();
#if GCC_CHECK_VERSION(4,6) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#endif
static
constexpr
HttpdOutput
*
Cast
(
audio_output
*
ao
)
{
return
(
HttpdOutput
*
)((
char
*
)
ao
-
offsetof
(
HttpdOutput
,
base
));
}
#if GCC_CHECK_VERSION(4,6) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
bool
Init
(
const
config_param
&
param
,
Error
&
error
);
void
Finish
()
{
...
...
src/output/HttpdOutputPlugin.cxx
View file @
e2425592
...
...
@@ -146,25 +146,10 @@ httpd_output_init(const config_param ¶m, Error &error)
return
result
;
}
#if GCC_CHECK_VERSION(4,6) || defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
#endif
static
inline
constexpr
HttpdOutput
*
Cast
(
audio_output
*
ao
)
{
return
(
HttpdOutput
*
)((
char
*
)
ao
-
offsetof
(
HttpdOutput
,
base
));
}
#if GCC_CHECK_VERSION(4,6) || defined(__clang__)
#pragma GCC diagnostic pop
#endif
static
void
httpd_output_finish
(
struct
audio_output
*
ao
)
{
HttpdOutput
*
httpd
=
Cast
(
ao
);
HttpdOutput
*
httpd
=
HttpdOutput
::
Cast
(
ao
);
httpd
->
Finish
();
delete
httpd
;
...
...
@@ -265,7 +250,7 @@ HttpdOutput::ReadPage()
static
bool
httpd_output_enable
(
struct
audio_output
*
ao
,
Error
&
error
)
{
HttpdOutput
*
httpd
=
Cast
(
ao
);
HttpdOutput
*
httpd
=
HttpdOutput
::
Cast
(
ao
);
return
httpd
->
Bind
(
error
);
}
...
...
@@ -273,7 +258,7 @@ httpd_output_enable(struct audio_output *ao, Error &error)
static
void
httpd_output_disable
(
struct
audio_output
*
ao
)
{
HttpdOutput
*
httpd
=
Cast
(
ao
);
HttpdOutput
*
httpd
=
HttpdOutput
::
Cast
(
ao
);
httpd
->
Unbind
();
}
...
...
@@ -319,7 +304,7 @@ static bool
httpd_output_open
(
struct
audio_output
*
ao
,
AudioFormat
&
audio_format
,
Error
&
error
)
{
HttpdOutput
*
httpd
=
Cast
(
ao
);
HttpdOutput
*
httpd
=
HttpdOutput
::
Cast
(
ao
);
assert
(
httpd
->
clients
.
empty
());
...
...
@@ -347,7 +332,7 @@ HttpdOutput::Close()
static
void
httpd_output_close
(
struct
audio_output
*
ao
)
{
HttpdOutput
*
httpd
=
Cast
(
ao
);
HttpdOutput
*
httpd
=
HttpdOutput
::
Cast
(
ao
);
const
ScopeLock
protect
(
httpd
->
mutex
);
httpd
->
Close
();
...
...
@@ -379,7 +364,7 @@ HttpdOutput::SendHeader(HttpdClient &client) const
static
unsigned
httpd_output_delay
(
struct
audio_output
*
ao
)
{
HttpdOutput
*
httpd
=
Cast
(
ao
);
HttpdOutput
*
httpd
=
HttpdOutput
::
Cast
(
ao
);
if
(
!
httpd
->
LockHasClients
()
&&
httpd
->
base
.
pause
)
{
/* if there's no client and this output is paused,
...
...
@@ -445,7 +430,7 @@ static size_t
httpd_output_play
(
struct
audio_output
*
ao
,
const
void
*
chunk
,
size_t
size
,
Error
&
error
)
{
HttpdOutput
*
httpd
=
Cast
(
ao
);
HttpdOutput
*
httpd
=
HttpdOutput
::
Cast
(
ao
);
if
(
httpd
->
LockHasClients
())
{
if
(
!
httpd
->
EncodeAndPlay
(
chunk
,
size
,
error
))
...
...
@@ -462,7 +447,7 @@ httpd_output_play(struct audio_output *ao, const void *chunk, size_t size,
static
bool
httpd_output_pause
(
struct
audio_output
*
ao
)
{
HttpdOutput
*
httpd
=
Cast
(
ao
);
HttpdOutput
*
httpd
=
HttpdOutput
::
Cast
(
ao
);
if
(
httpd
->
LockHasClients
())
{
static
const
char
silence
[
1020
]
=
{
0
};
...
...
@@ -525,7 +510,7 @@ HttpdOutput::SendTag(const Tag *tag)
static
void
httpd_output_tag
(
struct
audio_output
*
ao
,
const
Tag
*
tag
)
{
HttpdOutput
*
httpd
=
Cast
(
ao
);
HttpdOutput
*
httpd
=
HttpdOutput
::
Cast
(
ao
);
httpd
->
SendTag
(
tag
);
}
...
...
@@ -533,7 +518,7 @@ httpd_output_tag(struct audio_output *ao, const Tag *tag)
static
void
httpd_output_cancel
(
struct
audio_output
*
ao
)
{
HttpdOutput
*
httpd
=
Cast
(
ao
);
HttpdOutput
*
httpd
=
HttpdOutput
::
Cast
(
ao
);
const
ScopeLock
protect
(
httpd
->
mutex
);
for
(
auto
&
client
:
httpd
->
clients
)
...
...
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