aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-10 14:47:58 +0200
committerMax Kellermann <max@duempel.org>2008-10-10 14:47:58 +0200
commit0b4dfae22e883d376bc44e1e2d78f201d045970b (patch)
tree755cbfeff4158a09c6970824612488b3702a8c7b /src
parent8c33b64847c5ead45ade665afc9ad16a04a693f2 (diff)
downloadmpd-0b4dfae22e883d376bc44e1e2d78f201d045970b.tar.gz
mpd-0b4dfae22e883d376bc44e1e2d78f201d045970b.tar.xz
mpd-0b4dfae22e883d376bc44e1e2d78f201d045970b.zip
player: added player_control.audio_format
This replaces the attributes bits, channels, sampleRate.
Diffstat (limited to '')
-rw-r--r--src/command.c2
-rw-r--r--src/player_control.c10
-rw-r--r--src/player_control.h9
-rw-r--r--src/player_thread.c8
4 files changed, 12 insertions, 17 deletions
diff --git a/src/command.c b/src/command.c
index 2cada67d9..2557e86a4 100644
--- a/src/command.c
+++ b/src/command.c
@@ -403,7 +403,7 @@ static int commandStatus(struct client *client,
client_printf(client,
COMMAND_STATUS_TIME ": %i:%i\n"
COMMAND_STATUS_BITRATE ": %li\n"
- COMMAND_STATUS_AUDIO ": %u:%i:%i\n",
+ COMMAND_STATUS_AUDIO ": %u:%u:%u\n",
getPlayerElapsedTime(), getPlayerTotalTime(),
getPlayerBitRate(),
getPlayerSampleRate(), getPlayerBits(),
diff --git a/src/player_control.c b/src/player_control.c
index 0339af5de..efdab7208 100644
--- a/src/player_control.c
+++ b/src/player_control.c
@@ -256,17 +256,17 @@ double getPlayerTotalPlayTime(void)
unsigned int getPlayerSampleRate(void)
{
- return pc.sampleRate;
+ return pc.audio_format.sample_rate;
}
-int getPlayerBits(void)
+unsigned getPlayerBits(void)
{
- return pc.bits;
+ return pc.audio_format.bits;
}
-int getPlayerChannels(void)
+unsigned getPlayerChannels(void)
{
- return pc.channels;
+ return pc.audio_format.channels;
}
/* this actually creates a dupe of the current metadata */
diff --git a/src/player_control.h b/src/player_control.h
index 372c445db..b763cc389 100644
--- a/src/player_control.h
+++ b/src/player_control.h
@@ -20,6 +20,7 @@
#define PLAYER_H
#include "notify.h"
+#include "audio_format.h"
#include <stdint.h>
@@ -86,9 +87,7 @@ struct player_control {
volatile enum player_state state;
volatile int8_t error;
volatile uint16_t bitRate;
- volatile int8_t bits;
- volatile int8_t channels;
- volatile uint32_t sampleRate;
+ struct audio_format audio_format;
volatile float totalTime;
volatile float elapsedTime;
volatile float fileTime;
@@ -157,9 +156,9 @@ double getPlayerTotalPlayTime(void);
unsigned int getPlayerSampleRate(void);
-int getPlayerBits(void);
+unsigned getPlayerBits(void);
-int getPlayerChannels(void);
+unsigned getPlayerChannels(void);
struct song *
playerCurrentDecodeSong(void);
diff --git a/src/player_thread.c b/src/player_thread.c
index efb7d7ab5..c5a51a00a 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -62,9 +62,7 @@ static int waitOnDecode(int *decodeWaitedOn)
pc.totalTime = pc.fileTime;
pc.bitRate = 0;
- pc.sampleRate = 0;
- pc.bits = 0;
- pc.channels = 0;
+ audio_format_clear(&pc.audio_format);
*decodeWaitedOn = 1;
return 0;
@@ -253,9 +251,7 @@ static void do_play(void)
closeAudioDevice();
}
pc.totalTime = dc.totalTime;
- pc.sampleRate = dc.audioFormat.sample_rate;
- pc.bits = dc.audioFormat.bits;
- pc.channels = dc.audioFormat.channels;
+ pc.audio_format = dc.audioFormat;
sizeToTime = audioFormatSizeToTime(&ob.audioFormat);
}
else {