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