qtmobility/plugins/multimedia/symbian/mmf/mediaplayer/s60videoplayersession.h
changeset 14 6fbed849b4f4
parent 11 06b8e2af4411
child 15 1f895d8a5b2b
equal deleted inserted replaced
11:06b8e2af4411 14:6fbed849b4f4
    42 #ifndef S60VIDEOPLAYERSESSION_H
    42 #ifndef S60VIDEOPLAYERSESSION_H
    43 #define S60VIDEOPLAYERSESSION_H
    43 #define S60VIDEOPLAYERSESSION_H
    44 
    44 
    45 #include "s60mediaplayersession.h"
    45 #include "s60mediaplayersession.h"
    46 #include "s60mediaplayeraudioendpointselector.h"
    46 #include "s60mediaplayeraudioendpointselector.h"
       
    47 #ifdef MMF_VIDEO_SURFACES_SUPPORTED
       
    48 #include <videoplayer2.h>
       
    49 #else
    47 #include <videoplayer.h>
    50 #include <videoplayer.h>
       
    51 #endif // MMF_VIDEO_SURFACES_SUPPORTED
    48 #include <QtGui/qwidget.h>
    52 #include <QtGui/qwidget.h>
    49 #include <qvideowidget.h>
    53 #include <qvideowidget.h>
    50 
    54 
       
    55 #ifdef HAS_AUDIOROUTING_IN_VIDEOPLAYER
    51 #include <AudioOutput.h>
    56 #include <AudioOutput.h>
    52 #include <MAudioOutputObserver.h>
    57 #include <MAudioOutputObserver.h>
    53 
    58 #endif
    54 class QTimer;
    59 class QTimer;
    55 
    60 
    56 class S60VideoPlayerSession : public S60MediaPlayerSession,
    61 class S60VideoPlayerSession : public S60MediaPlayerSession,
    57                               public MVideoPlayerUtilityObserver, 
    62                               public MVideoPlayerUtilityObserver,
    58                               public MVideoLoadingObserver,
    63                               public MVideoLoadingObserver
    59                               public MAudioOutputObserver
    64 #ifdef HAS_AUDIOROUTING_IN_VIDEOPLAYER
       
    65                               , public MAudioOutputObserver
       
    66 #endif //HAS_AUDIOROUTING_IN_VIDEOPLAYER
    60 {
    67 {
    61     Q_OBJECT
    68     Q_OBJECT
    62 
       
    63 public:
    69 public:
    64     S60VideoPlayerSession(QMediaService *service);
    70     S60VideoPlayerSession(QMediaService *service);
    65     ~S60VideoPlayerSession();
    71     ~S60VideoPlayerSession();
    66     
    72 
    67     //From S60MediaPlayerSession
    73     //From S60MediaPlayerSession
    68     bool isVideoAvailable() const;
    74     bool isVideoAvailable() const;
    69     bool isAudioAvailable() const;
    75     bool isAudioAvailable() const;
    70     void setVideoRenderer(QObject *renderer);
    76     void setVideoRenderer(QObject *renderer);
    71     
    77 
    72     //From MVideoLoadingObserver
    78     //From MVideoLoadingObserver
    73     void MvloLoadingStarted();
    79     void MvloLoadingStarted();
    74     void MvloLoadingComplete();
    80     void MvloLoadingComplete();
    75     
    81 
       
    82 #ifdef HAS_AUDIOROUTING_IN_VIDEOPLAYER
    76     // From MAudioOutputObserver
    83     // From MAudioOutputObserver
    77     void DefaultAudioOutputChanged(CAudioOutput& aAudioOutput,
    84     void DefaultAudioOutputChanged(CAudioOutput& aAudioOutput,
    78         CAudioOutput::TAudioOutputPreference aNewDefault);
    85         CAudioOutput::TAudioOutputPreference aNewDefault);
    79 
    86 #endif //HAS_AUDIOROUTING_IN_VIDEOPLAYER
    80 public:
    87 public:
    81     // From S60MediaPlayerAudioEndpointSelector
    88     // From S60MediaPlayerAudioEndpointSelector
    82     QString activeEndpoint() const;
    89     QString activeEndpoint() const;
    83     QString defaultEndpoint() const;
    90     QString defaultEndpoint() const;
    84 public Q_SLOTS:
    91 public Q_SLOTS:
    85     void setActiveEndpoint(const QString& name);
    92     void setActiveEndpoint(const QString& name);
    86 Q_SIGNALS:
       
    87      void activeEndpointChanged(const QString &name);
       
    88 
    93 
    89 protected:
    94 protected:
    90     //From S60MediaPlayerSession
    95     //From S60MediaPlayerSession
    91     void doLoadL(const TDesC &path);
    96     void doLoadL(const TDesC &path);
    92     void doLoadUrlL(const TDesC &path);
    97     void doLoadUrlL(const TDesC &path);
   109 private: 
   114 private: 
   110     bool resetNativeHandles();
   115     bool resetNativeHandles();
   111     QPair<qreal, qreal> scaleFactor();
   116     QPair<qreal, qreal> scaleFactor();
   112     void startDirectScreenAccess();
   117     void startDirectScreenAccess();
   113     bool stopDirectScreenAccess();
   118     bool stopDirectScreenAccess();
       
   119 #ifdef HAS_AUDIOROUTING_IN_VIDEOPLAYER
   114     QString qStringFromTAudioOutputPreference(CAudioOutput::TAudioOutputPreference output) const;
   120     QString qStringFromTAudioOutputPreference(CAudioOutput::TAudioOutputPreference output) const;
   115     
   121 #endif
   116     
   122     
   117     // From MVideoPlayerUtilityObserver
   123     // From MVideoPlayerUtilityObserver
   118     void MvpuoOpenComplete(TInt aError);
   124     void MvpuoOpenComplete(TInt aError);
   119     void MvpuoPrepareComplete(TInt aError);
   125     void MvpuoPrepareComplete(TInt aError);
   120     void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError);
   126     void MvpuoFrameReady(CFbsBitmap &aFrame, TInt aError);
   121     void MvpuoPlayComplete(TInt aError);
   127     void MvpuoPlayComplete(TInt aError);
   122     void MvpuoEvent(const TMMFEvent &aEvent);
   128     void MvpuoEvent(const TMMFEvent &aEvent);
   123 
   129 
   124 private:
   130 private:
   125     // Qwn
   131     // Qwn
       
   132 #ifdef MMF_VIDEO_SURFACES_SUPPORTED
       
   133     CVideoPlayerUtility2 *m_player;
       
   134 #else
   126     CVideoPlayerUtility *m_player;
   135     CVideoPlayerUtility *m_player;
       
   136 #endif // MMF_VIDEO_SURFACES_SUPPORTED
   127     TRect m_rect;
   137     TRect m_rect;
   128     QVideoOutputControl::Output m_output;
   138     //QVideoOutputControl::Output m_output;
   129     WId m_windowId;
   139     WId m_windowId;
   130     bool m_dsaActive;
   140     bool m_dsaActive;
   131     bool m_dsaStopped;
   141     bool m_dsaStopped;
   132     
   142     
   133     //Reference
   143     //Reference
   134     RWsSession &m_wsSession;
   144     RWsSession &m_wsSession;
   135     CWsScreenDevice &m_screenDevice;
   145     CWsScreenDevice &m_screenDevice;
   136     RWindowBase *m_window;
   146     RWindowBase *m_window;
       
   147     RWindow *m_displayWindow;
   137     QMediaService &m_service;
   148     QMediaService &m_service;
   138     Qt::AspectRatioMode m_aspectRatioMode;
   149     Qt::AspectRatioMode m_aspectRatioMode;
   139     QSize m_originalSize;
   150     QSize m_originalSize;
       
   151 #ifdef HAS_AUDIOROUTING_IN_VIDEOPLAYER
   140     CAudioOutput *m_audioOutput;
   152     CAudioOutput *m_audioOutput;
       
   153 #endif
   141     QString m_audioEndpoint;
   154     QString m_audioEndpoint;
   142 };
   155 };
   143 
   156 
   144 #endif
   157 #endif