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
7de5f9ce
Commit
7de5f9ce
authored
Jan 03, 2008
by
Eric Wong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
player.c: introduce set_current_song to avoid needless repetition
git-svn-id:
https://svn.musicpd.org/mpd/trunk@7126
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
00e02249
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
27 deletions
+13
-27
player.c
src/player.c
+13
-27
No files found.
src/player.c
View file @
7de5f9ce
...
@@ -208,6 +208,15 @@ int playerWait(int fd)
...
@@ -208,6 +208,15 @@ int playerWait(int fd)
return
0
;
return
0
;
}
}
static
void
set_current_song
(
Song
*
song
)
{
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
pc
->
fileTime
=
song
->
tag
?
song
->
tag
->
time
:
0
;
copyMpdTagToMetadataChunk
(
song
->
tag
,
&
(
pc
->
fileMetadataChunk
));
get_song_url
(
pc
->
utf8url
,
song
);
}
int
playerPlay
(
int
fd
,
Song
*
song
)
int
playerPlay
(
int
fd
,
Song
*
song
)
{
{
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
...
@@ -215,14 +224,7 @@ int playerPlay(int fd, Song * song)
...
@@ -215,14 +224,7 @@ int playerPlay(int fd, Song * song)
if
(
playerStop
(
fd
)
<
0
)
if
(
playerStop
(
fd
)
<
0
)
return
-
1
;
return
-
1
;
if
(
song
->
tag
)
set_current_song
(
song
);
pc
->
fileTime
=
song
->
tag
->
time
;
else
pc
->
fileTime
=
0
;
copyMpdTagToMetadataChunk
(
song
->
tag
,
&
(
pc
->
fileMetadataChunk
));
get_song_url
(
pc
->
utf8url
,
song
);
pc
->
play
=
1
;
pc
->
play
=
1
;
if
(
playerInit
()
<
0
)
{
if
(
playerInit
()
<
0
)
{
...
@@ -395,15 +397,7 @@ int queueSong(Song * song)
...
@@ -395,15 +397,7 @@ int queueSong(Song * song)
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
if
(
pc
->
queueState
==
PLAYER_QUEUE_BLANK
)
{
if
(
pc
->
queueState
==
PLAYER_QUEUE_BLANK
)
{
get_song_url
(
pc
->
utf8url
,
song
);
set_current_song
(
song
);
if
(
song
->
tag
)
pc
->
fileTime
=
song
->
tag
->
time
;
else
pc
->
fileTime
=
0
;
copyMpdTagToMetadataChunk
(
song
->
tag
,
&
(
pc
->
fileMetadataChunk
));
pc
->
queueState
=
PLAYER_QUEUE_FULL
;
pc
->
queueState
=
PLAYER_QUEUE_FULL
;
return
0
;
return
0
;
}
}
...
@@ -462,16 +456,8 @@ int playerSeek(int fd, Song * song, float time)
...
@@ -462,16 +456,8 @@ int playerSeek(int fd, Song * song, float time)
return
-
1
;
return
-
1
;
}
}
if
(
strcmp
(
pc
->
utf8url
,
get_song_url
(
path_max_tmp
,
song
))
!=
0
)
{
if
(
strcmp
(
pc
->
utf8url
,
get_song_url
(
path_max_tmp
,
song
))
!=
0
)
if
(
song
->
tag
)
set_current_song
(
song
);
pc
->
fileTime
=
song
->
tag
->
time
;
else
pc
->
fileTime
=
0
;
copyMpdTagToMetadataChunk
(
song
->
tag
,
&
(
pc
->
fileMetadataChunk
));
strcpy
(
pc
->
utf8url
,
path_max_tmp
);
}
if
(
pc
->
error
==
PLAYER_ERROR_NOERROR
)
{
if
(
pc
->
error
==
PLAYER_ERROR_NOERROR
)
{
resetPlayerMetadata
();
resetPlayerMetadata
();
...
...
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