Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
2f512853
Commit
2f512853
authored
Jan 20, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v0.18.x'
parents
64465c13
ab9c9068
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
56 additions
and
55 deletions
+56
-55
NEWS
NEWS
+1
-0
Playlist.hxx
src/Playlist.hxx
+1
-1
PlaylistPrint.cxx
src/PlaylistPrint.cxx
+2
-2
PlaylistSave.cxx
src/PlaylistSave.cxx
+1
-1
PlaylistSave.hxx
src/PlaylistSave.hxx
+2
-2
Queue.cxx
src/Queue.cxx
+25
-25
Queue.hxx
src/Queue.hxx
+5
-5
QueuePrint.cxx
src/QueuePrint.cxx
+6
-6
QueuePrint.hxx
src/QueuePrint.hxx
+6
-6
QueueSave.cxx
src/QueueSave.cxx
+2
-2
QueueSave.hxx
src/QueueSave.hxx
+3
-3
test_queue_priority.cxx
test/test_queue_priority.cxx
+2
-2
No files found.
NEWS
View file @
2f512853
...
...
@@ -23,6 +23,7 @@ ver 0.19 (not yet released)
ver 0.18.8 (not yet released)
* decoder
- ffmpeg: support libav v10_alpha1
* fix Solaris build failure
ver 0.18.7 (2013/01/13)
* playlist
...
...
src/Playlist.hxx
View file @
2f512853
...
...
@@ -32,7 +32,7 @@ struct playlist {
/**
* The song queue - it contains the "real" playlist.
*/
struct
q
ueue
queue
;
struct
Q
ueue
queue
;
/**
* This value is true if the player is currently playing (or
...
...
src/PlaylistPrint.cxx
View file @
2f512853
...
...
@@ -41,7 +41,7 @@
void
playlist_print_uris
(
Client
&
client
,
const
playlist
&
playlist
)
{
const
q
ueue
&
queue
=
playlist
.
queue
;
const
Q
ueue
&
queue
=
playlist
.
queue
;
queue_print_uris
(
client
,
queue
,
0
,
queue
.
GetLength
());
}
...
...
@@ -50,7 +50,7 @@ bool
playlist_print_info
(
Client
&
client
,
const
playlist
&
playlist
,
unsigned
start
,
unsigned
end
)
{
const
q
ueue
&
queue
=
playlist
.
queue
;
const
Q
ueue
&
queue
=
playlist
.
queue
;
if
(
end
>
queue
.
GetLength
())
/* correct the "end" offset */
...
...
src/PlaylistSave.cxx
View file @
2f512853
...
...
@@ -64,7 +64,7 @@ playlist_print_uri(FILE *file, const char *uri)
}
PlaylistResult
spl_save_queue
(
const
char
*
name_utf8
,
const
q
ueue
&
queue
)
spl_save_queue
(
const
char
*
name_utf8
,
const
Q
ueue
&
queue
)
{
if
(
map_spl_path
().
IsNull
())
return
PlaylistResult
::
DISABLED
;
...
...
src/PlaylistSave.hxx
View file @
2f512853
...
...
@@ -24,7 +24,7 @@
#include <stdio.h>
struct
q
ueue
;
struct
Q
ueue
;
struct
playlist
;
struct
PlayerControl
;
class
DetachedSong
;
...
...
@@ -40,7 +40,7 @@ playlist_print_uri(FILE *fp, const char *uri);
* Saves a queue object into a stored playlist file.
*/
PlaylistResult
spl_save_queue
(
const
char
*
name_utf8
,
const
q
ueue
&
queue
);
spl_save_queue
(
const
char
*
name_utf8
,
const
Q
ueue
&
queue
);
/**
* Saves a playlist object into a stored playlist file.
...
...
src/Queue.cxx
View file @
2f512853
...
...
@@ -21,7 +21,7 @@
#include "Queue.hxx"
#include "DetachedSong.hxx"
queue
::
q
ueue
(
unsigned
_max_length
)
Queue
::
Q
ueue
(
unsigned
_max_length
)
:
max_length
(
_max_length
),
length
(
0
),
version
(
1
),
items
(
new
Item
[
max_length
]),
...
...
@@ -34,7 +34,7 @@ queue::queue(unsigned _max_length)
{
}
queue
::~
q
ueue
()
Queue
::~
Q
ueue
()
{
Clear
();
...
...
@@ -43,7 +43,7 @@ queue::~queue()
}
int
q
ueue
::
GetNextOrder
(
unsigned
_order
)
const
Q
ueue
::
GetNextOrder
(
unsigned
_order
)
const
{
assert
(
_order
<
length
);
...
...
@@ -60,7 +60,7 @@ queue::GetNextOrder(unsigned _order) const
}
void
q
ueue
::
IncrementVersion
()
Q
ueue
::
IncrementVersion
()
{
static
unsigned
long
max
=
((
uint32_t
)
1
<<
31
)
-
1
;
...
...
@@ -75,7 +75,7 @@ queue::IncrementVersion()
}
void
q
ueue
::
ModifyAtOrder
(
unsigned
_order
)
Q
ueue
::
ModifyAtOrder
(
unsigned
_order
)
{
assert
(
_order
<
length
);
...
...
@@ -84,7 +84,7 @@ queue::ModifyAtOrder(unsigned _order)
}
unsigned
q
ueue
::
Append
(
DetachedSong
&&
song
,
uint8_t
priority
)
Q
ueue
::
Append
(
DetachedSong
&&
song
,
uint8_t
priority
)
{
assert
(
!
IsFull
());
...
...
@@ -103,7 +103,7 @@ queue::Append(DetachedSong &&song, uint8_t priority)
}
void
q
ueue
::
SwapPositions
(
unsigned
position1
,
unsigned
position2
)
Q
ueue
::
SwapPositions
(
unsigned
position1
,
unsigned
position2
)
{
unsigned
id1
=
items
[
position1
].
id
;
unsigned
id2
=
items
[
position2
].
id
;
...
...
@@ -118,7 +118,7 @@ queue::SwapPositions(unsigned position1, unsigned position2)
}
void
q
ueue
::
MovePostion
(
unsigned
from
,
unsigned
to
)
Q
ueue
::
MovePostion
(
unsigned
from
,
unsigned
to
)
{
const
Item
tmp
=
items
[
from
];
...
...
@@ -154,7 +154,7 @@ queue::MovePostion(unsigned from, unsigned to)
}
void
q
ueue
::
MoveRange
(
unsigned
start
,
unsigned
end
,
unsigned
to
)
Q
ueue
::
MoveRange
(
unsigned
start
,
unsigned
end
,
unsigned
to
)
{
Item
tmp
[
end
-
start
];
// Copy the original block [start,end-1]
...
...
@@ -196,7 +196,7 @@ queue::MoveRange(unsigned start, unsigned end, unsigned to)
}
void
q
ueue
::
MoveOrder
(
unsigned
from_order
,
unsigned
to_order
)
Q
ueue
::
MoveOrder
(
unsigned
from_order
,
unsigned
to_order
)
{
assert
(
from_order
<
length
);
assert
(
to_order
<=
length
);
...
...
@@ -215,7 +215,7 @@ queue::MoveOrder(unsigned from_order, unsigned to_order)
}
void
q
ueue
::
DeletePosition
(
unsigned
position
)
Q
ueue
::
DeletePosition
(
unsigned
position
)
{
assert
(
position
<
length
);
...
...
@@ -248,7 +248,7 @@ queue::DeletePosition(unsigned position)
}
void
q
ueue
::
Clear
()
Q
ueue
::
Clear
()
{
for
(
unsigned
i
=
0
;
i
<
length
;
i
++
)
{
Item
*
item
=
&
items
[
i
];
...
...
@@ -262,7 +262,7 @@ queue::Clear()
}
static
void
queue_sort_order_by_priority
(
struct
q
ueue
*
queue
,
unsigned
start
,
unsigned
end
)
queue_sort_order_by_priority
(
Q
ueue
*
queue
,
unsigned
start
,
unsigned
end
)
{
assert
(
queue
!=
nullptr
);
assert
(
queue
->
random
);
...
...
@@ -270,8 +270,8 @@ queue_sort_order_by_priority(struct queue *queue, unsigned start, unsigned end)
assert
(
end
<=
queue
->
length
);
auto
cmp
=
[
queue
](
unsigned
a_pos
,
unsigned
b_pos
){
const
q
ueue
::
Item
&
a
=
queue
->
items
[
a_pos
];
const
q
ueue
::
Item
&
b
=
queue
->
items
[
b_pos
];
const
Q
ueue
::
Item
&
a
=
queue
->
items
[
a_pos
];
const
Q
ueue
::
Item
&
b
=
queue
->
items
[
b_pos
];
return
a
.
priority
>
b
.
priority
;
};
...
...
@@ -280,7 +280,7 @@ queue_sort_order_by_priority(struct queue *queue, unsigned start, unsigned end)
}
void
q
ueue
::
ShuffleOrderRange
(
unsigned
start
,
unsigned
end
)
Q
ueue
::
ShuffleOrderRange
(
unsigned
start
,
unsigned
end
)
{
assert
(
random
);
assert
(
start
<=
end
);
...
...
@@ -295,7 +295,7 @@ queue::ShuffleOrderRange(unsigned start, unsigned end)
* priority group.
*/
void
q
ueue
::
ShuffleOrderRangeWithPriority
(
unsigned
start
,
unsigned
end
)
Q
ueue
::
ShuffleOrderRangeWithPriority
(
unsigned
start
,
unsigned
end
)
{
assert
(
random
);
assert
(
start
<=
end
);
...
...
@@ -329,13 +329,13 @@ queue::ShuffleOrderRangeWithPriority(unsigned start, unsigned end)
}
void
q
ueue
::
ShuffleOrder
()
Q
ueue
::
ShuffleOrder
()
{
ShuffleOrderRangeWithPriority
(
0
,
length
);
}
void
q
ueue
::
ShuffleOrderFirst
(
unsigned
start
,
unsigned
end
)
Q
ueue
::
ShuffleOrderFirst
(
unsigned
start
,
unsigned
end
)
{
rand
.
AutoCreate
();
...
...
@@ -344,7 +344,7 @@ queue::ShuffleOrderFirst(unsigned start, unsigned end)
}
void
q
ueue
::
ShuffleOrderLast
(
unsigned
start
,
unsigned
end
)
Q
ueue
::
ShuffleOrderLast
(
unsigned
start
,
unsigned
end
)
{
rand
.
AutoCreate
();
...
...
@@ -353,7 +353,7 @@ queue::ShuffleOrderLast(unsigned start, unsigned end)
}
void
q
ueue
::
ShuffleRange
(
unsigned
start
,
unsigned
end
)
Q
ueue
::
ShuffleRange
(
unsigned
start
,
unsigned
end
)
{
assert
(
start
<=
end
);
assert
(
end
<=
length
);
...
...
@@ -369,7 +369,7 @@ queue::ShuffleRange(unsigned start, unsigned end)
}
unsigned
q
ueue
::
FindPriorityOrder
(
unsigned
start_order
,
uint8_t
priority
,
Q
ueue
::
FindPriorityOrder
(
unsigned
start_order
,
uint8_t
priority
,
unsigned
exclude_order
)
const
{
assert
(
random
);
...
...
@@ -386,7 +386,7 @@ queue::FindPriorityOrder(unsigned start_order, uint8_t priority,
}
unsigned
q
ueue
::
CountSamePriority
(
unsigned
start_order
,
uint8_t
priority
)
const
Q
ueue
::
CountSamePriority
(
unsigned
start_order
,
uint8_t
priority
)
const
{
assert
(
random
);
assert
(
start_order
<=
length
);
...
...
@@ -402,7 +402,7 @@ queue::CountSamePriority(unsigned start_order, uint8_t priority) const
}
bool
q
ueue
::
SetPriority
(
unsigned
position
,
uint8_t
priority
,
int
after_order
)
Q
ueue
::
SetPriority
(
unsigned
position
,
uint8_t
priority
,
int
after_order
)
{
assert
(
position
<
length
);
...
...
@@ -460,7 +460,7 @@ queue::SetPriority(unsigned position, uint8_t priority, int after_order)
}
bool
q
ueue
::
SetPriorityRange
(
unsigned
start_position
,
unsigned
end_position
,
Q
ueue
::
SetPriorityRange
(
unsigned
start_position
,
unsigned
end_position
,
uint8_t
priority
,
int
after_order
)
{
assert
(
start_position
<=
end_position
);
...
...
src/Queue.hxx
View file @
2f512853
...
...
@@ -41,7 +41,7 @@ class DetachedSong;
* - the unique id (which stays the same, regardless of moves)
* - the order number (which only differs from "position" in random mode)
*/
struct
q
ueue
{
struct
Q
ueue
{
/**
* reserve max_length * HASH_MULT elements in the id
* number space
...
...
@@ -103,16 +103,16 @@ struct queue {
/** random number generator for shuffle and random mode */
LazyRandomEngine
rand
;
q
ueue
(
unsigned
max_length
);
explicit
Q
ueue
(
unsigned
max_length
);
/**
* Deinitializes a queue object. It does not free the queue
* pointer itself.
*/
~
q
ueue
();
~
Q
ueue
();
queue
(
const
queue
&
other
)
=
delete
;
queue
&
operator
=
(
const
queue
&
other
)
=
delete
;
Queue
(
const
Queue
&
)
=
delete
;
Queue
&
operator
=
(
const
Queue
&
)
=
delete
;
unsigned
GetLength
()
const
{
assert
(
length
<=
max_length
);
...
...
src/QueuePrint.cxx
View file @
2f512853
...
...
@@ -33,7 +33,7 @@
* @param end the index of the last song (excluding)
*/
static
void
queue_print_song_info
(
Client
&
client
,
const
q
ueue
&
queue
,
queue_print_song_info
(
Client
&
client
,
const
Q
ueue
&
queue
,
unsigned
position
)
{
song_print_info
(
client
,
queue
.
Get
(
position
));
...
...
@@ -46,7 +46,7 @@ queue_print_song_info(Client &client, const queue &queue,
}
void
queue_print_info
(
Client
&
client
,
const
q
ueue
&
queue
,
queue_print_info
(
Client
&
client
,
const
Q
ueue
&
queue
,
unsigned
start
,
unsigned
end
)
{
assert
(
start
<=
end
);
...
...
@@ -57,7 +57,7 @@ queue_print_info(Client &client, const queue &queue,
}
void
queue_print_uris
(
Client
&
client
,
const
q
ueue
&
queue
,
queue_print_uris
(
Client
&
client
,
const
Q
ueue
&
queue
,
unsigned
start
,
unsigned
end
)
{
assert
(
start
<=
end
);
...
...
@@ -70,7 +70,7 @@ queue_print_uris(Client &client, const queue &queue,
}
void
queue_print_changes_info
(
Client
&
client
,
const
q
ueue
&
queue
,
queue_print_changes_info
(
Client
&
client
,
const
Q
ueue
&
queue
,
uint32_t
version
)
{
for
(
unsigned
i
=
0
;
i
<
queue
.
GetLength
();
i
++
)
{
...
...
@@ -80,7 +80,7 @@ queue_print_changes_info(Client &client, const queue &queue,
}
void
queue_print_changes_position
(
Client
&
client
,
const
q
ueue
&
queue
,
queue_print_changes_position
(
Client
&
client
,
const
Q
ueue
&
queue
,
uint32_t
version
)
{
for
(
unsigned
i
=
0
;
i
<
queue
.
GetLength
();
i
++
)
...
...
@@ -90,7 +90,7 @@ queue_print_changes_position(Client &client, const queue &queue,
}
void
queue_find
(
Client
&
client
,
const
q
ueue
&
queue
,
queue_find
(
Client
&
client
,
const
Q
ueue
&
queue
,
const
SongFilter
&
filter
)
{
for
(
unsigned
i
=
0
;
i
<
queue
.
GetLength
();
i
++
)
{
...
...
src/QueuePrint.hxx
View file @
2f512853
...
...
@@ -27,28 +27,28 @@
#include <stdint.h>
struct
q
ueue
;
struct
Q
ueue
;
class
SongFilter
;
class
Client
;
void
queue_print_info
(
Client
&
client
,
const
q
ueue
&
queue
,
queue_print_info
(
Client
&
client
,
const
Q
ueue
&
queue
,
unsigned
start
,
unsigned
end
);
void
queue_print_uris
(
Client
&
client
,
const
q
ueue
&
queue
,
queue_print_uris
(
Client
&
client
,
const
Q
ueue
&
queue
,
unsigned
start
,
unsigned
end
);
void
queue_print_changes_info
(
Client
&
client
,
const
q
ueue
&
queue
,
queue_print_changes_info
(
Client
&
client
,
const
Q
ueue
&
queue
,
uint32_t
version
);
void
queue_print_changes_position
(
Client
&
client
,
const
q
ueue
&
queue
,
queue_print_changes_position
(
Client
&
client
,
const
Q
ueue
&
queue
,
uint32_t
version
);
void
queue_find
(
Client
&
client
,
const
q
ueue
&
queue
,
queue_find
(
Client
&
client
,
const
Q
ueue
&
queue
,
const
SongFilter
&
filter
);
#endif
src/QueueSave.cxx
View file @
2f512853
...
...
@@ -57,7 +57,7 @@ queue_save_song(FILE *fp, int idx, const DetachedSong &song)
}
void
queue_save
(
FILE
*
fp
,
const
q
ueue
&
queue
)
queue_save
(
FILE
*
fp
,
const
Q
ueue
&
queue
)
{
for
(
unsigned
i
=
0
;
i
<
queue
.
GetLength
();
i
++
)
{
uint8_t
prio
=
queue
.
GetPriorityAtPosition
(
i
);
...
...
@@ -69,7 +69,7 @@ queue_save(FILE *fp, const queue &queue)
}
void
queue_load_song
(
TextFile
&
file
,
const
char
*
line
,
q
ueue
&
queue
)
queue_load_song
(
TextFile
&
file
,
const
char
*
line
,
Q
ueue
&
queue
)
{
if
(
queue
.
IsFull
())
return
;
...
...
src/QueueSave.hxx
View file @
2f512853
...
...
@@ -27,16 +27,16 @@
#include <stdio.h>
struct
q
ueue
;
struct
Q
ueue
;
class
TextFile
;
void
queue_save
(
FILE
*
fp
,
const
q
ueue
&
queue
);
queue_save
(
FILE
*
fp
,
const
Q
ueue
&
queue
);
/**
* Loads one song from the state file and appends it to the queue.
*/
void
queue_load_song
(
TextFile
&
file
,
const
char
*
line
,
q
ueue
&
queue
);
queue_load_song
(
TextFile
&
file
,
const
char
*
line
,
Q
ueue
&
queue
);
#endif
test/test_queue_priority.cxx
View file @
2f512853
...
...
@@ -12,7 +12,7 @@ Tag::Tag(const Tag &) {}
void
Tag
::
Clear
()
{}
static
void
check_descending_priority
(
const
struct
q
ueue
*
queue
,
check_descending_priority
(
const
Q
ueue
*
queue
,
unsigned
start_order
)
{
assert
(
start_order
<
queue
->
GetLength
());
...
...
@@ -58,7 +58,7 @@ QueuePriorityTest::TestPriority()
DetachedSong
(
"f.ogg"
),
};
struct
q
ueue
queue
(
32
);
Q
ueue
queue
(
32
);
for
(
unsigned
i
=
0
;
i
<
ARRAY_SIZE
(
songs
);
++
i
)
queue
.
Append
(
DetachedSong
(
songs
[
i
]),
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment