mmsharing/livecommsui/lcui/tsrc/mustester/Stubs/mceclientstub/src/mcedisplaysink.cpp
branchRCL_3
changeset 33 bc78a40cd63c
parent 32 73a1feb507fb
child 35 6c57ef9392d2
equal deleted inserted replaced
32:73a1feb507fb 33:bc78a40cd63c
     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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "mcedisplaysink.h"
       
    20 #include "mcesession.h"
       
    21 #include "mcemediastream.h"
       
    22 #include "mcemanager.h"
       
    23 #include "mccscreen.h"
       
    24 #include "muslogger.h"
       
    25 
       
    26 #include <e32std.h>
       
    27 #include <e32cmn.h>
       
    28 
       
    29 
       
    30 #define _FLAT_DATA static_cast<CMceComDisplaySink*>( iFlatData )
       
    31 #define FLAT_DATA( data ) _FLAT_DATA->data
       
    32 
       
    33 // ============================ MEMBER FUNCTIONS ===============================
       
    34 
       
    35 
       
    36 // -----------------------------------------------------------------------------
       
    37 // 
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 EXPORT_C CMceDisplaySink* CMceDisplaySink::NewL( CMceManager& aManager )
       
    41     {
       
    42     CMceDisplaySink* self = CMceDisplaySink::NewLC( aManager );
       
    43     CleanupStack::Pop( self );
       
    44     return self;
       
    45     }
       
    46 
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // 
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 EXPORT_C CMceDisplaySink* CMceDisplaySink::NewLC( CMceManager& /*aManager*/ )
       
    53     {
       
    54     CMceDisplaySink* self = new (ELeave) CMceDisplaySink();
       
    55     CleanupStack::PushL( self );
       
    56     return self;
       
    57     }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // 
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 EXPORT_C CMceDisplaySink* CMceDisplaySink::NewL()
       
    64     {
       
    65     CMceDisplaySink* self = CMceDisplaySink::NewLC();
       
    66     CleanupStack::Pop( self );
       
    67     return self;
       
    68     }
       
    69 
       
    70 
       
    71 // -----------------------------------------------------------------------------
       
    72 // 
       
    73 // -----------------------------------------------------------------------------
       
    74 //
       
    75 EXPORT_C CMceDisplaySink* CMceDisplaySink::NewLC()
       
    76     {
       
    77     CMceDisplaySink* self = new( ELeave )CMceDisplaySink();
       
    78     CleanupStack::PushL( self );
       
    79     return self;
       
    80     }
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // 
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 EXPORT_C CMceDisplaySink::~CMceDisplaySink()
       
    87     {
       
    88     delete iScreen;
       
    89     iScreen = 0;
       
    90     }
       
    91 
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // 
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 EXPORT_C void CMceDisplaySink::EnableL()
       
    98     {
       
    99     MUS_LOG("CMceDisplaySink::EnableL ->")
       
   100     CMceMediaSink::DoEnableL();   
       
   101     if ( !iScreen )
       
   102         {
       
   103         TPoint pos (0,0);
       
   104         TSize area = iDisplayRect.Size();
       
   105         TInt index = iDisplayIndex; 
       
   106         TInt windowOrdinalPosition = 2;
       
   107         TInt windowOrdinalPriority = 1;
       
   108         TSize viewFinderImageSize = iDisplayRect.Size();
       
   109         MUS_LOG2("CMceDisplaySink::EnableL display rect height=%d width=%d )",area.iHeight,area.iWidth)        
       
   110         iScreen =  CMccScreen::NewL( pos,area,index,windowOrdinalPosition,windowOrdinalPriority,viewFinderImageSize);
       
   111         }
       
   112     
       
   113     iScreen->StartL();
       
   114     MUS_LOG("CMceDisplaySink::EnableL <-")
       
   115     }
       
   116 
       
   117 
       
   118 // -----------------------------------------------------------------------------
       
   119 // 
       
   120 // -----------------------------------------------------------------------------
       
   121 //
       
   122 EXPORT_C void CMceDisplaySink::DisableL()
       
   123     {
       
   124     MUS_LOG("CMceDisplaySink::DisableL ->")
       
   125     CMceMediaSink::DoDisableL();
       
   126     if( iScreen ) iScreen->Stop();
       
   127     MUS_LOG("CMceDisplaySink::DisableL <-")
       
   128     }
       
   129 
       
   130 
       
   131 // -----------------------------------------------------------------------------
       
   132 // 
       
   133 // -----------------------------------------------------------------------------
       
   134 //
       
   135 EXPORT_C TInt CMceDisplaySink::DisplaysAvailable() const
       
   136     {
       
   137     return 1;
       
   138     }
       
   139 
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // 
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 EXPORT_C void CMceDisplaySink::SetDisplayIndexL( TInt aDisplayIndex )
       
   146     {
       
   147     __ASSERT_ALWAYS( aDisplayIndex >= 0 &&
       
   148                      aDisplayIndex < this->DisplaysAvailable(),
       
   149                      User::Leave( KErrArgument ) );
       
   150                      
       
   151     iDisplayIndex = aDisplayIndex;
       
   152          
       
   153     }   
       
   154 	    
       
   155 	    
       
   156 // -----------------------------------------------------------------------------
       
   157 // 
       
   158 // -----------------------------------------------------------------------------
       
   159 //    
       
   160 EXPORT_C void CMceDisplaySink::SetDisplay( RWindow& /*aWindow*/, 
       
   161                                            CWindowGc& /*aGc*/ )
       
   162     {
       
   163     }
       
   164 
       
   165 
       
   166 // -----------------------------------------------------------------------------
       
   167 // 
       
   168 // -----------------------------------------------------------------------------
       
   169 //
       
   170 EXPORT_C void CMceDisplaySink::SetDisplayRectL( const TRect& aRect )
       
   171     {
       
   172     iDisplayRect = aRect;
       
   173     }
       
   174 
       
   175 
       
   176 // -----------------------------------------------------------------------------
       
   177 // 
       
   178 // -----------------------------------------------------------------------------
       
   179 //
       
   180 EXPORT_C const TRect CMceDisplaySink::DisplayRectL()
       
   181     {
       
   182     return iDisplayRect;
       
   183     }
       
   184 
       
   185 
       
   186 // -----------------------------------------------------------------------------
       
   187 // 
       
   188 // -----------------------------------------------------------------------------
       
   189 //
       
   190 EXPORT_C void CMceDisplaySink::SetPriorityL( TUint aPriority )
       
   191     {
       
   192     iDisplayPriority = aPriority; 
       
   193     }
       
   194 
       
   195 
       
   196 // -----------------------------------------------------------------------------
       
   197 // 
       
   198 // -----------------------------------------------------------------------------
       
   199 //
       
   200 EXPORT_C TUint CMceDisplaySink::PriorityL()
       
   201     {
       
   202     return iDisplayPriority; 
       
   203     }
       
   204 
       
   205 
       
   206 // -----------------------------------------------------------------------------
       
   207 // 
       
   208 // -----------------------------------------------------------------------------
       
   209 //
       
   210 EXPORT_C void CMceDisplaySink::SetRotationL( TRotation aRotation )
       
   211     {
       
   212     iRotation = aRotation;
       
   213     }
       
   214 		
       
   215 
       
   216 // -----------------------------------------------------------------------------
       
   217 // 
       
   218 // -----------------------------------------------------------------------------
       
   219 //	
       
   220 EXPORT_C CMceDisplaySink::TRotation CMceDisplaySink::RotationL()
       
   221     {
       
   222     return iRotation;
       
   223     }
       
   224     
       
   225 
       
   226 // -----------------------------------------------------------------------------
       
   227 //
       
   228 // -----------------------------------------------------------------------------
       
   229 //
       
   230 void CMceDisplaySink::InitializeL( CMceManager* /*aManager*/ )
       
   231     {
       
   232     }
       
   233 
       
   234 // -----------------------------------------------------------------------------
       
   235 // 
       
   236 // -----------------------------------------------------------------------------
       
   237 //
       
   238 CMceDisplaySink::CMceDisplaySink()
       
   239     :CMceMediaSink(),
       
   240     iDisplayIndex( 0 ),
       
   241     iDisplayRect( TRect( 0, 0, 0, 0 ) ),
       
   242     iDisplayPriority( 0 ),
       
   243     iRotation( ENone )
       
   244     {
       
   245     iType = KMceDisplaySink;
       
   246     }