@@ -78,13 +78,26 @@ struct mpd_song {
7878 */
7979 unsigned start ;
8080
81+ /**
82+ * Start of the virtual song within the physical file in
83+ * milliseconds.
84+ */
85+ unsigned start_ms ;
86+
8187 /**
8288 * End of the virtual song within the physical file in
8389 * seconds. Zero means that the physical song file is
8490 * played to the end.
8591 */
8692 unsigned end ;
8793
94+ /**
95+ * End of the virtual song within the physical file in
96+ * milliseconds. Zero means that the physical song
97+ * file is played to the end.
98+ */
99+ unsigned end_ms ;
100+
88101 /**
89102 * The POSIX UTC time stamp of the last modification, or 0 if
90103 * that is unknown.
@@ -147,7 +160,9 @@ mpd_song_new(const char *uri)
147160 song -> duration = 0 ;
148161 song -> duration_ms = 0 ;
149162 song -> start = 0 ;
163+ song -> start_ms = 0 ;
150164 song -> end = 0 ;
165+ song -> end_ms = 0 ;
151166 song -> last_modified = 0 ;
152167 song -> pos = 0 ;
153168 song -> id = 0 ;
@@ -230,7 +245,9 @@ mpd_song_dup(const struct mpd_song *song)
230245 ret -> duration = song -> duration ;
231246 ret -> duration_ms = song -> duration_ms ;
232247 ret -> start = song -> start ;
248+ ret -> start_ms = song -> start_ms ;
233249 ret -> end = song -> end ;
250+ ret -> end_ms = song -> end_ms ;
234251 ret -> last_modified = song -> last_modified ;
235252 ret -> pos = song -> pos ;
236253 ret -> id = song -> id ;
@@ -396,6 +413,14 @@ mpd_song_get_start(const struct mpd_song *song)
396413 return song -> start ;
397414}
398415
416+ unsigned
417+ mpd_song_get_start_ms (const struct mpd_song * song )
418+ {
419+ assert (song != NULL );
420+
421+ return song -> start_ms ;
422+ }
423+
399424unsigned
400425mpd_song_get_end (const struct mpd_song * song )
401426{
@@ -404,6 +429,14 @@ mpd_song_get_end(const struct mpd_song *song)
404429 return song -> end ;
405430}
406431
432+ unsigned
433+ mpd_song_get_end_ms (const struct mpd_song * song )
434+ {
435+ assert (song != NULL );
436+
437+ return song -> end_ms ;
438+ }
439+
407440static void
408441mpd_song_set_last_modified (struct mpd_song * song , time_t mtime )
409442{
@@ -508,15 +541,19 @@ mpd_song_parse_range(struct mpd_song *song, const char *value)
508541 }
509542
510543 song -> start = start > 0.0 ? (unsigned )start : 0 ;
544+ song -> start_ms = start > 0.0 ? (unsigned )(start * 1000 ) : 0 ;
511545
512546 if (end > 0.0 ) {
513547 song -> end = (unsigned )end ;
548+ song -> end_ms = (unsigned )(end * 1000 );
514549 if (song -> end == 0 )
515550 /* round up, because the caller must sees that
516551 there's an upper limit */
517552 song -> end = 1 ;
518- } else
553+ } else {
519554 song -> end = 0 ;
555+ song -> end_ms = 0 ;
556+ }
520557}
521558
522559static void
0 commit comments