qtmobility/plugins/multimedia/phonon/qphononplayercontrol.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 QPHONONPLAYERCONTROL_H
       
    43 #define QPHONONPLAYERCONTROL_H
       
    44 
       
    45 #include <QtCore/qobject.h>
       
    46 
       
    47 #include <Phonon/MediaObject>
       
    48 #include <Phonon/AudioOutput>
       
    49 
       
    50 #include <qmediaplayercontrol.h>
       
    51 #include <qmediaplayer.h>
       
    52 
       
    53 QTM_BEGIN_NAMESPACE
       
    54 class QMediaPlaylist;
       
    55 class QMediaPlaylistNavigator;
       
    56 QTM_END_NAMESPACE
       
    57 
       
    58 class QPhononPlayerSession;
       
    59 class QPhononPlayerService;
       
    60 
       
    61 QTM_USE_NAMESPACE
       
    62 
       
    63 class QPhononPlayerControl : public QMediaPlayerControl
       
    64 {
       
    65     Q_OBJECT
       
    66 
       
    67 public:
       
    68     QPhononPlayerControl(Phonon::MediaObject *session, QObject *parent = 0);
       
    69     ~QPhononPlayerControl();
       
    70 
       
    71     QMediaPlayer::State state() const;
       
    72     QMediaPlayer::MediaStatus mediaStatus() const;
       
    73 
       
    74     QMediaContent media() const;
       
    75     const QIODevice *mediaStream() const;
       
    76     void setMedia(const QMediaContent &content, QIODevice *stream);
       
    77 
       
    78     qint64 position() const;
       
    79     qint64 duration() const;
       
    80 
       
    81     int bufferStatus() const;
       
    82 
       
    83     int volume() const;
       
    84     bool isMuted() const;
       
    85 
       
    86     int playlistPosition() const;
       
    87 
       
    88     bool isAudioAvailable() const;
       
    89     bool isVideoAvailable() const;
       
    90 
       
    91     bool isSeekable() const;
       
    92     QMediaTimeRange availablePlaybackRanges() const;
       
    93 
       
    94     qreal playbackRate() const;
       
    95     void setPlaybackRate(qreal rate);
       
    96 
       
    97 public Q_SLOTS:
       
    98     void setPosition(qint64 pos);
       
    99 
       
   100     void play();
       
   101     void pause();
       
   102     void stop();
       
   103 
       
   104     void setVolume(int volume);
       
   105     void setMuted(bool muted);
       
   106 
       
   107 private slots:
       
   108     void updateState(Phonon::State newState, Phonon::State oldState);
       
   109     void updateVolume();
       
   110     void processEOS();
       
   111 
       
   112 private:
       
   113     Phonon::MediaObject *m_session;
       
   114     Phonon::AudioOutput *m_audioOutput;
       
   115     QMediaPlayer::State m_state;
       
   116     QMediaPlayer::MediaStatus m_mediaStatus;
       
   117     QIODevice *m_mediaStream;
       
   118     QMediaContent m_resources;
       
   119 };
       
   120 
       
   121 #endif