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
3359f878
Commit
3359f878
authored
Nov 09, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output_thread: added command DRAIN
This command manually drains the hardware buffer. This is useful when the player thread want to make sure that everything has been played.
parent
96b974bc
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
0 deletions
+47
-0
output_all.c
src/output_all.c
+9
-0
output_all.h
src/output_all.h
+6
-0
output_control.c
src/output_control.c
+9
-0
output_control.h
src/output_control.h
+3
-0
output_internal.h
src/output_internal.h
+7
-0
output_thread.c
src/output_thread.c
+13
-0
No files found.
src/output_all.c
View file @
3359f878
...
...
@@ -496,6 +496,15 @@ audio_output_all_pause(void)
}
void
audio_output_all_drain
(
void
)
{
for
(
unsigned
i
=
0
;
i
<
num_audio_outputs
;
++
i
)
audio_output_drain_async
(
&
audio_outputs
[
i
]);
audio_output_wait_all
();
}
void
audio_output_all_cancel
(
void
)
{
unsigned
int
i
;
...
...
src/output_all.h
View file @
3359f878
...
...
@@ -130,6 +130,12 @@ void
audio_output_all_pause
(
void
);
/**
* Drain all audio outputs.
*/
void
audio_output_all_drain
(
void
);
/**
* Try to cancel data which may still be in the device's buffers.
*/
void
...
...
src/output_control.c
View file @
3359f878
...
...
@@ -229,6 +229,15 @@ void audio_output_pause(struct audio_output *ao)
g_mutex_unlock
(
ao
->
mutex
);
}
void
audio_output_drain_async
(
struct
audio_output
*
ao
)
{
g_mutex_lock
(
ao
->
mutex
);
if
(
audio_output_is_open
(
ao
))
ao_command_async
(
ao
,
AO_COMMAND_DRAIN
);
g_mutex_unlock
(
ao
->
mutex
);
}
void
audio_output_cancel
(
struct
audio_output
*
ao
)
{
g_mutex_lock
(
ao
->
mutex
);
...
...
src/output_control.h
View file @
3359f878
...
...
@@ -67,6 +67,9 @@ audio_output_play(struct audio_output *ao);
void
audio_output_pause
(
struct
audio_output
*
ao
);
void
audio_output_drain_async
(
struct
audio_output
*
ao
);
void
audio_output_cancel
(
struct
audio_output
*
ao
);
void
audio_output_close
(
struct
audio_output
*
ao
);
void
audio_output_finish
(
struct
audio_output
*
ao
);
...
...
src/output_internal.h
View file @
3359f878
...
...
@@ -40,6 +40,13 @@ enum audio_output_command {
AO_COMMAND_CLOSE
,
AO_COMMAND_PAUSE
,
/**
* Drains the internal (hardware) buffers of the device. This
* operation may take a while to complete.
*/
AO_COMMAND_DRAIN
,
AO_COMMAND_CANCEL
,
AO_COMMAND_KILL
};
...
...
src/output_thread.c
View file @
3359f878
...
...
@@ -450,6 +450,19 @@ static gpointer audio_output_task(gpointer arg)
the new command first */
continue
;
case
AO_COMMAND_DRAIN
:
if
(
ao
->
open
)
{
assert
(
ao
->
chunk
==
NULL
);
assert
(
music_pipe_peek
(
ao
->
pipe
)
==
NULL
);
g_mutex_unlock
(
ao
->
mutex
);
ao_plugin_drain
(
ao
->
plugin
,
ao
->
data
);
g_mutex_lock
(
ao
->
mutex
);
}
ao_command_finished
(
ao
);
continue
;
case
AO_COMMAND_CANCEL
:
ao
->
chunk
=
NULL
;
if
(
ao
->
open
)
...
...
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