qtmobility/plugins/multimedia/symbian/mmf/mediaplayer/s60videoplayersession.h
changeset 4 90517678cc4f
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 S60VIDEOPLAYERSESSION_H
       
    43 #define S60VIDEOPLAYERSESSION_H
       
    44 
       
    45 #include "s60mediaplayersession.h"
       
    46 #include "s60mediaplayeraudioendpointselector.h"
       
    47 #include <videoplayer.h>
       
    48 #include <QtGui/qwidget.h>
       
    49 #include <QVideoWidget>
       
    50 
       
    51 #include <AudioOutput.h>
       
    52 #include <MAudioOutputObserver.h>
       
    53 
       
    54 class QTimer;
       
    55 
       
    56 class S60VideoPlayerSession : public S60MediaPlayerSession,
       
    57                               public MVideoPlayerUtilityObserver, 
       
    58                               public MVideoLoadingObserver,
       
    59                               public MAudioOutputObserver
       
    60 {
       
    61     Q_OBJECT
       
    62 
       
    63 public:
       
    64     S60VideoPlayerSession(QMediaService *service);
       
    65     ~S60VideoPlayerSession();
       
    66     
       
    67     //From S60MediaPlayerSession
       
    68     bool isVideoAvailable() const;
       
    69     bool isAudioAvailable() const;
       
    70     void setVideoRenderer(QObject *renderer);
       
    71     
       
    72     //From MVideoLoadingObserver
       
    73     void MvloLoadingStarted();
       
    74     void MvloLoadingComplete();
       
    75     
       
    76     // From MAudioOutputObserver
       
    77     void DefaultAudioOutputChanged(CAudioOutput& aAudioOutput,
       
    78         CAudioOutput::TAudioOutputPreference aNewDefault);
       
    79 
       
    80 public:
       
    81     // From S60MediaPlayerAudioEndpointSelector
       
    82     QString activeEndpoint() const;
       
    83     QString defaultEndpoint() const;
       
    84 public Q_SLOTS:
       
    85     void setActiveEndpoint(const QString& name);
       
    86 Q_SIGNALS:
       
    87      void activeEndpointChanged(const QString &name);
       
    88 
       
    89 protected:
       
    90     //From S60MediaPlayerSession
       
    91     void doLoadL(const TDesC &path);
       
    92     void doLoadUrlL(const TDesC &path);
       
    93     void doPlay();
       
    94     void doStop();
       
    95     void doPauseL();
       
    96     void doSetVolumeL(int volume);
       
    97     qint64 doGetPositionL() const;
       
    98     void doSetPositionL(qint64 microSeconds);
       
    99     void updateMetaDataEntriesL();
       
   100     int doGetBufferStatusL() const;
       
   101     qint64 doGetDurationL() const;
       
   102 
       
   103 private slots: 
       
   104     void resetVideoDisplay();
       
   105     void suspendDirectScreenAccess();
       
   106     void resumeDirectScreenAccess();
       
   107     
       
   108 private: 
       
   109     bool resetNativeHandles();
       
   110     QPair<qreal, qreal> scaleFactor();
       
   111     void startDirectScreenAccess();
       
   112     bool stopDirectScreenAccess();
       
   113     QString qStringFromTAudioOutputPreference(CAudioOutput::TAudioOutputPreference output) const;
       
   114     
       
   115     
       
   116     // From MVideoPlayerUtilityObserver
       
   117     void MvpuoOpenComplete(TInt aError);
       
   118     void MvpuoPrepareComplete(TInt aError);
       
   119     void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError);
       
   120     void MvpuoPlayComplete(TInt aError);
       
   121     void MvpuoEvent(const TMMFEvent &aEvent);
       
   122 
       
   123 private:
       
   124     // Qwn
       
   125     CVideoPlayerUtility *m_player;
       
   126     TRect m_rect;
       
   127     QVideoOutputControl::Output m_output;
       
   128     WId m_windowId;
       
   129     bool m_dsaActive;
       
   130     bool m_dsaStopped;
       
   131     
       
   132     //Reference
       
   133     RWsSession &m_wsSession;
       
   134     CWsScreenDevice &m_screenDevice;
       
   135     RWindowBase *m_window;
       
   136     QMediaService &m_service;
       
   137     Qt::AspectRatioMode m_aspectRatioMode;
       
   138     QSize m_originalSize;
       
   139     CAudioOutput *m_audioOutput;
       
   140 };
       
   141 
       
   142 #endif