epoc32/include/mmf/common/mmfcontrollerpluginresolver.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // mmf\common\mmfcontrollerpluginresolver.h
    15 // 
    16 //
    17 
    18 #ifndef MMF_COMMON_MMFCONTROLLERPLUGINRESOLVER_H
    19 #define MMF_COMMON_MMFCONTROLLERPLUGINRESOLVER_H
    20 
    21 #include <ecom/ecom.h>
    22 #include <e32base.h>
    23 #include <apmstd.h>
    24 
    25 /**
    26 @publishedAll
    27 @released
    28 
    29 Default heap size for the controller thread
    30 */
    31 const TUint KMMFDefaultControllerThreadHeapSize = 0x100000; //1MB
    32 
    33 
    34 class CMMFFormatImplementationInformation;
    35 
    36 /**
    37 @publishedAll
    38 @released
    39 
    40 Array of CMMFFormatImplementationInformation 
    41 */
    42 typedef RPointerArray<CMMFFormatImplementationInformation> RMMFFormatImplInfoArray;
    43 
    44 class CMMFControllerImplementationInformation;
    45 
    46 /**
    47 @publishedAll
    48 @released
    49 
    50 Array of CMMFControllerImplementationInformation 
    51 */
    52 typedef RPointerArray<CMMFControllerImplementationInformation> RMMFControllerImplInfoArray;
    53 
    54 class CMatchData;
    55 
    56 class CDesC8Array;
    57 
    58 /**
    59 @publishedAll
    60 
    61 Abstract class that contains basic information about ECom Multimedia plugins.
    62 
    63 @released
    64 @since 7.0s
    65 */
    66 class CMMFPluginImplementationInformation : public CBase
    67 	{
    68 public:
    69 
    70 	/**
    71 	Returns the uid of this particular plugin implementation.
    72 	This is the UID used to instantiate this multimedia plugin.
    73 
    74 	@return The implementation uid.
    75 
    76 	@since  7.0s
    77 	*/
    78 	IMPORT_C TUid Uid() const;
    79 
    80 	/**
    81 	Returns the display name of this plugin implementation.
    82 
    83 	@return The display name.
    84 
    85 	@since  7.0s
    86 	*/
    87 	IMPORT_C const TDesC& DisplayName() const;
    88 
    89 	/**
    90 	Returns the name of the supplier of this plugin implementation, e.g. "Symbian".
    91 
    92 	@return The plugin supplier.
    93 
    94 	@since  7.0s
    95 	*/
    96 	IMPORT_C const TDesC& Supplier() const;
    97 
    98 	/**
    99 	Returns the version number of this plugin.
   100 
   101 	@return The version number.
   102 
   103 	@since 7.0s
   104 	*/
   105 	IMPORT_C TInt Version() const;
   106 
   107 	/**
   108 	Returns the array of media IDs supported by this plugin.
   109 	
   110 	The media ID can be used by clients to determine whether the plugin supports audio or
   111 	video data (or both). A UID is used for the media ID to provide future extensibility.
   112 
   113 	@return The array of media IDs.
   114 
   115 	@since  7.0s
   116 	*/
   117 	IMPORT_C const RArray<TUid>& SupportedMediaIds() const;
   118 
   119 	/**
   120 	Tests whether this plugin was supplied by aSupplier.
   121 
   122 	@param  aSupplier
   123 	        The required supplier.
   124 
   125 	@return A boolean indicating if this plugin was supplied by aSupplier. ETrue if this plugin was supplied 
   126 	        by aSupplier, EFalse if not.
   127 
   128 	@since 7.0s
   129 	*/
   130 	IMPORT_C TBool SupportsSupplier(const TDesC& aSupplier) const;
   131 
   132 	/**
   133 	Tests whether this plugin supports aMediaId.
   134 
   135 	@param  aMediaId
   136 	        The required media id.
   137 
   138 	@return A boolean indicating if the plugin supports aMediaId. ETrue if this plugin supports aMediaId, EFalse if not.
   139 
   140 	@since 7.0s
   141 	*/
   142 	IMPORT_C TBool SupportsMediaId(TUid aMediaId) const;
   143 
   144 	/**
   145 	Destructor.
   146 	*/
   147 	virtual ~CMMFPluginImplementationInformation();
   148 
   149 protected:
   150 
   151 	/**
   152 	Constructor.
   153 	*/
   154 	CMMFPluginImplementationInformation();
   155 
   156 	/** 
   157 	Sets the supplier. Takes a copy of aData.
   158 	*/
   159 	void SetSupplierL(const TDesC8& aData);
   160 
   161 	/**
   162 	Adds a media id. aData is parsed to find the uid of the media id to be added.
   163 	*/
   164 	void AddMediaIdL(const TDesC8& aData);
   165 	
   166 protected:
   167 
   168 	/** 
   169 	The UID of this plugin. 
   170 	*/
   171 	TUid iUid;
   172 
   173 	/** 
   174 	The display name of this plugin. 
   175 	*/
   176 	HBufC* iDisplayName;
   177 
   178 	/** 
   179 	The supplier of this plugin. 
   180 	*/
   181 	HBufC* iSupplier;
   182 
   183 	/** 
   184 	The version number of this plugin. 
   185 	*/
   186 	TInt iVersion;
   187 
   188 	/**
   189 	The media ids supported by this plugin.
   190 	*/
   191 	RArray<TUid> iMediaIds;
   192 	};
   193 
   194 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
   195 #include <mmf/common/taggeddataparser.h>
   196 #endif
   197 
   198 /**
   199 @publishedAll
   200 
   201 Interface to be implemented by customers of the class TaggedDataParser.
   202 */
   203 class MTaggedDataParserClient
   204 	{
   205 public:
   206 	virtual void ProcessTaggedDataL(const TDesC8& aTag, const TDesC8& aData) = 0;
   207 	};
   208 
   209 /**
   210 @publishedAll
   211 @released
   212 
   213 Contains format support information retrieved from the ECom registry.
   214 
   215 An object of this type may describe either a concrete format plugin (ie a CMMFFormatEncode or a
   216 CMMFFormatDecode implementation) or a format supported by a controller plugin.
   217 
   218 The object is created using a CImplementationInformation object retrieved from the ECom registry.
   219 All relevant data is copied out of the CImplementationInformation object, and its opaque data is
   220 parsed to provide the supplier, supported media ids, supported mime types, supported file extensions,
   221 and supported header data matches.
   222 
   223 Notes for Format Plugin developers:
   224 @code
   225 The opaque data section of the ECom plugin resource file must be in the format:
   226 
   227 opaque_data = "<?>Data 1<?>Data 2<?>Data 3<?>Data 4[...]<?>Data N";
   228 
   229 The <?> preceding the data determines the meaning of the data.  The following are the possible tags:
   230 
   231 	<s> - Supplier
   232 	<i> - Media Id
   233 	<m> - Mime Type
   234 	<e> - File Extension
   235 	<h> - Header Data
   236 	<c> - Custom Interfaces
   237 
   238 UIDs must always be in hex in the format '0x12345678', must include the '0x' and be 10 characters long
   239 @endcode
   240 
   241 @since 7.0s
   242 */
   243 class CMMFFormatImplementationInformation : public CMMFPluginImplementationInformation, MTaggedDataParserClient
   244 	{
   245 public:
   246 	/**
   247 	Constructs a new format implementation information object.
   248 
   249 	@param  aImplInfo
   250 	        The ECOM implementation information
   251 
   252 	@return The new object created.
   253 
   254 	@since 7.0s
   255 	*/
   256 	static CMMFFormatImplementationInformation* NewL(const CImplementationInformation& aImplInfo);
   257 
   258 	/**
   259 	Constructs a new format implementation information object.
   260 
   261 	@param  aImplInfo
   262 	        The ECOM implementation information
   263 
   264 	@return The new object created. Note that this will be on the cleanup stack.
   265 
   266 	@since  7.0s
   267 	*/
   268 	static CMMFFormatImplementationInformation* NewLC(const CImplementationInformation& aImplInfo);
   269 
   270 	/** 
   271 	Destructor 
   272 	*/
   273 	virtual ~CMMFFormatImplementationInformation();
   274 
   275 	/**
   276 	Returns the array of supported file extensions.
   277 
   278 	@return The array of file extensions.
   279 	@since  7.0s
   280 	*/
   281 	IMPORT_C const CDesC8Array& SupportedFileExtensions() const;
   282 
   283 	/**
   284 	Returns the array of supported mime types.
   285 
   286 	@return The array of mime types.
   287 
   288 	@since  7.0s
   289 	*/
   290 	IMPORT_C const CDesC8Array& SupportedMimeTypes() const;
   291 
   292 	/**
   293 	Returns the array of supported header data matches.
   294 
   295 	@return The array of header data.
   296 	@since 7.0s
   297 	*/
   298 	IMPORT_C const CDesC8Array& SupportedHeaderData() const;
   299 
   300 	/**
   301 	Tests whether this format provides support for the specified file extension, aFileExtension.
   302 
   303 	@param  aFileExtension
   304 	        The requested file extension. Must be the extension only, and contain the dot '.'
   305 
   306 	@return A boolean indicating if the specified file extension is supported. ETrue if this format provides 
   307 	        the required support, EFalse if it does not.
   308 
   309 	@since  7.0s
   310 	*/
   311 	IMPORT_C TBool SupportsFileExtension(const TDesC8& aFileExtension) const;
   312 
   313 	/**
   314 	Tests whether this format provides support for aMimeType.
   315 
   316 	@param  aMimeType
   317 	        The requested mime type.
   318 
   319 	@return A boolean indicating if the format is supported. ETrue if this format provides the required support, EFalse if not.
   320 
   321 	@since 7.0s
   322 	*/
   323 	IMPORT_C TBool SupportsMimeType(const TDesC8& aMimeType) const;
   324 
   325 	/**
   326 	Tests whether this format provides support for aHeaderData.
   327 	aHeaderData is searched for each chunk supported by this format.
   328 
   329 	@param	aHeaderData
   330 	        The requested header data.
   331 	        
   332 	@return A boolean indicating if aHeaderData is supported. ETrue if this format provides the required support, EFalse if not.
   333 
   334 	@since  7.0s
   335 	*/
   336 	IMPORT_C TBool SupportsHeaderDataL(const TDesC8& aHeaderData) const;
   337 
   338 	/**
   339 	Tests whether this format provides support for Custom Interfaces.
   340         
   341 	@return A boolean indicating if Custom Interfaces are supported. ETrue if this format provides the required support, EFalse if not.
   342 	*/
   343 	IMPORT_C TBool SupportsCustomInterfaces() const;
   344 
   345 protected:
   346 
   347 	/** 
   348 	Constructor 
   349 	*/
   350 	CMMFFormatImplementationInformation();
   351 
   352 	/** 
   353 	2nd phase constructor 
   354 	*/
   355 	void ConstructL(const CImplementationInformation& aImplInfo);
   356 
   357 	/** 
   358 	Adds a file extension to the array of extensions supported by this format. 
   359 	*/
   360 	void AddFileExtensionL(const TDesC8& aData);
   361 
   362 	/**
   363 	Adds a mime type to the array of types supported by this format.
   364 	*/
   365 	void AddMimeTypeL(const TDesC8& aData);
   366 
   367 	/** 
   368 	Adds a chunk of header data to the array of chunks supported by this format.
   369 	*/
   370 	void AddHeaderDataL(const TDesC8& aData);
   371 
   372 	/** 
   373 	from MTaggedDataParserClient 
   374 	*/
   375 	void ProcessTaggedDataL(const TDesC8& aTag, const TDesC8& aData);
   376 
   377 private:
   378 	class CBody;
   379 	/** 
   380 	CMMFFormatImplementationInformation body
   381 	*/
   382 	CBody* iBody;
   383 	};
   384 
   385 
   386 /**
   387 @publishedAll
   388 @released
   389 
   390 Contains controller plugin information retrieved from the ECom registry.
   391 
   392 The object is created using a CImplementationInformation object retrieved from the ECom registry.
   393 All relevant data is copied out of the CImplementationInformation object, and its opaque data is
   394 parsed to provide the supplier, supported media IDs.
   395 
   396 Notes for Format Plugin developers:
   397 The exact formats supported by the controller plugin are calculated by:
   398 
   399 1. The formats supported by the controller plugin itself must be declared in separate entries in the
   400 controller plugin resource file.  Two interface UIDs should be defined by the plugin writer - one
   401 for the play formats supported, the other for the record formats supported.  The play formats are
   402 then listed as implementations of the play format interface uid, and likewise the record formats.
   403 
   404 2. Format plugins (CMMFFormatEncode and CMMFFormatDecode) declare which controller plugin they
   405 extend.  ECom is search for the format plugins that extend the controller plugin, and they
   406 are added to the list.
   407 
   408 The opaque data section of the ECom plugin resource file must be in the format:
   409 @code
   410 
   411 opaque_data = "<?>Data 1<?>Data 2<?>Data 3<?>Data 4[...]<?>Data N";
   412 
   413 The <?> preceding the data determines the meaning of the data.  The following are the possible tags:
   414 
   415 	<s> - Supplier - must be only one
   416 	<i> - Media Id
   417 	<p> - UID of play format 'interface' - must be only one
   418 	<r> - UID of record format 'interface' - must be only one
   419 
   420 UIDs must always be in hex in the format '0x12345678', must include the '0x' and be 10 characters long.
   421 @endcode
   422 
   423 @since 7.0s
   424 */
   425 class CMMFControllerImplementationInformation : public CMMFPluginImplementationInformation, MTaggedDataParserClient
   426 	{
   427 public:
   428 
   429 	/**
   430 	Constructs a new controller implementation information object.
   431 
   432 	@param  aImplInfo
   433 	        The ECOM implementation information.
   434 
   435 	@return The new object created.
   436 	
   437 	@internalTechnology
   438 
   439 	@since  7.0s
   440 	*/
   441 	static CMMFControllerImplementationInformation* NewL(const CImplementationInformation& aImplInfo);
   442 
   443 	/**
   444 	Constructs a new controller implementation information object.
   445 
   446 	Note: 
   447 	The new object will be on the cleanup stack.
   448 
   449 	@param  aImplInfo
   450 	        The ECOM implementation information
   451 
   452 	@return The new object created.
   453 	
   454 	@internalTechnology
   455 
   456 	@since  7.0s
   457 	*/
   458 	static CMMFControllerImplementationInformation* NewLC(const CImplementationInformation& aImplInfo);
   459 
   460 	/**
   461 	Constructs a new controller implementation information object.
   462 
   463 	@param  aUid
   464 	        The Uid of the controller to obtain controller implementation information
   465 
   466 	@return The new object created.
   467 
   468 	@since  7.0s
   469 	*/
   470 	IMPORT_C static CMMFControllerImplementationInformation* NewL(TUid aUid);
   471 
   472 	/**
   473 	Destructor.
   474 	
   475 	@internalTechnology
   476 	*/
   477 	~CMMFControllerImplementationInformation();
   478 
   479 	/**
   480 	Returns the array of play formats supported by this controller.
   481 
   482 	@return The play formats supported.
   483 
   484 	@since  7.0s
   485 	*/
   486 	IMPORT_C const RMMFFormatImplInfoArray& PlayFormats() const;
   487 
   488 	/**
   489 	Returns the array of record formats supported by this controller.
   490 
   491 	@return The record formats supported.
   492 
   493 	@since  7.0s
   494 	*/
   495 	IMPORT_C const RMMFFormatImplInfoArray& RecordFormats() const;
   496 
   497 	/**
   498 	Returns the heap space required by this controller.
   499 
   500 	@return The heap space required.
   501 
   502 	@since  7.0s
   503 	*/
   504 	IMPORT_C TUint HeapSpaceRequired() const;
   505 
   506 	/**
   507 	Queries the ECom registry for the play formats supported. 
   508 	
   509 	@internalTechnology
   510 	*/
   511 	void GetPlayFormatsL();
   512 
   513 	/** 
   514 	Queries the ECom registry for the record formats supported.
   515 	
   516 	@internalTechnology
   517 	*/
   518 	void GetRecordFormatsL();
   519 	
   520 	/**
   521 	Returns the uri schemes of this plugin.
   522 
   523 	@return The array of uri schemes.
   524 
   525 	@internalTechnology
   526 	*/
   527 	IMPORT_C const CDesC8Array& SupportedUriSchemes() const;
   528 	
   529 	/**
   530 	Tests whether the plugin supports aUriScheme.
   531 	
   532 	@param  aUriScheme
   533 	        The required Uri Scheme.
   534 
   535 	@return A boolean indicating if the plugin supports aUriScheme. ETrue if this plugin supports aUriScheme, EFalse if not.
   536 
   537 	@internalTechnology
   538 	*/
   539 	IMPORT_C TBool SupportsUriScheme(const TDesC8& aUriScheme) const;
   540 	
   541 	/**
   542 	Tests whether the controller plugin supports url
   543 		
   544 	@return A boolean indicating if the plugin supports url. ETrue for uri supporting controller, EFalse if not.
   545 	
   546 	@internalTechnology
   547 	*/
   548 	IMPORT_C TBool SupportsNetworkCapability() const;
   549 	
   550 	/**
   551 	Sets the uri priority of this controller
   552 	
   553 	@param  aUriPriority
   554 	        The Uri priority to be assigned.
   555 	        
   556 	@internalTechnology
   557 	*/
   558 	IMPORT_C void SetUriPriority(TInt aUriPriority);
   559 	
   560 	/**
   561 	Retrieves the uri priority of this controller. 
   562 	Higher priority implies greater number. ie UriPriority() returning 3 
   563 	has higher prioirty than UriPriority() returning 1.
   564 	
   565 	@return  The assigned Uri priority.
   566 	
   567 	@internalTechnology
   568 	*/
   569 	IMPORT_C TInt UriPriority() const;
   570 	
   571 	/**
   572 	Check whether the controller plugin supports secure DRM process mode
   573 		
   574 	@return A boolean indicating if the plugin supports secure DRM process mode. 
   575 	ETrue for secure DRM process mode supporting controller, EFalse if not.
   576 	
   577 	@internalTechnology
   578 	*/
   579 	IMPORT_C TBool SupportsSecureDRMProcessMode() const;
   580 
   581 	/**
   582 	Returns the stack space required by this controller.
   583 
   584 	@return The stack space required.
   585 	
   586 	@internalTechnology
   587 	*/
   588 	IMPORT_C TUint StackSize() const;
   589 	
   590 protected:
   591 
   592 	/**
   593 	Constructor.
   594 	
   595 	@internalTechnology
   596 	*/
   597 	CMMFControllerImplementationInformation();
   598 
   599 	/**
   600 	2nd phase constructor.
   601 	
   602 	@internalTechnology
   603 	*/
   604 	void ConstructL(const CImplementationInformation& aImplInfo);
   605 
   606 	/**
   607 	Parses aData to get the collection UID of the play formats supported by this controller.
   608 	
   609 	@internalTechnology
   610 	*/
   611 	void SetPlayFormatCollectionUidL(const TDesC8& aData);
   612 
   613 	/**
   614 	Parses aData to get the collection UID of the record formats supported by this controller.
   615 	
   616 	@internalTechnology
   617 	*/
   618 	void SetRecordFormatCollectionUidL(const TDesC8& aData);
   619 
   620 	/**
   621 	Parses aData to get the size of the stack the controller requires.
   622 	
   623 	@internalTechnology
   624 	*/
   625 	void SetHeapSizeL(const TDesC8& aData);
   626 
   627 	/**
   628 	From MTaggedDataParserClient.
   629 	*/
   630 	void ProcessTaggedDataL(const TDesC8& aTag, const TDesC8& aData);
   631 
   632 	/**
   633 	Queries the ECom registry for:
   634 		- all registry entries with an interface UID of aFormatCollectionUid
   635 		- all format plugins with an interface UID of aFormatPluginCollectionUid (ie CMMFFormatEncode
   636 		  or CMMFFormatDecode) that have the UID of this controller plugin in the default_data field
   637 		  of their ECom resource file.
   638 
   639 	CMMFFormatImplementationInformation objects are created for each entry returned, and appended to
   640 	aFormatArray.
   641 
   642 	@param  aFormatCollectionUid
   643 	        See above.
   644 	@param  aFormatPluginCollectionUid
   645 	        See above.
   646 	@param  aFormatArray
   647 	        See above.
   648 	        
   649 	@internalTechnology
   650 
   651 	@since  7.0s
   652 	*/
   653 	void GetFormatsL(TUid aFormatCollectionUid, TUid aFormatPluginCollectionUid, RMMFFormatImplInfoArray& aFormatArray);
   654 
   655 	/**
   656 	Creates CMMFFormatImplementationInformation objects for all CImplementationInformation objects
   657 	in aEcomArray.  Any corrupt objects are ignored.  The objects created are added to aFormatArray.
   658 
   659 	@param  aEcomArray
   660 	        See above.
   661 	@param  aFormatArray
   662 	        See above.
   663 	        
   664 	@internalTechnology
   665 
   666 	@since  7.0s
   667 	*/
   668 	void AddFormatsSwallowCorruptL(RImplInfoPtrArray& aEcomArray, RMMFFormatImplInfoArray& aFormatArray);
   669 	
   670 	/**
   671 	Sets the Uri Scheme found in opaque data
   672 	
   673 	@param  aUriScheme
   674 			Gives the uri scheme supported by the controller
   675 	
   676 	@internalTechnology
   677 	*/
   678 	void SetUriSchemeL(const TDesC8& aUriScheme);
   679 	
   680 	/**
   681 	Sets the Network capability found in opaque data
   682 	
   683 	@param  aNetworkCapable
   684 			Declares the incapability to support uri if matches to 'yes'. 
   685 			If this is the case, iIsNetworkCtrl is set to EFalse
   686 	
   687 	@internalTechnology
   688 	*/
   689 	void SetNetworkCapabilityL(const TDesC8& aNetworkCapable);
   690 
   691 	/**
   692 	Parses aData to get the size of the stack the controller requires.
   693 		
   694 	@internalTechnology
   695 	*/
   696 	void SetStackSizeL(const TDesC8& aData);
   697 
   698 
   699 private:
   700 
   701 	/**
   702 	The play formats supported by this controller.
   703 	*/
   704 	RMMFFormatImplInfoArray iPlayFormats;
   705 
   706 	/**
   707 	The record formats supported by this controller.
   708 	*/
   709 	RMMFFormatImplInfoArray iRecordFormats;
   710 
   711 	/**
   712 	The interface uid of the resource file definitions of the play formats supported directly by this controller.
   713 	*/
   714 	TUid iPlayFormatCollectionUid;
   715 
   716 	/**
   717 	The interface uid of the resource file definitions of the record formats supported directly by this controller.
   718 	*/
   719 	TUid iRecordFormatCollectionUid;
   720 	
   721 	/**
   722 	The heap space required by this controller
   723 	*/
   724 	TUint iHeapSpaceRequired;
   725 		
   726 	/**
   727 	The Uri scheme supported by this plugin
   728 	*/
   729 	CDesC8Array* iUriSchemes;
   730 	
   731 	/**
   732 	The uri priority acquired by this controller
   733 	*/
   734 	TInt iUriPriority;  
   735 	
   736 	/**
   737 	The uri support provided by this controller
   738 	*/
   739 	TBool iIsNetworkCtrl;
   740 	
   741 	/**
   742 	Secure DRM process model supported by this controller
   743 	*/
   744 	TBool  iSupportsSecureDRMProcessMode;
   745 	/**
   746 	The stack space required by this controller
   747 	*/
   748 	TUint iStackSize;		
   749 	};
   750 
   751 
   752 /**
   753 @publishedAll
   754 
   755 Contains the parameters used to select mmf plugins from the ECOM registry.
   756 
   757 @released
   758 @since 7.0s
   759 */
   760 class CMMFPluginSelectionParameters : public CBase
   761 	{
   762 public:
   763 
   764 /**
   765 Describes the type of preferred supplier match to be performed on the plugins return from
   766 the ECOM registry.
   767 */
   768 enum TPreferredSupplierMatchType
   769 	{
   770 
   771 	/**	No preferred supplier match will be performed.
   772 	*/
   773 	ENoPreferredSupplierMatch,
   774 
   775 	/** Plugins from all suppliers will be returned, but those from the preferred supplier will be first in the list.
   776 	*/
   777 	EPreferredSupplierPluginsFirstInList,
   778 
   779 	/** Only plugins from the preferred supplier will be returned.
   780 	*/
   781 	EOnlyPreferredSupplierPluginsReturned
   782 	};
   783 /**
   784 Describes the type of media ID match to be performed on the plugins return from
   785 the ECOM registry.
   786 */
   787 enum TMediaIdMatchType
   788 	{
   789 
   790 	/** No media ID match will be performed.
   791 	*/
   792 	ENoMediaIdMatch,
   793 
   794 	/** All plugins that support the media ID supplied will be returned, even those that support
   795 	other media IDs.  For example, if an audio plugin is requested, plugins that support
   796 	audio and video will also be returned.
   797 	*/
   798 	EAllowOtherMediaIds,
   799 
   800 	/** Only plugins that support the exact media IDs supplied will be returned.  For example, if an
   801 	audio plugin is requested, plugins that only support audio will be returned
   802 	(ie. no audio/video plugins).
   803 	*/
   804 	EAllowOnlySuppliedMediaIds
   805 	};
   806 
   807 public:
   808 
   809 	/**
   810 	Destructor.  Resets and destroys all member data.
   811 
   812 	@since 7.0s
   813 	*/
   814 	virtual ~CMMFPluginSelectionParameters();
   815 
   816 
   817 	/**
   818 	Sets the preferred supplier of the plugin.
   819 
   820 	@param  aPreferredSupplier
   821 	        The preferred supplier of the plugin.
   822 	@param  aMatchType
   823 	        The type of match to be made.
   824 
   825 	@since  7.0s
   826 	*/
   827 	IMPORT_C void SetPreferredSupplierL(const TDesC& aPreferredSupplier, TPreferredSupplierMatchType aMatchType);
   828 
   829 	/**
   830 	Sets the media IDs that must be supported by the plugin, for example audio, video etc.
   831 
   832 	@param  aMediaIds
   833 	        An array of the media IDs that the selected plugins must support.
   834 	@param  aMatchType
   835 	        The type of match to be made.
   836 
   837 	@since  7.0s
   838 	*/
   839 	IMPORT_C void SetMediaIdsL(const RArray<TUid>& aMediaIds, TMediaIdMatchType aMatchType);
   840 
   841 	/**
   842 	Returns the preferred supplier.  If no preferred supplier has been set, a blank 
   843 	string will be returned.
   844 	
   845 	@return The preferred supplier
   846 	@since 7.0s
   847 	*/
   848 	IMPORT_C const TDesC& PreferredSupplier() const;
   849 
   850 	/**
   851 	Returns the type of preferred supplier match to perform.
   852 
   853 	@return The preferred supplier match type.
   854 	@since 7.0s
   855 	*/
   856 	IMPORT_C TPreferredSupplierMatchType PreferredSupplierMatchType() const;
   857 
   858 	/**
   859 	Returns the list of media IDs that must be supported by the plugin.
   860 
   861 	@return The list of media IDs.
   862 
   863 	@since	7.0s
   864 	*/
   865 	IMPORT_C const RArray<TUid>& MediaIds() const;
   866 
   867 	/**
   868 	Returns the type of preferred supplier match to perform.
   869 	
   870 	@return The preferred supplier match type.
   871 
   872 	@since 7.0s
   873 	*/
   874 	IMPORT_C TMediaIdMatchType MediaIdMatchType() const;
   875 
   876 	/**
   877 	Returns the uid of the interface to be searched for plugin matches.
   878 
   879 	@return The interface uid.
   880 
   881 	@since 7.0s
   882 	*/
   883 	IMPORT_C TUid InterfaceUid() const;
   884 
   885 protected:
   886 
   887 	/**
   888 	Protected constructor.
   889 
   890 	Defaults to setting the TPreferredSupplierMatchType enum to ENoPreferredSupplierMatch and TMediaIdMatchType
   891 	to ENoMediaIdMatch.
   892 
   893 	@param  aPluginInterfaceUid
   894 	        The plugin's interface UID.
   895 	*/
   896 	CMMFPluginSelectionParameters(TUid aPluginInterfaceUid);
   897 
   898 	/**
   899 	Tests whether the specified media is supported by the plugin.
   900 
   901 	@param  aPlugin
   902 	        The media to test.
   903 
   904 	@return A boolean indicating if the specified media is supported by the plugin. ETrue if the specified 
   905 	        media is supported by the plugin. EFalse if the specified media is not supported by the plugin.
   906 	*/
   907 	TBool CheckMediaIdSupportL(const CMMFPluginImplementationInformation& aPlugin) const;
   908 private:
   909 	TUid iPluginInterfaceUid;
   910 	HBufC* iPreferredSupplier;
   911 	TPreferredSupplierMatchType iPreferredSupplierMatchType;
   912 	RArray<TUid> iMediaIds;
   913 	TMediaIdMatchType iMediaIdMatchType;
   914 	};
   915 
   916 /**
   917 @publishedAll
   918 
   919 Defines the format support required.
   920 
   921 On construction, the selection parameters are blank, causing all plugins to be returned.
   922 
   923 @released
   924 @since 7.0s
   925 */
   926 class CMMFFormatSelectionParameters : public CBase
   927 	{
   928 public:
   929 /**
   930 Describes the type of match to be performed.
   931 The match types are mutually exclusive.
   932 */
   933 enum TMatchDataType
   934 	{
   935 
   936 	/** All plugins will be selected. This is the default option.
   937 	*/
   938 	EMatchAny,
   939 
   940 	/** The match will be based on a file extension.
   941 	*/
   942 	EMatchFileExtension,
   943 
   944 	/** The match will be based on a mime type.
   945 	*/
   946 	EMatchMimeType,
   947 
   948 	/** The match will be based on a header data.
   949 	*/
   950 	EMatchHeaderData,
   951 	
   952 	/** 
   953 	@publishedPartner
   954 	@released
   955 	
   956 	The match will be based on Uri details.
   957 	*/
   958 	EMatchUri
   959 	};
   960 
   961 public:
   962 	
   963 	/**
   964 	Allocates and constructs a new format selection parameter object with blank parameters.
   965 
   966 	Calls NewLC().
   967 
   968 	@return A new format selection parameter object.
   969 	*/
   970 	IMPORT_C static CMMFFormatSelectionParameters* NewL();
   971 
   972 	/**
   973     Allocates and constructs a new format selection parameter object with blank parameters, placing it on the 
   974 	cleanup stack.
   975 
   976 	@return A new format selection parameter object.
   977 	*/
   978 	IMPORT_C static CMMFFormatSelectionParameters* NewLC();
   979 
   980 	/**
   981 	Allocates and constructs a new format selection parameter object with the specified parameters.
   982 
   983 	@param  aParams
   984 	        The required parameters.
   985 	@return A new format selection parameter object.
   986 	*/
   987 	static CMMFFormatSelectionParameters* NewL(const CMMFFormatSelectionParameters& aParams);
   988 
   989 	/**
   990 	Sets this object to match to a file extension.
   991 
   992 	aFileName can be a full filename or just an extension.  If there is no dot in the filename
   993 	and it is 5 characters or less in length then it is assumed to be an extension.  If the first
   994 	character of the filename is a dot, it assumed to be an extension.  Otherwise, the filename
   995 	is parsed using TParse to reveal the extension.
   996 
   997 	Once the extension has been extracted, it is converted from unicode to utf8 and copied into
   998 	iMatchData.
   999 
  1000 	@param  aFileName
  1001 	        The file name to be matched.  Must include the extension.
  1002 
  1003 	@since  7.0s
  1004 	*/
  1005 	IMPORT_C void SetMatchToFileNameL(const TDesC& aFileName);
  1006 
  1007 	/**
  1008 	Sets this object to match to a file extension specified by a URI
  1009 
  1010 	Once the extension has been extracted, it is copied into iMatchData.
  1011 
  1012    	@param  aUri
  1013 	        The URI containing the file name to be matched.  Must include the extension.
  1014 
  1015 	@since  7.0s
  1016 	*/
  1017 	IMPORT_C void SetMatchToUriL(const TDesC& aUri);
  1018 	
  1019 	/**
  1020 	@publishedPartner
  1021 	@released
  1022 	
  1023 	Sets this object to match to uri scheme and file extension specified by a URI.
  1024 	
  1025 	The Uri scheme and extension are saved in iMatchReqData. Further,iMatchData contains uri extension, 
  1026 	iMatchUriScheme contains uri scheme.
  1027 
  1028 	@param  aUri
  1029 	        The URI containing the scheme and uri extension to be matched. 
  1030 
  1031 	*/
  1032 	IMPORT_C void SetMatchToUriSupportL(const TDesC& aUri);
  1033 	
  1034 	/**
  1035 	Sets this object to match to a MIME type.
  1036 	
  1037 	@param  aMimeType
  1038 	        The mime type to match.
  1039 
  1040 	@since  7.0s
  1041 	*/
  1042 	IMPORT_C void SetMatchToMimeTypeL(const TDesC8& aMimeType);
  1043 
  1044 	/**
  1045 	Sets this object to match to a pattern in header data.
  1046 	
  1047 	@param  aHeaderData
  1048 	        The header of the file in question.  This header data will be matched
  1049 	        against the match patterns provided by the plugins.
  1050 
  1051 	@since  7.0s
  1052 	*/
  1053 	IMPORT_C void SetMatchToHeaderDataL(const TDesC8& aHeaderData);
  1054 
  1055 	/**
  1056 	Returns the data used to perform the plugin match.
  1057 	
  1058 	@return The match data.
  1059 
  1060 	@since  7.0s
  1061 	*/
  1062 	IMPORT_C const TDesC8& MatchData() const;
  1063 	
  1064 	/**
  1065 	@publishedPartner
  1066 	@released
  1067 	
  1068 	Returns the uri scheme used to perform the plugin match.
  1069 	
  1070 	@return The uri scheme.
  1071 
  1072 	*/
  1073 	IMPORT_C const TDesC8& MatchUriScheme() const;
  1074 
  1075 	/**
  1076 	Returns the type of the data used to perform the plugin match.
  1077 
  1078 	@return The match data type.
  1079 
  1080 	@since  7.0s
  1081 	*/
  1082 	IMPORT_C TMatchDataType MatchDataType() const;
  1083 	
  1084 	/**
  1085 	Destructor.
  1086 	*/
  1087 	virtual ~CMMFFormatSelectionParameters();
  1088 protected:
  1089 
  1090 	/**
  1091 	Protected constructor.
  1092 	*/
  1093 	CMMFFormatSelectionParameters();
  1094 	void ConstructL(const CMMFFormatSelectionParameters& aParams);
  1095 
  1096 private:
  1097 	CMatchData* iMatchReqData;
  1098 	TMatchDataType iMatchDataType;
  1099 	};
  1100 
  1101 
  1102 
  1103 /**
  1104 @publishedAll
  1105 @released
  1106 
  1107 Contains the parameters used to select controller plugins from the ECOM registry.
  1108 
  1109 @since  7.0s
  1110 */
  1111 class CMMFControllerPluginSelectionParameters : public CMMFPluginSelectionParameters
  1112 	{
  1113 public:
  1114 
  1115 	/**
  1116 	Constructs a new controller selection parameters object.
  1117 
  1118 	@return The new object created.
  1119 
  1120 	@since  7.0s
  1121 	*/
  1122 	IMPORT_C static CMMFControllerPluginSelectionParameters* NewL();
  1123 
  1124 	/**
  1125 	Construct a new controller selection parameters object.
  1126 	
  1127 	@return The new object created.  Note that the new object will be left on the cleanup stack.
  1128 
  1129 	@since  7.0s
  1130 	*/
  1131 	IMPORT_C static CMMFControllerPluginSelectionParameters* NewLC();
  1132 
  1133 	/**
  1134 	Sets the play format support required.
  1135 
  1136 	Note:
  1137 	The play formats supported by the controller plugins will only be retrieved if
  1138 	this method is called.  To get all the play formats supported by the system, call this
  1139 	with a 'blank' CMMFFormatSelectionParameters object.
  1140 
  1141 	@param  aRequiredSupport
  1142 	        The play format support required.
  1143 
  1144 	@since  7.0s
  1145 	*/
  1146 	IMPORT_C void SetRequiredPlayFormatSupportL(const CMMFFormatSelectionParameters& aRequiredSupport);
  1147 
  1148 	/**
  1149 	Sets the record format support required.
  1150 
  1151 	Note:
  1152 	The record formats supported by the controller plugins will only be retrieved if
  1153 	this method is called.  To get all the record formats supported by the system, call this
  1154 	with a 'blank' CMMFFormatSelectionParameters object.
  1155 
  1156 	@param  aRequiredSupport
  1157 	        The record format support required.
  1158 
  1159 	@return The new object created.
  1160 
  1161 	@since  7.0s
  1162 	*/
  1163 	IMPORT_C void SetRequiredRecordFormatSupportL(const CMMFFormatSelectionParameters& aRequiredSupport);
  1164 
  1165 	/**
  1166 	Retrieves all controller plugins that support the requirements of the caller.
  1167 
  1168 	@param  aImplementations	
  1169 	        After this method returns, this array will contain all the
  1170 	        controller plugins that support the caller's requirements.
  1171 	        Note: The array will be emptied by this method.
  1172 
  1173 	@since  7.0s
  1174 	*/
  1175 	IMPORT_C virtual void ListImplementationsL(RMMFControllerImplInfoArray& aImplementations) const;
  1176 	
  1177 	/** 
  1178 	Destructor
  1179 	*/
  1180 	virtual ~CMMFControllerPluginSelectionParameters();
  1181 protected:
  1182 	CMMFControllerPluginSelectionParameters();
  1183 	void MatchImplementationToSelectParamsL(RMMFControllerImplInfoArray& aImplementations, const CMMFControllerImplementationInformation& aPlugin, TInt& aArrayPos) const;
  1184 	TInt CheckPreferredSupplierL(RMMFControllerImplInfoArray& aImplementations, const CMMFControllerImplementationInformation& aPlugin) const;
  1185 	TBool CheckFormatSupportL(CMMFFormatSelectionParameters* aSelectParams, const RMMFFormatImplInfoArray& aFormats) const;
  1186 	/**
  1187 	Checks the given Controller for uri support. Uri support may be there 
  1188 	if either requiredscheme or extension matches with that given controller
  1189 	
  1190 	@param  aSelectParams 
  1191 			Describes the selection parameter which a controller needs to 
  1192 			support in order to be selected
  1193 			
  1194 	@param	aPlugin
  1195 			The controller plugin which is checked for uri support 
  1196 			
  1197 	@param	aFormats
  1198 			The play or record formats looked for extension match
  1199 	*/
  1200 	TBool CheckUriSupport(CMMFFormatSelectionParameters* aSelectParams, CMMFControllerImplementationInformation* aPlugin, const RMMFFormatImplInfoArray& aFormats) const;
  1201 
  1202 protected:
  1203 	/**
  1204 	The required play format support
  1205 	*/
  1206 	CMMFFormatSelectionParameters* iRequiredPlayFormatSupport;
  1207 	
  1208 	/**
  1209 	The required record format support
  1210 	*/
  1211 	CMMFFormatSelectionParameters* iRequiredRecordFormatSupport;
  1212 	};
  1213 
  1214 /**
  1215 @publishedAll
  1216 @released
  1217 
  1218 Contains the parameters used to select controller plugins which support SecureDRM model 
  1219 from the ECOM registry. Controller plugins which support SecureDRM model allow play back of DRM-protected
  1220 content by client processes without DRM capability. In such case the controller will be loaded in a separate secure DRM process.
  1221 */
  1222 class CMMFControllerSecureDrmPluginSelectionParameters : public CMMFControllerPluginSelectionParameters
  1223 	{
  1224 
  1225 public:
  1226 	/**
  1227 	Constructs a new controller selection parameters object.
  1228 
  1229 	@return The new object created.
  1230 	*/
  1231 	IMPORT_C static CMMFControllerSecureDrmPluginSelectionParameters* NewL();
  1232 
  1233 	/**
  1234 	Construct a new controller selection parameters object.
  1235 	
  1236 	@return The new object created.  Note that the new object will be left on the cleanup stack.
  1237 	*/
  1238 	IMPORT_C static CMMFControllerSecureDrmPluginSelectionParameters* NewLC();
  1239 	
  1240 	/**
  1241 	Retrieves all controller plugins that support SecureDRM model and the requirements of the caller.
  1242 
  1243 	@param  aImplementations	
  1244 	        After this method returns, this array will contain all the
  1245 	        controller plugins that support the caller's requirements.
  1246 	        Note: The array will be emptied by this method and SecureDRM model.
  1247 	*/
  1248 	IMPORT_C virtual void ListImplementationsL(RMMFControllerImplInfoArray& aImplementations) const;
  1249 
  1250 	/** 
  1251 	Destructor
  1252 	*/
  1253 	virtual ~CMMFControllerSecureDrmPluginSelectionParameters() {};
  1254 protected:
  1255 	CMMFControllerSecureDrmPluginSelectionParameters();
  1256 	};
  1257 
  1258 /**
  1259 @publishedAll
  1260 @released
  1261 
  1262 Abstract class used to contain the parameters used to select format plugins from the ECOM registry.
  1263 
  1264 Note: 
  1265 The classes CMMFFormatEncodePluginSelectionParamters and CMMFFormatDecodePluginSelectionParameters
  1266 should be used to list and select format plugin implementations.
  1267 
  1268 @since  7.0s
  1269 */
  1270 class CMMFFormatPluginSelectionParameters : public CMMFPluginSelectionParameters
  1271 	{
  1272 public:
  1273 
  1274 	/**
  1275 	Retrieves all format plugins that support the requirements of the caller.
  1276 
  1277 	@param  aImplementations
  1278 	        After this function returns, this array will contain all the
  1279 	        format plugins that support the caller's requirements.
  1280 	        Note: The array will be emptied by this method.
  1281 
  1282 	@since  7.0s
  1283 	*/
  1284 	IMPORT_C void ListImplementationsL(RMMFFormatImplInfoArray& aImplementations) const;
  1285 
  1286 	/**
  1287 	Sets the format support required.
  1288 
  1289 	@param  aRequiredSupport
  1290 	        The format support required.
  1291 
  1292 	@since  7.0s
  1293 	*/
  1294 	IMPORT_C void SetRequiredFormatSupportL(const CMMFFormatSelectionParameters& aRequiredSupport);
  1295 
  1296 	/**
  1297 	Destructor.
  1298 	*/
  1299 	virtual ~CMMFFormatPluginSelectionParameters();
  1300 protected:
  1301 	/**
  1302 	Protected constructor.
  1303 	*/
  1304 	CMMFFormatPluginSelectionParameters(TUid aInterfaceUid);
  1305 
  1306 	void MatchImplementationToSelectParamsL(RMMFFormatImplInfoArray& aImplementations, const CMMFFormatImplementationInformation& aPlugin, TInt& aArrayPos) const;
  1307 	TInt CheckPreferredSupplierL(RMMFFormatImplInfoArray& aImplementations, const CMMFFormatImplementationInformation& aPlugin) const;
  1308 	TBool CheckFormatSupportL(const CMMFFormatImplementationInformation& aPlugin) const;
  1309 protected:
  1310 	/**
  1311 	The format support required
  1312 	*/
  1313 	CMMFFormatSelectionParameters* iRequiredFormatSupport;
  1314 	};
  1315 
  1316 /**
  1317 @publishedAll
  1318 @released
  1319 
  1320 Class used to list and select plugins implementing the CMMFFormatEncode interface.
  1321 
  1322 @since 7.0s
  1323 */
  1324 class CMMFFormatEncodePluginSelectionParameters : public CMMFFormatPluginSelectionParameters
  1325 	{
  1326 public:
  1327 
  1328 	/**
  1329 	Construct a new format encode selection parameters object.
  1330 	
  1331 	@return The new object created.
  1332 
  1333 	@since  7.0s
  1334 	*/
  1335 	IMPORT_C static CMMFFormatEncodePluginSelectionParameters* NewL();
  1336 
  1337 	/**
  1338 	Constructs a new format encode selection parameters object.
  1339 
  1340 	@return The new object created.  Note that the new object will be left on the cleanup stack.
  1341 
  1342 	@since  7.0s
  1343 	*/
  1344 	IMPORT_C static CMMFFormatEncodePluginSelectionParameters* NewLC();
  1345 protected:
  1346 	/**
  1347 	Protected constructor.
  1348 	*/
  1349 	CMMFFormatEncodePluginSelectionParameters();
  1350 	};
  1351 
  1352 
  1353 /**
  1354 @publishedAll
  1355 @released
  1356 
  1357 Class used to list and select plugins implementing the CMMFFormatDecode interface.
  1358 
  1359 @since 7.0s
  1360 */
  1361 class CMMFFormatDecodePluginSelectionParameters : public CMMFFormatPluginSelectionParameters
  1362 	{
  1363 public:
  1364 
  1365 	/**
  1366 	Constructs a new format decode selection parameters object.
  1367 
  1368 	@return The new object created.
  1369 	
  1370 	@since  7.0s
  1371 	*/
  1372 	IMPORT_C static CMMFFormatDecodePluginSelectionParameters* NewL();
  1373 
  1374 	/**
  1375 	Constructs a new format decode selection parameters object.
  1376 
  1377 	@return The new object created. Note that the new object will be left on the cleanup stack.
  1378 
  1379 	@since  7.0s
  1380 	*/
  1381 	IMPORT_C static CMMFFormatDecodePluginSelectionParameters* NewLC();
  1382 protected:
  1383 	/**
  1384 	Protected constructor.
  1385 	*/
  1386 	CMMFFormatDecodePluginSelectionParameters();
  1387 	};
  1388 
  1389 
  1390 
  1391 /** 
  1392 @publishedAll
  1393 @released
  1394 
  1395 Template class CleanupResetAndDestroy to clean up the array
  1396 of implementation information from the cleanup stack.
  1397 */
  1398 
  1399 template <class T>
  1400 class CleanupResetAndDestroy
  1401 	{
  1402 public:
  1403 	/**
  1404 	Puts an item on the cleanup stack.
  1405 
  1406 	@param  aRef 
  1407 	        The implementation information to be put on the cleanup stack.
  1408 	*/
  1409 	inline static void PushL(T& aRef);
  1410 private:
  1411 	static void ResetAndDestroy(TAny *aPtr);
  1412 	};
  1413 template <class T>
  1414 inline void CleanupResetAndDestroyPushL(T& aRef);
  1415 template <class T>
  1416 inline void CleanupResetAndDestroy<T>::PushL(T& aRef)
  1417 	{CleanupStack::PushL(TCleanupItem(&ResetAndDestroy,&aRef));}
  1418 template <class T>
  1419 void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr)
  1420 	{(STATIC_CAST(T*,aPtr))->ResetAndDestroy();}
  1421 template <class T>
  1422 inline void CleanupResetAndDestroyPushL(T& aRef)
  1423 	{CleanupResetAndDestroy<T>::PushL(aRef);}
  1424 
  1425 
  1426 #endif