os/mm/mmlibs/mmfw/tsrc/mmvalidationsuite/mmvalidationsuiteagents/src/agentsutility.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Part of the MVS Agents for TechView
sl@0
    15
//
sl@0
    16
sl@0
    17
#include "agentsutility.h"
sl@0
    18
#include <e32def.h>
sl@0
    19
const TInt KMaxHeaderSize = 256;
sl@0
    20
sl@0
    21
//CMVSControllerPluginInfo methods
sl@0
    22
sl@0
    23
/**
sl@0
    24
Constructs and initialises a new instance of the controller plugin information class.
sl@0
    25
sl@0
    26
The function leaves if the controller plugin information object cannot be created.
sl@0
    27
sl@0
    28
No callback notification is made upon completion of NewL().
sl@0
    29
sl@0
    30
@return A pointer to the new controller plugin information object.
sl@0
    31
sl@0
    32
*/
sl@0
    33
EXPORT_C CMVSControllerPluginInfo* CMVSControllerPluginInfo::NewL()
sl@0
    34
	{
sl@0
    35
    CMVSControllerPluginInfo* self = new(ELeave) CMVSControllerPluginInfo();
sl@0
    36
    CleanupStack::PushL(self);
sl@0
    37
    self->ConstructL();
sl@0
    38
    CleanupStack::Pop(self);
sl@0
    39
    return self;
sl@0
    40
    }
sl@0
    41
sl@0
    42
sl@0
    43
void CMVSControllerPluginInfo::ConstructL()
sl@0
    44
	{
sl@0
    45
    TInt err = KErrNone;
sl@0
    46
    CMMFControllerPluginSelectionParameters* cSelect=NULL;
sl@0
    47
    CMMFFormatSelectionParameters* fSelect=NULL;
sl@0
    48
    User::LeaveIfError(iFileLogger.Connect());
sl@0
    49
    iFileLogger.CreateLog(_L("LogMVSappUi"),_L("LogFile.txt"),EFileLoggingModeAppend);    
sl@0
    50
    cSelect =  CMMFControllerPluginSelectionParameters::NewLC();
sl@0
    51
    RArray<TUid> mediaIds; //search for both audio and video
sl@0
    52
	TRAP(err, mediaIds.Append(KUidMediaTypeAudio));
sl@0
    53
    TRAP(err, mediaIds.Append(KUidMediaTypeVideo));
sl@0
    54
    
sl@0
    55
    TRAP(err, cSelect->SetMediaIdsL(mediaIds,
sl@0
    56
         CMMFPluginSelectionParameters::EAllowOtherMediaIds));
sl@0
    57
    mediaIds.Close(); 
sl@0
    58
	
sl@0
    59
	fSelect = CMMFFormatSelectionParameters::NewLC();
sl@0
    60
	   
sl@0
    61
    TRAP(err, {
sl@0
    62
              cSelect->SetRequiredRecordFormatSupportL(*fSelect);
sl@0
    63
	          //Populate the controllers array
sl@0
    64
	          cSelect->ListImplementationsL(iControllers);
sl@0
    65
              });
sl@0
    66
	CleanupStack::PopAndDestroy(2);
sl@0
    67
    
sl@0
    68
    for(TInt count = 0;count < iControllers.Count();count++)
sl@0
    69
     	{
sl@0
    70
    	iUidArray.AppendL(iControllers[count]->Uid());
sl@0
    71
      	}
sl@0
    72
    //During the construction get all the supported controllers,not for a specific extension.
sl@0
    73
    CollectAudioControllersL(NULL); 
sl@0
    74
    CollectVideoControllersL(NULL);
sl@0
    75
    }
sl@0
    76
sl@0
    77
sl@0
    78
