aboutsummaryrefslogtreecommitdiffstats
path: root/src/player_control.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/player_control.h')
-rw-r--r--src/player_control.h75
1 files changed, 45 insertions, 30 deletions
diff --git a/src/player_control.h b/src/player_control.h
index b1f7481cd..e9a43e844 100644
--- a/src/player_control.h
+++ b/src/player_control.h
@@ -35,7 +35,6 @@ enum player_command {
PLAYER_COMMAND_NONE = 0,
PLAYER_COMMAND_EXIT,
PLAYER_COMMAND_STOP,
- PLAYER_COMMAND_PLAY,
PLAYER_COMMAND_PAUSE,
PLAYER_COMMAND_SEEK,
PLAYER_COMMAND_CLOSE_AUDIO,
@@ -49,6 +48,12 @@ enum player_command {
* stop
*/
PLAYER_COMMAND_CANCEL,
+
+ /**
+ * Refresh status information in the #player_control struct,
+ * e.g. elapsed_time.
+ */
+ PLAYER_COMMAND_REFRESH,
};
enum player_error {
@@ -60,6 +65,14 @@ enum player_error {
PLAYER_ERROR_FILENOTFOUND,
};
+struct player_status {
+ enum player_state state;
+ uint16_t bit_rate;
+ struct audio_format audio_format;
+ float total_time;
+ float elapsed_time;
+};
+
struct player_control {
unsigned buffer_chunks;
@@ -81,7 +94,6 @@ struct player_control {
struct song *errored_song;
volatile double seek_where;
float cross_fade_seconds;
- uint16_t software_volume;
double total_play_time;
};
@@ -100,37 +112,47 @@ void
pc_song_deleted(const struct song *song);
void
-playerPlay(struct song *song);
+pc_play(struct song *song);
/**
* see PLAYER_COMMAND_CANCEL
*/
void pc_cancel(void);
-void playerSetPause(int pause_flag);
-
-void playerPause(void);
-
-void playerKill(void);
+void
+pc_set_pause(bool pause_flag);
-int getPlayerTotalTime(void);
+void
+pc_pause(void);
-int getPlayerElapsedTime(void);
+void
+pc_kill(void);
-unsigned long getPlayerBitRate(void);
+void
+pc_get_status(struct player_status *status);
-enum player_state getPlayerState(void);
+enum player_state
+pc_get_state(void);
-void clearPlayerError(void);
+void
+pc_clear_error(void);
-char *getPlayerErrorStr(void);
+/**
+ * Returns the human-readable message describing the last error during
+ * playback, NULL if no error occurred. The caller has to free the
+ * returned string.
+ */
+char *
+pc_get_error_message(void);
-enum player_error getPlayerError(void);
+enum player_error
+pc_get_error(void);
-void playerWait(void);
+void
+pc_stop(void);
void
-queueSong(struct song *song);
+pc_enqueue_song(struct song *song);
/**
* Makes the player thread seek the specified song to a position.
@@ -141,20 +163,13 @@ queueSong(struct song *song);
bool
pc_seek(struct song *song, float seek_time);
-void setPlayerCrossFade(float crossFadeInSeconds);
-
-float getPlayerCrossFade(void);
-
-void setPlayerSoftwareVolume(int volume);
-
-double getPlayerTotalPlayTime(void);
+void
+pc_set_cross_fade(float cross_fade_seconds);
-static inline const struct audio_format *
-player_get_audio_format(void)
-{
- return &pc.audio_format;
-}
+float
+pc_get_cross_fade(void);
-void playerInit(void);
+double
+pc_get_total_play_time(void);
#endif