mpx/playbackframework/playbackengine/inc/mpxplaybackengine.inl
changeset 0 a2952bb97e68
child 30 6f9f6e99a23e
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Inline implementation of playback engine
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <mpxlog.h>
       
    20 // ============================ LOCAL FUNCTIONS ==============================
       
    21 
       
    22 // ----------------------------------------------------------------------------
       
    23 // Check if a pointer is NULL
       
    24 // ----------------------------------------------------------------------------
       
    25 //
       
    26 #include <mpxmessage2.h>
       
    27 #include <mpxcollectionplaylist.h>
       
    28 #include <mpxmediacollectiondetaildefs.h>
       
    29 #include <mpxplaybackmessagedefs.h>
       
    30 
       
    31 inline void CheckPtrL(TAny* aPtr)
       
    32     {
       
    33     if (!aPtr)
       
    34         {
       
    35         User::Leave(KErrNotReady);
       
    36         }
       
    37     }
       
    38     
       
    39 // ----------------------------------------------------------------------------
       
    40 // Check if a pointer is NULL
       
    41 // ----------------------------------------------------------------------------
       
    42 //
       
    43 inline void CheckPtrL(const TAny* aPtr)
       
    44     {
       
    45     CheckPtrL(const_cast<TAny*>(aPtr));
       
    46     }
       
    47 
       
    48 // ============================ MEMBER FUNCTIONS ==============================
       
    49 
       
    50 // ----------------------------------------------------------------------------
       
    51 // Return plugin interface
       
    52 // ----------------------------------------------------------------------------
       
    53 //
       
    54 inline CMPXPlaybackPlugin* CMPXPlaybackEngine::PluginL() const
       
    55     {
       
    56     CheckPtrL(iPluginHandler->Plugin());
       
    57     return iPluginHandler->Plugin();
       
    58     }
       
    59 
       
    60 // ----------------------------------------------------------------------------
       
    61 // Return the list of clients attached to this player
       
    62 // ----------------------------------------------------------------------------
       
    63 //
       
    64 inline CMPXClientList* CMPXPlaybackEngine::ClientList()
       
    65     {
       
    66     return iClientList;
       
    67     }
       
    68 
       
    69 // ----------------------------------------------------------------------------
       
    70 // Return plugin handler
       
    71 // ----------------------------------------------------------------------------
       
    72 //
       
    73 inline CMPXPlaybackPluginHandler* CMPXPlaybackEngine::PluginHandler()
       
    74     {
       
    75     return iPluginHandler;
       
    76     }    
       
    77     
       
    78 // ----------------------------------------------------------------------------
       
    79 // Does this player have access to audio resource
       
    80 // ----------------------------------------------------------------------------
       
    81 //
       
    82 inline TBool CMPXPlaybackEngine::IsPlayerActive() const
       
    83     {
       
    84     return iPlayerActive;
       
    85     }
       
    86     
       
    87 // ----------------------------------------------------------------------------
       
    88 // Return mode id of the player engine
       
    89 // ----------------------------------------------------------------------------
       
    90 //
       
    91 inline const TUid& CMPXPlaybackEngine::ModeId() const
       
    92     {
       
    93     return iModeId;
       
    94     }
       
    95 	
       
    96 
       
    97 // ----------------------------------------------------------------------------
       
    98 // Return category of the player engine
       
    99 // ----------------------------------------------------------------------------
       
   100 //
       
   101 inline const TInt CMPXPlaybackEngine::Category() const
       
   102     {
       
   103     return iCategory;
       
   104     }
       
   105 
       
   106 // ----------------------------------------------------------------------------
       
   107 // Current state
       
   108 // ----------------------------------------------------------------------------
       
   109 //
       
   110 inline TMPXPlaybackState CMPXPlaybackEngine::State() const
       
   111     {
       
   112     MPX_DEBUG3("CMPXPlaybackEngine::State(): this = 0x%08x, iState = %d", this, iState);
       
   113     return iState;
       
   114     }   
       
   115           
       
   116 // ----------------------------------------------------------------------------
       
   117 // Current collection path, or KNullDesC if none (i.e. not from collection)
       
   118 // ----------------------------------------------------------------------------
       
   119 //
       
   120 inline const CMPXCollectionPlaylist* CMPXPlaybackEngine::Playlist() const
       
   121     {
       
   122     CMPXCollectionPlaylist* pl = NULL;
       
   123     if (iPlaylist && iPlaySource==EPlayFromCollection)
       
   124         {
       
   125         pl = iPlaylist;
       
   126         }    
       
   127     return pl;
       
   128     }
       
   129     
       
   130 // ----------------------------------------------------------------------------
       
   131 // Current uri, or KNullDesC if none (i.e. uri not supplied)
       
   132 // ----------------------------------------------------------------------------
       
   133 //
       
   134 inline const TDesC& CMPXPlaybackEngine::Uri() const
       
   135     { 
       
   136     return (iUri && iPlaySource == EPlayFromUri) ? 
       
   137             static_cast<const TDesC&>(*iUri) : KNullDesC;
       
   138     }    
       
   139 
       
   140 // ----------------------------------------------------------------------------
       
   141 // Current file handle
       
   142 // ----------------------------------------------------------------------------
       
   143 //
       
   144 inline const RFile& CMPXPlaybackEngine::File() const
       
   145     {
       
   146     return iFile;
       
   147     }
       
   148 
       
   149 // ----------------------------------------------------------------------------
       
   150 // Return last active process id
       
   151 // ----------------------------------------------------------------------------
       
   152 //
       
   153 inline TProcessId CMPXPlaybackEngine::LastActiveProcessId() const
       
   154     {
       
   155     return iLastActiveProcess;
       
   156     }
       
   157 
       
   158 // ----------------------------------------------------------------------------
       
   159 // Return last inactive process id
       
   160 // ----------------------------------------------------------------------------
       
   161 //
       
   162 inline TProcessId CMPXPlaybackEngine::LastInactiveProcessId() const
       
   163     {
       
   164     return iLastInactiveProcess;
       
   165     }
       
   166 
       
   167 // ----------------------------------------------------------------------------
       
   168 // CPlaybackCallbackReflector constructor
       
   169 // ----------------------------------------------------------------------------
       
   170 //
       
   171 inline CMPXPlaybackEngine::TCallbackReflector::TCallbackReflector(
       
   172                                                    CMPXPlaybackEngine& aEngine)
       
   173     : iEngine(aEngine)
       
   174     {
       
   175     }
       
   176 
       
   177 // ----------------------------------------------------------------------------
       
   178 // Handle playback property
       
   179 // Called by CMPXPlaybackEngine::HandleProperty which is called by plugin
       
   180 // ----------------------------------------------------------------------------
       
   181 //  
       
   182 void CMPXPlaybackEngine::TCallbackReflector::HandleProperty(
       
   183     TMPXPlaybackProperty aProperty,
       
   184     TInt aValue,
       
   185     TInt aError)
       
   186     {
       
   187     MPX_FUNC_EX("CMPXPlaybackEngine::TCallbackReflector::HandleProperty");
       
   188     MPX_DEBUG5("HandleProperty eninge 0x%08x prop %d val %d err %d", 
       
   189                 &iEngine, aProperty, aValue, aError);
       
   190     ASSERT(iEngine.iTaskQueue->Task() == EProperty);
       
   191     if (KErrNone == aError)
       
   192         {
       
   193         iEngine.iProperties[aProperty]=aValue;
       
   194         TRAP_IGNORE(
       
   195             iEngine.iClientList->SendMsgL(TMPXPlaybackMessage(
       
   196                                     TMPXPlaybackMessage::EPropertyChanged,
       
   197                                     aProperty, aValue)));
       
   198         }
       
   199     // Task will be completed in the CMPXPlaybackEngine::HandleProperty
       
   200     }
       
   201     
       
   202 // ----------------------------------------------------------------------------
       
   203 // Method is called continously until aComplete=ETrue, signifying that 
       
   204 // it is done and there will be no more callbacks
       
   205 // ----------------------------------------------------------------------------
       
   206 //  
       
   207 void CMPXPlaybackEngine::TCallbackReflector::HandleSubPlayerNames(
       
   208                                                TUid /*aPlayer*/,
       
   209                                                const MDesCArray* /*aSubPlayers*/,
       
   210                                                TBool /*aComplete*/,
       
   211                                                TInt  /*aError*/)
       
   212     {
       
   213     MPX_FUNC_EX("CMPXPlaybackEngine::TCallbackReflector::HandleSubPlayerNames");
       
   214     }
       
   215     
       
   216 // ----------------------------------------------------------------------------
       
   217 // Callback of media request
       
   218 // ----------------------------------------------------------------------------
       
   219 //  
       
   220 void CMPXPlaybackEngine::TCallbackReflector::HandleMedia(
       
   221                                     CMPXMedia* /*aMedia*/,
       
   222                                     TInt /*aError*/)
       
   223     {
       
   224     MPX_FUNC_EX("CMPXPlaybackEngine::TCallbackReflector::HandleMedia");
       
   225     }
       
   226 
       
   227 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   228 // ----------------------------------------------------------------------------
       
   229 // Current file handle
       
   230 // ----------------------------------------------------------------------------
       
   231 //
       
   232 inline const RFile64& CMPXPlaybackEngine::File64() const
       
   233     {
       
   234     MPX_FUNC("CMPXPlaybackEngine::File64()");
       
   235     return iFile64;
       
   236     }
       
   237 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   238 
       
   239 //End of file