void CMVSControllerPluginInfo::CollectAudioControllersL(TDesC* aExt)
sl@0
    79
	{	
sl@0
    80
	TInt err = KErrNone;
sl@0
    81
    CMMFControllerPluginSelectionParameters* cSelect=NULL;
sl@0
    82
    CMMFFormatSelectionParameters* fSelect=NULL;
sl@0
    83
sl@0
    84
    cSelect =  CMMFControllerPluginSelectionParameters::NewLC();
sl@0
    85
    RArray<TUid> mediaIds; //search for audio only
sl@0
    86
	TRAP(err, mediaIds.Append(KUidMediaTypeAudio));
sl@0
    87
    
sl@0
    88
    TRAP(err, cSelect->SetMediaIdsL(mediaIds,
sl@0
    89
         CMMFPluginSelectionParameters::EAllowOnlySuppliedMediaIds));
sl@0
    90
    	
sl@0
    91
    mediaIds.Close(); 
sl@0
    92
	
sl@0
    93
	fSelect = CMMFFormatSelectionParameters::NewLC();
sl@0
    94
    if(aExt!=NULL)
sl@0
    95
    	{
sl@0
    96
     	fSelect->SetMatchToFileNameL(*aExt);	
sl@0
    97
     	}   
sl@0
    98
    TRAP(err, {
sl@0
    99
              cSelect->SetRequiredRecordFormatSupportL(*fSelect);
sl@0
   100
	          //Populate the controllers array
sl@0
   101
	          cSelect->ListImplementationsL(iAudioControllers);
sl@0
   102
              });
sl@0
   103
	
sl@0
   104
	CleanupStack::PopAndDestroy(2);
sl@0
   105
	
sl@0
   106
    for(TInt count = 0;count < iAudioControllers.Count();count++)
sl@0
   107
    	{
sl@0
   108
     	iAudioUidArray.AppendL(iAudioControllers[count]->Uid());
sl@0
   109
      	} 	
sl@0
   110
  	}
sl@0
   111
sl@0
   112
sl@0
   113
sl@0
   114
void CMVSControllerPluginInfo::CollectAudioPlayControllersL(TDesC* aExt)
sl@0
   115
	{	
sl@0
   116
	TInt err = KErrNone;
sl@0
   117
    CMMFFormatSelectionParameters* sSelect=NULL;
sl@0
   118
    CMMFControllerPluginSelectionParameters* pSelect=NULL;
sl@0
   119
    
sl@0
   120
    RArray<TUid> mediaIds; //search for audio only
sl@0
   121
	pSelect =  CMMFControllerPluginSelectionParameters::NewLC();
sl@0
   122
    
sl@0
   123
	TRAP(err, mediaIds.Append(KUidMediaTypeAudio));
sl@0
   124
    
sl@0
   125
    TRAP(err, pSelect->SetMediaIdsL(mediaIds,
sl@0
   126
         CMMFPluginSelectionParameters::EAllowOnlySuppliedMediaIds));
sl@0
   127
    
sl@0
   128
    mediaIds.Close(); 
sl@0
   129
	
sl@0
   130
	sSelect = CMMFFormatSelectionParameters::NewLC();
sl@0
   131
    if(aExt!=NULL)
sl@0
   132
    	{
sl@0
   133
     	sSelect->SetMatchToFileNameL(*aExt);	
sl@0
   134
     	}   
sl@0
   135
    
sl@0
   136
	TRAP(err,{
sl@0
   137
			 pSelect->SetRequiredPlayFormatSupportL(*sSelect);
sl@0
   138
	         //populate the play controllers array
sl@0
   139
	         pSelect->ListImplementationsL(iAudioPlayControllers);	
sl@0
   140
			 });
sl@0
   141
	CleanupStack::PopAndDestroy(2);
sl@0
   142
    
sl@0
   143
    for(TInt count = 0;count < iAudioPlayControllers.Count();count++)
sl@0
   144
    	{
sl@0
   145
     	iAudioPlayUidArray.AppendL(iAudioPlayControllers[count]->Uid());
sl@0
   146
      	} 	
sl@0
   147
    iFileLogger.Write(_L("CollectingAudioControllers "));  	
sl@0
   148
 	}
sl@0
   149
sl@0
   150
sl@0
   151
