omxilcomp/omxilgeneric/filesink/src/omxilfilesinkconfigmanager.cpp
changeset 0 58be5850fb6c
equal deleted inserted replaced
-1:000000000000 0:58be5850fb6c
       
     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 "omxilfilesinkconfigmanager.h"
       
    24 #include "omxilfilesinkprocessingfunction.h"
       
    25 #include <openmax/il/common/omxilspecversion.h>
       
    26 
       
    27 COmxILFileSinkConfigManager* COmxILFileSinkConfigManager::NewL(
       
    28                                                             const TDesC8& aComponentName,
       
    29                                                             const OMX_VERSIONTYPE& aComponentVersion,
       
    30                                                             const RPointerArray<TDesC8>& aComponentRoleList,
       
    31                                                             COmxILFileSinkProcessingFunction& aFileSinkPF)
       
    32 	{
       
    33 	COmxILFileSinkConfigManager* self = new(ELeave) COmxILFileSinkConfigManager(aFileSinkPF);
       
    34 	CleanupStack::PushL(self);
       
    35 	self->ConstructL(aComponentName, aComponentVersion, aComponentRoleList);
       
    36 	CleanupStack::Pop(self);
       
    37 	return self;
       
    38 	}
       
    39 
       
    40 COmxILFileSinkConfigManager::COmxILFileSinkConfigManager(COmxILFileSinkProcessingFunction& aFileSinkPF)
       
    41 	: iFileSinkPF(aFileSinkPF)
       
    42 	{
       
    43 	}
       
    44 
       
    45 void COmxILFileSinkConfigManager::ConstructL(
       
    46                                             const TDesC8& aComponentName,
       
    47                                             const OMX_VERSIONTYPE& aComponentVersion,
       
    48                                             const RPointerArray<TDesC8>& aComponentRoleList)
       
    49 	{
       
    50 	COmxILConfigManager::ConstructL(aComponentName, aComponentVersion, aComponentRoleList);
       
    51 	
       
    52 	InsertParamIndexL(OMX_IndexParamContentURI);
       
    53 	}
       
    54 
       
    55 COmxILFileSinkConfigManager::~COmxILFileSinkConfigManager()
       
    56 	{
       
    57 	}
       
    58 	
       
    59 OMX_ERRORTYPE COmxILFileSinkConfigManager::GetParameter(OMX_INDEXTYPE aParamIndex, TAny* aPtr) const
       
    60 	{
       
    61 	TInt index = FindParamIndex(aParamIndex);
       
    62 	if (KErrNotFound == index)
       
    63 		{
       
    64 		return OMX_ErrorUnsupportedIndex;
       
    65 		}
       
    66 		
       
    67 	switch (aParamIndex)
       
    68 		{
       
    69 		case OMX_IndexParamContentURI:
       
    70 			{			
       
    71 			OMX_PARAM_CONTENTURITYPE* param = reinterpret_cast<OMX_PARAM_CONTENTURITYPE*>(aPtr);
       
    72 			const HBufC8* uriData = iFileSinkPF.Uri();
       
    73 			if (!uriData)
       
    74 				{
       
    75 				return OMX_ErrorNotReady;
       
    76 				}
       
    77 			
       
    78 			const OMX_PARAM_CONTENTURITYPE* uri = reinterpret_cast<const OMX_PARAM_CONTENTURITYPE*>(uriData->Ptr());
       
    79 			if (uri->nSize > param->nSize)
       
    80 				{
       
    81 				return OMX_ErrorBadParameter;
       
    82 				}
       
    83 			
       
    84 			// The client's structure is guaranteed to be big enough.
       
    85 			Mem::Copy(param, uri, uri->nSize);
       
    86 			}
       
    87 			break;
       
    88 			
       
    89 		default:
       
    90 			{
       
    91 			return COmxILConfigManager::GetParameter(aParamIndex, aPtr);
       
    92 			}
       
    93 		}
       
    94 
       
    95 	return OMX_ErrorNone;
       
    96 	}
       
    97 
       
    98 OMX_ERRORTYPE COmxILFileSinkConfigManager::SetParameter(OMX_INDEXTYPE aParamIndex, const TAny* aPtr, OMX_BOOL aInitTime)
       
    99 	{
       
   100 	TInt index = FindParamIndex(aParamIndex);
       
   101 	if (KErrNotFound == index)
       
   102 		{
       
   103 		return OMX_ErrorUnsupportedIndex;
       
   104 		}
       
   105 
       
   106 	OMX_ERRORTYPE omxErr = OMX_ErrorNone;
       
   107 	
       
   108 	switch (aParamIndex)
       
   109 		{
       
   110 		case OMX_IndexParamContentURI:
       
   111 			{
       
   112 			if(aInitTime == OMX_TRUE)
       
   113 			    {
       
   114 			    omxErr = iFileSinkPF.ParamIndication(aParamIndex, aPtr);
       
   115 			    }
       
   116 			else
       
   117 			    {
       
   118 			    omxErr = OMX_ErrorUndefined;
       
   119 			    }
       
   120 			break;
       
   121 			}
       
   122 		default:
       
   123 			{
       
   124 			omxErr = COmxILConfigManager::SetParameter(aParamIndex, aPtr, aInitTime);
       
   125 			break;
       
   126 			}
       
   127 		}
       
   128 
       
   129 	return omxErr;
       
   130 	}