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
27f8ef2f
Commit
27f8ef2f
authored
Jan 27, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/httpd: rename struct httpd_output
parent
2cbe21c7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
33 deletions
+33
-33
HttpdClient.cxx
src/output/HttpdClient.cxx
+1
-1
HttpdClient.hxx
src/output/HttpdClient.hxx
+4
-4
HttpdInternal.hxx
src/output/HttpdInternal.hxx
+3
-3
HttpdOutputPlugin.cxx
src/output/HttpdOutputPlugin.cxx
+25
-25
No files found.
src/output/HttpdClient.cxx
View file @
27f8ef2f
...
@@ -335,7 +335,7 @@ httpd_client_in_event(G_GNUC_UNUSED GIOChannel *source, GIOCondition condition,
...
@@ -335,7 +335,7 @@ httpd_client_in_event(G_GNUC_UNUSED GIOChannel *source, GIOCondition condition,
}
}
}
}
HttpdClient
::
HttpdClient
(
httpd_o
utput
*
_httpd
,
int
_fd
,
HttpdClient
::
HttpdClient
(
HttpdO
utput
*
_httpd
,
int
_fd
,
bool
_metadata_supported
)
bool
_metadata_supported
)
:
httpd
(
_httpd
),
:
httpd
(
_httpd
),
channel
(
g_io_channel_new_socket
(
_fd
)),
channel
(
g_io_channel_new_socket
(
_fd
)),
...
...
src/output/HttpdClient.hxx
View file @
27f8ef2f
...
@@ -28,14 +28,14 @@
...
@@ -28,14 +28,14 @@
#include <stddef.h>
#include <stddef.h>
struct
httpd_o
utput
;
struct
HttpdO
utput
;
struct
page
;
struct
page
;
class
HttpdClient
final
{
class
HttpdClient
final
{
/**
/**
* The httpd output object this client is connected to.
* The httpd output object this client is connected to.
*/
*/
httpd_o
utput
*
const
httpd
;
HttpdO
utput
*
const
httpd
;
/**
/**
* The TCP socket.
* The TCP socket.
...
@@ -140,11 +140,11 @@ public:
...
@@ -140,11 +140,11 @@ public:
* @param httpd the HTTP output device
* @param httpd the HTTP output device
* @param fd the socket file descriptor
* @param fd the socket file descriptor
*/
*/
HttpdClient
(
httpd_o
utput
*
httpd
,
int
_fd
,
bool
_metadata_supported
);
HttpdClient
(
HttpdO
utput
*
httpd
,
int
_fd
,
bool
_metadata_supported
);
/**
/**
* Note: this does not remove the client from the
* Note: this does not remove the client from the
* #
httpd_o
utput object.
* #
HttpdO
utput object.
*/
*/
~
HttpdClient
();
~
HttpdClient
();
...
...
src/output/HttpdInternal.hxx
View file @
27f8ef2f
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
class
HttpdClient
;
class
HttpdClient
;
struct
httpd_o
utput
{
struct
HttpdO
utput
{
struct
audio_output
base
;
struct
audio_output
base
;
/**
/**
...
@@ -128,7 +128,7 @@ struct httpd_output {
...
@@ -128,7 +128,7 @@ struct httpd_output {
* Removes a client from the httpd_output.clients linked list.
* Removes a client from the httpd_output.clients linked list.
*/
*/
void
void
httpd_output_remove_client
(
struct
httpd_o
utput
*
httpd
,
httpd_output_remove_client
(
struct
HttpdO
utput
*
httpd
,
HttpdClient
*
client
);
HttpdClient
*
client
);
/**
/**
...
@@ -136,7 +136,7 @@ httpd_output_remove_client(struct httpd_output *httpd,
...
@@ -136,7 +136,7 @@ httpd_output_remove_client(struct httpd_output *httpd,
* the response headers have been sent.
* the response headers have been sent.
*/
*/
void
void
httpd_output_send_header
(
struct
httpd_o
utput
*
httpd
,
httpd_output_send_header
(
struct
HttpdO
utput
*
httpd
,
HttpdClient
*
client
);
HttpdClient
*
client
);
#endif
#endif
src/output/HttpdOutputPlugin.cxx
View file @
27f8ef2f
...
@@ -61,7 +61,7 @@ httpd_output_quark(void)
...
@@ -61,7 +61,7 @@ httpd_output_quark(void)
*/
*/
G_GNUC_PURE
G_GNUC_PURE
static
bool
static
bool
httpd_output_has_clients
(
const
httpd_o
utput
*
httpd
)
httpd_output_has_clients
(
const
HttpdO
utput
*
httpd
)
{
{
return
!
httpd
->
clients
.
empty
();
return
!
httpd
->
clients
.
empty
();
}
}
...
@@ -71,7 +71,7 @@ httpd_output_has_clients(const httpd_output *httpd)
...
@@ -71,7 +71,7 @@ httpd_output_has_clients(const httpd_output *httpd)
*/
*/
G_GNUC_PURE
G_GNUC_PURE
static
bool
static
bool
httpd_output_lock_has_clients
(
const
httpd_o
utput
*
httpd
)
httpd_output_lock_has_clients
(
const
HttpdO
utput
*
httpd
)
{
{
const
ScopeLock
protect
(
httpd
->
mutex
);
const
ScopeLock
protect
(
httpd
->
mutex
);
return
httpd_output_has_clients
(
httpd
);
return
httpd_output_has_clients
(
httpd
);
...
@@ -82,7 +82,7 @@ httpd_listen_in_event(int fd, const struct sockaddr *address,
...
@@ -82,7 +82,7 @@ httpd_listen_in_event(int fd, const struct sockaddr *address,
size_t
address_length
,
int
uid
,
void
*
ctx
);
size_t
address_length
,
int
uid
,
void
*
ctx
);
static
bool
static
bool
httpd_output_bind
(
httpd_o
utput
*
httpd
,
GError
**
error_r
)
httpd_output_bind
(
HttpdO
utput
*
httpd
,
GError
**
error_r
)
{
{
httpd
->
open
=
false
;
httpd
->
open
=
false
;
...
@@ -91,7 +91,7 @@ httpd_output_bind(httpd_output *httpd, GError **error_r)
...
@@ -91,7 +91,7 @@ httpd_output_bind(httpd_output *httpd, GError **error_r)
}
}
static
void
static
void
httpd_output_unbind
(
httpd_o
utput
*
httpd
)
httpd_output_unbind
(
HttpdO
utput
*
httpd
)
{
{
assert
(
!
httpd
->
open
);
assert
(
!
httpd
->
open
);
...
@@ -103,7 +103,7 @@ static struct audio_output *
...
@@ -103,7 +103,7 @@ static struct audio_output *
httpd_output_init
(
const
struct
config_param
*
param
,
httpd_output_init
(
const
struct
config_param
*
param
,
GError
**
error
)
GError
**
error
)
{
{
httpd_output
*
httpd
=
new
httpd_o
utput
();
HttpdOutput
*
httpd
=
new
HttpdO
utput
();
if
(
!
ao_base_init
(
&
httpd
->
base
,
&
httpd_output_plugin
,
param
,
error
))
{
if
(
!
ao_base_init
(
&
httpd
->
base
,
&
httpd_output_plugin
,
param
,
error
))
{
g_free
(
httpd
);
g_free
(
httpd
);
return
NULL
;
return
NULL
;
...
@@ -176,7 +176,7 @@ httpd_output_init(const struct config_param *param,
...
@@ -176,7 +176,7 @@ httpd_output_init(const struct config_param *param,
static
void
static
void
httpd_output_finish
(
struct
audio_output
*
ao
)
httpd_output_finish
(
struct
audio_output
*
ao
)
{
{
httpd_output
*
httpd
=
(
httpd_o
utput
*
)
ao
;
HttpdOutput
*
httpd
=
(
HttpdO
utput
*
)
ao
;
if
(
httpd
->
metadata
)
if
(
httpd
->
metadata
)
page_unref
(
httpd
->
metadata
);
page_unref
(
httpd
->
metadata
);
...
@@ -189,10 +189,10 @@ httpd_output_finish(struct audio_output *ao)
...
@@ -189,10 +189,10 @@ httpd_output_finish(struct audio_output *ao)
/**
/**
* Creates a new #HttpdClient object and adds it into the
* Creates a new #HttpdClient object and adds it into the
*
httpd_o
utput.clients linked list.
*
HttpdO
utput.clients linked list.
*/
*/
static
void
static
void
httpd_client_add
(
httpd_o
utput
*
httpd
,
int
fd
)
httpd_client_add
(
HttpdO
utput
*
httpd
,
int
fd
)
{
{
httpd
->
clients
.
emplace_front
(
httpd
,
fd
,
httpd
->
clients
.
emplace_front
(
httpd
,
fd
,
httpd
->
encoder
->
plugin
->
tag
==
NULL
);
httpd
->
encoder
->
plugin
->
tag
==
NULL
);
...
@@ -207,7 +207,7 @@ static void
...
@@ -207,7 +207,7 @@ static void
httpd_listen_in_event
(
int
fd
,
const
struct
sockaddr
*
address
,
httpd_listen_in_event
(
int
fd
,
const
struct
sockaddr
*
address
,
size_t
address_length
,
G_GNUC_UNUSED
int
uid
,
void
*
ctx
)
size_t
address_length
,
G_GNUC_UNUSED
int
uid
,
void
*
ctx
)
{
{
httpd_output
*
httpd
=
(
httpd_o
utput
*
)
ctx
;
HttpdOutput
*
httpd
=
(
HttpdO
utput
*
)
ctx
;
/* the listener socket has become readable - a client has
/* the listener socket has become readable - a client has
connected */
connected */
...
@@ -258,7 +258,7 @@ httpd_listen_in_event(int fd, const struct sockaddr *address,
...
@@ -258,7 +258,7 @@ httpd_listen_in_event(int fd, const struct sockaddr *address,
* as a new #page object.
* as a new #page object.
*/
*/
static
struct
page
*
static
struct
page
*
httpd_output_read_page
(
httpd_o
utput
*
httpd
)
httpd_output_read_page
(
HttpdO
utput
*
httpd
)
{
{
if
(
httpd
->
unflushed_input
>=
65536
)
{
if
(
httpd
->
unflushed_input
>=
65536
)
{
/* we have fed a lot of input into the encoder, but it
/* we have fed a lot of input into the encoder, but it
...
@@ -288,7 +288,7 @@ httpd_output_read_page(httpd_output *httpd)
...
@@ -288,7 +288,7 @@ httpd_output_read_page(httpd_output *httpd)
}
}
static
bool
static
bool
httpd_output_encoder_open
(
httpd_o
utput
*
httpd
,
httpd_output_encoder_open
(
HttpdO
utput
*
httpd
,
struct
audio_format
*
audio_format
,
struct
audio_format
*
audio_format
,
GError
**
error
)
GError
**
error
)
{
{
...
@@ -308,7 +308,7 @@ httpd_output_encoder_open(httpd_output *httpd,
...
@@ -308,7 +308,7 @@ httpd_output_encoder_open(httpd_output *httpd,
static
bool
static
bool
httpd_output_enable
(
struct
audio_output
*
ao
,
GError
**
error_r
)
httpd_output_enable
(
struct
audio_output
*
ao
,
GError
**
error_r
)
{
{
httpd_output
*
httpd
=
(
httpd_o
utput
*
)
ao
;
HttpdOutput
*
httpd
=
(
HttpdO
utput
*
)
ao
;
return
httpd_output_bind
(
httpd
,
error_r
);
return
httpd_output_bind
(
httpd
,
error_r
);
}
}
...
@@ -316,7 +316,7 @@ httpd_output_enable(struct audio_output *ao, GError **error_r)
...
@@ -316,7 +316,7 @@ httpd_output_enable(struct audio_output *ao, GError **error_r)
static
void
static
void
httpd_output_disable
(
struct
audio_output
*
ao
)
httpd_output_disable
(
struct
audio_output
*
ao
)
{
{
httpd_output
*
httpd
=
(
httpd_o
utput
*
)
ao
;
HttpdOutput
*
httpd
=
(
HttpdO
utput
*
)
ao
;
httpd_output_unbind
(
httpd
);
httpd_output_unbind
(
httpd
);
}
}
...
@@ -325,7 +325,7 @@ static bool
...
@@ -325,7 +325,7 @@ static bool
httpd_output_open
(
struct
audio_output
*
ao
,
struct
audio_format
*
audio_format
,
httpd_output_open
(
struct
audio_output
*
ao
,
struct
audio_format
*
audio_format
,
GError
**
error
)
GError
**
error
)
{
{
httpd_output
*
httpd
=
(
httpd_o
utput
*
)
ao
;
HttpdOutput
*
httpd
=
(
HttpdO
utput
*
)
ao
;
assert
(
httpd
->
clients
.
empty
());
assert
(
httpd
->
clients
.
empty
());
...
@@ -349,7 +349,7 @@ httpd_output_open(struct audio_output *ao, struct audio_format *audio_format,
...
@@ -349,7 +349,7 @@ httpd_output_open(struct audio_output *ao, struct audio_format *audio_format,
static
void
static
void
httpd_output_close
(
struct
audio_output
*
ao
)
httpd_output_close
(
struct
audio_output
*
ao
)
{
{
httpd_output
*
httpd
=
(
httpd_o
utput
*
)
ao
;
HttpdOutput
*
httpd
=
(
HttpdO
utput
*
)
ao
;
const
ScopeLock
protect
(
httpd
->
mutex
);
const
ScopeLock
protect
(
httpd
->
mutex
);
...
@@ -366,7 +366,7 @@ httpd_output_close(struct audio_output *ao)
...
@@ -366,7 +366,7 @@ httpd_output_close(struct audio_output *ao)
}
}
void
void
httpd_output_remove_client
(
httpd_o
utput
*
httpd
,
HttpdClient
*
client
)
httpd_output_remove_client
(
HttpdO
utput
*
httpd
,
HttpdClient
*
client
)
{
{
assert
(
httpd
!=
NULL
);
assert
(
httpd
!=
NULL
);
assert
(
httpd
->
clients_cnt
>
0
);
assert
(
httpd
->
clients_cnt
>
0
);
...
@@ -384,7 +384,7 @@ httpd_output_remove_client(httpd_output *httpd, HttpdClient *client)
...
@@ -384,7 +384,7 @@ httpd_output_remove_client(httpd_output *httpd, HttpdClient *client)
}
}
void
void
httpd_output_send_header
(
httpd_o
utput
*
httpd
,
HttpdClient
*
client
)
httpd_output_send_header
(
HttpdO
utput
*
httpd
,
HttpdClient
*
client
)
{
{
if
(
httpd
->
header
!=
NULL
)
if
(
httpd
->
header
!=
NULL
)
client
->
PushPage
(
httpd
->
header
);
client
->
PushPage
(
httpd
->
header
);
...
@@ -393,7 +393,7 @@ httpd_output_send_header(httpd_output *httpd, HttpdClient *client)
...
@@ -393,7 +393,7 @@ httpd_output_send_header(httpd_output *httpd, HttpdClient *client)
static
unsigned
static
unsigned
httpd_output_delay
(
struct
audio_output
*
ao
)
httpd_output_delay
(
struct
audio_output
*
ao
)
{
{
httpd_output
*
httpd
=
(
httpd_o
utput
*
)
ao
;
HttpdOutput
*
httpd
=
(
HttpdO
utput
*
)
ao
;
if
(
!
httpd_output_lock_has_clients
(
httpd
)
&&
httpd
->
base
.
pause
)
{
if
(
!
httpd_output_lock_has_clients
(
httpd
)
&&
httpd
->
base
.
pause
)
{
/* if there's no client and this output is paused,
/* if there's no client and this output is paused,
...
@@ -417,7 +417,7 @@ httpd_output_delay(struct audio_output *ao)
...
@@ -417,7 +417,7 @@ httpd_output_delay(struct audio_output *ao)
* Broadcasts a page struct to all clients.
* Broadcasts a page struct to all clients.
*/
*/
static
void
static
void
httpd_output_broadcast_page
(
httpd_o
utput
*
httpd
,
struct
page
*
page
)
httpd_output_broadcast_page
(
HttpdO
utput
*
httpd
,
struct
page
*
page
)
{
{
assert
(
page
!=
NULL
);
assert
(
page
!=
NULL
);
...
@@ -430,7 +430,7 @@ httpd_output_broadcast_page(httpd_output *httpd, struct page *page)
...
@@ -430,7 +430,7 @@ httpd_output_broadcast_page(httpd_output *httpd, struct page *page)
* Broadcasts data from the encoder to all clients.
* Broadcasts data from the encoder to all clients.
*/
*/
static
void
static
void
httpd_output_encoder_to_clients
(
httpd_o
utput
*
httpd
)
httpd_output_encoder_to_clients
(
HttpdO
utput
*
httpd
)
{
{
httpd
->
mutex
.
lock
();
httpd
->
mutex
.
lock
();
for
(
auto
&
client
:
httpd
->
clients
)
{
for
(
auto
&
client
:
httpd
->
clients
)
{
...
@@ -449,7 +449,7 @@ httpd_output_encoder_to_clients(httpd_output *httpd)
...
@@ -449,7 +449,7 @@ httpd_output_encoder_to_clients(httpd_output *httpd)
}
}
static
bool
static
bool
httpd_output_encode_and_play
(
httpd_o
utput
*
httpd
,
httpd_output_encode_and_play
(
HttpdO
utput
*
httpd
,
const
void
*
chunk
,
size_t
size
,
GError
**
error
)
const
void
*
chunk
,
size_t
size
,
GError
**
error
)
{
{
if
(
!
encoder_write
(
httpd
->
encoder
,
chunk
,
size
,
error
))
if
(
!
encoder_write
(
httpd
->
encoder
,
chunk
,
size
,
error
))
...
@@ -466,7 +466,7 @@ static size_t
...
@@ -466,7 +466,7 @@ static size_t
httpd_output_play
(
struct
audio_output
*
ao
,
const
void
*
chunk
,
size_t
size
,
httpd_output_play
(
struct
audio_output
*
ao
,
const
void
*
chunk
,
size_t
size
,
GError
**
error_r
)
GError
**
error_r
)
{
{
httpd_output
*
httpd
=
(
httpd_o
utput
*
)
ao
;
HttpdOutput
*
httpd
=
(
HttpdO
utput
*
)
ao
;
if
(
httpd_output_lock_has_clients
(
httpd
))
{
if
(
httpd_output_lock_has_clients
(
httpd
))
{
if
(
!
httpd_output_encode_and_play
(
httpd
,
chunk
,
size
,
error_r
))
if
(
!
httpd_output_encode_and_play
(
httpd
,
chunk
,
size
,
error_r
))
...
@@ -483,7 +483,7 @@ httpd_output_play(struct audio_output *ao, const void *chunk, size_t size,
...
@@ -483,7 +483,7 @@ httpd_output_play(struct audio_output *ao, const void *chunk, size_t size,
static
bool
static
bool
httpd_output_pause
(
struct
audio_output
*
ao
)
httpd_output_pause
(
struct
audio_output
*
ao
)
{
{
httpd_output
*
httpd
=
(
httpd_o
utput
*
)
ao
;
HttpdOutput
*
httpd
=
(
HttpdO
utput
*
)
ao
;
if
(
httpd_output_lock_has_clients
(
httpd
))
{
if
(
httpd_output_lock_has_clients
(
httpd
))
{
static
const
char
silence
[
1020
]
=
{
0
};
static
const
char
silence
[
1020
]
=
{
0
};
...
@@ -497,7 +497,7 @@ httpd_output_pause(struct audio_output *ao)
...
@@ -497,7 +497,7 @@ httpd_output_pause(struct audio_output *ao)
static
void
static
void
httpd_output_tag
(
struct
audio_output
*
ao
,
const
struct
tag
*
tag
)
httpd_output_tag
(
struct
audio_output
*
ao
,
const
struct
tag
*
tag
)
{
{
httpd_output
*
httpd
=
(
httpd_o
utput
*
)
ao
;
HttpdOutput
*
httpd
=
(
HttpdO
utput
*
)
ao
;
assert
(
tag
!=
NULL
);
assert
(
tag
!=
NULL
);
...
@@ -546,7 +546,7 @@ httpd_output_tag(struct audio_output *ao, const struct tag *tag)
...
@@ -546,7 +546,7 @@ httpd_output_tag(struct audio_output *ao, const struct tag *tag)
static
void
static
void
httpd_output_cancel
(
struct
audio_output
*
ao
)
httpd_output_cancel
(
struct
audio_output
*
ao
)
{
{
httpd_output
*
httpd
=
(
httpd_o
utput
*
)
ao
;
HttpdOutput
*
httpd
=
(
HttpdO
utput
*
)
ao
;
const
ScopeLock
protect
(
httpd
->
mutex
);
const
ScopeLock
protect
(
httpd
->
mutex
);
for
(
auto
&
client
:
httpd
->
clients
)
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