void CMVSControllerPluginInfo::CollectVideoControllersL(TDesC* aExt)
sl@0
   152
	{
sl@0
   153
	TInt err = KErrNone;
sl@0
   154
    CMMFControllerPluginSelectionParameters* cSelect=NULL;
sl@0
   155
    CMMFFormatSelectionParameters* fSelect=NULL;
sl@0
   156
        
sl@0
   157
    cSelect =  CMMFControllerPluginSelectionParameters::NewLC();
sl@0
   158
    RArray<TUid> mediaIds; //search for audio only
sl@0
   159
	TRAP(err, mediaIds.Append(KUidMediaTypeVideo));
sl@0
   160
    
sl@0
   161
    TRAP(err, cSelect->SetMediaIdsL(mediaIds,
sl@0
   162
         CMMFPluginSelectionParameters::EAllowOtherMediaIds));
sl@0
   163
    mediaIds.Close(); 
sl@0
   164
	
sl@0
   165
	fSelect = CMMFFormatSelectionParameters::NewLC();
sl@0
   166
	if(aExt!=NULL)
sl@0
   167
     	{
sl@0
   168
		fSelect->SetMatchToFileNameL(*aExt);    
sl@0
   169
     	}
sl@0
   170
    TRAP(err, {
sl@0
   171
              cSelect->SetRequiredRecordFormatSupportL(*fSelect);
sl@0
   172
	          //Populate the controllers array
sl@0
   173
	          cSelect->ListImplementationsL(iVideoControllers);
sl@0
   174
              });
sl@0
   175
	
sl@0
   176
	CleanupStack::PopAndDestroy(2);
sl@0
   177
sl@0
   178
    for(TInt count = 0;count < iVideoControllers.Count();count++)
sl@0
   179
    	{
sl@0
   180
     	iVideoUidArray.AppendL(iVideoControllers[count]->Uid());
sl@0
   181
      	}
sl@0
   182
    iFileLogger.Write(_L("CollectingVideoControllers ")) ;
sl@0
   183
	}
sl@0
   184
sl@0
   185
/**
sl@0
   186
Destructor.
sl@0
   187
sl@0
   188
Frees all resources owned by the object prior to its destruction.
sl@0
   189
*/
sl@0
   190
EXPORT_C CMVSControllerPluginInfo::~CMVSControllerPluginInfo()
sl@0
   191
    {
sl@0
   192
    iControllers.ResetAndDestroy();
sl@0
   193
	iControllers.Close();
sl@0
   194
	iSupportedControllers.ResetAndDestroy();
sl@0
   195
	iSupportedControllers.Close();
sl@0
   196
	iAudioControllers.ResetAndDestroy();
sl@0
   197
	iAudioControllers.Close();
sl@0
   198
	iAudioPlayControllers.ResetAndDestroy();
sl@0
   199
	iAudioPlayControllers.Close();
sl@0
   200
	iVideoControllers.ResetAndDestroy();
sl@0
   201
	iVideoControllers.Close();
sl@0
   202
    iUidArray.Close();
sl@0
   203
    iAudioUidArray.Close();
sl@0
   204
    iAudioPlayUidArray.Close();
sl@0
   205
    iVideoUidArray.Close();
sl@0
   206
    if(iFileLogger.Handle())
sl@0
   207
    	{
sl@0
   208
    	iFileLogger.CloseLog();
sl@0
   209
		iFileLogger.Close();
sl@0
   210
    	}
sl@0
   211
    }
sl@0
   212
sl@0
   213
sl@0
   214
CMVSControllerPluginInfo::CMVSControllerPluginInfo()
sl@0
   215
    {
sl@0
   216
    }
sl@0
   217
sl@0
   218
sl@0
   219
