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
a73d1e4b
Commit
a73d1e4b
authored
Sep 27, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlayerThread: use strictly typed enum
parent
d05bb2a0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
PlayerThread.cxx
src/PlayerThread.cxx
+14
-14
No files found.
src/PlayerThread.cxx
View file @
a73d1e4b
...
...
@@ -43,10 +43,10 @@
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "player_thread"
enum
xfade_state
{
XFADE_
DISABLED
=
-
1
,
XFADE_
UNKNOWN
=
0
,
XFADE_
ENABLED
=
1
enum
class
CrossFadeState
:
int8_t
{
DISABLED
=
-
1
,
UNKNOWN
=
0
,
ENABLED
=
1
};
struct
player
{
...
...
@@ -95,7 +95,7 @@ struct player {
/**
* is cross fading enabled?
*/
enum
xfade_state
xfad
e
;
CrossFadeState
xfade_stat
e
;
/**
* has cross-fading begun?
...
...
@@ -137,7 +137,7 @@ struct player {
queued
(
true
),
output_open
(
false
),
song
(
nullptr
),
xfade
(
XFADE_
UNKNOWN
),
xfade
_state
(
CrossFadeState
::
UNKNOWN
),
cross_fading
(
false
),
cross_fade_chunks
(
0
),
cross_fade_tag
(
nullptr
),
...
...
@@ -575,7 +575,7 @@ player::SeekDecoder()
player_command_finished
(
pc
);
xfade
=
XFADE_
UNKNOWN
;
xfade
_state
=
CrossFadeState
::
UNKNOWN
;
/* re-fill the buffer after seeking */
buffering
=
true
;
...
...
@@ -750,7 +750,7 @@ player::PlayNextChunk()
unsigned
cross_fade_position
;
struct
music_chunk
*
chunk
=
nullptr
;
if
(
xfade
==
XFADE_
ENABLED
&&
IsDecoderAtNextSong
()
&&
if
(
xfade
_state
==
CrossFadeState
::
ENABLED
&&
IsDecoderAtNextSong
()
&&
(
cross_fade_position
=
pipe
->
GetSize
())
<=
cross_fade_chunks
)
{
/* perform cross fade */
music_chunk
*
other_chunk
=
dc
.
pipe
->
Shift
();
...
...
@@ -807,7 +807,7 @@ player::PlayNextChunk()
cross fading */
dc
.
Unlock
();
xfade
=
XFADE_
DISABLED
;
xfade
_state
=
CrossFadeState
::
DISABLED
;
}
else
{
/* wait for the decoder */
dc
.
Signal
();
...
...
@@ -826,7 +826,7 @@ player::PlayNextChunk()
/* insert the postponed tag if cross-fading is finished */
if
(
xfade
!=
XFADE_
ENABLED
&&
cross_fade_tag
!=
nullptr
)
{
if
(
xfade
_state
!=
CrossFadeState
::
ENABLED
&&
cross_fade_tag
!=
nullptr
)
{
chunk
->
tag
=
Tag
::
MergeReplace
(
chunk
->
tag
,
cross_fade_tag
);
cross_fade_tag
=
nullptr
;
}
...
...
@@ -871,7 +871,7 @@ player::PlayNextChunk()
inline
bool
player
::
SongBorder
()
{
xfade
=
XFADE_
UNKNOWN
;
xfade
_state
=
CrossFadeState
::
UNKNOWN
;
char
*
uri
=
song
->
GetURI
();
g_message
(
"played
\"
%s
\"
"
,
uri
);
...
...
@@ -992,7 +992,7 @@ player::Run()
end of the current song */
!
pc
.
border_pause
&&
IsDecoderAtNextSong
()
&&
xfade
==
XFADE_
UNKNOWN
&&
xfade
_state
==
CrossFadeState
::
UNKNOWN
&&
!
dc
.
LockIsStarting
())
{
/* enable cross fading in this song? if yes,
calculate how many chunks will be required
...
...
@@ -1010,12 +1010,12 @@ player::Run()
buffer
.
GetSize
()
-
pc
.
buffered_before_play
);
if
(
cross_fade_chunks
>
0
)
{
xfade
=
XFADE_
ENABLED
;
xfade
_state
=
CrossFadeState
::
ENABLED
;
cross_fading
=
false
;
}
else
/* cross fading is disabled or the
next song is too short */
xfade
=
XFADE_
DISABLED
;
xfade
_state
=
CrossFadeState
::
DISABLED
;
}
if
(
paused
)
{
...
...
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