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
b5fde6df
Commit
b5fde6df
authored
Aug 15, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder_control: add function _is_current_song()
Replaces _current_song().
parent
784d666a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
15 deletions
+42
-15
decoder_control.c
src/decoder_control.c
+21
-0
decoder_control.h
src/decoder_control.h
+20
-14
player_thread.c
src/player_thread.c
+1
-1
No files found.
src/decoder_control.c
View file @
b5fde6df
...
...
@@ -97,6 +97,27 @@ dc_command_async(struct decoder_control *dc, enum decoder_command cmd)
decoder_unlock
(
dc
);
}
bool
decoder_is_current_song
(
const
struct
decoder_control
*
dc
,
const
struct
song
*
song
)
{
assert
(
dc
!=
NULL
);
assert
(
song
!=
NULL
);
switch
(
dc
->
state
)
{
case
DECODE_STATE_STOP
:
case
DECODE_STATE_ERROR
:
return
false
;
case
DECODE_STATE_START
:
case
DECODE_STATE_DECODE
:
return
dc
->
song
==
song
;
}
assert
(
false
);
return
false
;
}
void
dc_start
(
struct
decoder_control
*
dc
,
struct
song
*
song
,
unsigned
start_ms
,
unsigned
end_ms
,
...
...
src/decoder_control.h
View file @
b5fde6df
...
...
@@ -276,21 +276,27 @@ decoder_lock_has_failed(struct decoder_control *dc)
return
ret
;
}
static
inline
const
struct
song
*
decoder_current_song
(
const
struct
decoder_control
*
dc
)
{
switch
(
dc
->
state
)
{
case
DECODE_STATE_STOP
:
case
DECODE_STATE_ERROR
:
return
NULL
;
case
DECODE_STATE_START
:
case
DECODE_STATE_DECODE
:
return
dc
->
song
;
}
/**
* Check if the specified song is currently being decoded. If the
* decoder is not running currently (or being started), then this
* function returns false in any case.
*
* Caller must lock the object.
*/
gcc_pure
bool
decoder_is_current_song
(
const
struct
decoder_control
*
dc
,
const
struct
song
*
song
);
assert
(
false
);
return
NULL
;
gcc_pure
static
inline
bool
decoder_lock_is_current_song
(
struct
decoder_control
*
dc
,
const
struct
song
*
song
)
{
decoder_lock
(
dc
);
const
bool
result
=
decoder_is_current_song
(
dc
,
song
);
decoder_unlock
(
dc
);
return
result
;
}
/**
...
...
src/player_thread.c
View file @
b5fde6df
...
...
@@ -458,7 +458,7 @@ static bool player_seek_decoder(struct player *player)
assert
(
pc
->
next_song
!=
NULL
);
if
(
decoder_current_song
(
dc
)
!=
song
)
{
if
(
!
decoder_lock_is_current_song
(
dc
,
song
)
)
{
/* the decoder is already decoding the "next" song -
stop it and start the previous song again */
...
...
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