/**
sl@0
   220
Fetches an array of all the display names of the 
sl@0
   221
controller plugins existing currently in the system and an array of their Uid's
sl@0
   222
sl@0
   223
The data must be in a supported format (for example, WAV ,OGG or AVI).
sl@0
   224
sl@0
   225
@param	aDisplayNames
sl@0
   226
		This array will contain all the displaynames of the controllers when this method returns.
sl@0
   227
@param 	aUidArray
sl@0
   228
		This array will contain all the Uids when this method returns.
sl@0
   229
sl@0
   230
@return  number of plugins existing in the system.
sl@0
   231
sl@0
   232
*/
sl@0
   233
EXPORT_C TInt CMVSControllerPluginInfo::GetPluginListL(CDesCArrayFlat* aDisplayNames, RArray<TUid>& aUidArray)
sl@0
   234
	{
sl@0
   235
	for(TInt counter = 0;counter < iControllers.Count();counter++)
sl@0
   236
     	{
sl@0
   237
     	aDisplayNames->AppendL(iControllers[counter]->DisplayName());
sl@0
   238
     	aUidArray.Append(iUidArray[counter]);
sl@0
   239
     	}
sl@0
   240
    iFileLogger.Write(_L("Getting the Plugin List"));
sl@0
   241
    return aUidArray.Count();
sl@0
   242
    }
sl@0
   243
 
sl@0
   244
sl@0
   245
/**
sl@0
   246
Fetches an array of all the display names of the 
sl@0
   247
audio controller plugins existing currently in the system and an array of their Uid's
sl@0
   248
sl@0
   249
@param	aDisplayNames
sl@0
   250
		This array will contain all the displaynames of the audio controllers for the specified 
sl@0
   251
		extension, when this method returns.
sl@0
   252
@param 	aUidArray
sl@0
   253
		This array will contain all the corresponding Uids when this method returns.
sl@0
   254
@param  aExt
sl@0
   255
	    The specific extension (for example WAV or OGG) for which the supported controllers is to be retrieved 
sl@0
   256
sl@0
   257
@return number of audio plugins existing in the system.
sl@0
   258
sl@0
   259
*/
sl@0
   260
EXPORT_C TInt CMVSControllerPluginInfo::GetAudioPluginListL(CDesCArrayFlat* aDisplayNames, RArray<TUid>& aUidArray,RArray<TUid>& aUidPlayArray, TDesC* aExt)
sl@0
   261
	{
sl@0
   262
	iAudioControllers.ResetAndDestroy();
sl@0
   263
	iAudioUidArray.Reset();
sl@0
   264
	iAudioPlayControllers.ResetAndDestroy();
sl@0
   265
	iAudioPlayUidArray.Reset();
sl@0
   266
	CollectAudioControllersL(aExt);
sl@0
   267
	CollectAudioPlayControllersL(aExt);
sl@0
   268
	for(TInt counter = 0;counter < iAudioControllers.Count();counter++)
sl@0
   269
    	{
sl@0
   270
     	aDisplayNames->AppendL(iAudioControllers[counter]->DisplayName());
sl@0
   271
     	aUidArray.Append(iAudioUidArray[counter]);
sl@0
   272
     	}
sl@0
   273
    for(TInt counter = 0;counter < iAudioPlayControllers.Count();counter++)
sl@0
   274
     	{
sl@0
   275
      	aUidPlayArray.Append(iAudioPlayUidArray[counter]);
sl@0
   276
     	}
sl@0
   277
    iFileLogger.Write(_L("Getting the Audio Plugin List"));
sl@0
   278
    //Flushing out the existing seleced data and filling in with
sl@0
   279
    //all the audio controllers and corresponding UID's for the next run
sl@0
   280
    iAudioControllers.ResetAndDestroy();
sl@0
   281
	iAudioUidArray.Reset();
sl@0
   282
	iAudioPlayControllers.ResetAndDestroy();
sl@0
   283
	iAudioPlayUidArray.Reset();
sl@0
   284
    iFileLogger.Write(_L("Getting the Video Plugin List"));	
sl@0
   285
    CollectAudioControllersL(NULL);
sl@0
   286
    return aUidArray.Count();
sl@0
   287
	}
sl@0
   288
 
sl@0
   289
