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
af716057
Commit
af716057
authored
Jan 29, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output: rename "chunk" to "current_chunk"
parent
4657a3bd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
28 deletions
+30
-28
Internal.hxx
src/output/Internal.hxx
+6
-5
MultipleOutputs.cxx
src/output/MultipleOutputs.cxx
+8
-7
OutputControl.cxx
src/output/OutputControl.cxx
+2
-2
OutputThread.cxx
src/output/OutputThread.cxx
+14
-14
No files found.
src/output/Internal.hxx
View file @
af716057
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
class
Error
;
class
Error
;
class
Filter
;
class
Filter
;
class
MusicPipe
;
class
MusicPipe
;
struct
music_chunk
;
struct
config_param
;
struct
config_param
;
struct
PlayerControl
;
struct
PlayerControl
;
struct
AudioOutputPlugin
;
struct
AudioOutputPlugin
;
...
@@ -235,8 +236,8 @@ struct AudioOutput {
...
@@ -235,8 +236,8 @@ struct AudioOutput {
const
MusicPipe
*
pipe
;
const
MusicPipe
*
pipe
;
/**
/**
* This mutex protects #open, #fail_timer, #chunk and
* This mutex protects #open, #fail_timer, #c
urrent_c
hunk and
* #chunk_finished.
* #c
urrent_c
hunk_finished.
*/
*/
Mutex
mutex
;
Mutex
mutex
;
...
@@ -258,12 +259,12 @@ struct AudioOutput {
...
@@ -258,12 +259,12 @@ struct AudioOutput {
* #music_buffer, because they are not going to be used by
* #music_buffer, because they are not going to be used by
* this output anymore.
* this output anymore.
*/
*/
const
struct
music_chunk
*
chunk
;
const
music_chunk
*
current_
chunk
;
/**
/**
* Has the output finished playing #chunk?
* Has the output finished playing #c
urrent_c
hunk?
*/
*/
bool
chunk_finished
;
bool
c
urrent_c
hunk_finished
;
AudioOutput
(
const
AudioOutputPlugin
&
_plugin
);
AudioOutput
(
const
AudioOutputPlugin
&
_plugin
);
~
AudioOutput
();
~
AudioOutput
();
...
...
src/output/MultipleOutputs.cxx
View file @
af716057
...
@@ -264,17 +264,18 @@ chunk_is_consumed_in(const AudioOutput *ao,
...
@@ -264,17 +264,18 @@ chunk_is_consumed_in(const AudioOutput *ao,
if
(
!
ao
->
open
)
if
(
!
ao
->
open
)
return
true
;
return
true
;
if
(
ao
->
chunk
==
nullptr
)
if
(
ao
->
c
urrent_c
hunk
==
nullptr
)
return
false
;
return
false
;
assert
(
chunk
==
ao
->
chunk
||
pipe
->
Contains
(
ao
->
chunk
));
assert
(
chunk
==
ao
->
current_chunk
||
pipe
->
Contains
(
ao
->
current_chunk
));
if
(
chunk
!=
ao
->
chunk
)
{
if
(
chunk
!=
ao
->
c
urrent_c
hunk
)
{
assert
(
chunk
->
next
!=
nullptr
);
assert
(
chunk
->
next
!=
nullptr
);
return
true
;
return
true
;
}
}
return
ao
->
chunk_finished
&&
chunk
->
next
==
nullptr
;
return
ao
->
c
urrent_c
hunk_finished
&&
chunk
->
next
==
nullptr
;
}
}
bool
bool
...
@@ -309,9 +310,9 @@ MultipleOutputs::ClearTailChunk(gcc_unused const struct music_chunk *chunk,
...
@@ -309,9 +310,9 @@ MultipleOutputs::ClearTailChunk(gcc_unused const struct music_chunk *chunk,
continue
;
continue
;
}
}
assert
(
ao
->
chunk
==
chunk
);
assert
(
ao
->
c
urrent_c
hunk
==
chunk
);
assert
(
ao
->
chunk_finished
);
assert
(
ao
->
c
urrent_c
hunk_finished
);
ao
->
chunk
=
nullptr
;
ao
->
c
urrent_c
hunk
=
nullptr
;
}
}
}
}
...
...
src/output/OutputControl.cxx
View file @
af716057
...
@@ -124,7 +124,7 @@ AudioOutput::Open(const AudioFormat audio_format, const MusicPipe &mp)
...
@@ -124,7 +124,7 @@ AudioOutput::Open(const AudioFormat audio_format, const MusicPipe &mp)
assert
(
pipe
==
&
mp
||
(
always_on
&&
pause
));
assert
(
pipe
==
&
mp
||
(
always_on
&&
pause
));
if
(
pause
)
{
if
(
pause
)
{
chunk
=
nullptr
;
c
urrent_c
hunk
=
nullptr
;
pipe
=
&
mp
;
pipe
=
&
mp
;
/* unpause with the CANCEL command; this is a
/* unpause with the CANCEL command; this is a
...
@@ -141,7 +141,7 @@ AudioOutput::Open(const AudioFormat audio_format, const MusicPipe &mp)
...
@@ -141,7 +141,7 @@ AudioOutput::Open(const AudioFormat audio_format, const MusicPipe &mp)
}
}
in_audio_format
=
audio_format
;
in_audio_format
=
audio_format
;
chunk
=
nullptr
;
c
urrent_c
hunk
=
nullptr
;
pipe
=
&
mp
;
pipe
=
&
mp
;
...
...
src/output/OutputThread.cxx
View file @
af716057
...
@@ -139,7 +139,7 @@ ao_open(AudioOutput *ao)
...
@@ -139,7 +139,7 @@ ao_open(AudioOutput *ao)
assert
(
!
ao
->
open
);
assert
(
!
ao
->
open
);
assert
(
ao
->
pipe
!=
nullptr
);
assert
(
ao
->
pipe
!=
nullptr
);
assert
(
ao
->
chunk
==
nullptr
);
assert
(
ao
->
c
urrent_c
hunk
==
nullptr
);
assert
(
ao
->
in_audio_format
.
IsValid
());
assert
(
ao
->
in_audio_format
.
IsValid
());
ao
->
fail_timer
.
Reset
();
ao
->
fail_timer
.
Reset
();
...
@@ -212,7 +212,7 @@ ao_close(AudioOutput *ao, bool drain)
...
@@ -212,7 +212,7 @@ ao_close(AudioOutput *ao, bool drain)
ao
->
pipe
=
nullptr
;
ao
->
pipe
=
nullptr
;
ao
->
chunk
=
nullptr
;
ao
->
c
urrent_c
hunk
=
nullptr
;
ao
->
open
=
false
;
ao
->
open
=
false
;
ao
->
mutex
.
unlock
();
ao
->
mutex
.
unlock
();
...
@@ -252,7 +252,7 @@ ao_reopen_filter(AudioOutput *ao)
...
@@ -252,7 +252,7 @@ ao_reopen_filter(AudioOutput *ao)
ao
->
pipe
=
nullptr
;
ao
->
pipe
=
nullptr
;
ao
->
chunk
=
nullptr
;
ao
->
c
urrent_c
hunk
=
nullptr
;
ao
->
open
=
false
;
ao
->
open
=
false
;
ao
->
fail_timer
.
Update
();
ao
->
fail_timer
.
Update
();
...
@@ -486,9 +486,9 @@ ao_play_chunk(AudioOutput *ao, const struct music_chunk *chunk)
...
@@ -486,9 +486,9 @@ ao_play_chunk(AudioOutput *ao, const struct music_chunk *chunk)
static
const
struct
music_chunk
*
static
const
struct
music_chunk
*
ao_next_chunk
(
AudioOutput
*
ao
)
ao_next_chunk
(
AudioOutput
*
ao
)
{
{
return
ao
->
chunk
!=
nullptr
return
ao
->
c
urrent_c
hunk
!=
nullptr
/* continue the previous play() call */
/* continue the previous play() call */
?
ao
->
chunk
->
next
?
ao
->
c
urrent_c
hunk
->
next
/* get the first chunk from the pipe */
/* get the first chunk from the pipe */
:
ao
->
pipe
->
Peek
();
:
ao
->
pipe
->
Peek
();
}
}
...
@@ -514,30 +514,30 @@ ao_play(AudioOutput *ao)
...
@@ -514,30 +514,30 @@ ao_play(AudioOutput *ao)
/* no chunk available */
/* no chunk available */
return
false
;
return
false
;
ao
->
chunk_finished
=
false
;
ao
->
c
urrent_c
hunk_finished
=
false
;
assert
(
!
ao
->
in_playback_loop
);
assert
(
!
ao
->
in_playback_loop
);
ao
->
in_playback_loop
=
true
;
ao
->
in_playback_loop
=
true
;
while
(
chunk
!=
nullptr
&&
ao
->
command
==
AO_COMMAND_NONE
)
{
while
(
chunk
!=
nullptr
&&
ao
->
command
==
AO_COMMAND_NONE
)
{
assert
(
!
ao
->
chunk_finished
);
assert
(
!
ao
->
c
urrent_c
hunk_finished
);
ao
->
chunk
=
chunk
;
ao
->
c
urrent_c
hunk
=
chunk
;
success
=
ao_play_chunk
(
ao
,
chunk
);
success
=
ao_play_chunk
(
ao
,
chunk
);
if
(
!
success
)
{
if
(
!
success
)
{
assert
(
ao
->
chunk
==
nullptr
);
assert
(
ao
->
c
urrent_c
hunk
==
nullptr
);
break
;
break
;
}
}
assert
(
ao
->
chunk
==
chunk
);
assert
(
ao
->
c
urrent_c
hunk
==
chunk
);
chunk
=
chunk
->
next
;
chunk
=
chunk
->
next
;
}
}
assert
(
ao
->
in_playback_loop
);
assert
(
ao
->
in_playback_loop
);
ao
->
in_playback_loop
=
false
;
ao
->
in_playback_loop
=
false
;
ao
->
chunk_finished
=
true
;
ao
->
c
urrent_c
hunk_finished
=
true
;
ao
->
mutex
.
unlock
();
ao
->
mutex
.
unlock
();
ao
->
player_control
->
LockSignal
();
ao
->
player_control
->
LockSignal
();
...
@@ -637,7 +637,7 @@ audio_output_task(void *arg)
...
@@ -637,7 +637,7 @@ audio_output_task(void *arg)
case
AO_COMMAND_DRAIN
:
case
AO_COMMAND_DRAIN
:
if
(
ao
->
open
)
{
if
(
ao
->
open
)
{
assert
(
ao
->
chunk
==
nullptr
);
assert
(
ao
->
c
urrent_c
hunk
==
nullptr
);
assert
(
ao
->
pipe
->
Peek
()
==
nullptr
);
assert
(
ao
->
pipe
->
Peek
()
==
nullptr
);
ao
->
mutex
.
unlock
();
ao
->
mutex
.
unlock
();
...
@@ -649,7 +649,7 @@ audio_output_task(void *arg)
...
@@ -649,7 +649,7 @@ audio_output_task(void *arg)
continue
;
continue
;
case
AO_COMMAND_CANCEL
:
case
AO_COMMAND_CANCEL
:
ao
->
chunk
=
nullptr
;
ao
->
c
urrent_c
hunk
=
nullptr
;
if
(
ao
->
open
)
{
if
(
ao
->
open
)
{
ao
->
mutex
.
unlock
();
ao
->
mutex
.
unlock
();
...
@@ -661,7 +661,7 @@ audio_output_task(void *arg)
...
@@ -661,7 +661,7 @@ audio_output_task(void *arg)
continue
;
continue
;
case
AO_COMMAND_KILL
:
case
AO_COMMAND_KILL
:
ao
->
chunk
=
nullptr
;
ao
->
c
urrent_c
hunk
=
nullptr
;
ao_command_finished
(
ao
);
ao_command_finished
(
ao
);
ao
->
mutex
.
unlock
();
ao
->
mutex
.
unlock
();
return
;
return
;
...
...
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