00001 /********************************************************************** 00002 ** Copyright (C) 2000 Trolltech AS. All rights reserved. 00003 ** 00004 ** This file is part of Qtopia Environment. 00005 ** 00006 ** This file may be distributed and/or modified under the terms of the 00007 ** GNU General Public License version 2 as published by the Free Software 00008 ** Foundation and appearing in the file LICENSE.GPL included in the 00009 ** packaging of this file. 00010 ** 00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 ** 00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00015 ** 00016 ** Contact info@trolltech.com if any conditions of this licensing are 00017 ** not clear to you. 00018 ** 00019 **********************************************************************/ 00020 // L.J.Potter added changes Fri 02-15-2002 00021 00022 00023 #ifndef MPEGVIEW_H 00024 #define MPEGVIEW_H 00025 00026 00027 #include <qwidget.h> 00028 #include <qdatetime.h> 00029 00030 00031 class LoopControl : public QObject { 00032 Q_OBJECT 00033 public: 00034 LoopControl( QObject *parent, const char *name ); 00035 ~LoopControl(); 00036 00037 bool init( const QString& filename ); 00038 00039 bool hasVideo() const { return hasVideoChannel; } 00040 bool hasAudio() const { return hasAudioChannel; } 00041 00042 long totalPlaytime() { return (long)(hasVideoChannel ? total_video_frames / framerate : total_audio_samples / freq); } 00043 00044 // These are public to run them from global functions needed to start threads 00045 // Otherwise they would be private 00046 void startAudio(); 00047 void startVideo(); 00048 bool moreAudio; 00049 bool moreVideo; 00050 public slots: 00051 void play(); 00052 void stop( bool willPlayAgainShortly = FALSE ); 00053 00054 void setMute( bool ); 00055 void setPaused( bool ); 00056 void setPosition( long ); 00057 00058 signals: 00059 void positionChanged( long, long ); 00060 00061 protected: 00062 void timerEvent(QTimerEvent*); 00063 00064 private: 00065 void startTimers(); 00066 void killTimers(); 00067 00068 QTime playtime; 00069 int videoId; 00070 int sliderId; 00071 00072 int audioSampleCounter; 00073 long current_frame; 00074 long total_video_frames; 00075 long total_audio_samples; 00076 00077 float framerate; 00078 int freq; 00079 int stream; 00080 int framecount; 00081 int channels; 00082 00083 bool hasVideoChannel; 00084 bool hasAudioChannel; 00085 bool isMuted; 00086 QString fileName; 00087 }; 00088 00089 00090 #endif 00091
1.4.2