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
b4b468eb
Commit
b4b468eb
authored
Oct 18, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge tag 'v0.20.11'
release v0.20.11
parents
bd50a0d2
a7fdfa08
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
107 additions
and
21 deletions
+107
-21
NEWS
NEWS
+5
-1
PlaylistFile.cxx
src/PlaylistFile.cxx
+5
-6
PlaylistSave.cxx
src/PlaylistSave.cxx
+15
-3
DecoderThread.cxx
src/decoder/DecoderThread.cxx
+1
-0
Playlist.cxx
src/queue/Playlist.cxx
+1
-2
Playlist.hxx
src/queue/Playlist.hxx
+12
-0
PlaylistControl.cxx
src/queue/PlaylistControl.cxx
+27
-7
Queue.cxx
src/queue/Queue.cxx
+20
-1
Queue.hxx
src/queue/Queue.hxx
+21
-1
No files found.
NEWS
View file @
b4b468eb
...
...
@@ -13,12 +13,16 @@ ver 0.21 (not yet released)
* mixer
- sndio: new mixer plugin
ver 0.20.11 (
not yet released
)
ver 0.20.11 (
2017/10/18
)
* storage
- curl: support Content-Type application/xml
* decoder
- ffmpeg: more reliable song duration
- gme: fix track numbering
* improve random song order when switching songs manually
* fix case insensitive search without libicu
* fix Unicode file names in playlists on Windows
* fix endless loop when accessing malformed file names in ZIP files
ver 0.20.10 (2017/08/24)
* decoder
...
...
src/PlaylistFile.cxx
View file @
b4b468eb
...
...
@@ -207,13 +207,12 @@ try {
continue
;
#ifdef _UNICODE
wchar_t
buffer
[
MAX_PATH
];
auto
result
=
MultiByteToWideChar
(
CP_ACP
,
0
,
s
,
-
1
,
buffer
,
ARRAY_SIZE
(
buffer
));
if
(
result
<=
0
)
/* on Windows, playlists always contain UTF-8, because
its "narrow" charset (i.e. CP_ACP) is incapable of
storing all Unicode paths */
const
auto
path
=
AllocatedPath
::
FromUTF8
(
s
);
if
(
path
.
IsNull
())
continue
;
const
Path
path
=
Path
::
FromFS
(
buffer
);
#else
const
Path
path
=
Path
::
FromFS
(
s
);
#endif
...
...
src/PlaylistSave.cxx
View file @
b4b468eb
...
...
@@ -28,13 +28,25 @@
#include "fs/AllocatedPath.hxx"
#include "fs/Traits.hxx"
#include "fs/FileSystem.hxx"
#include "fs/NarrowPath.hxx"
#include "fs/io/FileOutputStream.hxx"
#include "fs/io/BufferedOutputStream.hxx"
#include "util/UriUtil.hxx"
#include <stdexcept>
static
void
playlist_print_path
(
BufferedOutputStream
&
os
,
const
Path
path
)
{
#ifdef _UNICODE
/* on Windows, playlists always contain UTF-8, because its
"narrow" charset (i.e. CP_ACP) is incapable of storing all
Unicode paths */
os
.
Format
(
"%s
\n
"
,
path
.
ToUTF8
().
c_str
());
#else
os
.
Format
(
"%s
\n
"
,
path
.
c_str
());
#endif
}
void
playlist_print_song
(
BufferedOutputStream
&
os
,
const
DetachedSong
&
song
)
{
...
...
@@ -44,7 +56,7 @@ playlist_print_song(BufferedOutputStream &os, const DetachedSong &song)
try
{
const
auto
uri_fs
=
AllocatedPath
::
FromUTF8Throw
(
uri_utf8
);
os
.
Format
(
"%s
\n
"
,
NarrowPath
(
uri_fs
).
c_str
()
);
playlist_print_path
(
os
,
uri_fs
);
}
catch
(
const
std
::
runtime_error
&
)
{
}
}
...
...
@@ -63,7 +75,7 @@ playlist_print_uri(BufferedOutputStream &os, const char *uri)
AllocatedPath
::
FromUTF8Throw
(
uri
);
if
(
!
path
.
IsNull
())
os
.
Format
(
"%s
\n
"
,
NarrowPath
(
path
).
c_str
()
);
playlist_print_path
(
os
,
path
);
}
catch
(
const
std
::
runtime_error
&
)
{
}
}
...
...
src/decoder/DecoderThread.cxx
View file @
b4b468eb
...
...
@@ -508,6 +508,7 @@ try {
decoder_run_song
(
dc
,
song
,
uri_utf8
,
path_fs
);
}
catch
(...)
{
dc
.
state
=
DecoderState
::
ERROR
;
dc
.
command
=
DecoderCommand
::
NONE
;
dc
.
error
=
std
::
current_exception
();
dc
.
client_cond
.
signal
();
}
...
...
src/queue/Playlist.cxx
View file @
b4b468eb
...
...
@@ -310,8 +310,7 @@ playlist::SetRandom(PlayerControl &pc, bool status)
playlist is played after that */
unsigned
current_order
=
queue
.
PositionToOrder
(
current_position
);
queue
.
MoveOrder
(
current_order
,
0
);
current
=
0
;
current
=
queue
.
MoveOrder
(
current_order
,
0
);
}
else
current
=
-
1
;
}
else
...
...
src/queue/Playlist.hxx
View file @
b4b468eb
...
...
@@ -356,6 +356,18 @@ public:
}
void
SetConsume
(
bool
new_value
);
private
:
/**
* Prepare a manual song change: move the given song to the
* current playback order. This is done to avoid skipping
* upcoming songs in the order list. The newly selected song
* shall be inserted in the order list, and the rest shall be
* played after that as previously planned.
*
* @return the new order number of the given song
*/
unsigned
MoveOrderToCurrent
(
unsigned
old_order
);
};
#endif
src/queue/PlaylistControl.cxx
View file @
b4b468eb
...
...
@@ -56,6 +56,30 @@ playlist::Stop(PlayerControl &pc)
}
}
unsigned
playlist
::
MoveOrderToCurrent
(
unsigned
old_order
)
{
if
(
!
queue
.
random
)
/* no-op because there is no order list */
return
old_order
;
if
(
playing
)
{
/* already playing: move the specified song after the
current one (because the current one has already
been playing and shall not be played again) */
return
queue
.
MoveOrderAfter
(
old_order
,
current
);
}
else
if
(
current
>=
0
)
{
/* not playing: move the specified song before the
current one, so it will be played eventually */
return
queue
.
MoveOrderBefore
(
old_order
,
current
);
}
else
{
/* not playing anything: move the specified song to
the front */
queue
.
SwapOrders
(
old_order
,
0
);
return
0
;
}
}
void
playlist
::
PlayPosition
(
PlayerControl
&
pc
,
int
song
)
{
...
...
@@ -90,13 +114,7 @@ playlist::PlayPosition(PlayerControl &pc, int song)
number, because random mode is enabled */
i
=
queue
.
PositionToOrder
(
song
);
if
(
!
playing
)
current
=
0
;
/* swap the new song with the previous "current" one,
so playback continues as planned */
queue
.
SwapOrders
(
i
,
current
);
i
=
current
;
i
=
MoveOrderToCurrent
(
i
);
}
stop_on_error
=
false
;
...
...
@@ -205,6 +223,8 @@ playlist::SeekSongOrder(PlayerControl &pc, unsigned i, SongTime seek_time)
/* seeking is not within the current song - prepare
song change */
i
=
MoveOrderToCurrent
(
i
);
playing
=
true
;
current
=
i
;
...
...
src/queue/Queue.cxx
View file @
b4b468eb
...
...
@@ -195,7 +195,7 @@ Queue::MoveRange(unsigned start, unsigned end, unsigned to) noexcept
}
}
voi
d
unsigne
d
Queue
::
MoveOrder
(
unsigned
from_order
,
unsigned
to_order
)
noexcept
{
assert
(
from_order
<
length
);
...
...
@@ -212,6 +212,25 @@ Queue::MoveOrder(unsigned from_order, unsigned to_order) noexcept
}
order
[
to_order
]
=
from_position
;
return
to_order
;
}
unsigned
Queue
::
MoveOrderBefore
(
unsigned
from_order
,
unsigned
to_order
)
noexcept
{
/* if "from_order" comes before "to_order", then the new
position is "to_order-1"; otherwise the "to_order" song is
moved one ahead */
return
MoveOrder
(
from_order
,
to_order
-
(
from_order
<
to_order
));
}
unsigned
Queue
::
MoveOrderAfter
(
unsigned
from_order
,
unsigned
to_order
)
noexcept
{
/* if "from_order" comes after "to_order", then the new
position is "to_order+1"; otherwise the "to_order" song is
moved one back */
return
MoveOrder
(
from_order
,
to_order
+
(
from_order
>
to_order
));
}
void
...
...
src/queue/Queue.hxx
View file @
b4b468eb
...
...
@@ -284,8 +284,28 @@ struct Queue {
/**
* Moves a song to a new position in the "order" list.
*
* @return to_order
*/
unsigned
MoveOrder
(
unsigned
from_order
,
unsigned
to_order
)
noexcept
;
/**
* Moves a song to a new position in the "order" list before
* the given one.
*
* @return the new order number of the given "from" song
*/
unsigned
MoveOrderBefore
(
unsigned
from_order
,
unsigned
to_order
)
noexcept
;
/**
* Moves a song to a new position in the "order" list after
* the given one.
*
* @return the new order number of the given "from" song
*/
void
MoveOrder
(
unsigned
from_order
,
unsigned
to_order
)
noexcept
;
unsigned
MoveOrderAfter
(
unsigned
from_order
,
unsigned
to_order
)
noexcept
;
/**
* Moves a song to a new position.
...
...
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