Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

loopcontrol_threaded.h

Go to the documentation of this file.
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 #ifndef MPEGVIEW_H
00021 #define MPEGVIEW_H
00022 
00023 #include <qwidget.h>
00024 #include <qdatetime.h>
00025 
00026 
00027 class LoopControl : public QObject {
00028     Q_OBJECT
00029 public:
00030     LoopControl( QObject *parent, const char *name );
00031     ~LoopControl();
00032 
00033     bool init( const QString& filename );
00034 
00035     bool hasVideo() const { return hasVideoChannel; }
00036     bool hasAudio() const { return hasAudioChannel; }
00037     
00038     long totalPlaytime() { return (long)(hasVideoChannel ? total_video_frames / framerate : total_audio_samples / freq); }
00039 
00040     // These are public to run them from global functions needed to start threads
00041     // Otherwise they would be private
00042     void startAudio();
00043     void startVideo();
00044 public slots:
00045     void play();
00046     void stop( bool willPlayAgainShortly = FALSE );
00047 
00048     void setMute( bool );
00049     void setPaused( bool );
00050     void setPosition( long );
00051     
00052 signals:
00053     void positionChanged( long, long );
00054     void playFinished();
00055 
00056 protected:
00057     void timerEvent(QTimerEvent*);
00058 
00059 private:
00060     void startTimers();
00061     void killTimers();
00062 
00063 
00064     QTime playtime;
00065     int timerid;
00066     int audioSampleCounter;
00067     long current_frame;
00068     long total_video_frames;
00069     long total_audio_samples;
00070     
00071     float framerate;
00072     int freq;
00073     int stream;
00074     int framecount;
00075     int channels;
00076      
00077     bool moreAudio;
00078     bool moreVideo;
00079 
00080     bool hasVideoChannel;
00081     bool hasAudioChannel;
00082     bool isMuted;
00083     QString fileName;
00084 };
00085 
00086 
00087 #endif
00088 

Generated on Sat Nov 5 16:15:37 2005 for OPIE by  doxygen 1.4.2