qtmobility/src/multimedia/qmlmediabase_p.h
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 5 453da2cfceef
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
     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 QMLMEDIABASE_P_H
       
    43 #define QMLMEDIABASE_P_H
       
    44 
       
    45 
       
    46 #include <qmediaplayer.h>
       
    47 #include <QtCore/qbasictimer.h>
       
    48 
       
    49 QTM_BEGIN_NAMESPACE
       
    50 
       
    51 class QMediaPlayerControl;
       
    52 class QMediaService;
       
    53 class QMediaServiceProvider;
       
    54 class QMetaDataControl;
       
    55 class QMetaDataControlMetaObject;
       
    56 class QmlMediaBaseAnimation;
       
    57 
       
    58 class QmlMediaBase
       
    59 {
       
    60 public:
       
    61     QmlMediaBase();
       
    62     virtual ~QmlMediaBase();
       
    63 
       
    64     QUrl source() const;
       
    65     void setSource(const QUrl &url);
       
    66 
       
    67     bool isPlaying() const;
       
    68     void setPlaying(bool playing);
       
    69 
       
    70     bool isPaused() const;
       
    71     void setPaused(bool paused);
       
    72 
       
    73     int duration() const;
       
    74 
       
    75     int position() const;
       
    76     void setPosition(int position);
       
    77 
       
    78     qreal volume() const;
       
    79     void setVolume(qreal volume);
       
    80 
       
    81     bool isMuted() const;
       
    82     void setMuted(bool muted);
       
    83 
       
    84     qreal bufferProgress() const;
       
    85 
       
    86     bool isSeekable() const;
       
    87 
       
    88     qreal playbackRate() const;
       
    89     void setPlaybackRate(qreal rate);
       
    90 
       
    91     QString errorString() const;
       
    92 
       
    93     void _q_stateChanged(QMediaPlayer::State state);
       
    94     void _q_mediaStatusChanged(QMediaPlayer::MediaStatus status);
       
    95 
       
    96     void _q_metaDataChanged();
       
    97 
       
    98 protected:
       
    99     void shutdown();
       
   100 
       
   101     void setObject(QObject *object);
       
   102 
       
   103     virtual void sourceChanged() = 0;
       
   104 
       
   105     virtual void playingChanged() = 0;
       
   106     virtual void pausedChanged() = 0;
       
   107 
       
   108     virtual void started() = 0;
       
   109     virtual void resumed() = 0;
       
   110     virtual void paused() = 0;
       
   111     virtual void stopped() = 0;
       
   112 
       
   113     virtual void statusChanged() = 0;
       
   114 
       
   115     virtual void loaded() = 0;
       
   116     virtual void buffering() = 0;
       
   117     virtual void stalled() = 0;
       
   118     virtual void buffered() = 0;
       
   119     virtual void endOfMedia() = 0;
       
   120 
       
   121     virtual void durationChanged() = 0;
       
   122     virtual void positionChanged() = 0;
       
   123 
       
   124     virtual void volumeChanged() = 0;
       
   125     virtual void mutedChanged() = 0;
       
   126 
       
   127     virtual void bufferProgressChanged() = 0;
       
   128 
       
   129     virtual void seekableChanged() = 0;
       
   130     virtual void playbackRateChanged() = 0;
       
   131 
       
   132     QMediaService *m_mediaService;
       
   133     QMediaPlayerControl *m_playerControl;
       
   134 
       
   135     QMediaObject *m_mediaObject;
       
   136     QMediaServiceProvider *m_mediaProvider;
       
   137     QMetaDataControl *m_metaDataControl;
       
   138     QMetaDataControlMetaObject *m_metaObject;
       
   139     QmlMediaBaseAnimation *m_animation;
       
   140 
       
   141     QMediaPlayer::State m_state;
       
   142     QMediaPlayer::MediaStatus m_status;
       
   143     QMediaPlayer::Error m_error;
       
   144     QString m_errorString;
       
   145 
       
   146     friend class QmlMediaBaseAnimation;
       
   147 };
       
   148 
       
   149 QTM_END_NAMESPACE
       
   150 
       
   151 #endif