diff options
author | Alexey Yakovenko <wakeroid@gmail.com> | 2009-10-11 17:14:10 +0200 |
---|---|---|
committer | Alexey Yakovenko <wakeroid@gmail.com> | 2009-10-11 17:14:10 +0200 |
commit | 4326a465afb45622d22d2dd52fe6f4d25f1a17ef (patch) | |
tree | c9480b530aa077ab43f5bc9a3940eda556accb03 /plugins | |
parent | 9425bbc1716081cff72c73744a4fc82251b9db41 (diff) |
added total playtime display to statusbar
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/cdda/cdda.c | 2 | ||||
-rw-r--r-- | plugins/faad2/faad2.c | 2 | ||||
-rw-r--r-- | plugins/ffap/ffap.c | 2 | ||||
-rw-r--r-- | plugins/flac/flac.c | 2 | ||||
-rw-r--r-- | plugins/lastfm/lastfm.c | 6 | ||||
-rw-r--r-- | plugins/mpgmad/mpgmad.c | 8 | ||||
-rw-r--r-- | plugins/sndfile/sndfile.c | 2 | ||||
-rw-r--r-- | plugins/vorbis/vorbis.c | 10 | ||||
-rw-r--r-- | plugins/wavpack/wavpack.c | 2 |
9 files changed, 18 insertions, 18 deletions
diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c index 76b4662a..a429d5a6 100644 --- a/plugins/cdda/cdda.c +++ b/plugins/cdda/cdda.c @@ -289,7 +289,7 @@ insert_single_track (CdIo_t* cdio, DB_playItem_t *after, const char* file, int t it->decoder = &plugin; it->fname = strdup (tmp); it->filetype = "cdda"; - it->duration = (float)sector_count / 75.0; + deadbeef->pl_set_item_duration (it, (float)sector_count / 75.0); snprintf (tmp, sizeof (tmp), "CD Track %02d", track_nr); deadbeef->pl_add_meta (it, "title", tmp); diff --git a/plugins/faad2/faad2.c b/plugins/faad2/faad2.c index 7c1d8cac..46a144ce 100644 --- a/plugins/faad2/faad2.c +++ b/plugins/faad2/faad2.c @@ -223,7 +223,7 @@ aac_insert (DB_playItem_t *after, const char *fname) { it->decoder = &plugin; it->fname = strdup (fname); it->filetype = ftype; - it->duration = duration; + deadbeef->pl_set_item_duration (it, duration); // read tags if (ftype == "aac") { diff --git a/plugins/ffap/ffap.c b/plugins/ffap/ffap.c index fd96fc9f..993863ed 100644 --- a/plugins/ffap/ffap.c +++ b/plugins/ffap/ffap.c @@ -1657,7 +1657,7 @@ ffap_insert (DB_playItem_t *after, const char *fname) { it->decoder = &plugin; it->fname = strdup (fname); it->filetype = "APE"; - it->duration = duration; + deadbeef->pl_set_item_duration (it, duration); int v2err = deadbeef->junk_read_id3v2 (it, fp); int v1err = deadbeef->junk_read_id3v1 (it, fp); diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c index 4a6b9f9c..de78d653 100644 --- a/plugins/flac/flac.c +++ b/plugins/flac/flac.c @@ -364,7 +364,7 @@ cflac_init_metadata_callback(const FLAC__StreamDecoder *decoder, const FLAC__Str DB_playItem_t *it = cb->it; //it->tracknum = 0; if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO) { - it->duration = metadata->data.stream_info.total_samples / (float)metadata->data.stream_info.sample_rate; + deadbeef->pl_set_item_duration (it, metadata->data.stream_info.total_samples / (float)metadata->data.stream_info.sample_rate); } else if (metadata->type == FLAC__METADATA_TYPE_VORBIS_COMMENT) { const FLAC__StreamMetadata_VorbisComment *vc = &metadata->data.vorbis_comment; diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c index bd4577c9..e7c5cddb 100644 --- a/plugins/lastfm/lastfm.c +++ b/plugins/lastfm/lastfm.c @@ -247,7 +247,7 @@ lfm_fetch_song_info (DB_playItem_t *song, const char **a, const char **t, const if (!*b) { *b = ""; } - *l = song->duration; + *l = deadbeef->pl_get_item_duration (song); *n = deadbeef->pl_find_meta (song, "track"); if (!*n) { *n = ""; @@ -425,12 +425,12 @@ lastfm_songfinished (DB_event_song_t *ev, uintptr_t data) { #if !LFM_IGNORE_RULES // check submission rules // duration must be >= 30 sec - if (ev->song->duration < 30) { + if (deadbeef->pl_get_item_duration (ev->song) < 30) { trace ("song duration is %f seconds. not eligible for submission\n", ev->song->duration); return 0; } // must be played for >=240sec of half the total time - if (ev->song->playtime < 240 && ev->song->playtime < ev->song->duration/2) { + if (ev->song->playtime < 240 && ev->song->playtime < deadbeef->pl_get_item_duration (ev->song)/2) { trace ("song playtime=%f seconds. not eligible for submission\n", ev->song->playtime); return 0; } diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c index d25f59d4..7465a076 100644 --- a/plugins/mpgmad/mpgmad.c +++ b/plugins/mpgmad/mpgmad.c @@ -502,7 +502,7 @@ cmp3_init (DB_playItem_t *it) { plugin.seek_sample (0); } else { - it->duration = buffer.duration; + deadbeef->pl_set_item_duration (it, buffer.duration); buffer.startsample = 0; buffer.endsample = buffer.totalsamples-1; buffer.skipsamples = buffer.startdelay; @@ -526,7 +526,7 @@ cmp3_init (DB_playItem_t *it) { plugin.free (); return -1; } - it->duration = buffer.duration; + deadbeef->pl_set_item_duration (it, buffer.duration); if (buffer.duration >= 0) { buffer.endsample = buffer.totalsamples - 1; } @@ -921,7 +921,7 @@ cmp3_insert (DB_playItem_t *after, const char *fname) { it->fname = strdup (fname); deadbeef->fclose (fp); deadbeef->pl_add_meta (it, "title", NULL); - it->duration = -1; + deadbeef->pl_set_item_duration (it, -1); it->filetype = filetypes[0]; after = deadbeef->pl_insert_item (after, it); return after; @@ -998,7 +998,7 @@ cmp3_insert (DB_playItem_t *after, const char *fname) { int v1err = deadbeef->junk_read_id3v1 (it, fp); deadbeef->fclose (fp); deadbeef->pl_add_meta (it, "title", NULL); - it->duration = buffer.duration; + deadbeef->pl_set_item_duration (it, buffer.duration); it->filetype = ftype; after = deadbeef->pl_insert_item (after, it); diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c index 545d41b8..46e3a99f 100644 --- a/plugins/sndfile/sndfile.c +++ b/plugins/sndfile/sndfile.c @@ -138,7 +138,7 @@ sndfile_insert (DB_playItem_t *after, const char *fname) { it->decoder = &plugin; it->fname = strdup (fname); it->filetype = "wav"; - it->duration = duration; + deadbeef->pl_set_item_duration (it, duration); trace ("sndfile: totalsamples=%d, samplerate=%d, duration=%f\n", totalsamples, samplerate, duration); diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index d3de500f..8a32bd86 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -132,7 +132,7 @@ cvorbis_init (DB_playItem_t *it) { plugin.free (); return -1; } - it->duration = -1; + deadbeef->pl_set_item_duration (it, -1); } else { @@ -150,7 +150,7 @@ cvorbis_init (DB_playItem_t *it) { plugin.free (); return -1; } - it->duration = ov_time_total (&vorbis_file, -1); + deadbeef->pl_set_item_duration (it, ov_time_total (&vorbis_file, -1)); } vi = ov_info (&vorbis_file, -1); if (!vi) { // not a vorbis stream @@ -177,7 +177,7 @@ cvorbis_init (DB_playItem_t *it) { } else { startsample = 0; - if (it->duration < 0) { + if (deadbeef->pl_get_item_duration (it) < 0) { endsample = -1; } else { @@ -311,7 +311,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) { it->decoder = &plugin; it->fname = strdup (fname); it->filetype = "OggVorbis"; - it->duration = -1; + deadbeef->pl_set_item_duration (it, -1); deadbeef->pl_add_meta (it, "title", NULL); after = deadbeef->pl_insert_item (after, it); return after; @@ -342,7 +342,7 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) { it->decoder = &plugin; it->fname = strdup (fname); it->filetype = "OggVorbis"; - it->duration = duration; + deadbeef->pl_set_item_duration (it, duration); // metainfo vorbis_comment *vc = ov_comment (&vorbis_file, -1); diff --git a/plugins/wavpack/wavpack.c b/plugins/wavpack/wavpack.c index 51608d64..5400a600 100644 --- a/plugins/wavpack/wavpack.c +++ b/plugins/wavpack/wavpack.c @@ -230,7 +230,7 @@ wv_insert (DB_playItem_t *after, const char *fname) { it->decoder = &plugin; it->fname = strdup (fname); it->filetype = "wv"; - it->duration = duration; + deadbeef->pl_set_item_duration (it, duration); trace ("wv: totalsamples=%d, samplerate=%d, duration=%f\n", totalsamples, samplerate, duration); |