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
bf9e2afb
Commit
bf9e2afb
authored
May 19, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
just a we bit of changes
git-svn-id:
https://svn.musicpd.org/mpd/trunk@1075
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
3cb99237
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
32 deletions
+43
-32
player.c
src/player.c
+30
-21
player.h
src/player.h
+5
-3
playlist.c
src/playlist.c
+8
-8
No files found.
src/player.c
View file @
bf9e2afb
...
@@ -186,7 +186,7 @@ int playerGetSuffix(char * utf8file) {
...
@@ -186,7 +186,7 @@ int playerGetSuffix(char * utf8file) {
return
-
1
;
return
-
1
;
}
}
int
playerPlay
(
FILE
*
fp
,
char
*
utf8file
)
{
int
playerPlay
(
FILE
*
fp
,
Song
*
song
)
{
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
int
decodeType
;
int
decodeType
;
...
@@ -204,7 +204,7 @@ int playerPlay(FILE * fp, char * utf8file) {
...
@@ -204,7 +204,7 @@ int playerPlay(FILE * fp, char * utf8file) {
}
}
}*/
}*/
decodeType
=
playerGetDecodeType
(
utf8file
);
decodeType
=
playerGetDecodeType
(
song
->
utf8url
);
if
(
decodeType
<
0
)
{
if
(
decodeType
<
0
)
{
strncpy
(
pc
->
erroredFile
,
pc
->
file
,
MAXPATHLEN
);
strncpy
(
pc
->
erroredFile
,
pc
->
file
,
MAXPATHLEN
);
pc
->
erroredFile
[
MAXPATHLEN
]
=
'\0'
;
pc
->
erroredFile
[
MAXPATHLEN
]
=
'\0'
;
...
@@ -212,12 +212,15 @@ int playerPlay(FILE * fp, char * utf8file) {
...
@@ -212,12 +212,15 @@ int playerPlay(FILE * fp, char * utf8file) {
return
0
;
return
0
;
}
}
pc
->
decodeType
=
decodeType
;
pc
->
decodeType
=
decodeType
;
pc
->
fileSuffix
=
playerGetSuffix
(
utf8file
);
pc
->
fileSuffix
=
playerGetSuffix
(
song
->
utf8url
);
if
(
song
->
tag
)
pc
->
fileTime
=
song
->
tag
->
time
;
else
pc
->
fileTime
=
0
;
if
(
isRemoteUrl
(
utf8file
))
{
if
(
isRemoteUrl
(
song
->
utf8url
))
{
strncpy
(
pc
->
file
,
utf8file
,
MAXPATHLEN
);
strncpy
(
pc
->
file
,
song
->
utf8url
,
MAXPATHLEN
);
}
}
else
strncpy
(
pc
->
file
,
rmp2amp
(
utf8ToFsCharset
(
utf8file
)),
MAXPATHLEN
);
else
strncpy
(
pc
->
file
,
rmp2amp
(
utf8ToFsCharset
(
song
->
utf8url
)),
MAXPATHLEN
);
pc
->
file
[
MAXPATHLEN
]
=
'\0'
;
pc
->
file
[
MAXPATHLEN
]
=
'\0'
;
pc
->
play
=
1
;
pc
->
play
=
1
;
...
@@ -247,9 +250,9 @@ int playerStop(FILE * fp) {
...
@@ -247,9 +250,9 @@ int playerStop(FILE * fp) {
void
playerKill
()
{
void
playerKill
()
{
int
pid
;
int
pid
;
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
/*
PlayerControl * pc = &(getPlayerData()->playerControl);
/*
playerStop(stderr);
playerStop(stderr);
playerCloseAudio(stderr);
playerCloseAudio(stderr);
if(player_pid>0 && pc->closeAudio) sleep(1);*/
if(player_pid>0 && pc->closeAudio) sleep(1);*/
...
@@ -357,21 +360,24 @@ void playerCloseAudio() {
...
@@ -357,21 +360,24 @@ void playerCloseAudio() {
}
}
}
}
int
queueSong
(
char
*
utf8file
)
{
int
queueSong
(
Song
*
song
)
{
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
int
decodeType
;
int
decodeType
;
if
(
pc
->
queueState
==
PLAYER_QUEUE_BLANK
)
{
if
(
pc
->
queueState
==
PLAYER_QUEUE_BLANK
)
{
if
(
isRemoteUrl
(
utf8file
))
{
if
(
isRemoteUrl
(
song
->
utf8url
))
{
strncpy
(
pc
->
file
,
utf8file
,
MAXPATHLEN
);
strncpy
(
pc
->
file
,
song
->
utf8url
,
MAXPATHLEN
);
}
}
else
strncpy
(
pc
->
file
,
rmp2amp
(
utf8ToFsCharset
(
utf8file
)),
MAXPATHLEN
);
else
strncpy
(
pc
->
file
,
rmp2amp
(
utf8ToFsCharset
(
song
->
utf8url
)),
MAXPATHLEN
);
pc
->
file
[
MAXPATHLEN
]
=
'\0'
;
pc
->
file
[
MAXPATHLEN
]
=
'\0'
;
decodeType
=
playerGetDecodeType
(
utf8file
);
decodeType
=
playerGetDecodeType
(
song
->
utf8url
);
if
(
decodeType
<
0
)
return
-
1
;
if
(
decodeType
<
0
)
return
-
1
;
pc
->
decodeType
=
decodeType
;
pc
->
decodeType
=
decodeType
;
pc
->
fileSuffix
=
playerGetSuffix
(
utf8file
);
pc
->
fileSuffix
=
playerGetSuffix
(
song
->
utf8url
);
if
(
song
->
tag
)
pc
->
fileTime
=
song
->
tag
->
time
;
else
pc
->
fileTime
=
0
;
pc
->
queueState
=
PLAYER_QUEUE_FULL
;
pc
->
queueState
=
PLAYER_QUEUE_FULL
;
return
0
;
return
0
;
...
@@ -412,7 +418,7 @@ void playerQueueUnlock() {
...
@@ -412,7 +418,7 @@ void playerQueueUnlock() {
}
}
}
}
int
playerSeek
(
FILE
*
fp
,
char
*
utf8file
,
float
time
)
{
int
playerSeek
(
FILE
*
fp
,
Song
*
song
,
float
time
)
{
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
char
*
file
;
char
*
file
;
int
decodeType
;
int
decodeType
;
...
@@ -423,18 +429,21 @@ int playerSeek(FILE * fp, char * utf8file, float time) {
...
@@ -423,18 +429,21 @@ int playerSeek(FILE * fp, char * utf8file, float time) {
return
-
1
;
return
-
1
;
}
}
if
(
isRemoteUrl
(
utf8file
))
file
=
utf8file
;
if
(
isRemoteUrl
(
song
->
utf8url
))
file
=
song
->
utf8url
;
else
file
=
rmp2amp
(
utf8ToFsCharset
(
utf8file
));
else
file
=
rmp2amp
(
utf8ToFsCharset
(
song
->
utf8url
));
if
(
strcmp
(
pc
->
file
,
file
)
!=
0
)
{
if
(
strcmp
(
pc
->
file
,
file
)
!=
0
)
{
decodeType
=
playerGetDecodeType
(
utf8file
);
decodeType
=
playerGetDecodeType
(
song
->
utf8url
);
if
(
decodeType
<
0
)
{
if
(
decodeType
<
0
)
{
myfprintf
(
fp
,
"%s unknown file type: %s
\n
"
,
myfprintf
(
fp
,
"%s unknown file type: %s
\n
"
,
COMMAND_RESPOND_ERROR
,
utf8file
);
COMMAND_RESPOND_ERROR
,
song
->
utf8url
);
ERROR
(
"playerSeek: unknown file type: %s
\n
"
,
utf8file
);
ERROR
(
"playerSeek: unknown file type: %s
\n
"
,
song
->
utf8url
);
return
-
1
;
return
-
1
;
}
}
pc
->
decodeType
=
decodeType
;
pc
->
decodeType
=
decodeType
;
pc
->
fileSuffix
=
playerGetSuffix
(
utf8file
);
pc
->
fileSuffix
=
playerGetSuffix
(
song
->
utf8url
);
if
(
song
->
tag
)
pc
->
fileTime
=
song
->
tag
->
time
;
else
pc
->
fileTime
=
0
;
strncpy
(
pc
->
file
,
file
,
MAXPATHLEN
);
strncpy
(
pc
->
file
,
file
,
MAXPATHLEN
);
pc
->
file
[
MAXPATHLEN
]
=
'\0'
;
pc
->
file
[
MAXPATHLEN
]
=
'\0'
;
...
...
src/player.h
View file @
bf9e2afb
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "../config.h"
#include "../config.h"
#include "mpd_types.h"
#include "mpd_types.h"
#include "song.h"
#include <stdio.h>
#include <stdio.h>
#include <sys/param.h>
#include <sys/param.h>
...
@@ -66,6 +67,7 @@ typedef struct _PlayerControl {
...
@@ -66,6 +67,7 @@ typedef struct _PlayerControl {
volatile
float
beginTime
;
volatile
float
beginTime
;
volatile
float
totalTime
;
volatile
float
totalTime
;
volatile
float
elapsedTime
;
volatile
float
elapsedTime
;
volatile
float
fileTime
;
char
file
[
MAXPATHLEN
+
1
];
char
file
[
MAXPATHLEN
+
1
];
char
erroredFile
[
MAXPATHLEN
+
1
];
char
erroredFile
[
MAXPATHLEN
+
1
];
volatile
mpd_sint8
queueState
;
volatile
mpd_sint8
queueState
;
...
@@ -85,7 +87,7 @@ void clearPlayerPid();
...
@@ -85,7 +87,7 @@ void clearPlayerPid();
void
player_sigChldHandler
(
int
pid
,
int
status
);
void
player_sigChldHandler
(
int
pid
,
int
status
);
int
playerPlay
(
FILE
*
fp
,
char
*
utf8file
);
int
playerPlay
(
FILE
*
fp
,
Song
*
song
);
int
playerSetPause
(
FILE
*
fp
,
int
pause
);
int
playerSetPause
(
FILE
*
fp
,
int
pause
);
...
@@ -115,7 +117,7 @@ int getPlayerError();
...
@@ -115,7 +117,7 @@ int getPlayerError();
int
playerInit
();
int
playerInit
();
int
queueSong
(
char
*
utf8file
);
int
queueSong
(
Song
*
song
);
int
getPlayerQueueState
();
int
getPlayerQueueState
();
...
@@ -125,7 +127,7 @@ void playerQueueLock();
...
@@ -125,7 +127,7 @@ void playerQueueLock();
void
playerQueueUnlock
();
void
playerQueueUnlock
();
int
playerSeek
(
FILE
*
fp
,
char
*
utf8file
,
float
time
);
int
playerSeek
(
FILE
*
fp
,
Song
*
song
,
float
time
);
void
setPlayerCrossFade
(
float
crossFadeInSeconds
);
void
setPlayerCrossFade
(
float
crossFadeInSeconds
);
...
...
src/playlist.c
View file @
bf9e2afb
...
@@ -386,8 +386,9 @@ void queueNextSongInPlaylist() {
...
@@ -386,8 +386,9 @@ void queueNextSongInPlaylist() {
playlist
.
queued
,
playlist
.
queued
,
playlist
.
songs
[
playlist
.
order
[
playlist
.
songs
[
playlist
.
order
[
playlist
.
queued
]]
->
utf8url
);
playlist
.
queued
]]
->
utf8url
);
if
(
queueSong
(
playlist
.
songs
[
playlist
.
order
[
if
(
queueSong
(
playlist
.
songs
[
playlist
.
order
[
playlist
.
queued
]])
<
playlist
.
queued
]]
->
utf8url
)
<
0
)
{
0
)
{
playlist
.
queued
=
-
1
;
playlist
.
queued
=
-
1
;
playlist_queueError
=
1
;
playlist_queueError
=
1
;
}
}
...
@@ -401,8 +402,9 @@ void queueNextSongInPlaylist() {
...
@@ -401,8 +402,9 @@ void queueNextSongInPlaylist() {
playlist
.
queued
,
playlist
.
queued
,
playlist
.
songs
[
playlist
.
order
[
playlist
.
songs
[
playlist
.
order
[
playlist
.
queued
]]
->
utf8url
);
playlist
.
queued
]]
->
utf8url
);
if
(
queueSong
(
playlist
.
songs
[
playlist
.
order
[
if
(
queueSong
(
playlist
.
songs
[
playlist
.
order
[
playlist
.
queued
]])
<
playlist
.
queued
]]
->
utf8url
)
<
0
)
{
0
)
{
playlist
.
queued
=
-
1
;
playlist
.
queued
=
-
1
;
playlist_queueError
=
1
;
playlist_queueError
=
1
;
}
}
...
@@ -660,9 +662,7 @@ int playPlaylistOrderNumber(FILE * fp, int orderNum) {
...
@@ -660,9 +662,7 @@ int playPlaylistOrderNumber(FILE * fp, int orderNum) {
DEBUG
(
"playlist: play %i:
\"
%s
\"\n
"
,
orderNum
,
DEBUG
(
"playlist: play %i:
\"
%s
\"\n
"
,
orderNum
,
(
playlist
.
songs
[
playlist
.
order
[
orderNum
]])
->
utf8url
);
(
playlist
.
songs
[
playlist
.
order
[
orderNum
]])
->
utf8url
);
if
(
playerPlay
(
fp
,(
playlist
.
songs
[
playlist
.
order
[
orderNum
]])
->
if
(
playerPlay
(
fp
,(
playlist
.
songs
[
playlist
.
order
[
orderNum
]]))
<
0
)
{
utf8url
)
<
0
)
{
stopPlaylist
(
fp
);
stopPlaylist
(
fp
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1220,6 +1220,6 @@ int seekSongInPlaylist(FILE * fp, int song, float time) {
...
@@ -1220,6 +1220,6 @@ int seekSongInPlaylist(FILE * fp, int song, float time) {
if
(
playPlaylistOrderNumber
(
fp
,
i
)
<
0
)
return
-
1
;
if
(
playPlaylistOrderNumber
(
fp
,
i
)
<
0
)
return
-
1
;
}
}
return
playerSeek
(
fp
,
playlist
.
songs
[
playlist
.
order
[
i
]]
->
utf8url
,
time
);
return
playerSeek
(
fp
,
playlist
.
songs
[
playlist
.
order
[
i
]],
time
);
}
}
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
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