changed microsecond patch in Taglib to return integer and fractional parts separately (so that they fit into two int's)
This commit is contained in:
parent
0ac70b4e14
commit
b22c1f9c1e
2 changed files with 24 additions and 23 deletions
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
Author : $Author: fgerlits $
|
||||
Version : $Revision: 1.12 $
|
||||
Version : $Revision: 1.13 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -273,9 +273,9 @@ UploadFileWindow :: updateFileInfo(void) throw ()
|
|||
lengthStr << std::setfill('0')
|
||||
<< std::setw(2) << playlength->hours() << ":"
|
||||
<< std::setw(2) << playlength->minutes() << ":"
|
||||
<< std::setw(2) << (playlength->fractional_seconds() < 500000 ?
|
||||
playlength->seconds()
|
||||
: playlength->seconds() + 1);
|
||||
<< std::setw(2) << (playlength->fractional_seconds() < 500000
|
||||
? playlength->seconds()
|
||||
: playlength->seconds() + 1);
|
||||
lengthValueLabel->set_text(lengthStr.str());
|
||||
}
|
||||
}
|
||||
|
@ -360,8 +360,9 @@ UploadFileWindow :: readPlaylength(const std::string & fileName)
|
|||
TagLib::AudioProperties * audioProperties = fileRef.audioProperties();
|
||||
|
||||
if (audioProperties) {
|
||||
Ptr<time_duration>::Ref length(new time_duration(microseconds(
|
||||
audioProperties->length_microseconds() )));
|
||||
Ptr<time_duration>::Ref length(new time_duration(
|
||||
seconds( audioProperties->length() )
|
||||
+ microseconds(audioProperties->length_microseconds()) ));
|
||||
return length;
|
||||
} else {
|
||||
throw std::invalid_argument("could not read file length");
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
|
||||
/*!
|
||||
- * Returns the lenght of the file in seconds.
|
||||
+ * Returns the length of the file in seconds.
|
||||
+ * Returns the length of the file in seconds (rounded down).
|
||||
*/
|
||||
virtual int length() const = 0;
|
||||
|
||||
/*!
|
||||
+ * Returns the length of the file in microseconds.
|
||||
+ * Returns the fractional part of the length of the file, in microseconds.
|
||||
+ */
|
||||
+ virtual long length_microseconds() const = 0;
|
||||
+ virtual int length_microseconds() const = 0;
|
||||
+
|
||||
+ /*!
|
||||
* Returns the most appropriate bit rate for the file in kb/s. For constant
|
||||
|
@ -24,7 +24,7 @@
|
|||
// Reimplementations.
|
||||
|
||||
virtual int length() const;
|
||||
+ virtual long length_microseconds() const;
|
||||
+ virtual int length_microseconds() const;
|
||||
virtual int bitrate() const;
|
||||
virtual int sampleRate() const;
|
||||
virtual int channels() const;
|
||||
|
@ -34,9 +34,9 @@
|
|||
return d->length;
|
||||
}
|
||||
|
||||
+long FLAC::Properties::length_microseconds() const
|
||||
+int FLAC::Properties::length_microseconds() const
|
||||
+{
|
||||
+ return long(d->length) * 1000000;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int FLAC::Properties::bitrate() const
|
||||
|
@ -48,7 +48,7 @@
|
|||
// Reimplementations.
|
||||
|
||||
virtual int length() const;
|
||||
+ virtual long length_microseconds() const;
|
||||
+ virtual int length_microseconds() const;
|
||||
virtual int bitrate() const;
|
||||
virtual int sampleRate() const;
|
||||
virtual int channels() const;
|
||||
|
@ -58,9 +58,9 @@
|
|||
return d->length;
|
||||
}
|
||||
|
||||
+long MPC::Properties::length_microseconds() const
|
||||
+int MPC::Properties::length_microseconds() const
|
||||
+{
|
||||
+ return long(d->length) * 1000000;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
int MPC::Properties::bitrate() const
|
||||
|
@ -72,7 +72,7 @@
|
|||
// Reimplementations.
|
||||
|
||||
virtual int length() const;
|
||||
+ virtual long length_microseconds() const;
|
||||
+ virtual int length_microseconds() const;
|
||||
virtual int bitrate() const;
|
||||
virtual int sampleRate() const;
|
||||
virtual int channels() const;
|
||||
|
@ -92,12 +92,12 @@
|
|||
int MPEG::Properties::length() const
|
||||
{
|
||||
- return d->length;
|
||||
+ return int((d->length + 500000) / 1000000);
|
||||
+ return int(d->length / 1000000);
|
||||
+}
|
||||
+
|
||||
+long MPEG::Properties::length_microseconds() const
|
||||
+int MPEG::Properties::length_microseconds() const
|
||||
+{
|
||||
+ return long(d->length);
|
||||
+ return int(d->length % 1000000);
|
||||
}
|
||||
|
||||
int MPEG::Properties::bitrate() const
|
||||
|
@ -132,7 +132,7 @@
|
|||
// Reimplementations.
|
||||
|
||||
virtual int length() const;
|
||||
+ virtual long length_microseconds() const;
|
||||
+ virtual int length_microseconds() const;
|
||||
virtual int bitrate() const;
|
||||
virtual int sampleRate() const;
|
||||
virtual int channels() const;
|
||||
|
@ -152,12 +152,12 @@
|
|||
int Vorbis::Properties::length() const
|
||||
{
|
||||
- return d->length;
|
||||
+ return int((d->length + 500000) / 1000000);
|
||||
+ return int(d->length / 1000000);
|
||||
+}
|
||||
+
|
||||
+long Vorbis::Properties::length_microseconds() const
|
||||
+int Vorbis::Properties::length_microseconds() const
|
||||
+{
|
||||
+ return long(d->length);
|
||||
+ return int(d->length % 1000000);
|
||||
}
|
||||
|
||||
int Vorbis::Properties::bitrate() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue