Main Page | Class Hierarchy | Compound List | File List | Compound Members

MP7Time.hpp

Go to the documentation of this file.
00001  /***********************************************************************
00002  *                                                                      *
00003  * MuViNo - ViTooKi Video Annotation Tool                               *
00004  *                                                                      *
00005  * title:   MP7Time.hpp                                             *
00006  *                                                                      *
00007  * $Id: MP7Time_8hpp-source.html,v 1.1 2004/09/27 07:24:51 mtaschwer Exp $
00008  *                                                                      *
00009  * ITEC institute of the University of Klagenfurt (Austria)             *
00010  * http://www.itec.uni-klu.ac.at                                        *
00011  *                                                                      *
00012  *                                                                      *
00013  * For more information visit the ViTooKi homepage:                     *
00014  * http://ViTooKi.sourceforge.net                                       *
00015  * vitooki-user@lists.sourceforge.net                                   *
00016  * vitooki-devel@lists.sourceforge.net                                  *
00017  *                                                                      *
00018  * This file is part of ViTooKi, a free video toolkit.                  *
00019  * ViTooKi is free software; you can redistribute it and/or             *
00020  * modify it under the terms of the GNU General Public License          *
00021  * as published by the Free Software Foundation; either version 2       *
00022  * of the License, or (at your option) any later version.               *
00023  *                                                                      *
00024  * This program is distributed in the hope that it will be useful,      *
00025  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
00026  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the         *
00027  * GNU General Public License for more details.                         *
00028  *                                                                      *
00029  * You should have received a copy of the GNU General Public License    *
00030  * along with this program; if not, write to the Free Software          *
00031  * Foundation, Inc., 59 Temple Place - Suite 330, Boston,               *
00032  * MA  02111-1307, USA.                                                 *
00033  *                                                                      *
00034  ***********************************************************************/
00035 
00036 #ifndef _MP7TIME_HPP_
00037 #define _MP7TIME_HPP_
00038 
00049 class MP7Time
00050 {
00051 public:
00053   MP7Time();
00054 
00059   bool setTimePoint(uint value, uint ticksPerSecond = 1);
00060 
00064   bool setTimePoint(const QString &mp7Value);
00065 
00070   bool setTimePoint(const MP7Time &otherTime);
00071 
00079   bool moveTimePoint(int value, uint ticksPerSecond);
00080   
00084   bool setDuration(uint value, uint ticks);
00085 
00089   bool setDuration(const QString &mp7Value);
00090 
00095   bool setDuration(const MP7Time &duration);
00096 
00104   bool setDurationFromEnd(const MP7Time &end);
00105 
00112   bool addDuration(const MP7Time &otherTime);
00113 
00119   QString timePointPretty(bool forceSubSec = false) const;
00120 
00122   QString durationPretty() const;
00123 
00130   MP7Time endTimePoint() const;
00131 
00140   QString endTimePointPretty(bool forceSubSec = false) const;
00141 
00143   QString toString() const;
00144 
00146   QString timePointMP7() const;
00147 
00152   QString durationMP7() const;
00153 
00157   double timeToSec() const;
00158 
00162   int timeToMSec() const;
00163 
00165   int durationToMSec() const;
00166 
00168   double durationToSec() const;
00169 
00173   bool timePointIsValid() const;
00174 
00176   bool durationIsNull() const;
00177 
00190   int compareTimePoint(const MP7Time &other) const;
00191 
00195   bool contains(const MP7Time &time) const;
00196 
00197 private:
00199   void reset();
00200 
00202   void resetTimePoint();
00203 
00205   void resetDuration();
00206 
00208   struct timepoint {
00209     QString date;       // date part, in MPEG-7 format, sign included
00210     bool hasTime;       // false if both sec and num fields are invalid
00211     uint sec;           // time in seconds
00212     uint num;           // numerator of second fraction
00213     uint denom;         // denominator of second fraction
00214     QString tz;         // time zone
00215   } tpoint;
00216 
00218   struct duration {
00219     char sign;          // +1 or -1
00220     uint days;
00221     uint sec;           // seconds
00222     uint num;           // numerator of second fraction
00223     uint denom;         // denominator of second fraction
00224     QString tz;         // time zone
00225     int units;          // number of time units (for IncrDuration type)
00226   } duration;
00227 
00229   static uint commonMultiple(uint op1, uint op2);
00230 };
00231 
00232 #endif /* _MP7TIME_HPP_ */

Generated on Mon Sep 27 09:12:05 2004 for Muvino by doxygen 1.3.2