Commit 2f512853 authored by Max Kellermann's avatar Max Kellermann

Merge branch 'v0.18.x'

parents 64465c13 ab9c9068
...@@ -23,6 +23,7 @@ ver 0.19 (not yet released) ...@@ -23,6 +23,7 @@ ver 0.19 (not yet released)
ver 0.18.8 (not yet released) ver 0.18.8 (not yet released)
* decoder * decoder
- ffmpeg: support libav v10_alpha1 - ffmpeg: support libav v10_alpha1
* fix Solaris build failure
ver 0.18.7 (2013/01/13) ver 0.18.7 (2013/01/13)
* playlist * playlist
......
...@@ -32,7 +32,7 @@ struct playlist { ...@@ -32,7 +32,7 @@ struct playlist {
/** /**
* The song queue - it contains the "real" playlist. * The song queue - it contains the "real" playlist.
*/ */
struct queue queue; struct Queue queue;
/** /**
* This value is true if the player is currently playing (or * This value is true if the player is currently playing (or
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
void void
playlist_print_uris(Client &client, const playlist &playlist) playlist_print_uris(Client &client, const playlist &playlist)
{ {
const queue &queue = playlist.queue; const Queue &queue = playlist.queue;
queue_print_uris(client, queue, 0, queue.GetLength()); queue_print_uris(client, queue, 0, queue.GetLength());
} }
...@@ -50,7 +50,7 @@ bool ...@@ -50,7 +50,7 @@ bool
playlist_print_info(Client &client, const playlist &playlist, playlist_print_info(Client &client, const playlist &playlist,
unsigned start, unsigned end) unsigned start, unsigned end)
{ {
const queue &queue = playlist.queue; const Queue &queue = playlist.queue;
if (end > queue.GetLength()) if (end > queue.GetLength())
/* correct the "end" offset */ /* correct the "end" offset */
......
...@@ -64,7 +64,7 @@ playlist_print_uri(FILE *file, const char *uri) ...@@ -64,7 +64,7 @@ playlist_print_uri(FILE *file, const char *uri)
} }
PlaylistResult PlaylistResult
spl_save_queue(const char *name_utf8, const queue &queue) spl_save_queue(const char *name_utf8, const Queue &queue)
{ {
if (map_spl_path().IsNull()) if (map_spl_path().IsNull())
return PlaylistResult::DISABLED; return PlaylistResult::DISABLED;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <stdio.h> #include <stdio.h>
struct queue; struct Queue;
struct playlist; struct playlist;
struct PlayerControl; struct PlayerControl;
class DetachedSong; class DetachedSong;
...@@ -40,7 +40,7 @@ playlist_print_uri(FILE *fp, const char *uri); ...@@ -40,7 +40,7 @@ playlist_print_uri(FILE *fp, const char *uri);
* Saves a queue object into a stored playlist file. * Saves a queue object into a stored playlist file.
*/ */
PlaylistResult PlaylistResult
spl_save_queue(const char *name_utf8, const queue &queue); spl_save_queue(const char *name_utf8, const Queue &queue);
/** /**
* Saves a playlist object into a stored playlist file. * Saves a playlist object into a stored playlist file.
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "Queue.hxx" #include "Queue.hxx"
#include "DetachedSong.hxx" #include "DetachedSong.hxx"
queue::queue(unsigned _max_length) Queue::Queue(unsigned _max_length)
:max_length(_max_length), length(0), :max_length(_max_length), length(0),
version(1), version(1),
items(new Item[max_length]), items(new Item[max_length]),
...@@ -34,7 +34,7 @@ queue::queue(unsigned _max_length) ...@@ -34,7 +34,7 @@ queue::queue(unsigned _max_length)
{ {
} }
queue::~queue() Queue::~Queue()
{ {
Clear(); Clear();
...@@ -43,7 +43,7 @@ queue::~queue() ...@@ -43,7 +43,7 @@ queue::~queue()
} }
int int
queue::GetNextOrder(unsigned _order) const Queue::GetNextOrder(unsigned _order) const
{ {
assert(_order < length); assert(_order < length);
...@@ -60,7 +60,7 @@ queue::GetNextOrder(unsigned _order) const ...@@ -60,7 +60,7 @@ queue::GetNextOrder(unsigned _order) const
} }
void void
queue::IncrementVersion() Queue::IncrementVersion()
{ {
static unsigned long max = ((uint32_t) 1 << 31) - 1; static unsigned long max = ((uint32_t) 1 << 31) - 1;
...@@ -75,7 +75,7 @@ queue::IncrementVersion() ...@@ -75,7 +75,7 @@ queue::IncrementVersion()
} }
void void
queue::ModifyAtOrder(unsigned _order) Queue::ModifyAtOrder(unsigned _order)
{ {
assert(_order < length); assert(_order < length);
...@@ -84,7 +84,7 @@ queue::ModifyAtOrder(unsigned _order) ...@@ -84,7 +84,7 @@ queue::ModifyAtOrder(unsigned _order)
} }
unsigned unsigned
queue::Append(DetachedSong &&song, uint8_t priority) Queue::Append(DetachedSong &&song, uint8_t priority)
{ {
assert(!IsFull()); assert(!IsFull());
...@@ -103,7 +103,7 @@ queue::Append(DetachedSong &&song, uint8_t priority) ...@@ -103,7 +103,7 @@ queue::Append(DetachedSong &&song, uint8_t priority)
} }
void void
queue::SwapPositions(unsigned position1, unsigned position2) Queue::SwapPositions(unsigned position1, unsigned position2)
{ {
unsigned id1 = items[position1].id; unsigned id1 = items[position1].id;
unsigned id2 = items[position2].id; unsigned id2 = items[position2].id;
...@@ -118,7 +118,7 @@ queue::SwapPositions(unsigned position1, unsigned position2) ...@@ -118,7 +118,7 @@ queue::SwapPositions(unsigned position1, unsigned position2)
} }
void void
queue::MovePostion(unsigned from, unsigned to) Queue::MovePostion(unsigned from, unsigned to)
{ {
const Item tmp = items[from]; const Item tmp = items[from];
...@@ -154,7 +154,7 @@ queue::MovePostion(unsigned from, unsigned to) ...@@ -154,7 +154,7 @@ queue::MovePostion(unsigned from, unsigned to)
} }
void void
queue::MoveRange(unsigned start, unsigned end, unsigned to) Queue::MoveRange(unsigned start, unsigned end, unsigned to)
{ {
Item tmp[end - start]; Item tmp[end - start];
// Copy the original block [start,end-1] // Copy the original block [start,end-1]
...@@ -196,7 +196,7 @@ queue::MoveRange(unsigned start, unsigned end, unsigned to) ...@@ -196,7 +196,7 @@ queue::MoveRange(unsigned start, unsigned end, unsigned to)
} }
void void
queue::MoveOrder(unsigned from_order, unsigned to_order) Queue::MoveOrder(unsigned from_order, unsigned to_order)
{ {
assert(from_order < length); assert(from_order < length);
assert(to_order <= length); assert(to_order <= length);
...@@ -215,7 +215,7 @@ queue::MoveOrder(unsigned from_order, unsigned to_order) ...@@ -215,7 +215,7 @@ queue::MoveOrder(unsigned from_order, unsigned to_order)
} }
void void
queue::DeletePosition(unsigned position) Queue::DeletePosition(unsigned position)
{ {
assert(position < length); assert(position < length);
...@@ -248,7 +248,7 @@ queue::DeletePosition(unsigned position) ...@@ -248,7 +248,7 @@ queue::DeletePosition(unsigned position)
} }
void void
queue::Clear() Queue::Clear()
{ {
for (unsigned i = 0; i < length; i++) { for (unsigned i = 0; i < length; i++) {
Item *item = &items[i]; Item *item = &items[i];
...@@ -262,7 +262,7 @@ queue::Clear() ...@@ -262,7 +262,7 @@ queue::Clear()
} }
static void static void
queue_sort_order_by_priority(struct queue *queue, unsigned start, unsigned end) queue_sort_order_by_priority(Queue *queue, unsigned start, unsigned end)
{ {
assert(queue != nullptr); assert(queue != nullptr);
assert(queue->random); assert(queue->random);
...@@ -270,8 +270,8 @@ queue_sort_order_by_priority(struct queue *queue, unsigned start, unsigned end) ...@@ -270,8 +270,8 @@ queue_sort_order_by_priority(struct queue *queue, unsigned start, unsigned end)
assert(end <= queue->length); assert(end <= queue->length);
auto cmp = [queue](unsigned a_pos, unsigned b_pos){ auto cmp = [queue](unsigned a_pos, unsigned b_pos){
const queue::Item &a = queue->items[a_pos]; const Queue::Item &a = queue->items[a_pos];
const queue::Item &b = queue->items[b_pos]; const Queue::Item &b = queue->items[b_pos];
return a.priority > b.priority; return a.priority > b.priority;
}; };
...@@ -280,7 +280,7 @@ queue_sort_order_by_priority(struct queue *queue, unsigned start, unsigned end) ...@@ -280,7 +280,7 @@ queue_sort_order_by_priority(struct queue *queue, unsigned start, unsigned end)
} }
void void
queue::ShuffleOrderRange(unsigned start, unsigned end) Queue::ShuffleOrderRange(unsigned start, unsigned end)
{ {
assert(random); assert(random);
assert(start <= end); assert(start <= end);
...@@ -295,7 +295,7 @@ queue::ShuffleOrderRange(unsigned start, unsigned end) ...@@ -295,7 +295,7 @@ queue::ShuffleOrderRange(unsigned start, unsigned end)
* priority group. * priority group.
*/ */
void void
queue::ShuffleOrderRangeWithPriority(unsigned start, unsigned end) Queue::ShuffleOrderRangeWithPriority(unsigned start, unsigned end)
{ {
assert(random); assert(random);
assert(start <= end); assert(start <= end);
...@@ -329,13 +329,13 @@ queue::ShuffleOrderRangeWithPriority(unsigned start, unsigned end) ...@@ -329,13 +329,13 @@ queue::ShuffleOrderRangeWithPriority(unsigned start, unsigned end)
} }
void void
queue::ShuffleOrder() Queue::ShuffleOrder()
{ {
ShuffleOrderRangeWithPriority(0, length); ShuffleOrderRangeWithPriority(0, length);
} }
void void
queue::ShuffleOrderFirst(unsigned start, unsigned end) Queue::ShuffleOrderFirst(unsigned start, unsigned end)
{ {
rand.AutoCreate(); rand.AutoCreate();
...@@ -344,7 +344,7 @@ queue::ShuffleOrderFirst(unsigned start, unsigned end) ...@@ -344,7 +344,7 @@ queue::ShuffleOrderFirst(unsigned start, unsigned end)
} }
void void
queue::ShuffleOrderLast(unsigned start, unsigned end) Queue::ShuffleOrderLast(unsigned start, unsigned end)
{ {
rand.AutoCreate(); rand.AutoCreate();
...@@ -353,7 +353,7 @@ queue::ShuffleOrderLast(unsigned start, unsigned end) ...@@ -353,7 +353,7 @@ queue::ShuffleOrderLast(unsigned start, unsigned end)
} }
void void
queue::ShuffleRange(unsigned start, unsigned end) Queue::ShuffleRange(unsigned start, unsigned end)
{ {
assert(start <= end); assert(start <= end);
assert(end <= length); assert(end <= length);
...@@ -369,7 +369,7 @@ queue::ShuffleRange(unsigned start, unsigned end) ...@@ -369,7 +369,7 @@ queue::ShuffleRange(unsigned start, unsigned end)
} }
unsigned unsigned
queue::FindPriorityOrder(unsigned start_order, uint8_t priority, Queue::FindPriorityOrder(unsigned start_order, uint8_t priority,
unsigned exclude_order) const unsigned exclude_order) const
{ {
assert(random); assert(random);
...@@ -386,7 +386,7 @@ queue::FindPriorityOrder(unsigned start_order, uint8_t priority, ...@@ -386,7 +386,7 @@ queue::FindPriorityOrder(unsigned start_order, uint8_t priority,
} }
unsigned unsigned
queue::CountSamePriority(unsigned start_order, uint8_t priority) const Queue::CountSamePriority(unsigned start_order, uint8_t priority) const
{ {
assert(random); assert(random);
assert(start_order <= length); assert(start_order <= length);
...@@ -402,7 +402,7 @@ queue::CountSamePriority(unsigned start_order, uint8_t priority) const ...@@ -402,7 +402,7 @@ queue::CountSamePriority(unsigned start_order, uint8_t priority) const
} }
bool bool
queue::SetPriority(unsigned position, uint8_t priority, int after_order) Queue::SetPriority(unsigned position, uint8_t priority, int after_order)
{ {
assert(position < length); assert(position < length);
...@@ -460,7 +460,7 @@ queue::SetPriority(unsigned position, uint8_t priority, int after_order) ...@@ -460,7 +460,7 @@ queue::SetPriority(unsigned position, uint8_t priority, int after_order)
} }
bool bool
queue::SetPriorityRange(unsigned start_position, unsigned end_position, Queue::SetPriorityRange(unsigned start_position, unsigned end_position,
uint8_t priority, int after_order) uint8_t priority, int after_order)
{ {
assert(start_position <= end_position); assert(start_position <= end_position);
......
...@@ -41,7 +41,7 @@ class DetachedSong; ...@@ -41,7 +41,7 @@ class DetachedSong;
* - the unique id (which stays the same, regardless of moves) * - the unique id (which stays the same, regardless of moves)
* - the order number (which only differs from "position" in random mode) * - the order number (which only differs from "position" in random mode)
*/ */
struct queue { struct Queue {
/** /**
* reserve max_length * HASH_MULT elements in the id * reserve max_length * HASH_MULT elements in the id
* number space * number space
...@@ -103,16 +103,16 @@ struct queue { ...@@ -103,16 +103,16 @@ struct queue {
/** random number generator for shuffle and random mode */ /** random number generator for shuffle and random mode */
LazyRandomEngine rand; LazyRandomEngine rand;
queue(unsigned max_length); explicit Queue(unsigned max_length);
/** /**
* Deinitializes a queue object. It does not free the queue * Deinitializes a queue object. It does not free the queue
* pointer itself. * pointer itself.
*/ */
~queue(); ~Queue();
queue(const queue &other) = delete; Queue(const Queue &) = delete;
queue &operator=(const queue &other) = delete; Queue &operator=(const Queue &) = delete;
unsigned GetLength() const { unsigned GetLength() const {
assert(length <= max_length); assert(length <= max_length);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
* @param end the index of the last song (excluding) * @param end the index of the last song (excluding)
*/ */
static void static void
queue_print_song_info(Client &client, const queue &queue, queue_print_song_info(Client &client, const Queue &queue,
unsigned position) unsigned position)
{ {
song_print_info(client, queue.Get(position)); song_print_info(client, queue.Get(position));
...@@ -46,7 +46,7 @@ queue_print_song_info(Client &client, const queue &queue, ...@@ -46,7 +46,7 @@ queue_print_song_info(Client &client, const queue &queue,
} }
void void
queue_print_info(Client &client, const queue &queue, queue_print_info(Client &client, const Queue &queue,
unsigned start, unsigned end) unsigned start, unsigned end)
{ {
assert(start <= end); assert(start <= end);
...@@ -57,7 +57,7 @@ queue_print_info(Client &client, const queue &queue, ...@@ -57,7 +57,7 @@ queue_print_info(Client &client, const queue &queue,
} }
void void
queue_print_uris(Client &client, const queue &queue, queue_print_uris(Client &client, const Queue &queue,
unsigned start, unsigned end) unsigned start, unsigned end)
{ {
assert(start <= end); assert(start <= end);
...@@ -70,7 +70,7 @@ queue_print_uris(Client &client, const queue &queue, ...@@ -70,7 +70,7 @@ queue_print_uris(Client &client, const queue &queue,
} }
void void
queue_print_changes_info(Client &client, const queue &queue, queue_print_changes_info(Client &client, const Queue &queue,
uint32_t version) uint32_t version)
{ {
for (unsigned i = 0; i < queue.GetLength(); i++) { for (unsigned i = 0; i < queue.GetLength(); i++) {
...@@ -80,7 +80,7 @@ queue_print_changes_info(Client &client, const queue &queue, ...@@ -80,7 +80,7 @@ queue_print_changes_info(Client &client, const queue &queue,
} }
void void
queue_print_changes_position(Client &client, const queue &queue, queue_print_changes_position(Client &client, const Queue &queue,
uint32_t version) uint32_t version)
{ {
for (unsigned i = 0; i < queue.GetLength(); i++) for (unsigned i = 0; i < queue.GetLength(); i++)
...@@ -90,7 +90,7 @@ queue_print_changes_position(Client &client, const queue &queue, ...@@ -90,7 +90,7 @@ queue_print_changes_position(Client &client, const queue &queue,
} }
void void
queue_find(Client &client, const queue &queue, queue_find(Client &client, const Queue &queue,
const SongFilter &filter) const SongFilter &filter)
{ {
for (unsigned i = 0; i < queue.GetLength(); i++) { for (unsigned i = 0; i < queue.GetLength(); i++) {
......
...@@ -27,28 +27,28 @@ ...@@ -27,28 +27,28 @@
#include <stdint.h> #include <stdint.h>
struct queue; struct Queue;
class SongFilter; class SongFilter;
class Client; class Client;
void void
queue_print_info(Client &client, const queue &queue, queue_print_info(Client &client, const Queue &queue,
unsigned start, unsigned end); unsigned start, unsigned end);
void void
queue_print_uris(Client &client, const queue &queue, queue_print_uris(Client &client, const Queue &queue,
unsigned start, unsigned end); unsigned start, unsigned end);
void void
queue_print_changes_info(Client &client, const queue &queue, queue_print_changes_info(Client &client, const Queue &queue,
uint32_t version); uint32_t version);
void void
queue_print_changes_position(Client &client, const queue &queue, queue_print_changes_position(Client &client, const Queue &queue,
uint32_t version); uint32_t version);
void void
queue_find(Client &client, const queue &queue, queue_find(Client &client, const Queue &queue,
const SongFilter &filter); const SongFilter &filter);
#endif #endif
...@@ -57,7 +57,7 @@ queue_save_song(FILE *fp, int idx, const DetachedSong &song) ...@@ -57,7 +57,7 @@ queue_save_song(FILE *fp, int idx, const DetachedSong &song)
} }
void void
queue_save(FILE *fp, const queue &queue) queue_save(FILE *fp, const Queue &queue)
{ {
for (unsigned i = 0; i < queue.GetLength(); i++) { for (unsigned i = 0; i < queue.GetLength(); i++) {
uint8_t prio = queue.GetPriorityAtPosition(i); uint8_t prio = queue.GetPriorityAtPosition(i);
...@@ -69,7 +69,7 @@ queue_save(FILE *fp, const queue &queue) ...@@ -69,7 +69,7 @@ queue_save(FILE *fp, const queue &queue)
} }
void void
queue_load_song(TextFile &file, const char *line, queue &queue) queue_load_song(TextFile &file, const char *line, Queue &queue)
{ {
if (queue.IsFull()) if (queue.IsFull())
return; return;
......
...@@ -27,16 +27,16 @@ ...@@ -27,16 +27,16 @@
#include <stdio.h> #include <stdio.h>
struct queue; struct Queue;
class TextFile; class TextFile;
void void
queue_save(FILE *fp, const queue &queue); queue_save(FILE *fp, const Queue &queue);
/** /**
* Loads one song from the state file and appends it to the queue. * Loads one song from the state file and appends it to the queue.
*/ */
void void
queue_load_song(TextFile &file, const char *line, queue &queue); queue_load_song(TextFile &file, const char *line, Queue &queue);
#endif #endif
...@@ -12,7 +12,7 @@ Tag::Tag(const Tag &) {} ...@@ -12,7 +12,7 @@ Tag::Tag(const Tag &) {}
void Tag::Clear() {} void Tag::Clear() {}
static void static void
check_descending_priority(const struct queue *queue, check_descending_priority(const Queue *queue,
unsigned start_order) unsigned start_order)
{ {
assert(start_order < queue->GetLength()); assert(start_order < queue->GetLength());
...@@ -58,7 +58,7 @@ QueuePriorityTest::TestPriority() ...@@ -58,7 +58,7 @@ QueuePriorityTest::TestPriority()
DetachedSong("f.ogg"), DetachedSong("f.ogg"),
}; };
struct queue queue(32); Queue queue(32);
for (unsigned i = 0; i < ARRAY_SIZE(songs); ++i) for (unsigned i = 0; i < ARRAY_SIZE(songs); ++i)
queue.Append(DetachedSong(songs[i]), 0); queue.Append(DetachedSong(songs[i]), 0);
......
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