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
9b1c5505
Commit
9b1c5505
authored
Feb 27, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add xfade and audio to status, remove crossfade no args options
git-svn-id:
https://svn.musicpd.org/mpd/trunk@75
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
ce1d377d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
25 deletions
+62
-25
audio.h
src/audio.h
+5
-3
audiofile_decode.c
src/audiofile_decode.c
+4
-2
command.c
src/command.c
+6
-6
decode.c
src/decode.c
+4
-0
player.c
src/player.c
+18
-0
player.h
src/player.h
+25
-14
No files found.
src/audio.h
View file @
9b1c5505
...
...
@@ -19,15 +19,17 @@
#ifndef AUDIO_H
#define AUDIO_H
#include "mpd_types.h"
#include <stdio.h>
#include <ao/ao.h>
#define AUDIO_AO_DRIVER_DEFAULT "default"
typedef
struct
_AudioFormat
{
int
channels
;
int
sampleRate
;
int
bits
;
mpd_sint8
channels
;
mpd_uint32
sampleRate
;
mpd_sint8
bits
;
}
AudioFormat
;
extern
int
audio_ao_driver_id
;
...
...
src/audiofile_decode.c
View file @
9b1c5505
...
...
@@ -52,6 +52,7 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
{
int
fs
,
frame_count
;
AFfilehandle
af_fp
;
int
bits
;
af_fp
=
afOpenFile
(
dc
->
file
,
"r"
,
NULL
);
if
(
af_fp
==
AF_NULL_FILEHANDLE
)
{
...
...
@@ -59,8 +60,9 @@ int audiofile_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
return
-
1
;
}
afGetSampleFormat
(
af_fp
,
AF_DEFAULT_TRACK
,
&
fs
,
&
af
->
bits
);
af
->
sampleRate
=
(
int
)
afGetRate
(
af_fp
,
AF_DEFAULT_TRACK
);
afGetSampleFormat
(
af_fp
,
AF_DEFAULT_TRACK
,
&
fs
,
&
bits
);
af
->
bits
=
bits
;
af
->
sampleRate
=
afGetRate
(
af_fp
,
AF_DEFAULT_TRACK
);
af
->
channels
=
afGetChannels
(
af_fp
,
AF_DEFAULT_TRACK
);
frame_count
=
afGetFrameCount
(
af_fp
,
AF_DEFAULT_TRACK
);
...
...
src/command.c
View file @
9b1c5505
...
...
@@ -29,6 +29,7 @@
#include "list.h"
#include "conf.h"
#include "permission.h"
#include "audio.h"
#include <stdlib.h>
#include <string.h>
...
...
@@ -81,6 +82,8 @@
#define COMMAND_STATUS_TIME "time"
#define COMMAND_STATUS_BITRATE "bitrate"
#define COMMAND_STATUS_ERROR "error"
#define COMMAND_STATUS_CROSSFADE "xfade"
#define COMMAND_STATUS_AUDIO "audio"
typedef
int
(
*
CommandHandlerFunction
)(
FILE
*
,
unsigned
int
*
,
int
,
char
**
);
...
...
@@ -186,6 +189,8 @@ int commandStatus(FILE * fp, unsigned int * permission, int argArrayLength,
myfprintf
(
fp
,
"%s: %i
\n
"
,
COMMAND_STATUS_SONG
,
getPlaylistCurrentSong
());
myfprintf
(
fp
,
"%s: %i:%i
\n
"
,
COMMAND_STATUS_TIME
,
getPlayerElapsedTime
(),
getPlayerTotalTime
());
myfprintf
(
fp
,
"%s: %li
\n
"
,
COMMAND_STATUS_BITRATE
,
getPlayerBitRate
(),
getPlayerTotalTime
());
myfprintf
(
fp
,
"%s: %i
\n
"
,
COMMAND_STATUS_CROSSFADE
,(
int
)
getPlayerCrossFade
());
myfprintf
(
fp
,
"%s: %u:%i:%i
\n
"
,
COMMAND_STATUS_AUDIO
,
getPlayerSampleRate
(),
getPlayerBits
(),
getPlayerChannels
());
}
if
(
getPlayerError
()
!=
PLAYER_ERROR_NOERROR
)
{
...
...
@@ -512,11 +517,6 @@ int handleCrossfade(FILE * fp, unsigned int * permission, int argArrayLength,
int
time
;
char
*
test
;
if
(
argArrayLength
==
1
)
{
myfprintf
(
fp
,
"crossfade: %i
\n
"
,(
int
)(
getPlayerCrossFade
()));
return
0
;
}
time
=
strtol
(
argArray
[
1
],
&
test
,
10
);
if
(
*
test
!=
'\0'
||
time
<
0
)
{
myfprintf
(
fp
,
"%s
\"
%s
\"
is not a integer >= 0
\n
"
,
...
...
@@ -567,7 +567,7 @@ void initCommands() {
addCommand
(
COMMAND_PING
,
0
,
0
,
0
,
handlePing
);
addCommand
(
COMMAND_SETVOL
,
PERMISSION_CONTROL
,
1
,
1
,
handleSetVol
);
addCommand
(
COMMAND_PASSWORD
,
0
,
1
,
1
,
handlePassword
);
addCommand
(
COMMAND_CROSSFADE
,
PERMISSION_CONTROL
,
0
,
1
,
handleCrossfade
);
addCommand
(
COMMAND_CROSSFADE
,
PERMISSION_CONTROL
,
1
,
1
,
handleCrossfade
);
sortList
(
commandList
);
}
...
...
src/decode.c
View file @
9b1c5505
...
...
@@ -17,6 +17,7 @@
*/
#include "decode.h"
#include "player.h"
#include "playerData.h"
#include "utils.h"
...
...
@@ -123,6 +124,9 @@ int waitOnDecode(PlayerControl * pc, AudioFormat * af, DecoderControl * dc,
pc
->
elapsedTime
=
0
;
pc
->
bitRate
=
0
;
pc
->
sampleRate
=
af
->
sampleRate
;
pc
->
bits
=
af
->
bits
;
pc
->
channels
=
af
->
channels
;
pc
->
totalTime
=
cb
->
totalTime
;
return
0
;
...
...
src/player.c
View file @
9b1c5505
...
...
@@ -414,3 +414,21 @@ double getPlayerTotalPlayTime() {
return
pc
->
totalPlayTime
+
pc
->
elapsedTime
-
pc
->
beginTime
;
}
unsigned
int
getPlayerSampleRate
()
{
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
return
pc
->
sampleRate
;
}
int
getPlayerBits
()
{
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
return
pc
->
bits
;
}
int
getPlayerChannels
()
{
PlayerControl
*
pc
=
&
(
getPlayerData
()
->
playerControl
);
return
pc
->
channels
;
}
src/player.h
View file @
9b1c5505
...
...
@@ -19,6 +19,8 @@
#ifndef PLAYER_H
#define PLAYER_H
#include "mpd_types.h"
#include <stdio.h>
#include <sys/param.h>
...
...
@@ -47,27 +49,30 @@
#define PLAYER_QUEUE_LOCKED 1
typedef
struct
_PlayerControl
{
int
decodeType
;
int
stop
;
int
play
;
int
pause
;
int
state
;
int
closeAudio
;
int
error
;
unsigned
long
bitRate
;
mpd_sint8
decodeType
;
mpd_sint8
stop
;
mpd_sint8
play
;
mpd_sint8
pause
;
mpd_sint8
state
;
mpd_sint8
closeAudio
;
mpd_sint8
error
;
mpd_uint16
bitRate
;
mpd_sint8
bits
;
mpd_sint8
channels
;
mpd_uint32
sampleRate
;
float
beginTime
;
float
totalTime
;
float
elapsedTime
;
char
file
[
MAXPATHLEN
+
1
];
char
erroredFile
[
MAXPATHLEN
+
1
];
int
queueState
;
int
queueLockState
;
int
lockQueue
;
int
unlockQueue
;
int
seek
;
mpd_sint8
queueState
;
mpd_sint8
queueLockState
;
mpd_sint8
lockQueue
;
mpd_sint8
unlockQueue
;
mpd_sint8
seek
;
double
seekWhere
;
float
crossFade
;
int
softwareVolume
;
mpd_sint8
softwareVolume
;
double
totalPlayTime
;
}
PlayerControl
;
...
...
@@ -125,4 +130,10 @@ void setPlayerSoftwareVolume(int volume);
double
getPlayerTotalPlayTime
();
unsigned
int
getPlayerSampleRate
();
int
getPlayerBits
();
int
getPlayerChannels
();
#endif
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