omxil/generic/omxilfilesource/src/omxilfilesourceconfigmanager.cpp
branchOpenMAX-IL_SHAI
changeset 16 eedf2dcd43c6
equal deleted inserted replaced
15:c1e808730d6c 16:eedf2dcd43c6
       
     1 // Copyright (c) 2008-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 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  * @file
       
    20  * @internalTechnology
       
    21  */
       
    22 
       
    23 #include "omxilfilesourceconfigmanager.h"
       
    24 #include "omxilfilesourceprocessingfunction.h"
       
    25 #include "omxilspecversion.h"
       
    26 
       
    27 COmxILFileSourceConfigManager* COmxILFileSourceConfigManager::NewL(
       
    28                                         MOmxILPortManagerIf& aPortManager,
       
    29                                         const TDesC8& aComponentName,
       
    30                                         const OMX_VERSIONTYPE& aComponentVersion,
       
    31                                         const RPointerArray<TDesC8>& aComponentRoleList,
       
    32                                         COmxILFileSourceProcessingFunction& aFileSourcePF)
       
    33 	{
       
    34 	COmxILFileSourceConfigManager* self = new(ELeave) COmxILFileSourceConfigManager(aPortManager, aFileSourcePF);
       
    35 	CleanupStack::PushL(self);
       
    36 	self->ConstructL(aComponentName, aComponentVersion, aComponentRoleList);
       
    37 	CleanupStack::Pop(self);
       
    38 	return self;
       
    39 	}
       
    40 
       
    41 COmxILFileSourceConfigManager::COmxILFileSourceConfigManager(MOmxILPortManagerIf& aPortManager, COmxILFileSourceProcessingFunction& aFileSourcePF)
       
    42 	:COmxILConfigManager(aPortManager),
       
    43 	iFileSourcePF(aFileSourcePF)
       
    44 	{
       
    45 	}
       
    46 
       
    47 void COmxILFileSourceConfigManager::ConstructL(
       
    48                                     const TDesC8& aComponentName,
       
    49                                     const OMX_VERSIONTYPE& aComponentVersion,
       
    50                                     const RPointerArray<TDesC8>& aComponentRoleList)
       
    51 	{
       
    52 	COmxILConfigManager::ConstructL(aComponentName, aComponentVersion, aComponentRoleList);
       
    53 	
       
    54 	InsertParamIndexL(OMX_IndexParamContentURI);
       
    55 	}
       
    56 
       
    57 COmxILFileSourceConfigManager::~COmxILFileSourceConfigManager()
       
    58 	{
       
    59 	}
       
    60 
       
    61 OMX_ERRORTYPE COmxILFileSourceConfigManager::GetParameter(OMX_INDEXTYPE aParamIndex, TAny* aPtr) const
       
    62 	{
       
    63 	TInt index = FindParamIndex(aParamIndex);
       
    64 	if (KErrNotFound == index)
       
    65 		{
       
    66 		return OMX_ErrorUnsupportedIndex;
       
    67 		}
       
    68 		
       
    69 	switch (aParamIndex)
       
    70 		{
       
    71 		case OMX_IndexParamContentURI:
       
    72 			{			
       
    73 			OMX_PARAM_CONTENTURITYPE* param = reinterpret_cast<OMX_PARAM_CONTENTURITYPE*>(aPtr);
       
    74 			const HBufC8* uriData = iFileSourcePF.Uri();
       
    75 			if (!uriData)
       
    76 				{
       
    77 				return OMX_ErrorNotReady;
       
    78 				}
       
    79 			
       
    80 			const OMX_PARAM_CONTENTURITYPE* uri = reinterpret_cast<const OMX_PARAM_CONTENTURITYPE*>(uriData->Ptr());
       
    81 			if (uri->nSize > param->nSize)
       
    82 				{
       
    83 				return OMX_ErrorBadParameter;
       
    84 				}
       
    85 			
       
    86 			// The client's structure is guaranteed to be big enough.
       
    87 			Mem::Copy(param, uri, uri->nSize);            
       
    88 			}
       
    89 			break;
       
    90 			
       
    91 		default:
       
    92 			{
       
    93 			return COmxILConfigManager::GetParameter(aParamIndex, aPtr);
       
    94 			}
       
    95 		}
       
    96 
       
    97 	return OMX_ErrorNone;
       
    98 	}
       
    99 
       
   100 OMX_ERRORTYPE COmxILFileSourceConfigManager::SetParameter(OMX_INDEXTYPE aParamIndex, const TAny* aPtr, OMX_BOOL aInitTime)
       
   101 	{
       
   102 	TInt index = FindParamIndex(aParamIndex);
       
   103 	if (KErrNotFound == index)
       
   104 		{
       
   105 		return OMX_ErrorUnsupportedIndex;
       
   106 		}
       
   107 
       
   108 	OMX_ERRORTYPE omxErr = OMX_ErrorNone;
       
   109 	
       
   110 	switch (aParamIndex)
       
   111 		{
       
   112 		case OMX_IndexParamContentURI:
       
   113 			{
       
   114 			omxErr = iFileSourcePF.ParamIndication(aParamIndex, aPtr);
       
   115 			break;
       
   116 			}
       
   117 		default:
       
   118 			{
       
   119 			omxErr = COmxILConfigManager::SetParameter(aParamIndex, aPtr, aInitTime);
       
   120 			break;
       
   121 			}
       
   122 		}
       
   123 
       
   124 	return omxErr;
       
   125 	}