videoplayback/videohelix/tsrc/ut_videohelixtest/src/mpxvideoaccessoryobserver_stub.cpp
changeset 0 96612d01cf9f
child 2 dec420019252
equal deleted inserted replaced
-1:000000000000 0:96612d01cf9f
       
     1 /*
       
     2 * Copyright (c) 2009 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:  This class is the stub for the accessory observer.
       
    15  *
       
    16 */
       
    17 
       
    18 // Version : %version: 2 %
       
    19 
       
    20 //
       
    21 //  INCLUDE FILES
       
    22 //
       
    23 #include "stifutilities.h"
       
    24 #include "mpxvideoaccessoryobserver_stub.h"
       
    25 #include "mpxvideoplaybackcontroller.h"
       
    26 
       
    27 
       
    28 //
       
    29 // ============================ MEMBER FUNCTIONS ===================================================
       
    30 //
       
    31 
       
    32 
       
    33 CMPXVideoAccessoryObserver*
       
    34 CMPXVideoAccessoryObserver::NewL( CMPXVideoPlaybackController* aController )
       
    35 {
       
    36     MPX_ENTER_EXIT(_L("CMPXVideoAccessoryObserver::NewL()"));
       
    37 
       
    38     CMPXVideoAccessoryObserver* self = new (ELeave) CMPXVideoAccessoryObserver( aController );
       
    39 
       
    40     StifUtilities* utility = reinterpret_cast<StifUtilities*>( Dll::Tls() );
       
    41 
       
    42     if ( utility->iAccObserver )
       
    43     {
       
    44         utility->iAccObserver->iController = aController;
       
    45     }
       
    46     else
       
    47     {
       
    48         utility->iAccObserver = new (ELeave) CMPXVideoAccessoryObserver( aController );
       
    49         utility->iAccObserver->ConstructL();
       
    50     }
       
    51 
       
    52     return utility->iAccObserver;
       
    53 }
       
    54 
       
    55 
       
    56 void CMPXVideoAccessoryObserver::ConstructL()
       
    57 {
       
    58 }
       
    59 
       
    60 // -------------------------------------------------------------------------------------------------
       
    61 //   CMPXVideoAccessoryObserver::CMPXVideoAccessoryObserver
       
    62 // -------------------------------------------------------------------------------------------------
       
    63 //
       
    64 CMPXVideoAccessoryObserver::CMPXVideoAccessoryObserver( CMPXVideoPlaybackController* aController )
       
    65     : iController( aController )
       
    66     , iTvOutConnected( EFalse )
       
    67     , iTvOutPlaybackAllowed( ETrue )
       
    68 {
       
    69 }
       
    70 
       
    71 CMPXVideoAccessoryObserver::~CMPXVideoAccessoryObserver()
       
    72 {
       
    73     MPX_ENTER_EXIT(_L("CMPXVideoAccessoryObserver::~CMPXVideoAccessoryObserver()"));
       
    74 }
       
    75 
       
    76 void CMPXVideoAccessoryObserver::SetTvOutConnected( TBool aConnected )
       
    77 {
       
    78     iTvOutConnected = aConnected;
       
    79 
       
    80     if ( ! iTvOutConnected )
       
    81     {
       
    82         iTvOutPlaybackAllowed = ETrue;
       
    83     }
       
    84 }
       
    85 
       
    86 void CMPXVideoAccessoryObserver::SetTvOutPlaybackAllowed( TBool aAllowed )
       
    87 {
       
    88     iTvOutPlaybackAllowed = aAllowed;
       
    89 }
       
    90 
       
    91 void CMPXVideoAccessoryObserver::UpdateTvOutStatusL( TBool aTvOutConnected )
       
    92 {
       
    93     MPX_DEBUG(_L("CMPXVideoAccessoryObserver::UpdateTvOutStatusL()"));
       
    94 
       
    95     //
       
    96     //  Check if the TV-Out status has changed
       
    97     //
       
    98     if ( iTvOutConnected != aTvOutConnected )
       
    99     {
       
   100         iTvOutConnected = aTvOutConnected;
       
   101 
       
   102         if ( iTvOutConnected )
       
   103         {
       
   104             //
       
   105             //  Check the playablility of the clip
       
   106             //
       
   107             if ( iController )
       
   108             {
       
   109                 iTvOutPlaybackAllowed = iController->iPlaybackMode->IsTvOutAllowedL();
       
   110             }
       
   111         }
       
   112         else
       
   113         {
       
   114             iTvOutPlaybackAllowed = ETrue;
       
   115         }
       
   116 
       
   117         iController->HandleTvOutEventL( iTvOutConnected );
       
   118     }
       
   119 
       
   120     MPX_DEBUG(_L("    iTvOutConnected = %d"), iTvOutConnected);
       
   121 }
       
   122 
       
   123 // -------------------------------------------------------------------------------------------------
       
   124 //   CMPXVideoAccessoryObserver::IsTvOutConnected
       
   125 // -------------------------------------------------------------------------------------------------
       
   126 //
       
   127 TBool CMPXVideoAccessoryObserver::IsTvOutConnected()
       
   128 {
       
   129     MPX_DEBUG(_L("CMPXVideoAccessoryObserver::IsTvOutConnected(%d)"), iTvOutConnected);
       
   130 
       
   131     return iTvOutConnected;
       
   132 }
       
   133 
       
   134 // -------------------------------------------------------------------------------------------------
       
   135 //   CMPXVideoAccessoryObserver::IsTvOutPlaybackAllowed
       
   136 // -------------------------------------------------------------------------------------------------
       
   137 //
       
   138 TBool CMPXVideoAccessoryObserver::IsTvOutPlaybackAllowed()
       
   139 {
       
   140     TBool playAllowed = ( ! iTvOutConnected || iTvOutPlaybackAllowed );
       
   141     MPX_DEBUG(_L("CMPXVideoAccessoryObserver::IsTvOutPlaybackAllowed(%d)"), playAllowed);
       
   142 
       
   143     return playAllowed;
       
   144 }
       
   145 
       
   146 //  End of File