player_control: rename to PlayerControl
This commit is contained in:
parent
e699f6781e
commit
5b5675cc12
@ -42,7 +42,7 @@ class Client final : private FullyBufferedSocket, TimeoutMonitor {
|
|||||||
public:
|
public:
|
||||||
Partition &partition;
|
Partition &partition;
|
||||||
struct playlist &playlist;
|
struct playlist &playlist;
|
||||||
struct player_control &player_control;
|
struct PlayerControl &player_control;
|
||||||
|
|
||||||
unsigned permission;
|
unsigned permission;
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ audio_output_config_count(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
audio_output_all_init(player_control &pc)
|
audio_output_all_init(PlayerControl &pc)
|
||||||
{
|
{
|
||||||
const struct config_param *param = nullptr;
|
const struct config_param *param = nullptr;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
@ -469,7 +469,7 @@ audio_output_all_check(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
audio_output_all_wait(player_control &pc, unsigned threshold)
|
audio_output_all_wait(PlayerControl &pc, unsigned threshold)
|
||||||
{
|
{
|
||||||
pc.Lock();
|
pc.Lock();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
struct AudioFormat;
|
struct AudioFormat;
|
||||||
class MusicBuffer;
|
class MusicBuffer;
|
||||||
struct music_chunk;
|
struct music_chunk;
|
||||||
struct player_control;
|
struct PlayerControl;
|
||||||
class Error;
|
class Error;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,7 +40,7 @@ class Error;
|
|||||||
* file and initialize them.
|
* file and initialize them.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
audio_output_all_init(player_control &pc);
|
audio_output_all_init(PlayerControl &pc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global finalization: free memory occupied by audio outputs. All
|
* Global finalization: free memory occupied by audio outputs. All
|
||||||
@ -135,7 +135,7 @@ audio_output_all_check(void);
|
|||||||
* @return true if there are less than #threshold chunks in the pipe
|
* @return true if there are less than #threshold chunks in the pipe
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
audio_output_all_wait(player_control &pc, unsigned threshold);
|
audio_output_all_wait(PlayerControl &pc, unsigned threshold);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Puts all audio outputs into pause mode. Most implementations will
|
* Puts all audio outputs into pause mode. Most implementations will
|
||||||
|
@ -28,7 +28,6 @@ struct audio_output;
|
|||||||
struct AudioFormat;
|
struct AudioFormat;
|
||||||
struct config_param;
|
struct config_param;
|
||||||
class MusicPipe;
|
class MusicPipe;
|
||||||
struct player_control;
|
|
||||||
|
|
||||||
void
|
void
|
||||||
audio_output_set_replay_gain_mode(struct audio_output *ao,
|
audio_output_set_replay_gain_mode(struct audio_output *ao,
|
||||||
|
@ -281,7 +281,7 @@ audio_output_setup(struct audio_output *ao, const config_param ¶m,
|
|||||||
|
|
||||||
struct audio_output *
|
struct audio_output *
|
||||||
audio_output_new(const config_param ¶m,
|
audio_output_new(const config_param ¶m,
|
||||||
player_control &pc,
|
PlayerControl &pc,
|
||||||
Error &error)
|
Error &error)
|
||||||
{
|
{
|
||||||
const struct audio_output_plugin *plugin;
|
const struct audio_output_plugin *plugin;
|
||||||
|
@ -32,6 +32,7 @@ class Error;
|
|||||||
class Filter;
|
class Filter;
|
||||||
class MusicPipe;
|
class MusicPipe;
|
||||||
struct config_param;
|
struct config_param;
|
||||||
|
struct PlayerControl;
|
||||||
typedef struct _GTimer GTimer;
|
typedef struct _GTimer GTimer;
|
||||||
|
|
||||||
enum audio_output_command {
|
enum audio_output_command {
|
||||||
@ -225,10 +226,10 @@ struct audio_output {
|
|||||||
Cond cond;
|
Cond cond;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The player_control object which "owns" this output. This
|
* The PlayerControl object which "owns" this output. This
|
||||||
* object is needed to signal command completion.
|
* object is needed to signal command completion.
|
||||||
*/
|
*/
|
||||||
struct player_control *player_control;
|
PlayerControl *player_control;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The #music_chunk which is currently being played. All
|
* The #music_chunk which is currently being played. All
|
||||||
@ -264,7 +265,7 @@ audio_output_command_is_finished(const struct audio_output *ao)
|
|||||||
|
|
||||||
struct audio_output *
|
struct audio_output *
|
||||||
audio_output_new(const config_param ¶m,
|
audio_output_new(const config_param ¶m,
|
||||||
player_control &pc,
|
PlayerControl &pc,
|
||||||
Error &error);
|
Error &error);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -34,7 +34,7 @@ struct Partition {
|
|||||||
|
|
||||||
struct playlist playlist;
|
struct playlist playlist;
|
||||||
|
|
||||||
player_control pc;
|
PlayerControl pc;
|
||||||
|
|
||||||
Partition(Instance &_instance,
|
Partition(Instance &_instance,
|
||||||
unsigned max_length,
|
unsigned max_length,
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
player_control::player_control(unsigned _buffer_chunks,
|
PlayerControl::PlayerControl(unsigned _buffer_chunks,
|
||||||
unsigned _buffered_before_play)
|
unsigned _buffered_before_play)
|
||||||
:buffer_chunks(_buffer_chunks),
|
:buffer_chunks(_buffer_chunks),
|
||||||
buffered_before_play(_buffered_before_play),
|
buffered_before_play(_buffered_before_play),
|
||||||
@ -50,7 +50,7 @@ player_control::player_control(unsigned _buffer_chunks,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
player_control::~player_control()
|
PlayerControl::~PlayerControl()
|
||||||
{
|
{
|
||||||
if (next_song != nullptr)
|
if (next_song != nullptr)
|
||||||
next_song->Free();
|
next_song->Free();
|
||||||
@ -60,7 +60,7 @@ player_control::~player_control()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::Play(Song *song)
|
PlayerControl::Play(Song *song)
|
||||||
{
|
{
|
||||||
assert(song != nullptr);
|
assert(song != nullptr);
|
||||||
|
|
||||||
@ -79,14 +79,14 @@ player_control::Play(Song *song)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::Cancel()
|
PlayerControl::Cancel()
|
||||||
{
|
{
|
||||||
LockSynchronousCommand(PlayerCommand::CANCEL);
|
LockSynchronousCommand(PlayerCommand::CANCEL);
|
||||||
assert(next_song == nullptr);
|
assert(next_song == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::Stop()
|
PlayerControl::Stop()
|
||||||
{
|
{
|
||||||
LockSynchronousCommand(PlayerCommand::CLOSE_AUDIO);
|
LockSynchronousCommand(PlayerCommand::CLOSE_AUDIO);
|
||||||
assert(next_song == nullptr);
|
assert(next_song == nullptr);
|
||||||
@ -95,13 +95,13 @@ player_control::Stop()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::UpdateAudio()
|
PlayerControl::UpdateAudio()
|
||||||
{
|
{
|
||||||
LockSynchronousCommand(PlayerCommand::UPDATE_AUDIO);
|
LockSynchronousCommand(PlayerCommand::UPDATE_AUDIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::Kill()
|
PlayerControl::Kill()
|
||||||
{
|
{
|
||||||
assert(thread.IsDefined());
|
assert(thread.IsDefined());
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ player_control::Kill()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::PauseLocked()
|
PlayerControl::PauseLocked()
|
||||||
{
|
{
|
||||||
if (state != PlayerState::STOP) {
|
if (state != PlayerState::STOP) {
|
||||||
SynchronousCommand(PlayerCommand::PAUSE);
|
SynchronousCommand(PlayerCommand::PAUSE);
|
||||||
@ -121,7 +121,7 @@ player_control::PauseLocked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::Pause()
|
PlayerControl::Pause()
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
PauseLocked();
|
PauseLocked();
|
||||||
@ -129,7 +129,7 @@ player_control::Pause()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::SetPause(bool pause_flag)
|
PlayerControl::SetPause(bool pause_flag)
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ player_control::SetPause(bool pause_flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::SetBorderPause(bool _border_pause)
|
PlayerControl::SetBorderPause(bool _border_pause)
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
border_pause = _border_pause;
|
border_pause = _border_pause;
|
||||||
@ -160,7 +160,7 @@ player_control::SetBorderPause(bool _border_pause)
|
|||||||
}
|
}
|
||||||
|
|
||||||
player_status
|
player_status
|
||||||
player_control::GetStatus()
|
PlayerControl::GetStatus()
|
||||||
{
|
{
|
||||||
player_status status;
|
player_status status;
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ player_control::GetStatus()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::SetError(PlayerError type, Error &&_error)
|
PlayerControl::SetError(PlayerError type, Error &&_error)
|
||||||
{
|
{
|
||||||
assert(type != PlayerError::NONE);
|
assert(type != PlayerError::NONE);
|
||||||
assert(_error.IsDefined());
|
assert(_error.IsDefined());
|
||||||
@ -192,7 +192,7 @@ player_control::SetError(PlayerError type, Error &&_error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::ClearError()
|
PlayerControl::ClearError()
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ player_control::ClearError()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::LockSetTaggedSong(const Song &song)
|
PlayerControl::LockSetTaggedSong(const Song &song)
|
||||||
{
|
{
|
||||||
Lock();
|
Lock();
|
||||||
if (tagged_song != nullptr)
|
if (tagged_song != nullptr)
|
||||||
@ -215,7 +215,7 @@ player_control::LockSetTaggedSong(const Song &song)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::ClearTaggedSong()
|
PlayerControl::ClearTaggedSong()
|
||||||
{
|
{
|
||||||
if (tagged_song != nullptr) {
|
if (tagged_song != nullptr) {
|
||||||
tagged_song->Free();
|
tagged_song->Free();
|
||||||
@ -224,7 +224,7 @@ player_control::ClearTaggedSong()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::EnqueueSong(Song *song)
|
PlayerControl::EnqueueSong(Song *song)
|
||||||
{
|
{
|
||||||
assert(song != nullptr);
|
assert(song != nullptr);
|
||||||
|
|
||||||
@ -234,7 +234,7 @@ player_control::EnqueueSong(Song *song)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
player_control::Seek(Song *song, float seek_time)
|
PlayerControl::Seek(Song *song, float seek_time)
|
||||||
{
|
{
|
||||||
assert(song != nullptr);
|
assert(song != nullptr);
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ player_control::Seek(Song *song, float seek_time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::SetCrossFade(float _cross_fade_seconds)
|
PlayerControl::SetCrossFade(float _cross_fade_seconds)
|
||||||
{
|
{
|
||||||
if (_cross_fade_seconds < 0)
|
if (_cross_fade_seconds < 0)
|
||||||
_cross_fade_seconds = 0;
|
_cross_fade_seconds = 0;
|
||||||
@ -266,7 +266,7 @@ player_control::SetCrossFade(float _cross_fade_seconds)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::SetMixRampDb(float _mixramp_db)
|
PlayerControl::SetMixRampDb(float _mixramp_db)
|
||||||
{
|
{
|
||||||
mixramp_db = _mixramp_db;
|
mixramp_db = _mixramp_db;
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ player_control::SetMixRampDb(float _mixramp_db)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_control::SetMixRampDelay(float _mixramp_delay_seconds)
|
PlayerControl::SetMixRampDelay(float _mixramp_delay_seconds)
|
||||||
{
|
{
|
||||||
mixramp_delay_seconds = _mixramp_delay_seconds;
|
mixramp_delay_seconds = _mixramp_delay_seconds;
|
||||||
|
|
||||||
|
@ -50,18 +50,18 @@ enum class PlayerCommand : uint8_t {
|
|||||||
*/
|
*/
|
||||||
UPDATE_AUDIO,
|
UPDATE_AUDIO,
|
||||||
|
|
||||||
/** player_control.next_song has been updated */
|
/** PlayerControl.next_song has been updated */
|
||||||
QUEUE,
|
QUEUE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cancel pre-decoding player_control.next_song; if the player
|
* cancel pre-decoding PlayerControl.next_song; if the player
|
||||||
* has already started playing this song, it will completely
|
* has already started playing this song, it will completely
|
||||||
* stop
|
* stop
|
||||||
*/
|
*/
|
||||||
CANCEL,
|
CANCEL,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh status information in the #player_control struct,
|
* Refresh status information in the #PlayerControl struct,
|
||||||
* e.g. elapsed_time.
|
* e.g. elapsed_time.
|
||||||
*/
|
*/
|
||||||
REFRESH,
|
REFRESH,
|
||||||
@ -89,7 +89,7 @@ struct player_status {
|
|||||||
float elapsed_time;
|
float elapsed_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct player_control {
|
struct PlayerControl {
|
||||||
unsigned buffer_chunks;
|
unsigned buffer_chunks;
|
||||||
|
|
||||||
unsigned int buffered_before_play;
|
unsigned int buffered_before_play;
|
||||||
@ -169,9 +169,9 @@ struct player_control {
|
|||||||
*/
|
*/
|
||||||
bool border_pause;
|
bool border_pause;
|
||||||
|
|
||||||
player_control(unsigned buffer_chunks,
|
PlayerControl(unsigned buffer_chunks,
|
||||||
unsigned buffered_before_play);
|
unsigned buffered_before_play);
|
||||||
~player_control();
|
~PlayerControl();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locks the object.
|
* Locks the object.
|
||||||
|
@ -51,7 +51,7 @@ enum class CrossFadeState : int8_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class Player {
|
class Player {
|
||||||
player_control &pc;
|
PlayerControl &pc;
|
||||||
|
|
||||||
DecoderControl &dc;
|
DecoderControl &dc;
|
||||||
|
|
||||||
@ -130,7 +130,7 @@ class Player {
|
|||||||
float elapsed_time;
|
float elapsed_time;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Player(player_control &_pc, DecoderControl &_dc,
|
Player(PlayerControl &_pc, DecoderControl &_dc,
|
||||||
MusicBuffer &_buffer)
|
MusicBuffer &_buffer)
|
||||||
:pc(_pc), dc(_dc), buffer(_buffer),
|
:pc(_pc), dc(_dc), buffer(_buffer),
|
||||||
buffering(false),
|
buffering(false),
|
||||||
@ -275,7 +275,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
player_command_finished(player_control &pc)
|
player_command_finished(PlayerControl &pc)
|
||||||
{
|
{
|
||||||
pc.Lock();
|
pc.Lock();
|
||||||
pc.CommandFinished();
|
pc.CommandFinished();
|
||||||
@ -349,7 +349,7 @@ Player::WaitForDecoder()
|
|||||||
|
|
||||||
pc.Lock();
|
pc.Lock();
|
||||||
|
|
||||||
/* update player_control's song information */
|
/* update PlayerControl's song information */
|
||||||
pc.total_time = pc.next_song->GetDuration();
|
pc.total_time = pc.next_song->GetDuration();
|
||||||
pc.bit_rate = 0;
|
pc.bit_rate = 0;
|
||||||
pc.audio_format.Clear();
|
pc.audio_format.Clear();
|
||||||
@ -686,7 +686,7 @@ Player::ProcessCommand()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_song_tag(player_control &pc, Song *song, const Tag &new_tag)
|
update_song_tag(PlayerControl &pc, Song *song, const Tag &new_tag)
|
||||||
{
|
{
|
||||||
if (song->IsFile())
|
if (song->IsFile())
|
||||||
/* don't update tags of local files, only remote
|
/* don't update tags of local files, only remote
|
||||||
@ -717,7 +717,7 @@ update_song_tag(player_control &pc, Song *song, const Tag &new_tag)
|
|||||||
* Player lock is not held.
|
* Player lock is not held.
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
play_chunk(player_control &pc,
|
play_chunk(PlayerControl &pc,
|
||||||
Song *song, struct music_chunk *chunk,
|
Song *song, struct music_chunk *chunk,
|
||||||
MusicBuffer &buffer,
|
MusicBuffer &buffer,
|
||||||
const AudioFormat format,
|
const AudioFormat format,
|
||||||
@ -1095,7 +1095,7 @@ Player::Run()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
do_play(player_control &pc, DecoderControl &dc,
|
do_play(PlayerControl &pc, DecoderControl &dc,
|
||||||
MusicBuffer &buffer)
|
MusicBuffer &buffer)
|
||||||
{
|
{
|
||||||
Player player(pc, dc, buffer);
|
Player player(pc, dc, buffer);
|
||||||
@ -1105,7 +1105,7 @@ do_play(player_control &pc, DecoderControl &dc,
|
|||||||
static void
|
static void
|
||||||
player_task(void *arg)
|
player_task(void *arg)
|
||||||
{
|
{
|
||||||
player_control &pc = *(player_control *)arg;
|
PlayerControl &pc = *(PlayerControl *)arg;
|
||||||
|
|
||||||
DecoderControl dc;
|
DecoderControl dc;
|
||||||
decoder_thread_start(dc);
|
decoder_thread_start(dc);
|
||||||
@ -1193,7 +1193,7 @@ player_task(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
player_create(player_control &pc)
|
player_create(PlayerControl &pc)
|
||||||
{
|
{
|
||||||
assert(!pc.thread.IsDefined());
|
assert(!pc.thread.IsDefined());
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* audio outputs via audio_output_all_play().
|
* audio outputs via audio_output_all_play().
|
||||||
*
|
*
|
||||||
* It is controlled by the main thread (the playlist code), see
|
* It is controlled by the main thread (the playlist code), see
|
||||||
* player_control.h. The playlist enqueues new songs into the player
|
* PlayerControl.hxx. The playlist enqueues new songs into the player
|
||||||
* thread and sends it commands.
|
* thread and sends it commands.
|
||||||
*
|
*
|
||||||
* The player thread itself does not do any I/O. It synchronizes with
|
* The player thread itself does not do any I/O. It synchronizes with
|
||||||
@ -37,9 +37,9 @@
|
|||||||
#ifndef MPD_PLAYER_THREAD_HXX
|
#ifndef MPD_PLAYER_THREAD_HXX
|
||||||
#define MPD_PLAYER_THREAD_HXX
|
#define MPD_PLAYER_THREAD_HXX
|
||||||
|
|
||||||
struct player_control;
|
struct PlayerControl;
|
||||||
|
|
||||||
void
|
void
|
||||||
player_create(player_control &pc);
|
player_create(PlayerControl &pc);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -49,7 +49,7 @@ playlist::TagModified(Song &&song)
|
|||||||
* Queue a song, addressed by its order number.
|
* Queue a song, addressed by its order number.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
playlist_queue_song_order(playlist &playlist, player_control &pc,
|
playlist_queue_song_order(playlist &playlist, PlayerControl &pc,
|
||||||
unsigned order)
|
unsigned order)
|
||||||
{
|
{
|
||||||
assert(playlist.queue.IsValidOrder(order));
|
assert(playlist.queue.IsValidOrder(order));
|
||||||
@ -71,7 +71,7 @@ playlist_queue_song_order(playlist &playlist, player_control &pc,
|
|||||||
* Called if the player thread has started playing the "queued" song.
|
* Called if the player thread has started playing the "queued" song.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
playlist_song_started(playlist &playlist, player_control &pc)
|
playlist_song_started(playlist &playlist, PlayerControl &pc)
|
||||||
{
|
{
|
||||||
assert(pc.next_song == nullptr);
|
assert(pc.next_song == nullptr);
|
||||||
assert(playlist.queued >= -1);
|
assert(playlist.queued >= -1);
|
||||||
@ -98,7 +98,7 @@ playlist::GetQueuedSong() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::UpdateQueuedSong(player_control &pc, const Song *prev)
|
playlist::UpdateQueuedSong(PlayerControl &pc, const Song *prev)
|
||||||
{
|
{
|
||||||
if (!playing)
|
if (!playing)
|
||||||
return;
|
return;
|
||||||
@ -144,7 +144,7 @@ playlist::UpdateQueuedSong(player_control &pc, const Song *prev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::PlayOrder(player_control &pc, int order)
|
playlist::PlayOrder(PlayerControl &pc, int order)
|
||||||
{
|
{
|
||||||
playing = true;
|
playing = true;
|
||||||
queued = -1;
|
queued = -1;
|
||||||
@ -162,10 +162,10 @@ playlist::PlayOrder(player_control &pc, int order)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
playlist_resume_playback(playlist &playlist, player_control &pc);
|
playlist_resume_playback(playlist &playlist, PlayerControl &pc);
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::SyncWithPlayer(player_control &pc)
|
playlist::SyncWithPlayer(PlayerControl &pc)
|
||||||
{
|
{
|
||||||
if (!playing)
|
if (!playing)
|
||||||
/* this event has reached us out of sync: we aren't
|
/* this event has reached us out of sync: we aren't
|
||||||
@ -205,7 +205,7 @@ playlist::SyncWithPlayer(player_control &pc)
|
|||||||
* decide whether to re-start playback
|
* decide whether to re-start playback
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
playlist_resume_playback(playlist &playlist, player_control &pc)
|
playlist_resume_playback(playlist &playlist, PlayerControl &pc)
|
||||||
{
|
{
|
||||||
assert(playlist.playing);
|
assert(playlist.playing);
|
||||||
assert(pc.GetState() == PlayerState::STOP);
|
assert(pc.GetState() == PlayerState::STOP);
|
||||||
@ -228,7 +228,7 @@ playlist_resume_playback(playlist &playlist, player_control &pc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::SetRepeat(player_control &pc, bool status)
|
playlist::SetRepeat(PlayerControl &pc, bool status)
|
||||||
{
|
{
|
||||||
if (status == queue.repeat)
|
if (status == queue.repeat)
|
||||||
return;
|
return;
|
||||||
@ -255,7 +255,7 @@ playlist_order(playlist &playlist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::SetSingle(player_control &pc, bool status)
|
playlist::SetSingle(PlayerControl &pc, bool status)
|
||||||
{
|
{
|
||||||
if (status == queue.single)
|
if (status == queue.single)
|
||||||
return;
|
return;
|
||||||
@ -282,7 +282,7 @@ playlist::SetConsume(bool status)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::SetRandom(player_control &pc, bool status)
|
playlist::SetRandom(PlayerControl &pc, bool status)
|
||||||
{
|
{
|
||||||
if (status == queue.random)
|
if (status == queue.random)
|
||||||
return;
|
return;
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "Queue.hxx"
|
#include "Queue.hxx"
|
||||||
#include "PlaylistError.hxx"
|
#include "PlaylistError.hxx"
|
||||||
|
|
||||||
struct player_control;
|
struct PlayerControl;
|
||||||
struct Song;
|
struct Song;
|
||||||
|
|
||||||
struct playlist {
|
struct playlist {
|
||||||
@ -105,7 +105,7 @@ struct playlist {
|
|||||||
* player thread whenever it requests a new queued song, or
|
* player thread whenever it requests a new queued song, or
|
||||||
* when it exits.
|
* when it exits.
|
||||||
*/
|
*/
|
||||||
void SyncWithPlayer(player_control &pc);
|
void SyncWithPlayer(PlayerControl &pc);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@ -123,10 +123,10 @@ protected:
|
|||||||
* @param prev the song which was previously queued, as
|
* @param prev the song which was previously queued, as
|
||||||
* determined by playlist_get_queued_song()
|
* determined by playlist_get_queued_song()
|
||||||
*/
|
*/
|
||||||
void UpdateQueuedSong(player_control &pc, const Song *prev);
|
void UpdateQueuedSong(PlayerControl &pc, const Song *prev);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Clear(player_control &pc);
|
void Clear(PlayerControl &pc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A tag in the play queue has been modified by the player
|
* A tag in the play queue has been modified by the player
|
||||||
@ -140,7 +140,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void DatabaseModified();
|
void DatabaseModified();
|
||||||
|
|
||||||
PlaylistResult AppendSong(player_control &pc,
|
PlaylistResult AppendSong(PlayerControl &pc,
|
||||||
Song *song,
|
Song *song,
|
||||||
unsigned *added_id=nullptr);
|
unsigned *added_id=nullptr);
|
||||||
|
|
||||||
@ -150,28 +150,28 @@ public:
|
|||||||
*
|
*
|
||||||
* Note: the caller is responsible for checking permissions.
|
* Note: the caller is responsible for checking permissions.
|
||||||
*/
|
*/
|
||||||
PlaylistResult AppendFile(player_control &pc,
|
PlaylistResult AppendFile(PlayerControl &pc,
|
||||||
const char *path_utf8,
|
const char *path_utf8,
|
||||||
unsigned *added_id=nullptr);
|
unsigned *added_id=nullptr);
|
||||||
|
|
||||||
PlaylistResult AppendURI(player_control &pc,
|
PlaylistResult AppendURI(PlayerControl &pc,
|
||||||
const char *uri_utf8,
|
const char *uri_utf8,
|
||||||
unsigned *added_id=nullptr);
|
unsigned *added_id=nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void DeleteInternal(player_control &pc,
|
void DeleteInternal(PlayerControl &pc,
|
||||||
unsigned song, const Song **queued_p);
|
unsigned song, const Song **queued_p);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PlaylistResult DeletePosition(player_control &pc,
|
PlaylistResult DeletePosition(PlayerControl &pc,
|
||||||
unsigned position);
|
unsigned position);
|
||||||
|
|
||||||
PlaylistResult DeleteOrder(player_control &pc,
|
PlaylistResult DeleteOrder(PlayerControl &pc,
|
||||||
unsigned order) {
|
unsigned order) {
|
||||||
return DeletePosition(pc, queue.OrderToPosition(order));
|
return DeletePosition(pc, queue.OrderToPosition(order));
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult DeleteId(player_control &pc, unsigned id);
|
PlaylistResult DeleteId(PlayerControl &pc, unsigned id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a range of songs from the playlist.
|
* Deletes a range of songs from the playlist.
|
||||||
@ -179,49 +179,49 @@ public:
|
|||||||
* @param start the position of the first song to delete
|
* @param start the position of the first song to delete
|
||||||
* @param end the position after the last song to delete
|
* @param end the position after the last song to delete
|
||||||
*/
|
*/
|
||||||
PlaylistResult DeleteRange(player_control &pc,
|
PlaylistResult DeleteRange(PlayerControl &pc,
|
||||||
unsigned start, unsigned end);
|
unsigned start, unsigned end);
|
||||||
|
|
||||||
void DeleteSong(player_control &pc, const Song &song);
|
void DeleteSong(PlayerControl &pc, const Song &song);
|
||||||
|
|
||||||
void Shuffle(player_control &pc, unsigned start, unsigned end);
|
void Shuffle(PlayerControl &pc, unsigned start, unsigned end);
|
||||||
|
|
||||||
PlaylistResult MoveRange(player_control &pc,
|
PlaylistResult MoveRange(PlayerControl &pc,
|
||||||
unsigned start, unsigned end, int to);
|
unsigned start, unsigned end, int to);
|
||||||
|
|
||||||
PlaylistResult MoveId(player_control &pc, unsigned id, int to);
|
PlaylistResult MoveId(PlayerControl &pc, unsigned id, int to);
|
||||||
|
|
||||||
PlaylistResult SwapPositions(player_control &pc,
|
PlaylistResult SwapPositions(PlayerControl &pc,
|
||||||
unsigned song1, unsigned song2);
|
unsigned song1, unsigned song2);
|
||||||
|
|
||||||
PlaylistResult SwapIds(player_control &pc,
|
PlaylistResult SwapIds(PlayerControl &pc,
|
||||||
unsigned id1, unsigned id2);
|
unsigned id1, unsigned id2);
|
||||||
|
|
||||||
PlaylistResult SetPriorityRange(player_control &pc,
|
PlaylistResult SetPriorityRange(PlayerControl &pc,
|
||||||
unsigned start_position,
|
unsigned start_position,
|
||||||
unsigned end_position,
|
unsigned end_position,
|
||||||
uint8_t priority);
|
uint8_t priority);
|
||||||
|
|
||||||
PlaylistResult SetPriorityId(player_control &pc,
|
PlaylistResult SetPriorityId(PlayerControl &pc,
|
||||||
unsigned song_id, uint8_t priority);
|
unsigned song_id, uint8_t priority);
|
||||||
|
|
||||||
void Stop(player_control &pc);
|
void Stop(PlayerControl &pc);
|
||||||
|
|
||||||
PlaylistResult PlayPosition(player_control &pc, int position);
|
PlaylistResult PlayPosition(PlayerControl &pc, int position);
|
||||||
|
|
||||||
void PlayOrder(player_control &pc, int order);
|
void PlayOrder(PlayerControl &pc, int order);
|
||||||
|
|
||||||
PlaylistResult PlayId(player_control &pc, int id);
|
PlaylistResult PlayId(PlayerControl &pc, int id);
|
||||||
|
|
||||||
void PlayNext(player_control &pc);
|
void PlayNext(PlayerControl &pc);
|
||||||
|
|
||||||
void PlayPrevious(player_control &pc);
|
void PlayPrevious(PlayerControl &pc);
|
||||||
|
|
||||||
PlaylistResult SeekSongPosition(player_control &pc,
|
PlaylistResult SeekSongPosition(PlayerControl &pc,
|
||||||
unsigned song_position,
|
unsigned song_position,
|
||||||
float seek_time);
|
float seek_time);
|
||||||
|
|
||||||
PlaylistResult SeekSongId(player_control &pc,
|
PlaylistResult SeekSongId(PlayerControl &pc,
|
||||||
unsigned song_id, float seek_time);
|
unsigned song_id, float seek_time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -232,26 +232,26 @@ public:
|
|||||||
* @param relative if true, then the specified time is relative to the
|
* @param relative if true, then the specified time is relative to the
|
||||||
* current position
|
* current position
|
||||||
*/
|
*/
|
||||||
PlaylistResult SeekCurrent(player_control &pc,
|
PlaylistResult SeekCurrent(PlayerControl &pc,
|
||||||
float seek_time, bool relative);
|
float seek_time, bool relative);
|
||||||
|
|
||||||
bool GetRepeat() const {
|
bool GetRepeat() const {
|
||||||
return queue.repeat;
|
return queue.repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRepeat(player_control &pc, bool new_value);
|
void SetRepeat(PlayerControl &pc, bool new_value);
|
||||||
|
|
||||||
bool GetRandom() const {
|
bool GetRandom() const {
|
||||||
return queue.random;
|
return queue.random;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetRandom(player_control &pc, bool new_value);
|
void SetRandom(PlayerControl &pc, bool new_value);
|
||||||
|
|
||||||
bool GetSingle() const {
|
bool GetSingle() const {
|
||||||
return queue.single;
|
return queue.single;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSingle(player_control &pc, bool new_value);
|
void SetSingle(PlayerControl &pc, bool new_value);
|
||||||
|
|
||||||
bool GetConsume() const {
|
bool GetConsume() const {
|
||||||
return queue.consume;
|
return queue.consume;
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#include "Log.hxx"
|
#include "Log.hxx"
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::Stop(player_control &pc)
|
playlist::Stop(PlayerControl &pc)
|
||||||
{
|
{
|
||||||
if (!playing)
|
if (!playing)
|
||||||
return;
|
return;
|
||||||
@ -57,7 +57,7 @@ playlist::Stop(player_control &pc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::PlayPosition(player_control &pc, int song)
|
playlist::PlayPosition(PlayerControl &pc, int song)
|
||||||
{
|
{
|
||||||
pc.ClearError();
|
pc.ClearError();
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ playlist::PlayPosition(player_control &pc, int song)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::PlayId(player_control &pc, int id)
|
playlist::PlayId(PlayerControl &pc, int id)
|
||||||
{
|
{
|
||||||
if (id == -1)
|
if (id == -1)
|
||||||
return PlayPosition(pc, id);
|
return PlayPosition(pc, id);
|
||||||
@ -120,7 +120,7 @@ playlist::PlayId(player_control &pc, int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::PlayNext(player_control &pc)
|
playlist::PlayNext(PlayerControl &pc)
|
||||||
{
|
{
|
||||||
if (!playing)
|
if (!playing)
|
||||||
return;
|
return;
|
||||||
@ -166,7 +166,7 @@ playlist::PlayNext(player_control &pc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::PlayPrevious(player_control &pc)
|
playlist::PlayPrevious(PlayerControl &pc)
|
||||||
{
|
{
|
||||||
if (!playing)
|
if (!playing)
|
||||||
return;
|
return;
|
||||||
@ -190,7 +190,7 @@ playlist::PlayPrevious(player_control &pc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::SeekSongPosition(player_control &pc, unsigned song, float seek_time)
|
playlist::SeekSongPosition(PlayerControl &pc, unsigned song, float seek_time)
|
||||||
{
|
{
|
||||||
if (!queue.IsValidPosition(song))
|
if (!queue.IsValidPosition(song))
|
||||||
return PlaylistResult::BAD_RANGE;
|
return PlaylistResult::BAD_RANGE;
|
||||||
@ -229,7 +229,7 @@ playlist::SeekSongPosition(player_control &pc, unsigned song, float seek_time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::SeekSongId(player_control &pc, unsigned id, float seek_time)
|
playlist::SeekSongId(PlayerControl &pc, unsigned id, float seek_time)
|
||||||
{
|
{
|
||||||
int song = queue.IdToPosition(id);
|
int song = queue.IdToPosition(id);
|
||||||
if (song < 0)
|
if (song < 0)
|
||||||
@ -239,7 +239,7 @@ playlist::SeekSongId(player_control &pc, unsigned id, float seek_time)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::SeekCurrent(player_control &pc, float seek_time, bool relative)
|
playlist::SeekCurrent(PlayerControl &pc, float seek_time, bool relative)
|
||||||
{
|
{
|
||||||
if (!playing)
|
if (!playing)
|
||||||
return PlaylistResult::NOT_PLAYING;
|
return PlaylistResult::NOT_PLAYING;
|
||||||
|
@ -46,7 +46,7 @@ playlist::OnModified()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::Clear(player_control &pc)
|
playlist::Clear(PlayerControl &pc)
|
||||||
{
|
{
|
||||||
Stop(pc);
|
Stop(pc);
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ playlist::Clear(player_control &pc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::AppendFile(struct player_control &pc,
|
playlist::AppendFile(PlayerControl &pc,
|
||||||
const char *path_utf8, unsigned *added_id)
|
const char *path_utf8, unsigned *added_id)
|
||||||
{
|
{
|
||||||
Song *song = Song::LoadFile(path_utf8, nullptr);
|
Song *song = Song::LoadFile(path_utf8, nullptr);
|
||||||
@ -70,7 +70,7 @@ playlist::AppendFile(struct player_control &pc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::AppendSong(struct player_control &pc,
|
playlist::AppendSong(PlayerControl &pc,
|
||||||
Song *song, unsigned *added_id)
|
Song *song, unsigned *added_id)
|
||||||
{
|
{
|
||||||
unsigned id;
|
unsigned id;
|
||||||
@ -105,7 +105,7 @@ playlist::AppendSong(struct player_control &pc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::AppendURI(struct player_control &pc,
|
playlist::AppendURI(PlayerControl &pc,
|
||||||
const char *uri, unsigned *added_id)
|
const char *uri, unsigned *added_id)
|
||||||
{
|
{
|
||||||
FormatDebug(playlist_domain, "add to playlist: %s", uri);
|
FormatDebug(playlist_domain, "add to playlist: %s", uri);
|
||||||
@ -134,7 +134,7 @@ playlist::AppendURI(struct player_control &pc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::SwapPositions(player_control &pc, unsigned song1, unsigned song2)
|
playlist::SwapPositions(PlayerControl &pc, unsigned song1, unsigned song2)
|
||||||
{
|
{
|
||||||
if (!queue.IsValidPosition(song1) || !queue.IsValidPosition(song2))
|
if (!queue.IsValidPosition(song1) || !queue.IsValidPosition(song2))
|
||||||
return PlaylistResult::BAD_RANGE;
|
return PlaylistResult::BAD_RANGE;
|
||||||
@ -165,7 +165,7 @@ playlist::SwapPositions(player_control &pc, unsigned song1, unsigned song2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::SwapIds(player_control &pc, unsigned id1, unsigned id2)
|
playlist::SwapIds(PlayerControl &pc, unsigned id1, unsigned id2)
|
||||||
{
|
{
|
||||||
int song1 = queue.IdToPosition(id1);
|
int song1 = queue.IdToPosition(id1);
|
||||||
int song2 = queue.IdToPosition(id2);
|
int song2 = queue.IdToPosition(id2);
|
||||||
@ -177,7 +177,7 @@ playlist::SwapIds(player_control &pc, unsigned id1, unsigned id2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::SetPriorityRange(player_control &pc,
|
playlist::SetPriorityRange(PlayerControl &pc,
|
||||||
unsigned start, unsigned end,
|
unsigned start, unsigned end,
|
||||||
uint8_t priority)
|
uint8_t priority)
|
||||||
{
|
{
|
||||||
@ -211,7 +211,7 @@ playlist::SetPriorityRange(player_control &pc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::SetPriorityId(struct player_control &pc,
|
playlist::SetPriorityId(PlayerControl &pc,
|
||||||
unsigned song_id, uint8_t priority)
|
unsigned song_id, uint8_t priority)
|
||||||
{
|
{
|
||||||
int song_position = queue.IdToPosition(song_id);
|
int song_position = queue.IdToPosition(song_id);
|
||||||
@ -224,7 +224,7 @@ playlist::SetPriorityId(struct player_control &pc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::DeleteInternal(player_control &pc,
|
playlist::DeleteInternal(PlayerControl &pc,
|
||||||
unsigned song, const Song **queued_p)
|
unsigned song, const Song **queued_p)
|
||||||
{
|
{
|
||||||
assert(song < GetLength());
|
assert(song < GetLength());
|
||||||
@ -270,7 +270,7 @@ playlist::DeleteInternal(player_control &pc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::DeletePosition(struct player_control &pc, unsigned song)
|
playlist::DeletePosition(PlayerControl &pc, unsigned song)
|
||||||
{
|
{
|
||||||
if (song >= queue.GetLength())
|
if (song >= queue.GetLength())
|
||||||
return PlaylistResult::BAD_RANGE;
|
return PlaylistResult::BAD_RANGE;
|
||||||
@ -286,7 +286,7 @@ playlist::DeletePosition(struct player_control &pc, unsigned song)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::DeleteRange(struct player_control &pc, unsigned start, unsigned end)
|
playlist::DeleteRange(PlayerControl &pc, unsigned start, unsigned end)
|
||||||
{
|
{
|
||||||
if (start >= queue.GetLength())
|
if (start >= queue.GetLength())
|
||||||
return PlaylistResult::BAD_RANGE;
|
return PlaylistResult::BAD_RANGE;
|
||||||
@ -310,7 +310,7 @@ playlist::DeleteRange(struct player_control &pc, unsigned start, unsigned end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::DeleteId(struct player_control &pc, unsigned id)
|
playlist::DeleteId(PlayerControl &pc, unsigned id)
|
||||||
{
|
{
|
||||||
int song = queue.IdToPosition(id);
|
int song = queue.IdToPosition(id);
|
||||||
if (song < 0)
|
if (song < 0)
|
||||||
@ -320,7 +320,7 @@ playlist::DeleteId(struct player_control &pc, unsigned id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::DeleteSong(struct player_control &pc, const struct Song &song)
|
playlist::DeleteSong(PlayerControl &pc, const struct Song &song)
|
||||||
{
|
{
|
||||||
for (int i = queue.GetLength() - 1; i >= 0; --i)
|
for (int i = queue.GetLength() - 1; i >= 0; --i)
|
||||||
if (SongEquals(song, queue.Get(i)))
|
if (SongEquals(song, queue.Get(i)))
|
||||||
@ -328,7 +328,7 @@ playlist::DeleteSong(struct player_control &pc, const struct Song &song)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::MoveRange(player_control &pc, unsigned start, unsigned end, int to)
|
playlist::MoveRange(PlayerControl &pc, unsigned start, unsigned end, int to)
|
||||||
{
|
{
|
||||||
if (!queue.IsValidPosition(start) || !queue.IsValidPosition(end - 1))
|
if (!queue.IsValidPosition(start) || !queue.IsValidPosition(end - 1))
|
||||||
return PlaylistResult::BAD_RANGE;
|
return PlaylistResult::BAD_RANGE;
|
||||||
@ -381,7 +381,7 @@ playlist::MoveRange(player_control &pc, unsigned start, unsigned end, int to)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::MoveId(player_control &pc, unsigned id1, int to)
|
playlist::MoveId(PlayerControl &pc, unsigned id1, int to)
|
||||||
{
|
{
|
||||||
int song = queue.IdToPosition(id1);
|
int song = queue.IdToPosition(id1);
|
||||||
if (song < 0)
|
if (song < 0)
|
||||||
@ -391,7 +391,7 @@ playlist::MoveId(player_control &pc, unsigned id1, int to)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist::Shuffle(player_control &pc, unsigned start, unsigned end)
|
playlist::Shuffle(PlayerControl &pc, unsigned start, unsigned end)
|
||||||
{
|
{
|
||||||
if (end > GetLength())
|
if (end > GetLength())
|
||||||
/* correct the "end" offset */
|
/* correct the "end" offset */
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist_load_into_queue(const char *uri, SongEnumerator &e,
|
playlist_load_into_queue(const char *uri, SongEnumerator &e,
|
||||||
unsigned start_index, unsigned end_index,
|
unsigned start_index, unsigned end_index,
|
||||||
playlist &dest, player_control &pc,
|
playlist &dest, PlayerControl &pc,
|
||||||
bool secure)
|
bool secure)
|
||||||
{
|
{
|
||||||
const std::string base_uri = uri != nullptr
|
const std::string base_uri = uri != nullptr
|
||||||
@ -66,7 +66,7 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e,
|
|||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist_open_into_queue(const char *uri,
|
playlist_open_into_queue(const char *uri,
|
||||||
unsigned start_index, unsigned end_index,
|
unsigned start_index, unsigned end_index,
|
||||||
playlist &dest, player_control &pc,
|
playlist &dest, PlayerControl &pc,
|
||||||
bool secure)
|
bool secure)
|
||||||
{
|
{
|
||||||
Mutex mutex;
|
Mutex mutex;
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
class SongEnumerator;
|
class SongEnumerator;
|
||||||
struct playlist;
|
struct playlist;
|
||||||
struct player_control;
|
struct PlayerControl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the contents of a playlist and append it to the specified
|
* Loads the contents of a playlist and append it to the specified
|
||||||
@ -42,7 +42,7 @@ struct player_control;
|
|||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist_load_into_queue(const char *uri, SongEnumerator &e,
|
playlist_load_into_queue(const char *uri, SongEnumerator &e,
|
||||||
unsigned start_index, unsigned end_index,
|
unsigned start_index, unsigned end_index,
|
||||||
playlist &dest, player_control &pc,
|
playlist &dest, PlayerControl &pc,
|
||||||
bool secure);
|
bool secure);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,7 +52,7 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e,
|
|||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist_open_into_queue(const char *uri,
|
playlist_open_into_queue(const char *uri,
|
||||||
unsigned start_index, unsigned end_index,
|
unsigned start_index, unsigned end_index,
|
||||||
playlist &dest, player_control &pc,
|
playlist &dest, PlayerControl &pc,
|
||||||
bool secure);
|
bool secure);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -101,7 +101,7 @@ spl_save_playlist(const char *name_utf8, const playlist &playlist)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
playlist_load_spl(struct playlist &playlist, player_control &pc,
|
playlist_load_spl(struct playlist &playlist, PlayerControl &pc,
|
||||||
const char *name_utf8,
|
const char *name_utf8,
|
||||||
unsigned start_index, unsigned end_index,
|
unsigned start_index, unsigned end_index,
|
||||||
Error &error)
|
Error &error)
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
struct Song;
|
struct Song;
|
||||||
struct queue;
|
struct queue;
|
||||||
struct playlist;
|
struct playlist;
|
||||||
struct player_control;
|
struct PlayerControl;
|
||||||
class Error;
|
class Error;
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -53,7 +53,7 @@ spl_save_playlist(const char *name_utf8, const playlist &playlist);
|
|||||||
* playlist.
|
* playlist.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
playlist_load_spl(struct playlist &playlist, player_control &pc,
|
playlist_load_spl(struct playlist &playlist, PlayerControl &pc,
|
||||||
const char *name_utf8,
|
const char *name_utf8,
|
||||||
unsigned start_index, unsigned end_index,
|
unsigned start_index, unsigned end_index,
|
||||||
Error &error);
|
Error &error);
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
|
|
||||||
void
|
void
|
||||||
playlist_state_save(FILE *fp, const struct playlist &playlist,
|
playlist_state_save(FILE *fp, const struct playlist &playlist,
|
||||||
player_control &pc)
|
PlayerControl &pc)
|
||||||
{
|
{
|
||||||
const auto player_status = pc.GetStatus();
|
const auto player_status = pc.GetStatus();
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ playlist_state_load(TextFile &file, struct playlist &playlist)
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
playlist_state_restore(const char *line, TextFile &file,
|
playlist_state_restore(const char *line, TextFile &file,
|
||||||
struct playlist &playlist, player_control &pc)
|
struct playlist &playlist, PlayerControl &pc)
|
||||||
{
|
{
|
||||||
int current = -1;
|
int current = -1;
|
||||||
int seek_time = 0;
|
int seek_time = 0;
|
||||||
@ -217,7 +217,7 @@ playlist_state_restore(const char *line, TextFile &file,
|
|||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
playlist_state_get_hash(const playlist &playlist,
|
playlist_state_get_hash(const playlist &playlist,
|
||||||
player_control &pc)
|
PlayerControl &pc)
|
||||||
{
|
{
|
||||||
const auto player_status = pc.GetStatus();
|
const auto player_status = pc.GetStatus();
|
||||||
|
|
||||||
|
@ -28,16 +28,16 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
struct playlist;
|
struct playlist;
|
||||||
struct player_control;
|
struct PlayerControl;
|
||||||
class TextFile;
|
class TextFile;
|
||||||
|
|
||||||
void
|
void
|
||||||
playlist_state_save(FILE *fp, const struct playlist &playlist,
|
playlist_state_save(FILE *fp, const struct playlist &playlist,
|
||||||
player_control &pc);
|
PlayerControl &pc);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
playlist_state_restore(const char *line, TextFile &file,
|
playlist_state_restore(const char *line, TextFile &file,
|
||||||
struct playlist &playlist, player_control &pc);
|
struct playlist &playlist, PlayerControl &pc);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a hash number for the current state of the playlist and
|
* Generates a hash number for the current state of the playlist and
|
||||||
@ -47,6 +47,6 @@ playlist_state_restore(const char *line, TextFile &file,
|
|||||||
*/
|
*/
|
||||||
unsigned
|
unsigned
|
||||||
playlist_state_get_hash(const struct playlist &playlist,
|
playlist_state_get_hash(const struct playlist &playlist,
|
||||||
player_control &c);
|
PlayerControl &c);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -72,9 +72,9 @@ find_named_config_block(ConfigOption option, const char *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
player_control::player_control(gcc_unused unsigned _buffer_chunks,
|
PlayerControl::PlayerControl(gcc_unused unsigned _buffer_chunks,
|
||||||
gcc_unused unsigned _buffered_before_play) {}
|
gcc_unused unsigned _buffered_before_play) {}
|
||||||
player_control::~player_control() {}
|
PlayerControl::~PlayerControl() {}
|
||||||
|
|
||||||
static struct audio_output *
|
static struct audio_output *
|
||||||
load_audio_output(const char *name)
|
load_audio_output(const char *name)
|
||||||
@ -87,7 +87,7 @@ load_audio_output(const char *name)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct player_control dummy_player_control(32, 4);
|
static struct PlayerControl dummy_player_control(32, 4);
|
||||||
|
|
||||||
Error error;
|
Error error;
|
||||||
struct audio_output *ao =
|
struct audio_output *ao =
|
||||||
|
Loading…
Reference in New Issue
Block a user