vtprotocolplugins/VideoSource/src/CVSDataProvider.cpp
changeset 0 ed9695c8bcbe
child 14 856ae1b15d98
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 #include <badesca.h>
       
    21 #include <e32svr.h>
       
    22 #include <featmgr.h>
       
    23 #include "CApiVideoSource.h"
       
    24 #include "CVSCameraDataProvider.h"
       
    25 #include "CVSStillImageDataProvider.h"
       
    26 #include "CVSOnboardCameraDataProvider.h"
       
    27 
       
    28 // EXTERNAL FUNCTION PROTOTYPES
       
    29 
       
    30 // MACROS
       
    31 
       
    32 #ifdef _DEBUG
       
    33 #    define __IF_DEBUG(t) {RDebug::t;}
       
    34 #else
       
    35 #    define __IF_DEBUG(t)
       
    36 #endif
       
    37 
       
    38 // LOCAL CONSTANTS AND MACROS
       
    39 
       
    40 class TSizeCount
       
    41     {
       
    42     public:
       
    43         TInt    iCount;
       
    44         TSize   iSize;
       
    45     };
       
    46 
       
    47 class TRateCount
       
    48     {
       
    49     public:
       
    50         TInt    iCount;
       
    51         TReal32 iRate;
       
    52     };
       
    53 
       
    54 // LOCAL FUNCTION PROTOTYPES
       
    55 
       
    56 static TInt TSizeCountTLinearOrderFunc( 
       
    57     const TSizeCount& aSizeCount1, const TSizeCount& aSizeCount2 );
       
    58 static TBool TSizeCountTIdentityRelationFunc( 
       
    59     const TSizeCount& aSizeCount1, const TSizeCount& aSizeCount2 );
       
    60 static TInt TRateCountTLinearOrderFunc( 
       
    61     const TRateCount& aRateCount1, const TRateCount& aRateCount2 );
       
    62 static TBool TRateCountTIdentityRelationFunc( 
       
    63     const TRateCount& aRateCount1, const TRateCount& aRateCount2 );
       
    64 
       
    65 // FORWARD DECLARATIONS
       
    66 
       
    67 // ============================= LOCAL FUNCTIONS ===============================
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // TSizeCountTLinearOrderFunc: Used in RArray<TSizeCount)::InsertInOrder
       
    71 // -----------------------------------------------------------------------------
       
    72 //
       
    73 static TInt TSizeCountTLinearOrderFunc( 
       
    74     const TSizeCount& aSizeCount1,
       
    75     const TSizeCount& aSizeCount2 )
       
    76     {
       
    77     if ( aSizeCount1.iSize == aSizeCount2.iSize )
       
    78         {
       
    79         return 0;
       
    80         }
       
    81     else
       
    82         {
       
    83         // It is assumed that width and height fit in 16-bit, if they don't,
       
    84         // use TInt64
       
    85         TInt32 s1 = 
       
    86             ( aSizeCount1.iSize.iWidth & 0xffff ) << 16 | 
       
    87             ( aSizeCount1.iSize.iHeight & 0xffff );
       
    88         TInt32 s2 = 
       
    89             ( aSizeCount2.iSize.iWidth & 0xffff ) << 16 | 
       
    90             ( aSizeCount2.iSize.iHeight & 0xffff );
       
    91         return s1 - s2;
       
    92         }
       
    93     }
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // TSizeCountTIdentityRelationFunc: Used in RArray<TSizeCount)::Find
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 static TBool TSizeCountTIdentityRelationFunc( 
       
   100     const TSizeCount& aSizeCount1, 
       
   101     const TSizeCount& aSizeCount2 )
       
   102     {
       
   103     if ( aSizeCount1.iSize == aSizeCount2.iSize )
       
   104         {
       
   105         return ETrue;
       
   106         }
       
   107     else
       
   108         {
       
   109         return EFalse;
       
   110         }
       
   111     }
       
   112 
       
   113 // -----------------------------------------------------------------------------
       
   114 // TRateCountTLinearOrderFunc: Used in RArray<TRateCount)::InsertInOrder
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 static TInt TRateCountTLinearOrderFunc( 
       
   118     const TRateCount& aRateCount1, 
       
   119     const TRateCount& aRateCount2 )
       
   120     {
       
   121     if ( aRateCount1.iRate > aRateCount2.iRate ) 
       
   122         {
       
   123         return 1;
       
   124         }
       
   125         
       
   126     if ( aRateCount1.iRate < aRateCount2.iRate )
       
   127         {
       
   128         return -1;
       
   129         }
       
   130         
       
   131     return 0;
       
   132     }
       
   133 
       
   134 // -----------------------------------------------------------------------------
       
   135 // TRateCountTIdentityRelationFunc: Used in RArray<TRateCount)::Find
       
   136 // -----------------------------------------------------------------------------
       
   137 //
       
   138 static TBool TRateCountTIdentityRelationFunc( 
       
   139     const TRateCount& aRateCount1, 
       
   140     const TRateCount& aRateCount2 )
       
   141     {
       
   142     if ( aRateCount1.iRate == aRateCount2.iRate )
       
   143         {
       
   144         return ETrue;
       
   145         }
       
   146     else
       
   147         {
       
   148         return EFalse;
       
   149         }
       
   150     }
       
   151 
       
   152 // ============================ MEMBER FUNCTIONS ===============================
       
   153 
       
   154 // -----------------------------------------------------------------------------
       
   155 // CVSDataProvider::NewL
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 CVSDataProvider* CVSDataProvider::NewL( 
       
   159     TInt aProviderIndex, 
       
   160     MVSDataProviderObserver* aObserver, 
       
   161     MVSBufferPool* aPool )
       
   162     {
       
   163     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::NewL() [aProviderIndex = %d] >>"), RThread().Id().operator TUint(), aProviderIndex));
       
   164     
       
   165     CVSDataProvider* self = NULL;
       
   166     
       
   167     // Is it ecam
       
   168     TInt count = CamerasAvailable();
       
   169     
       
   170     // < 0 == error
       
   171     if( count < 0 )
       
   172         {
       
   173         User::Leave( count );
       
   174         }
       
   175 
       
   176     if ( aProviderIndex < count )
       
   177         {
       
   178         self = CVSCameraDataProvider::NewL( aObserver, aProviderIndex, aPool );
       
   179         }
       
   180     else
       
   181         {
       
   182         // Is it still image
       
   183         count += 1;
       
   184 
       
   185         if ( aProviderIndex == ( count - 1) )
       
   186             {
       
   187             self = CVSStillImageDataProvider::NewL( aObserver, aPool );
       
   188             }
       
   189         else
       
   190             {
       
   191             User::Leave( KErrNotSupported );
       
   192             }
       
   193         }
       
   194     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::NewL() <<"), RThread().Id().operator TUint()));
       
   195     return self;
       
   196     }
       
   197 
       
   198 // -----------------------------------------------------------------------------
       
   199 // CVSDataProvider::~CVSDataProvider
       
   200 // -----------------------------------------------------------------------------
       
   201 //
       
   202 CVSDataProvider::~CVSDataProvider()
       
   203     {
       
   204     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::~CVSDataProvider() >>"), RThread().Id().operator TUint()));
       
   205     delete iErrorNotifier;
       
   206     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::~CVSDataProvider() <<"), RThread().Id().operator TUint()));
       
   207     }
       
   208 
       
   209 // -----------------------------------------------------------------------------
       
   210 // CVSDataProvider::ProvidersAvailable
       
   211 // -----------------------------------------------------------------------------
       
   212 //
       
   213 TInt CVSDataProvider::ProvidersAvailable()
       
   214     {
       
   215     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ProvidersAvailable() >>"), RThread().Id().operator TUint()));
       
   216     
       
   217     // Count ecams
       
   218     TInt numProviders = CamerasAvailable();
       
   219 
       
   220     // < 0 == error
       
   221     if ( numProviders < 0 )
       
   222         {
       
   223         numProviders = 1; // only still image provider
       
   224         }
       
   225     else
       
   226         {
       
   227         numProviders += 1; // add still
       
   228         }
       
   229     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ProvidersAvailable() [numProviders = %d] <<"), RThread().Id().operator TUint(), numProviders));
       
   230 
       
   231     return numProviders;
       
   232     }
       
   233 
       
   234 // -----------------------------------------------------------------------------
       
   235 // CVSDataProvider::ProviderInfoL
       
   236 // -----------------------------------------------------------------------------
       
   237 //
       
   238 void CVSDataProvider::ProviderInfoL( 
       
   239     TInt aProviderIndex, 
       
   240     TVSDataProviderInfo& aInfo )
       
   241     {
       
   242     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ProviderInfoL() >>"), RThread().Id().operator TUint()));
       
   243     CVSDataProvider* provider = NewL( aProviderIndex, NULL, NULL);
       
   244     provider->ProviderInfo( aInfo );
       
   245     delete provider;
       
   246     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ProviderInfoL() <<"), RThread().Id().operator TUint()));
       
   247     }
       
   248 
       
   249 // -----------------------------------------------------------------------------
       
   250 // CVSDataProvider::SetFillBufferParams
       
   251 // -----------------------------------------------------------------------------
       
   252 //
       
   253 void CVSDataProvider::SetFillBufferParams( 
       
   254     MVTVideoSink* aConsumer, 
       
   255     TMediaId aMediaId )
       
   256     {
       
   257     iConsumer = aConsumer;
       
   258     iMediaId = aMediaId;
       
   259     }
       
   260 
       
   261 // -----------------------------------------------------------------------------
       
   262 // CVSDataProvider::NotifyError
       
   263 // -----------------------------------------------------------------------------
       
   264 //
       
   265 void CVSDataProvider::NotifyError( TInt aError )
       
   266     {
       
   267     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::NotifyError() >>"), RThread().Id().operator TUint()));
       
   268     iErrorNotifier->NotifyError( &Observer(), aError );
       
   269     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::NotifyError() <<"), RThread().Id().operator TUint()));
       
   270     }
       
   271 
       
   272 // -----------------------------------------------------------------------------
       
   273 // CVSDataProvider::CVSDataProvider
       
   274 // -----------------------------------------------------------------------------
       
   275 //
       
   276 CVSDataProvider::CVSDataProvider( 
       
   277     MVSDataProviderObserver* aObserver, 
       
   278     MVSBufferPool* aPool ) : 
       
   279         iObserver( aObserver ), 
       
   280         iPool ( aPool )
       
   281     {
       
   282     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::CVSDataProvider() >>"), RThread().Id().operator TUint()));
       
   283     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::CVSDataProvider() <<"), RThread().Id().operator TUint()));
       
   284     }
       
   285 
       
   286 // -----------------------------------------------------------------------------
       
   287 // CVSDataProvider::ConstructL
       
   288 // -----------------------------------------------------------------------------
       
   289 //
       
   290 void CVSDataProvider::ConstructL()
       
   291     {
       
   292     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ConstructL() >>"), RThread().Id().operator TUint()));
       
   293     iErrorNotifier = CProviderErrorNotifierAO::NewL();
       
   294     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ConstructL() <<"), RThread().Id().operator TUint()));
       
   295     }
       
   296 
       
   297 
       
   298 // -----------------------------------------------------------------------------
       
   299 // CVSDataProvider::TimeToPlay
       
   300 // -----------------------------------------------------------------------------
       
   301 //
       
   302 const TTimeIntervalMicroSeconds& CVSDataProvider::TimeToPlay()
       
   303     {
       
   304     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::TimeToPlay() >>"), RThread().Id().operator TUint()));
       
   305 
       
   306     TTime now;
       
   307     now.HomeTime();
       
   308 
       
   309     TTimeIntervalMicroSeconds timeToPlay( now.MicroSecondsFrom( iStartTime ) );
       
   310 
       
   311     if( timeToPlay <= iPreviousTimeToPlay )
       
   312         {
       
   313         __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::TimeToPlay(): *WARNING* Time warp backwards! Correcting.."), RThread().Id().operator TUint()));
       
   314         iPreviousTimeToPlay = 
       
   315             TTimeIntervalMicroSeconds( iPreviousTimeToPlay.Int64() + 1 );
       
   316         }
       
   317     else
       
   318         {
       
   319         iPreviousTimeToPlay = timeToPlay;
       
   320         }
       
   321 
       
   322     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::TimeToPlay() <<"), RThread().Id().operator TUint()));
       
   323     return iPreviousTimeToPlay;
       
   324     }
       
   325 
       
   326 // -----------------------------------------------------------------------------
       
   327 // CVSDataProvider::ResetStartTime
       
   328 // -----------------------------------------------------------------------------
       
   329 //
       
   330 void CVSDataProvider::ResetStartTime()
       
   331     {
       
   332     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ResetStartTime() >>"), RThread().Id().operator TUint()));
       
   333     iStartTime.HomeTime();
       
   334     iPreviousTimeToPlay = iStartTime.MicroSecondsFrom( iStartTime );
       
   335     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::ResetStartTime() <<"), RThread().Id().operator TUint()));
       
   336     }
       
   337 
       
   338 // -----------------------------------------------------------------------------
       
   339 // CVSDataProvider::CamerasAvailable()
       
   340 // -----------------------------------------------------------------------------
       
   341 //
       
   342 TInt CVSDataProvider::CamerasAvailable()
       
   343     {
       
   344     TRAPD( result, FeatureManager::InitializeLibL() );
       
   345     
       
   346     if( result != KErrNone )
       
   347         {
       
   348         return result;
       
   349         }
       
   350     
       
   351     TInt count( 0 );
       
   352 
       
   353     if( FeatureManager::FeatureSupported( KFeatureIdCamera ) )
       
   354         {
       
   355         count = CCamera::CamerasAvailable();
       
   356         }
       
   357 
       
   358     FeatureManager::UnInitializeLib();
       
   359 
       
   360     return count;
       
   361     }
       
   362 
       
   363 // -----------------------------------------------------------------------------
       
   364 // CVSDataProvider::SwitchFrom
       
   365 // -----------------------------------------------------------------------------
       
   366 //
       
   367 void CVSDataProvider::SwitchFrom( const CVSDataProvider& anOldProvider )
       
   368     {
       
   369     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::SwitchFrom() >>"), RThread().Id().operator TUint()));
       
   370     iStartTime = anOldProvider.iStartTime;
       
   371     iPreviousTimeToPlay = anOldProvider.iPreviousTimeToPlay;
       
   372     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::SwitchFrom() <<"), RThread().Id().operator TUint()));
       
   373     }
       
   374 
       
   375 // -----------------------------------------------------------------------------
       
   376 // CVSDataProvider::EnumerateVideoFrameFormatsL
       
   377 // -----------------------------------------------------------------------------
       
   378 //
       
   379 void CVSDataProvider::EnumerateVideoFrameFormatsL( 
       
   380     CDesC8Array* aSupportedFormats )
       
   381     {
       
   382     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameFormats() >>"), RThread().Id().operator TUint()));
       
   383     TInt providerCount = ProvidersAvailable();    
       
   384     TInt countOfProvidersThatSupportYUV420Planar = 0;
       
   385     for ( TInt i = 0; i < providerCount; i++ )
       
   386         {
       
   387         TVSDataProviderInfo info;
       
   388         ProviderInfoL( i, info );
       
   389         if ( info.iVideoFrameFormatsSupported & CCamera::EFormatYUV420Planar )
       
   390             {
       
   391             countOfProvidersThatSupportYUV420Planar++;
       
   392             }
       
   393         }
       
   394     if( providerCount > 0 && 
       
   395         providerCount <= countOfProvidersThatSupportYUV420Planar )
       
   396         {
       
   397         aSupportedFormats->AppendL( KVtVideoMIMETypeYUV420 );
       
   398         }
       
   399     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameFormats() <<"), RThread().Id().operator TUint()));
       
   400     }
       
   401 
       
   402 // -----------------------------------------------------------------------------
       
   403 // CVSDataProvider::EnumerateVideoFrameSizesL
       
   404 // -----------------------------------------------------------------------------
       
   405 //
       
   406 void CVSDataProvider::EnumerateVideoFrameSizesL( 
       
   407     RArray<TSize>& aSupportedSizes, 
       
   408     const TDesC8& aFormat )
       
   409     {
       
   410     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameSizes() >>"), RThread().Id().operator TUint()));
       
   411     RArray<TSizeCount> sizeCountArray;
       
   412     CleanupClosePushL( sizeCountArray );
       
   413     TInt providerCount = ProvidersAvailable();
       
   414     for ( TInt i = 0; i < providerCount; i++ )
       
   415         {
       
   416         CVSDataProvider* p = CVSDataProvider::NewL( i, NULL, NULL );
       
   417         CleanupStack::PushL( p );
       
   418         TVSDataProviderInfo info;
       
   419         ProviderInfoL( i, info );
       
   420         for ( TInt j = 0; j < info.iNumVideoFrameSizesSupported; j++ )
       
   421             {
       
   422             TSize size;
       
   423             p->GetVideoFrameSize( size, j, aFormat );
       
   424             if ( size != TSize(0,0) )
       
   425                 {
       
   426                 TSizeCount sizeCount;
       
   427                 sizeCount.iCount = 1;
       
   428                 sizeCount.iSize = size;
       
   429                 TInt err = sizeCountArray.InsertInOrder( 
       
   430                     sizeCount, 
       
   431                     TLinearOrder<TSizeCount>( TSizeCountTLinearOrderFunc ) );
       
   432                 if ( err == KErrAlreadyExists )
       
   433                     {
       
   434                     TInt idx = sizeCountArray.Find( 
       
   435                         sizeCount, 
       
   436                         TIdentityRelation<TSizeCount>( 
       
   437                             TSizeCountTIdentityRelationFunc ) );
       
   438                     if ( idx == KErrNotFound )
       
   439                         {
       
   440                         User::Leave( KErrUnknown );
       
   441                         }
       
   442                     else
       
   443                         {
       
   444                         // Increment count of providers that supports the size
       
   445                         sizeCountArray[idx].iCount++;
       
   446                         }
       
   447                     }
       
   448                 else
       
   449                     {
       
   450                     User::LeaveIfError( err );
       
   451                     }
       
   452                 }
       
   453             }
       
   454         CleanupStack::PopAndDestroy(); // p
       
   455         }
       
   456     aSupportedSizes.Reset();
       
   457     for ( TInt k = 0; k < sizeCountArray.Count(); k++ )
       
   458         {
       
   459         // Do all providers support the size
       
   460         if ( providerCount > 0 && providerCount <= sizeCountArray[k].iCount ) 
       
   461             {
       
   462             User::LeaveIfError( 
       
   463                 aSupportedSizes.Append( sizeCountArray[k].iSize ) );
       
   464             }
       
   465         }
       
   466     CleanupStack::PopAndDestroy( ); // sizeCountArray
       
   467     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameSizes() <<"), RThread().Id().operator TUint()));
       
   468     }
       
   469 
       
   470 // -----------------------------------------------------------------------------
       
   471 // CVSDataProvider::EnumerateVideoFrameRatesL
       
   472 // -----------------------------------------------------------------------------
       
   473 //
       
   474 void CVSDataProvider::EnumerateVideoFrameRatesL( 
       
   475     RArray<TReal32>& aSupportedRates, 
       
   476     const TDesC8& aFormat, 
       
   477     const TSize& aSize )
       
   478     {
       
   479     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameRates() >>"), RThread().Id().operator TUint()));
       
   480     RArray<TRateCount> rateCountArray;
       
   481     CleanupClosePushL( rateCountArray );
       
   482     TInt providerCount = ProvidersAvailable();
       
   483     __IF_DEBUG(Print(_L("   LOOKING FOR COMMON SUPPORTED RATES, PROVIDER COUNT: %d"), providerCount));
       
   484     for ( TInt i = 0; i < providerCount; i++ )
       
   485         {
       
   486         __IF_DEBUG(Print(_L("      PROVIDER %d"), i));
       
   487         CVSDataProvider* p = CVSDataProvider::NewL( i, NULL, NULL );
       
   488         CleanupStack::PushL( p );
       
   489         TVSDataProviderInfo info;
       
   490         ProviderInfoL( i, info );
       
   491         __IF_DEBUG(Print(_L("         info.iNumVideoFrameRatesSupported: %d"), info.iNumVideoFrameRatesSupported));
       
   492         for ( TInt j = 0; j < info.iNumVideoFrameRatesSupported; j++ )
       
   493             {
       
   494             TReal32 rate = 0.0;
       
   495             p->GetVideoFrameRate( rate, j, aFormat, aSize );
       
   496             __IF_DEBUG(Print(_L("         RATE FOR RATE INDEX %d IS %f"), j, rate));
       
   497             if ( rate != 0.0 )
       
   498                 {
       
   499                 TRateCount rateCount;
       
   500                 rateCount.iCount = 1;
       
   501                 rateCount.iRate = rate;
       
   502                 TInt err = rateCountArray.InsertInOrder( 
       
   503                     rateCount, 
       
   504                     TLinearOrder<TRateCount>( TRateCountTLinearOrderFunc ) );
       
   505                 if ( err == KErrAlreadyExists )
       
   506                     {
       
   507                     TInt idx = rateCountArray.Find( 
       
   508                         rateCount, 
       
   509                         TIdentityRelation<TRateCount>( 
       
   510                             TRateCountTIdentityRelationFunc ) );
       
   511                     if ( idx == KErrNotFound )
       
   512                         {
       
   513                         User::Leave( KErrUnknown );
       
   514                         }
       
   515                     else
       
   516                         {
       
   517                         // Increment count of providers that supports the rate
       
   518                         rateCountArray[idx].iCount++;
       
   519                         }
       
   520                     }
       
   521                 else
       
   522                     {
       
   523                     User::LeaveIfError( err );
       
   524                     }
       
   525                 }
       
   526             }
       
   527         CleanupStack::PopAndDestroy(); // p
       
   528         }
       
   529     aSupportedRates.Reset();
       
   530     for ( TInt k = 0; k < rateCountArray.Count(); k++ )
       
   531         {
       
   532         // Do all providers support the rate
       
   533         if ( providerCount > 0 && providerCount <= rateCountArray[k].iCount )
       
   534             {
       
   535             User::LeaveIfError( 
       
   536                 aSupportedRates.Append( rateCountArray[k].iRate ) );
       
   537             }
       
   538         }
       
   539     CleanupStack::PopAndDestroy( ); // rateCountArray
       
   540     __IF_DEBUG(Print(_L("VideoSource[%d]: CVSDataProvider::EnumerateVideoFrameRates() <<"), RThread().Id().operator TUint()));
       
   541     }
       
   542 
       
   543 //  End of File