sl@0
   290
/**
sl@0
   291
Fetches an array of all the display names of the 
sl@0
   292
video controller plugins existing currently in the system and an array of their Uid's
sl@0
   293
sl@0
   294
@param	aDisplayNames
sl@0
   295
		This array will contain all the displaynames of the video controllers for the specified 
sl@0
   296
		extension, when this method returns.
sl@0
   297
@param 	aUidArray
sl@0
   298
		This array will contain all the corresponding Uids when this method returns.
sl@0
   299
@param  aExt
sl@0
   300
	    The specific extension (for example AVI) for which the supported controllers is to be retrieved.
sl@0
   301
sl@0
   302
@return number of video plugins existing in the system.
sl@0
   303
sl@0
   304
*/
sl@0
   305
EXPORT_C TInt CMVSControllerPluginInfo::GetVideoPluginListL(CDesCArrayFlat* aDisplayNames, RArray<TUid>& aUidArray,TDesC* aExt)
sl@0
   306
	{
sl@0
   307
	iVideoControllers.ResetAndDestroy();
sl@0
   308
	iVideoUidArray.Reset();
sl@0
   309
	CollectVideoControllersL(aExt);
sl@0
   310
	for(TInt counter = 0;counter < iVideoControllers.Count();counter++)
sl@0
   311
     	{
sl@0
   312
     	aDisplayNames->AppendL(iVideoControllers[counter]->DisplayName());
sl@0
   313
     	aUidArray.Append(iVideoUidArray[counter]);
sl@0
   314
     	}
sl@0
   315
    //Flushing out the existing seleced data and filling in with
sl@0
   316
    //all the video controllers and corresponding UID's for the next run
sl@0
   317
    iVideoControllers.ResetAndDestroy();
sl@0
   318
	iVideoUidArray.Reset();
sl@0
   319
    iFileLogger.Write(_L("Getting the Video Plugin List"));	
sl@0
   320
    CollectVideoControllersL(NULL);
sl@0
   321
    return aUidArray.Count();
sl@0
   322
   	}
sl@0
   323
sl@0
   324
sl@0
   325
/**
sl@0
   326
Extracts the list of all the extensions supported. 
sl@0
   327
sl@0
   328
All the supported extensions by the system are retrieved including both audio and video.
sl@0
   329
sl@0
   330
@param	aMediaType
sl@0
   331
		Specifies the media type ie audio/video.
sl@0
   332
@param 	aExtArray
sl@0
   333
		This array will contain all the supported extensions, when this method returns.
sl@0
   334
sl@0
   335
@return number of supported extensions existing in the system.
sl@0
   336
sl@0
   337
*/
sl@0
   338
