qtmobility/plugins/multimedia/symbian/mediaplayer/s60mediaplayercontrol.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 S60MEDIAPLAYERCONTROL_H
       
    43 #define S60MEDIAPLAYERCONTROL_H
       
    44 
       
    45 #include <QtCore/qobject.h>
       
    46 
       
    47 #include <QMediaPlayerControl>
       
    48 
       
    49 #include "ms60mediaplayerresolver.h"
       
    50 #include <QtCore/qdebug.h>
       
    51 
       
    52 QTM_BEGIN_NAMESPACE
       
    53 class QMediaPlayer;
       
    54 class QMediaTimeRange;
       
    55 class QMediaContent;
       
    56 QTM_END_NAMESPACE
       
    57 
       
    58 QTM_USE_NAMESPACE
       
    59 
       
    60 class S60MediaPlayerSession;
       
    61 class S60MediaPlayerService;
       
    62 
       
    63 class S60MediaSettings
       
    64 {
       
    65 
       
    66 public:
       
    67     S60MediaSettings() 
       
    68         : m_volume(0)
       
    69         , m_muted(false)
       
    70         , m_playbackRate(1.0)
       
    71     {
       
    72     }
       
    73     
       
    74     void setVolume(int volume) { m_volume = volume; }
       
    75     void setMuted(bool muted) { m_muted = muted; }
       
    76     void setPlaybackRate(int rate) { m_playbackRate = rate; }
       
    77     
       
    78     int volume() const { return m_volume; }
       
    79     bool isMuted() const { return m_muted; }
       
    80     qreal playbackRate() const { return m_playbackRate; }
       
    81     
       
    82 private:
       
    83     int m_volume;
       
    84     bool m_muted;
       
    85     qreal m_playbackRate;
       
    86 };
       
    87 
       
    88 class S60MediaPlayerControl : public QMediaPlayerControl
       
    89 {
       
    90     Q_OBJECT
       
    91 
       
    92 public:
       
    93     S60MediaPlayerControl(MS60MediaPlayerResolver& mediaPlayerResolver, QObject *parent = 0);
       
    94     ~S60MediaPlayerControl();
       
    95 
       
    96     // from QMediaPlayerControl
       
    97     virtual QMediaPlayer::State state() const;
       
    98     virtual QMediaPlayer::MediaStatus mediaStatus() const;
       
    99     virtual qint64 duration() const;
       
   100     virtual qint64 position() const;
       
   101     virtual void setPosition(qint64 pos);
       
   102     virtual int volume() const;
       
   103     virtual void setVolume(int volume);
       
   104     virtual bool isMuted() const;
       
   105     virtual void setMuted(bool muted);
       
   106     virtual int bufferStatus() const;
       
   107     virtual bool isAudioAvailable() const;
       
   108     virtual bool isVideoAvailable() const;
       
   109     virtual bool isSeekable() const;
       
   110     virtual QMediaTimeRange availablePlaybackRanges() const;
       
   111     virtual qreal playbackRate() const;
       
   112     virtual void setPlaybackRate(qreal rate);
       
   113     virtual QMediaContent media() const;
       
   114     virtual const QIODevice *mediaStream() const;
       
   115     virtual void setMedia(const QMediaContent&, QIODevice *);
       
   116     virtual void play();
       
   117     virtual void pause();
       
   118     virtual void stop();  
       
   119 
       
   120     // Own methods
       
   121     void setVideoOutput(QObject *output);
       
   122     const S60MediaSettings& mediaControlSettings() const;
       
   123  
       
   124 private:
       
   125     MS60MediaPlayerResolver &m_mediaPlayerResolver;
       
   126     S60MediaPlayerSession *m_session;
       
   127     QMediaContent m_currentResource; 
       
   128     QIODevice *m_stream;
       
   129     S60MediaSettings m_mediaSettings;
       
   130 };
       
   131 
       
   132 #endif