qtinternetradio/irqmediaplayer/src/irqmmfadapter.cpp
changeset 14 896e9dbc5f19
parent 5 0930554dc389
child 17 38bbf2dcd608
equal deleted inserted replaced
12:608f67c22514 14:896e9dbc5f19
    17 #include <mmf/common/mmferrors.h>
    17 #include <mmf/common/mmferrors.h>
    18 #include <NokiaAudioPreference.h>
    18 #include <NokiaAudioPreference.h>
    19 #include <coedef.h>
    19 #include <coedef.h>
    20 #include <QStringList>
    20 #include <QStringList>
    21 #include <hxmetadatakeys.h>
    21 #include <hxmetadatakeys.h>
       
    22 #include <StereoWideningBase.h>
       
    23 
    22 #include "irqmetadata.h"
    24 #include "irqmetadata.h"
    23 #include "irqenums.h"
    25 #include "irqenums.h"
    24 #include "irqmmfadapter.h"
    26 #include "irqmmfadapter.h"
    25 #include "irqlogger.h"
    27 #include "irqlogger.h"
    26 
    28 
    28 const TUid KUidController        = { 0x101F8514 }; // Helix Video controller UID
    30 const TUid KUidController        = { 0x101F8514 }; // Helix Video controller UID
    29 const TInt KConnectingTime       = 30*1000000;     // 30 seconds
    31 const TInt KConnectingTime       = 30*1000000;     // 30 seconds
    30 const TInt KVolumeMinPercentage  = 0;              // Minimum volume percentage
    32 const TInt KVolumeMinPercentage  = 0;              // Minimum volume percentage
    31 const TInt KVolumeMaxPercentage  = 100;            // Maximum volume percentage
    33 const TInt KVolumeMaxPercentage  = 100;            // Maximum volume percentage
    32 const TInt KLoadingCompletePercentage = 100;       // Loading Complete percentage
    34 const TInt KLoadingCompletePercentage = 100;       // Loading Complete percentage
       
    35 const int KDefaultStereoLevel = 100;            // Default stereo level
    33 
    36 
    34 // ---------------------------------------------------------------------------
    37 // ---------------------------------------------------------------------------
    35 //  IRQMMFAdapter::IRQMMFAdapter
    38 //  IRQMMFAdapter::IRQMMFAdapter
    36 //  Constructor
    39 //  Constructor
    37 //  Initialize viriants
    40 //  Initialize viriants
    38 // ---------------------------------------------------------------------------
    41 // ---------------------------------------------------------------------------
    39 //
    42 //
    40 IRQMMFAdapter::IRQMMFAdapter() :
    43 IRQMMFAdapter::IRQMMFAdapter() :
    41     iVideoPlayer(NULL)
    44     iVideoPlayer(NULL)
    42     ,iQMetaData(NULL)
    45     ,iQMetaData(NULL)
    43     ,iPrepareTimer(NULL)
    46     ,iPrepareTimer(NULL), iStereoEffect(NULL)
    44 {
    47 {
    45     iPlayState = EStopped;
    48     iPlayState = EStopped;
    46 }
    49 }
    47 
    50 
    48 // ---------------------------------------------------------------------------
    51 // ---------------------------------------------------------------------------
    65             iPrepareTimer->Cancel();
    68             iPrepareTimer->Cancel();
    66         }
    69         }
    67         delete iPrepareTimer;
    70         delete iPrepareTimer;
    68         iPrepareTimer = NULL;
    71         iPrepareTimer = NULL;
    69     }
    72     }
       
    73     
       
    74     delete iStereoEffect;
       
    75     iStereoEffect = NULL;
    70 }
    76 }
    71 
    77 
    72 // ---------------------------------------------------------------------------
    78 // ---------------------------------------------------------------------------
    73 //  IRQMMFAdapter::playStation
    79 //  IRQMMFAdapter::playStation
    74 //  IRQPlayerAdapterInterface method
    80 //  IRQPlayerAdapterInterface method
   205 // ---------------------------------------------------------------------------
   211 // ---------------------------------------------------------------------------
   206 //
   212 //
   207 void* IRQMMFAdapter::getPlayerInstance()
   213 void* IRQMMFAdapter::getPlayerInstance()
   208 {
   214 {
   209     return (void*)iVideoPlayer;
   215     return (void*)iVideoPlayer;
       
   216 }
       
   217 
       
   218 void IRQMMFAdapter::enableStereoEffect()
       
   219 {
       
   220     if (IRQPlayerAdapterInterface::EPlaying != iPlayState)
       
   221     {
       
   222         return;
       
   223     }
       
   224 
       
   225     TRAP_IGNORE(enableStereoEffectL());
       
   226 }
       
   227 
       
   228 void IRQMMFAdapter::disableStereoEffect()
       
   229 {
       
   230     if (iStereoEffect)
       
   231     {
       
   232         if (iStereoEffect->IsEnabled())
       
   233         {
       
   234             TRAPD(error, iStereoEffect->DisableL());
       
   235             if (KErrNone != error)
       
   236             {
       
   237                 emit errorOccured(EIRQPlayerErrorSetStereoFailed);
       
   238             }
       
   239             delete iStereoEffect;
       
   240             iStereoEffect = NULL;
       
   241         }
       
   242     }
   210 }
   243 }
   211 
   244 
   212 // ---------------------------------------------------------------------------
   245 // ---------------------------------------------------------------------------
   213 //  IRQMMFAdapter::MvpuoOpenComplete
   246 //  IRQMMFAdapter::MvpuoOpenComplete
   214 //  Callback function, MVideoPlayerUtilityObserver method
   247 //  Callback function, MVideoPlayerUtilityObserver method
   528     {
   561     {
   529         emit errorOccured(EIRQPlayerErrorConnectingFailed);
   562         emit errorOccured(EIRQPlayerErrorConnectingFailed);
   530         stop();
   563         stop();
   531     }
   564     }
   532 }
   565 }
       
   566 
       
   567 void IRQMMFAdapter::enableStereoEffectL()
       
   568 {
       
   569     LOG_METHOD;
       
   570     TUint stereoLevel = KDefaultStereoLevel;
       
   571 
       
   572     if (!iStereoEffect)
       
   573     {
       
   574         CVideoPlayerUtility* playerInstance = (CVideoPlayerUtility*)getPlayerInstance();
       
   575         iStereoEffect = CStereoWidening::NewL(*playerInstance, EFalse, stereoLevel);
       
   576     }
       
   577 
       
   578     if (!iStereoEffect->IsEnabled())
       
   579     {
       
   580         iStereoEffect->EnableL();
       
   581         iStereoEffect->SetStereoWideningLevelL(stereoLevel);
       
   582         iStereoEffect->ApplyL();
       
   583     }
       
   584 }