db/simple/Song: use std::chrono::duration for start_ms and end_ms
This commit is contained in:
parent
2efd8ef52d
commit
888ab0c89c
@ -52,7 +52,7 @@ song_save(BufferedOutputStream &os, const Song &song)
|
||||
{
|
||||
os.Format(SONG_BEGIN "%s\n", song.uri);
|
||||
|
||||
range_save(os, song.start_ms, song.end_ms);
|
||||
range_save(os, song.start_time.ToMS(), song.end_time.ToMS());
|
||||
|
||||
tag_save(os, song.tag);
|
||||
|
||||
|
@ -30,7 +30,8 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
inline Song::Song(const char *_uri, size_t uri_length, Directory &_parent)
|
||||
:parent(&_parent), mtime(0), start_ms(0), end_ms(0)
|
||||
:parent(&_parent), mtime(0),
|
||||
start_time(SongTime::zero()), end_time(SongTime::zero())
|
||||
{
|
||||
memcpy(uri, _uri, uri_length + 1);
|
||||
}
|
||||
@ -59,8 +60,8 @@ Song::NewFrom(DetachedSong &&other, Directory &parent)
|
||||
Song *song = song_alloc(other.GetURI(), parent);
|
||||
song->tag = std::move(other.WritableTag());
|
||||
song->mtime = other.GetLastModified();
|
||||
song->start_ms = other.GetStartTime().ToMS();
|
||||
song->end_ms = other.GetEndTime().ToMS();
|
||||
song->start_time = other.GetStartTime();
|
||||
song->end_time = other.GetEndTime();
|
||||
return song;
|
||||
}
|
||||
|
||||
@ -105,7 +106,7 @@ Song::Export() const
|
||||
dest.real_uri = nullptr;
|
||||
dest.tag = &tag;
|
||||
dest.mtime = mtime;
|
||||
dest.start_time = SongTime::FromMS(start_ms);
|
||||
dest.end_time = SongTime::FromMS(end_ms);
|
||||
dest.start_time = start_time;
|
||||
dest.end_time = end_time;
|
||||
return dest;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
#ifndef MPD_SONG_HXX
|
||||
#define MPD_SONG_HXX
|
||||
|
||||
#include "Chrono.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
#include "Compiler.h"
|
||||
|
||||
@ -71,15 +72,15 @@ struct Song {
|
||||
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;
|
||||
|
||||
/**
|
||||
* The file name.
|
||||
|
Loading…
Reference in New Issue
Block a user