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
2efd8ef5
Commit
2efd8ef5
authored
Aug 28, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/LightSong: use std::chrono::duration for start_ms and end_ms
parent
6ad93398
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
24 deletions
+28
-24
DetachedSong.cxx
src/DetachedSong.cxx
+2
-2
SongPrint.cxx
src/SongPrint.cxx
+11
-8
LightSong.cxx
src/db/LightSong.cxx
+3
-3
LightSong.hxx
src/db/LightSong.hxx
+5
-4
ProxyDatabasePlugin.cxx
src/db/plugins/ProxyDatabasePlugin.cxx
+3
-3
Song.cxx
src/db/plugins/simple/Song.cxx
+2
-2
UpnpDatabasePlugin.cxx
src/db/plugins/upnp/UpnpDatabasePlugin.cxx
+2
-2
No files found.
src/DetachedSong.cxx
View file @
2efd8ef5
...
...
@@ -28,8 +28,8 @@ DetachedSong::DetachedSong(const LightSong &other)
real_uri
(
other
.
real_uri
!=
nullptr
?
other
.
real_uri
:
""
),
tag
(
*
other
.
tag
),
mtime
(
other
.
mtime
),
start_time
(
SongTime
::
FromMS
(
other
.
start_ms
)
),
end_time
(
SongTime
::
FromMS
(
other
.
end_ms
)
)
{}
start_time
(
other
.
start_time
),
end_time
(
other
.
end_time
)
{}
DetachedSong
::~
DetachedSong
()
{
...
...
src/SongPrint.cxx
View file @
2efd8ef5
...
...
@@ -75,16 +75,19 @@ song_print_info(Client &client, const LightSong &song, bool base)
{
song_print_uri
(
client
,
song
,
base
);
if
(
song
.
end_ms
>
0
)
const
unsigned
start_ms
=
song
.
start_time
.
ToMS
();
const
unsigned
end_ms
=
song
.
end_time
.
ToMS
();
if
(
end_ms
>
0
)
client_printf
(
client
,
"Range: %u.%03u-%u.%03u
\n
"
,
s
ong
.
s
tart_ms
/
1000
,
s
ong
.
s
tart_ms
%
1000
,
song
.
end_ms
/
1000
,
song
.
end_ms
%
1000
);
else
if
(
s
ong
.
s
tart_ms
>
0
)
start_ms
/
1000
,
start_ms
%
1000
,
end_ms
/
1000
,
end_ms
%
1000
);
else
if
(
start_ms
>
0
)
client_printf
(
client
,
"Range: %u.%03u-
\n
"
,
s
ong
.
s
tart_ms
/
1000
,
s
ong
.
s
tart_ms
%
1000
);
start_ms
/
1000
,
start_ms
%
1000
);
if
(
song
.
mtime
>
0
)
time_print
(
client
,
"Last-Modified"
,
song
.
mtime
);
...
...
src/db/LightSong.cxx
View file @
2efd8ef5
...
...
@@ -23,11 +23,11 @@
double
LightSong
::
GetDuration
()
const
{
if
(
end_
ms
>
0
)
return
(
end_
ms
-
start_ms
)
/
1000.0
;
if
(
end_
time
.
IsPositive
()
)
return
(
end_
time
-
start_time
).
ToDoubleS
()
;
if
(
tag
->
time
<=
0
)
return
0
;
return
tag
->
time
-
start_
ms
/
1000.0
;
return
tag
->
time
-
start_
time
.
ToDoubleS
()
;
}
src/db/LightSong.hxx
View file @
2efd8ef5
...
...
@@ -20,6 +20,7 @@
#ifndef MPD_LIGHT_SONG_HXX
#define MPD_LIGHT_SONG_HXX
#include "Chrono.hxx"
#include "Compiler.h"
#include <string>
...
...
@@ -64,15 +65,15 @@ struct LightSong {
time_t
mtime
;
/**
* Start of this sub-song within the file
in milliseconds
.
* Start of this sub-song within the file.
*/
unsigned
start_ms
;
SongTime
start_time
;
/**
* End of this sub-song within the file
in milliseconds
.
* End of this sub-song within the file.
* Unused if zero.
*/
unsigned
end_ms
;
SongTime
end_time
;
gcc_pure
std
::
string
GetURI
()
const
{
...
...
src/db/plugins/ProxyDatabasePlugin.cxx
View file @
2efd8ef5
...
...
@@ -192,10 +192,10 @@ ProxySong::ProxySong(const mpd_song *song)
mtime
=
mpd_song_get_last_modified
(
song
);
#if LIBMPDCLIENT_CHECK_VERSION(2,3,0)
start_
ms
=
mpd_song_get_start
(
song
)
*
1000
;
end_
ms
=
mpd_song_get_end
(
song
)
*
1000
;
start_
time
=
SongTime
::
FromS
(
mpd_song_get_start
(
song
))
;
end_
time
=
SongTime
::
FromS
(
mpd_song_get_end
(
song
))
;
#else
start_
ms
=
end_ms
=
0
;
start_
time
=
end_time
=
SongTime
::
zero
()
;
#endif
TagBuilder
tag_builder
;
...
...
src/db/plugins/simple/Song.cxx
View file @
2efd8ef5
...
...
@@ -105,7 +105,7 @@ Song::Export() const
dest
.
real_uri
=
nullptr
;
dest
.
tag
=
&
tag
;
dest
.
mtime
=
mtime
;
dest
.
start_
ms
=
start_ms
;
dest
.
end_
ms
=
end_ms
;
dest
.
start_
time
=
SongTime
::
FromMS
(
start_ms
)
;
dest
.
end_
time
=
SongTime
::
FromMS
(
end_ms
)
;
return
dest
;
}
src/db/plugins/upnp/UpnpDatabasePlugin.cxx
View file @
2efd8ef5
...
...
@@ -66,7 +66,7 @@ public:
real_uri
=
real_uri2
.
c_str
();
tag
=
&
tag2
;
mtime
=
0
;
start_
ms
=
end_ms
=
0
;
start_
time
=
end_time
=
SongTime
::
zero
()
;
}
};
...
...
@@ -360,7 +360,7 @@ visitSong(const UPnPDirObject &meta, const char *path,
song
.
real_uri
=
meta
.
url
.
c_str
();
song
.
tag
=
&
meta
.
tag
;
song
.
mtime
=
0
;
song
.
start_
ms
=
song
.
end_ms
=
0
;
song
.
start_
time
=
song
.
end_time
=
SongTime
::
zero
()
;
return
!
selection
.
Match
(
song
)
||
visit_song
(
song
,
error
);
}
...
...
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