src/3rdparty/phonon/mmf/audioplayer.h
changeset 0 1918ee327afb
child 3 41300fa6a67c
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 /*  This file is part of the KDE project.
       
     2 
       
     3 Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 
       
     5 This library is free software: you can redistribute it and/or modify
       
     6 it under the terms of the GNU Lesser General Public License as published by
       
     7 the Free Software Foundation, either version 2.1 or 3 of the License.
       
     8 
       
     9 This library is distributed in the hope that it will be useful,
       
    10 but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 GNU Lesser General Public License for more details.
       
    13 
       
    14 You should have received a copy of the GNU Lesser General Public License
       
    15 along with this library.  If not, see <http://www.gnu.org/licenses/>.
       
    16 
       
    17 */
       
    18 
       
    19 #ifndef PHONON_MMF_AUDIOPLAYER_H
       
    20 #define PHONON_MMF_AUDIOPLAYER_H
       
    21 
       
    22 #include "abstractmediaplayer.h"
       
    23 
       
    24 class CDrmPlayerUtility;
       
    25 class TTimeIntervalMicroSeconds;
       
    26 
       
    27 #ifdef QT_PHONON_MMF_AUDIO_DRM
       
    28 #include <drmaudiosampleplayer.h>
       
    29 typedef CDrmPlayerUtility CPlayerType;
       
    30 typedef MDrmAudioPlayerCallback MPlayerObserverType;
       
    31 #else
       
    32 #include <mdaaudiosampleplayer.h>
       
    33 typedef CMdaAudioPlayerUtility CPlayerType;
       
    34 typedef MMdaAudioPlayerCallback MPlayerObserverType;
       
    35 #endif
       
    36 
       
    37 QT_BEGIN_NAMESPACE
       
    38 
       
    39 namespace Phonon
       
    40 {
       
    41 namespace MMF
       
    42 {
       
    43 /**
       
    44  * @short Wrapper over MMF audio client utility
       
    45  */
       
    46 class AudioPlayer   :   public AbstractMediaPlayer
       
    47                     ,   public MPlayerObserverType    // typedef
       
    48 #ifdef QT_PHONON_MMF_AUDIO_DRM
       
    49                     ,   public MAudioLoadingObserver
       
    50 #endif
       
    51 {
       
    52     Q_OBJECT
       
    53 
       
    54 public:
       
    55     AudioPlayer();
       
    56     explicit AudioPlayer(const AbstractPlayer& player);
       
    57     virtual ~AudioPlayer();
       
    58 
       
    59     // AbstractMediaPlayer
       
    60     virtual void doPlay();
       
    61     virtual void doPause();
       
    62     virtual void doStop();
       
    63     virtual void doSeek(qint64 milliseconds);
       
    64     virtual int setDeviceVolume(int mmfVolume);
       
    65     virtual int openFile(RFile& file);
       
    66     virtual void close();
       
    67 
       
    68     // MediaObjectInterface
       
    69     virtual bool hasVideo() const;
       
    70     virtual qint64 currentTime() const;
       
    71     virtual qint64 totalTime() const;
       
    72 
       
    73 #ifdef QT_PHONON_MMF_AUDIO_DRM
       
    74     // MDrmAudioPlayerCallback
       
    75     virtual void MdapcInitComplete(TInt aError,
       
    76                                    const TTimeIntervalMicroSeconds &aDuration);
       
    77     virtual void MdapcPlayComplete(TInt aError);
       
    78 
       
    79     // MAudioLoadingObserver
       
    80     virtual void MaloLoadingStarted();
       
    81     virtual void MaloLoadingComplete();
       
    82 #else
       
    83     // MMdaAudioPlayerCallback
       
    84     virtual void MapcInitComplete(TInt aError,
       
    85                                   const TTimeIntervalMicroSeconds &aDuration);
       
    86     virtual void MapcPlayComplete(TInt aError);
       
    87 #endif
       
    88 
       
    89     /**
       
    90      * This class owns the pointer.
       
    91      */
       
    92     CPlayerType *player() const;
       
    93 
       
    94 private:
       
    95     void construct();
       
    96 
       
    97 private:
       
    98     /**
       
    99      * Using CPlayerType typedef in order to be able to easily switch between
       
   100      * CMdaAudioPlayerUtility and CDrmPlayerUtility
       
   101      */
       
   102     QScopedPointer<CPlayerType> m_player;
       
   103 };
       
   104 }
       
   105 }
       
   106 
       
   107 QT_END_NAMESPACE
       
   108 
       
   109 #endif