From b22c1f9c1e71ebe13e2372b933c8c76c6fb8b4dd Mon Sep 17 00:00:00 2001 From: fgerlits Date: Mon, 20 Jun 2005 12:29:35 +0000 Subject: [PATCH] changed microsecond patch in Taglib to return integer and fractional parts separately (so that they fit into two int's) --- .../gLiveSupport/src/UploadFileWindow.cxx | 13 +++---- .../taglib-1.3.1-length-in-microseconds.patch | 34 +++++++++---------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx b/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx index fd8435732..cce038141 100644 --- a/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx +++ b/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx @@ -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::Ref length(new time_duration(microseconds( - audioProperties->length_microseconds() ))); + Ptr::Ref length(new time_duration( + seconds( audioProperties->length() ) + + microseconds(audioProperties->length_microseconds()) )); return length; } else { throw std::invalid_argument("could not read file length"); diff --git a/livesupport/tools/taglib/taglib-1.3.1/etc/taglib-1.3.1-length-in-microseconds.patch b/livesupport/tools/taglib/taglib-1.3.1/etc/taglib-1.3.1-length-in-microseconds.patch index b5289eead..bd8047634 100644 --- a/livesupport/tools/taglib/taglib-1.3.1/etc/taglib-1.3.1-length-in-microseconds.patch +++ b/livesupport/tools/taglib/taglib-1.3.1/etc/taglib-1.3.1-length-in-microseconds.patch @@ -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