Commit e202b407 authored by Max Kellermann's avatar Max Kellermann

Playlist: add constructor and destructor

parent 2cc89e60
......@@ -35,12 +35,8 @@ struct Partition {
Partition(unsigned max_length,
unsigned buffer_chunks,
unsigned buffered_before_play)
:pc(buffer_chunks, buffered_before_play) {
playlist_init(&playlist, max_length);
}
~Partition() {
playlist_finish(&playlist);
:playlist(max_length),
pc(buffer_chunks, buffered_before_play) {
}
};
......
......@@ -52,21 +52,6 @@ playlist_tag_changed(struct playlist *playlist)
idle_add(IDLE_PLAYLIST);
}
void
playlist_init(struct playlist *playlist, unsigned max_length)
{
queue_init(&playlist->queue, max_length);
playlist->queued = -1;
playlist->current = -1;
}
void
playlist_finish(struct playlist *playlist)
{
queue_finish(&playlist->queue);
}
/**
* Queue a song, addressed by its order number.
*/
......
......@@ -68,16 +68,19 @@ struct playlist {
* This variable is only valid if #playing is true.
*/
int queued;
};
void
playlist_global_init();
playlist(unsigned max_length)
:current(-1), queued(-1) {
queue_init(&queue, max_length);
}
void
playlist_init(struct playlist *playlist, unsigned max_length);
~playlist() {
queue_finish(&queue);
}
};
void
playlist_finish(struct playlist *playlist);
playlist_global_init();
void
playlist_tag_changed(struct playlist *playlist);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment