diff options
author | Ian Nartowicz <iann@crunchbang> | 2014-06-14 00:10:49 +0100 |
---|---|---|
committer | Ian Nartowicz <iann@crunchbang> | 2014-06-14 00:10:49 +0100 |
commit | caf400178adbcaaace2a258354b7310067726a04 (patch) | |
tree | b03bd9a087583ee21ac13dd8bf6544db42a67da9 /plugins/flac | |
parent | 17463ab388e7c2a95db8f19e41a1fad459a63717 (diff) |
bitrate for OggFLAC, plus oggedit changes
Diffstat (limited to 'plugins/flac')
-rw-r--r-- | plugins/flac/flac.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c index 7cb38458..5deab23e 100644 --- a/plugins/flac/flac.c +++ b/plugins/flac/flac.c @@ -791,9 +791,18 @@ cflac_insert (ddb_playlist_t *plt, DB_playItem_t *after, const char *fname) { snprintf (s, sizeof (s), "%d", info.info.fmt.samplerate); deadbeef->pl_add_meta (it, ":SAMPLERATE", s); if ( deadbeef->pl_get_item_duration (it) > 0) { - FLAC__uint64 position; - if (FLAC__stream_decoder_get_decode_position (decoder, &position)) - fsize -= position; + if (!isogg) { + FLAC__uint64 position; + if (FLAC__stream_decoder_get_decode_position (decoder, &position)) + fsize -= position; + } +#if USE_OGGEDIT + else { + const off_t stream_size = oggedit_flac_stream_info(deadbeef->fopen(fname), 0, 0); + if (stream_size > 0) + fsize = stream_size; + } +#endif deadbeef->pl_set_meta_int (it, ":BITRATE", (int)roundf(fsize / deadbeef->pl_get_item_duration (it) * 8 / 1000)); } FLAC__stream_decoder_delete(decoder); |