WAV track length

Brett Hoyle kickbits at gmail.com
Sun Jul 4 02:45:30 CEST 2010


Ok the attached works.

Added setlength to wavproperties.cpp/h:
void RIFF::WAV::Properties::setlength(int length)
{
  d->length = length;
}

And this to the bottom of wavfile.cpp:
else if(chunkName(i) == "data" && readProperties)
{
  if(d->properties->bitrate() != 0 )
    d->properties->setlength(chunkData(i).size() / (d->properties->bitrate()
/ 8 * 1024));
}



-----Original Message-----
From: Brett Hoyle [mailto:kickbits at gmail.com] 
Sent: Thursday, 1 July 2010 9:48 PM
To: taglib-devel at kde.org
Subject: WAV track length

TagLib still does not support returning the track length for wav files:
https://bugs.kde.org/show_bug.cgi?id=116033

The quickest and easiest way to get the track length is to get the size of
the "data" chunk and divide by the averagebyterate.
The below doesn't work but is my idea of how this could be fixed at the
bottom of wavfile.cpp.
I think this would only need a minor change to be able to compile but I
can't work it out :)

    else if(chunkName(i) == "data" && readProperties)
	{
		if(d->properties->bitrate != 0 )
			d->properties->length = chunkName(i).size() /
(d->properties->bitrate / 8);
	}

_______________________________________________
taglib-devel mailing list
taglib-devel at kde.org
https://mail.kde.org/mailman/listinfo/taglib-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wav_track_length.zip
Type: application/octet-stream
Size: 3608 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/taglib-devel/attachments/20100704/bcf95fff/attachment.obj 


More information about the taglib-devel mailing list