EXPORT_C TInt CMVSControllerPluginInfo::GetExtensionListL(TBool aMediaType, CDesCArrayFlat* aExtArray)
sl@0
   339
	{
sl@0
   340
	CMMFFormatImplementationInformation* formatInfo;
sl@0
   341
	if(aMediaType)//selected video
sl@0
   342
		{
sl@0
   343
		if(iVideoUidArray.Count())
sl@0
   344
    		{
sl@0
   345
    		for(TInt counter = 0; counter < iVideoUidArray.Count(); counter++)
sl@0
   346
        		{
sl@0
   347
         	  	CMMFControllerImplementationInformation& plugin= *(iVideoControllers[counter]);
sl@0
   348
       			//Collect all supported 'Recording' formats
sl@0
   349
				const RMMFFormatImplInfoArray& recFormatInfo = plugin.RecordFormats();
sl@0
   350
       	 		for(TInt n = 0; n < recFormatInfo.Count(); n++)
sl@0
   351
					{
sl@0
   352
					formatInfo = recFormatInfo[n];
sl@0
   353
					const CDesC8Array& fileExtensions = formatInfo->SupportedFileExtensions();
sl@0
   354
					for(TInt innerCounter = 0;innerCounter < fileExtensions.Count();innerCounter++)
sl@0
   355
						{
sl@0
   356
						TBuf<16> buf;
sl@0
   357
						buf.Zero();
sl@0
   358
						buf.Copy(fileExtensions[innerCounter]);
sl@0
   359
						aExtArray->AppendL(buf);
sl@0
   360
						}
sl@0
   361
					}
sl@0
   362
          		}
sl@0
   363
        	}
sl@0
   364
		}
sl@0
   365
    else
sl@0
   366
    	{
sl@0
   367
    	if(iAudioUidArray.Count())
sl@0
   368
    		{
sl@0
   369
    		for(TInt counter = 0; counter < iAudioUidArray.Count(); counter++)
sl@0
   370
        		{
sl@0
   371
         	    CMMFControllerImplementationInformation& plugin= *(iAudioControllers[counter]);
sl@0
   372
       			//Collect all supported 'Recording' formats
sl@0
   373
				const RMMFFormatImplInfoArray& recFormatInfo = plugin.RecordFormats();
sl@0
   374
       	 		for(TInt n = 0; n < recFormatInfo.Count(); n++)
sl@0
   375
					{
sl@0
   376
					formatInfo = recFormatInfo[n];
sl@0
   377
					const CDesC8Array& fileExtensions = formatInfo->SupportedFileExtensions();
sl@0
   378
					for(TInt innerCounter = 0;innerCounter < fileExtensions.Count();innerCounter++)
sl@0
   379
						{
sl@0
   380
						TBuf<16> buf;
sl@0
   381
						buf.Zero();
sl@0
   382
						buf.Copy(fileExtensions[innerCounter]);
sl@0
   383
						aExtArray->AppendL(buf);
sl@0
   384
						}
sl@0
   385
					}
sl@0
   386
          		}
sl@0
   387
    		}
sl@0
   388
    	}
sl@0
   389
    iFileLogger.Write(_L("Getting the Extension List")); 
sl@0
   390
    return(aExtArray->Count());
sl@0
   391
    }
sl@0
   392
sl@0
   393
sl@0
   394
/**
sl@0
   395
Returns the type of the given media file. Returns NULL Uid if the 
sl@0
   396
	file is not supported by MMF.
sl@0
   397
sl@0
   398
@param	aFile
sl@0
   399
		The name of the media file.
sl@0
   400
		
sl@0
   401
@return	Uid of the media.
sl@0
   402
*/
sl@0
   403
