aboutsummaryrefslogtreecommitdiffstats
path: root/src/ogg_decode.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-03-10 02:38:31 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-03-10 02:38:31 +0000
commitec234e985563316d725c7a8b8873f2c34e4d4635 (patch)
treea91cc7765db20d0a5c1815d211246cad3abb438f /src/ogg_decode.c
parent1459ee22fe0aee6aa754d3bbb56e76840f4ee1c1 (diff)
downloadmpd-ec234e985563316d725c7a8b8873f2c34e4d4635.tar.gz
mpd-ec234e985563316d725c7a8b8873f2c34e4d4635.tar.xz
mpd-ec234e985563316d725c7a8b8873f2c34e4d4635.zip
move time from tag info to song info.
also, if we can't get the time, then don't add the song to the db! git-svn-id: https://svn.musicpd.org/mpd/trunk@236 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/ogg_decode.c')
-rw-r--r--src/ogg_decode.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/ogg_decode.c b/src/ogg_decode.c
index 0b75ce3b2..bcc0f6ee5 100644
--- a/src/ogg_decode.c
+++ b/src/ogg_decode.c
@@ -37,6 +37,25 @@
#define OGG_DECODE_USE_BIGENDIAN 0
#endif
+int getOggTotalTime(char * file) {
+ OggVorbis_File vf;
+ FILE * oggfp;
+ int totalTime;
+
+ if(!(oggfp = fopen(file,"r"))) return -1;
+
+ if(ov_open(oggfp, &vf, NULL, 0) < 0) {
+ fclose(oggfp);
+ return -1;
+ }
+
+ totalTime = ov_time_total(&vf,-1)+0.5;
+
+ ov_clear(&vf);
+
+ return totalTime;
+}
+
int ogg_decode(Buffer * cb, AudioFormat * af, DecoderControl * dc)
{
OggVorbis_File vf;