qtmobility/plugins/declarative/multimedia/qdeclarativemediabase_p.h
changeset 14 6fbed849b4f4
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
       
     1 /****************************************************************************
       
     2 **
       
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ** All rights reserved.
       
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 **
       
     7 ** This file is part of the Qt Mobility Components.
       
     8 **
       
     9 ** $QT_BEGIN_LICENSE:LGPL$
       
    10 ** No Commercial Usage
       
    11 ** This file contains pre-release code and may not be distributed.
       
    12 ** You may use this file in accordance with the terms and conditions
       
    13 ** contained in the Technology Preview License Agreement accompanying
       
    14 ** this package.
       
    15 **
       
    16 ** GNU Lesser General Public License Usage
       
    17 ** Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ** General Public License version 2.1 as published by the Free Software
       
    19 ** Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ** packaging of this file.  Please review the following information to
       
    21 ** ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 **
       
    24 ** In addition, as a special exception, Nokia gives you certain additional
       
    25 ** rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 **
       
    28 ** If you have questions regarding the use of this file, please contact
       
    29 ** Nokia at qt-info@nokia.com.
       
    30 **
       
    31 **
       
    32 **
       
    33 **
       
    34 **
       
    35 **
       
    36 **
       
    37 **
       
    38 ** $QT_END_LICENSE$
       
    39 **
       
    40 ****************************************************************************/
       
    41 
       
    42 #ifndef QDECLARATIVEMEDIABASE_P_H
       
    43 #define QDECLARATIVEMEDIABASE_P_H
       
    44 
       
    45 //
       
    46 //  W A R N I N G
       
    47 //  -------------
       
    48 //
       
    49 // This file is not part of the Qt API.  It exists for the convenience
       
    50 // of other Qt classes.  This header file may change from version to
       
    51 // version without notice, or even be removed.
       
    52 //
       
    53 // We mean it.
       
    54 //
       
    55 
       
    56 #include <QtCore/qbasictimer.h>
       
    57 #include <qmediaplayer.h>
       
    58 
       
    59 QT_BEGIN_HEADER
       
    60 
       
    61 QT_BEGIN_NAMESPACE
       
    62 
       
    63 class QMediaPlayerControl;
       
    64 class QMediaService;
       
    65 class QMediaServiceProvider;
       
    66 class QMetaDataReaderControl;
       
    67 class QMetaDataControlMetaObject;
       
    68 class QDeclarativeMediaBaseAnimation;
       
    69 
       
    70 class QDeclarativeMediaBase
       
    71 {
       
    72 public:
       
    73     QDeclarativeMediaBase();
       
    74     virtual ~QDeclarativeMediaBase();
       
    75 
       
    76     QUrl source() const;
       
    77     void setSource(const QUrl &url);
       
    78 
       
    79     bool isAutoLoad() const;
       
    80     void setAutoLoad(bool autoLoad);
       
    81 
       
    82     bool isPlaying() const;
       
    83     void setPlaying(bool playing);
       
    84 
       
    85     bool isPaused() const;
       
    86     void setPaused(bool paused);
       
    87 
       
    88     int duration() const;
       
    89 
       
    90     int position() const;
       
    91     void setPosition(int position);
       
    92 
       
    93     qreal volume() const;
       
    94     void setVolume(qreal volume);
       
    95 
       
    96     bool isMuted() const;
       
    97     void setMuted(bool muted);
       
    98 
       
    99     qreal bufferProgress() const;
       
   100 
       
   101     bool isSeekable() const;
       
   102 
       
   103     qreal playbackRate() const;
       
   104     void setPlaybackRate(qreal rate);
       
   105 
       
   106     QString errorString() const;
       
   107 
       
   108     void _q_stateChanged(QMediaPlayer::State state);
       
   109     void _q_mediaStatusChanged(QMediaPlayer::MediaStatus status);
       
   110 
       
   111     void _q_metaDataChanged();
       
   112 
       
   113     void componentComplete();
       
   114 
       
   115 protected:
       
   116     void shutdown();
       
   117 
       
   118     void setObject(QObject *object);
       
   119 
       
   120     virtual void sourceChanged() = 0;
       
   121     virtual void autoLoadChanged() = 0;
       
   122     virtual void playingChanged() = 0;
       
   123     virtual void pausedChanged() = 0;
       
   124 
       
   125     virtual void started() = 0;
       
   126     virtual void resumed() = 0;
       
   127     virtual void paused() = 0;
       
   128     virtual void stopped() = 0;
       
   129 
       
   130     virtual void statusChanged() = 0;
       
   131 
       
   132     virtual void loaded() = 0;
       
   133     virtual void buffering() = 0;
       
   134     virtual void stalled() = 0;
       
   135     virtual void buffered() = 0;
       
   136     virtual void endOfMedia() = 0;
       
   137 
       
   138     virtual void durationChanged() = 0;
       
   139     virtual void positionChanged() = 0;
       
   140 
       
   141     virtual void volumeChanged() = 0;
       
   142     virtual void mutedChanged() = 0;
       
   143 
       
   144     virtual void bufferProgressChanged() = 0;
       
   145 
       
   146     virtual void seekableChanged() = 0;
       
   147     virtual void playbackRateChanged() = 0;
       
   148 
       
   149     virtual void errorChanged() = 0;
       
   150 
       
   151     bool m_paused;
       
   152     bool m_playing;
       
   153     bool m_autoLoad;
       
   154     bool m_loaded;
       
   155     bool m_muted;
       
   156     int m_position;
       
   157     qreal m_vol;
       
   158     qreal m_playbackRate;
       
   159     QMediaService *m_mediaService;
       
   160     QMediaPlayerControl *m_playerControl;
       
   161 
       
   162     QMediaObject *m_mediaObject;
       
   163     QMediaServiceProvider *m_mediaProvider;
       
   164     QMetaDataReaderControl *m_metaDataControl;
       
   165     QMetaDataControlMetaObject *m_metaObject;
       
   166     QDeclarativeMediaBaseAnimation *m_animation;
       
   167 
       
   168     QMediaPlayer::State m_state;
       
   169     QMediaPlayer::MediaStatus m_status;
       
   170     QMediaPlayer::Error m_error;
       
   171     QString m_errorString;
       
   172     QUrl m_source;
       
   173 
       
   174     friend class QDeclarativeMediaBaseAnimation;
       
   175 };
       
   176 
       
   177 QT_END_NAMESPACE
       
   178 
       
   179 QT_END_HEADER
       
   180 
       
   181 #endif