EXPORT_C TUid CMVSControllerPluginInfo::GetMediaTypeL(TDesC& aFile)
sl@0
   404
	{
sl@0
   405
	CMMFControllerPluginSelectionParameters* cSelect=NULL;
sl@0
   406
    CMMFFormatSelectionParameters* fSelect=NULL;
sl@0
   407
    TUid uid=TUid::Null();
sl@0
   408
    
sl@0
   409
    iSupportedControllers.ResetAndDestroy();
sl@0
   410
    iSupportedControllers.Close();
sl@0
   411
    
sl@0
   412
    cSelect =  CMMFControllerPluginSelectionParameters::NewLC();
sl@0
   413
sl@0
   414
	fSelect = CMMFFormatSelectionParameters::NewLC();
sl@0
   415
   	fSelect->SetMatchToFileNameL(aFile);
sl@0
   416
    
sl@0
   417
   cSelect->SetRequiredPlayFormatSupportL(*fSelect);
sl@0
   418
   //Populate the controllers array
sl@0
   419
   cSelect->ListImplementationsL(iSupportedControllers);
sl@0
   420
               
sl@0
   421
	
sl@0
   422
    if(iSupportedControllers.Count())
sl@0
   423
   		{
sl@0
   424
   		//must be sufficient to check with one. not sure if MVS plays midi!
sl@0
   425
   		TBool video = iSupportedControllers[0]->SupportsMediaId(KUidMediaTypeVideo);
sl@0
   426
   		if(video)
sl@0
   427
   			{
sl@0
   428
   			uid=KUidMediaTypeVideo; 
sl@0
   429
   			}
sl@0
   430
   		else
sl@0
   431
   			{
sl@0
   432
   			uid=KUidMediaTypeAudio; 
sl@0
   433
   			}
sl@0
   434
   		CleanupStack::PopAndDestroy(2,cSelect);//fselect, cselect
sl@0
   435
   		}
sl@0
   436
   	else
sl@0
   437
   		{   	
sl@0
   438
	   	//If we are here, file extension has not matched any controller
sl@0
   439
	   	//Try to find controller based on header data
sl@0
   440
	   	HBufC8* headerData = HBufC8::NewLC(KMaxHeaderSize);
sl@0
   441
		TPtr8 headerDataPtr = headerData->Des();
sl@0
   442
					
sl@0
   443
		GetHeaderL(aFile, headerDataPtr);
sl@0
   444
		
sl@0
   445
		fSelect->SetMatchToHeaderDataL(headerDataPtr);
sl@0
   446
		cSelect->SetRequiredPlayFormatSupportL(*fSelect);
sl@0
   447
		//Populate the controllers array
sl@0
   448
		cSelect->ListImplementationsL(iSupportedControllers);
sl@0
   449
	               
sl@0
   450
		if(iSupportedControllers.Count())
sl@0
   451
	   		{
sl@0
   452
	   		TBool video = iSupportedControllers[0]->SupportsMediaId(KUidMediaTypeVideo);
sl@0
   453
	   		if(video)
sl@0
   454
	   			{
sl@0
   455
	   			uid=KUidMediaTypeVideo; 
sl@0
   456
	   			}
sl@0
   457
	   		else 
sl@0
   458
	   			{
sl@0
   459
	   			uid=KUidMediaTypeAudio; 
sl@0
   460
	   			}
sl@0
   461
	   		}
sl@0
   462
		CleanupStack::PopAndDestroy(3,cSelect);//fselect, cselect,headerData
sl@0
   463
   		}
sl@0
   464
    	
sl@0
   465
   	return uid;
sl@0
   466
   	}
sl@0
   467
sl@0
   468
sl@0
   469
/**
sl@0
   470
Returns the controller implementation information associated with the given controller
sl@0
   471
sl@0
   472
@param  aControllerUid
sl@0
   473
        The Uid of the controller plugin
sl@0
   474
sl@0
   475
@return	controller implementation structure 
sl@0
   476
*/
sl@0
   477
EXPORT_C CMMFControllerImplementationInformation& CMVSControllerPluginInfo::GetControllerInfo(TUid aControllerUid)
sl@0
   478
	{
sl@0
   479
    TInt index = -1;
sl@0
   480
    for(TInt counter = 0; counter < iUidArray.Count(); counter++)
sl@0
   481
       	{
sl@0
   482
       	TUid controllerUid = iUidArray[counter];
sl@0
   483
       	if(controllerUid == aControllerUid)
sl@0
   484
       		{
sl@0
   485
       		index = counter;
sl@0
   486
       		}
sl@0
   487
       	}
sl@0
   488
    iFileLogger.Write(_L("Getting the controller info"));  
sl@0
   489
    return *(iControllers[index]);
sl@0
   490
	}
sl@0
   491
sl@0
   492
void CMVSControllerPluginInfo::GetHeaderL(TDesC& aFileName, TDes8& aHeaderData)
sl@0
   493
	{
sl@0
   494
	RFile file;
sl@0
   495
	RFs	fs;
sl@0
   496
			
sl@0
   497
	User::LeaveIfError(fs.Connect());
sl@0
   498
	CleanupClosePushL(fs);
sl@0
   499
	User::LeaveIfError(file.Open(fs, aFileName, EFileShareReadersOnly));
sl@0
   500
	CleanupClosePushL(file);
sl@0
   501
	User::LeaveIfError(file.Read(aHeaderData,KMaxHeaderSize));
sl@0
   502
		
sl@0
   503
	CleanupStack::PopAndDestroy(2,&fs);
sl@0
   504
	}
sl@0
   505