vtprotocolplugins/VideoSource/src/CVSControllerImp.cpp
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     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:  Video Source subsystem.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 
       
    21 #include <e32svr.h>
       
    22 
       
    23 #include "CVSControllerImp.h"
       
    24 #include "VSPanic.h"
       
    25 
       
    26 // MACROS
       
    27 
       
    28 #ifdef _DEBUG
       
    29 #    define __IF_DEBUG(t) {RDebug::t;}
       
    30 #else
       
    31 #    define __IF_DEBUG(t)
       
    32 #endif
       
    33 
       
    34 // FORWARD DECLARATIONS
       
    35 
       
    36 // ============================= LOCAL FUNCTIONS ===============================
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // Panics current thread.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 void Panic( TVSPanic aPanicCode )
       
    43     {
       
    44     User::Panic( KVSPanicCategory(), aPanicCode );
       
    45     }
       
    46 
       
    47 // ============================ MEMBER FUNCTIONS ===============================
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CVSController::NewL
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 EXPORT_C CVSController* CVSController::NewL( MVSControllerObserver* aObserver )
       
    54     {
       
    55     __IF_DEBUG(Print(_L("VideoSource: CVSController::NewL() entering")));
       
    56     if ( aObserver == NULL )
       
    57         {
       
    58         User::Leave( KErrArgument );
       
    59         }
       
    60     CVSController* self = CVSControllerImp::NewL();
       
    61     CleanupStack::PushL( self );
       
    62     self->ConstructL( aObserver );
       
    63     CleanupStack::Pop( self );
       
    64     __IF_DEBUG(Print(_L("VideoSource: CVSController::NewL() returning")));
       
    65     return self;
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CVSControllerImp::ConstructL
       
    70 // -----------------------------------------------------------------------------
       
    71 //
       
    72 void CVSControllerImp::ConstructL( MVSControllerObserver* aObserver )
       
    73     {
       
    74     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ConstructL() entering")));
       
    75     iObserver = aObserver;
       
    76     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ConstructL() returning")));
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CVSControllerImp::NewL
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 CVSControllerImp* CVSControllerImp::NewL()
       
    84     {
       
    85     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::NewL() entering")));
       
    86     CVSControllerImp* self = new (ELeave) CVSControllerImp;
       
    87     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::NewL() returning")));
       
    88     return self;
       
    89     }
       
    90 
       
    91 // -----------------------------------------------------------------------------
       
    92 // CVSControllerImp::~CVSControllerImp
       
    93 // -----------------------------------------------------------------------------
       
    94 //
       
    95 CVSControllerImp::~CVSControllerImp()
       
    96     {
       
    97     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::~CVSControllerImp() entering")));
       
    98     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::~CVSControllerImp() returning")));
       
    99     }
       
   100 
       
   101 // -----------------------------------------------------------------------------
       
   102 // CVSControllerImp::CreateDataSourceL
       
   103 // -----------------------------------------------------------------------------
       
   104 //
       
   105 CVSDataSource* CVSControllerImp::CreateDataSourceL( MVSDataSourceObserver* aObserver )
       
   106     {
       
   107     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::CreateDataSourceL() entering")));
       
   108     CVSDataSource* p = CVSDataSource::NewSourceL( aObserver );
       
   109     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::CreateDataSourceL() returning")));
       
   110     return p;
       
   111     }
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // CVSControllerImp::ProvidersAvailable
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 TInt CVSControllerImp::ProvidersAvailable()
       
   118     {
       
   119     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ProvidersAvailable() entering")));
       
   120     TInt count = CVSDataProvider::ProvidersAvailable();
       
   121     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ProvidersAvailable() returning")));
       
   122     return count;
       
   123     }
       
   124 
       
   125 // -----------------------------------------------------------------------------
       
   126 // CVSControllerImp::ProviderInfoL
       
   127 // -----------------------------------------------------------------------------
       
   128 //
       
   129 void CVSControllerImp::ProviderInfoL(
       
   130     TInt aProviderIndex,
       
   131     TVSDataProviderInfo& aInfo )
       
   132     {
       
   133     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ProviderInfo() entering")));
       
   134     if (aProviderIndex >= ProvidersAvailable() || aProviderIndex < 0)
       
   135         {
       
   136         User::Leave( KErrNotSupported );
       
   137         }
       
   138     CVSDataProvider::ProviderInfoL( aProviderIndex, aInfo );
       
   139     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::ProviderInfo() returning")));
       
   140     }
       
   141 
       
   142 // -----------------------------------------------------------------------------
       
   143 // CVSControllerImp::CreateDataProviderL
       
   144 // -----------------------------------------------------------------------------
       
   145 //
       
   146 CVSDataProvider* CVSControllerImp::CreateDataProviderL(
       
   147     TInt aProviderIndex,
       
   148     MVSDataProviderObserver* aObserver,
       
   149     MVSBufferPool* aPool )
       
   150     {
       
   151     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::CreateDataProviderL() entering")));
       
   152     if (aProviderIndex >= ProvidersAvailable() || aProviderIndex < 0)
       
   153         {
       
   154         User::Leave( KErrArgument );
       
   155         }
       
   156     if ( aObserver == NULL )
       
   157         {
       
   158         User::Leave( KErrArgument );
       
   159         }
       
   160     CVSDataProvider* p =
       
   161         CVSDataProvider::NewL( aProviderIndex, aObserver, aPool );
       
   162     __IF_DEBUG(Print(_L("VideoSource: CVSControllerImp::CreateDataProviderL() returning")));
       
   163     return p;
       
   164     }
       
   165 
       
   166 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   167 
       
   168 //  End of File