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
e11ff967
Commit
e11ff967
authored
Nov 05, 2010
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/shout: implement delay()
This makes the plugin more responsive to control commands, because it will listen to control events while waiting.
parent
2dc6ed7b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
NEWS
NEWS
+1
-0
shout_plugin.c
src/output/shout_plugin.c
+13
-8
No files found.
NEWS
View file @
e11ff967
...
...
@@ -65,6 +65,7 @@ ver 0.16 (20??/??/??)
- httpd: bind_to_address support (including IPv6)
- oss: 24 bit support via OSS4
- win32: new output plugin for Windows Wave
- shout: more responsive to control commands
- wildcards allowed in audio_format configuration
- consistently lock audio output objects
* player:
...
...
src/output/shout_plugin.c
View file @
e11ff967
...
...
@@ -342,7 +342,6 @@ write_page(struct shout_data *sd, GError **error)
if
(
sd
->
buf
.
len
==
0
)
return
true
;
shout_sync
(
sd
->
shout_conn
);
err
=
shout_send
(
sd
->
shout_conn
,
sd
->
buf
.
data
,
sd
->
buf
.
len
);
if
(
!
handle_shout_error
(
sd
,
err
,
error
))
return
false
;
...
...
@@ -441,6 +440,18 @@ my_shout_open_device(void *data, struct audio_format *audio_format,
return
true
;
}
static
unsigned
my_shout_delay
(
void
*
data
)
{
struct
shout_data
*
sd
=
(
struct
shout_data
*
)
data
;
int
delay
=
shout_delay
(
sd
->
shout_conn
);
if
(
delay
<
0
)
delay
=
0
;
return
delay
;
}
static
size_t
my_shout_play
(
void
*
data
,
const
void
*
chunk
,
size_t
size
,
GError
**
error
)
{
...
...
@@ -455,15 +466,8 @@ my_shout_play(void *data, const void *chunk, size_t size, GError **error)
static
bool
my_shout_pause
(
void
*
data
)
{
struct
shout_data
*
sd
=
(
struct
shout_data
*
)
data
;
static
const
char
silence
[
1020
];
if
(
shout_delay
(
sd
->
shout_conn
)
>
500
)
{
/* cap the latency for unpause */
g_usleep
(
500000
);
return
true
;
}
return
my_shout_play
(
data
,
silence
,
sizeof
(
silence
),
NULL
);
}
...
...
@@ -540,6 +544,7 @@ const struct audio_output_plugin shoutPlugin = {
.
init
=
my_shout_init_driver
,
.
finish
=
my_shout_finish_driver
,
.
open
=
my_shout_open_device
,
.
delay
=
my_shout_delay
,
.
play
=
my_shout_play
,
.
pause
=
my_shout_pause
,
.
cancel
=
my_shout_drop_buffered_audio
,
...
...
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