omxil/video/omxilclock/src/comxilclockoutputport.cpp
branchOpenMAX-IL_SHAI
changeset 16 eedf2dcd43c6
equal deleted inserted replaced
15:c1e808730d6c 16:eedf2dcd43c6
       
     1 /*
       
     2 * Copyright (c) 2008-2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 /**
       
    20 @file
       
    21 @internalComponent
       
    22 */
       
    23 
       
    24 #include "comxilclockoutputport.h"
       
    25 #include "comxilclockprocessingfunction.h"
       
    26 #include "clockpanics.h"
       
    27 
       
    28 COmxILClockOutputPort* COmxILClockOutputPort::NewL(const TOmxILCommonPortData& aCommonPortData, const RArray<OMX_OTHER_FORMATTYPE>& aSupportedFormats, COmxILClockProcessingFunction& aProcessingFunction)
       
    29 	{
       
    30 	COmxILClockOutputPort* self = new(ELeave) COmxILClockOutputPort(aCommonPortData, aProcessingFunction);
       
    31 	CleanupStack::PushL(self);
       
    32 	self->ConstructL(aSupportedFormats);
       
    33 	CleanupStack::Pop(self);
       
    34 	return self;
       
    35 	}
       
    36 
       
    37 COmxILClockOutputPort::COmxILClockOutputPort(const TOmxILCommonPortData& aCommonPortData, COmxILClockProcessingFunction& aProcessingFunction) :
       
    38  COmxILOtherPort(aCommonPortData),
       
    39  iProcessingFunction(&aProcessingFunction)
       
    40 	{
       
    41 	}
       
    42 
       
    43 void COmxILClockOutputPort::ConstructL(const RArray<OMX_OTHER_FORMATTYPE>& aSupportedFormats)
       
    44 	{
       
    45 	COmxILOtherPort::ConstructL(aSupportedFormats);
       
    46 	}
       
    47 
       
    48 COmxILClockOutputPort::~COmxILClockOutputPort()
       
    49 	{
       
    50 	}
       
    51 	
       
    52 OMX_ERRORTYPE COmxILClockOutputPort::GetLocalOmxParamIndexes(RArray<TUint>& aIndexArray) const
       
    53 	{
       
    54 	return COmxILOtherPort::GetLocalOmxParamIndexes(aIndexArray);
       
    55 	}
       
    56 
       
    57 OMX_ERRORTYPE COmxILClockOutputPort::GetLocalOmxConfigIndexes(RArray<TUint>& aIndexArray) const
       
    58 	{
       
    59 	OMX_ERRORTYPE omxRetValue = COmxILOtherPort::GetLocalOmxConfigIndexes(aIndexArray);
       
    60 	if (omxRetValue != OMX_ErrorNone)
       
    61 		{
       
    62 		return omxRetValue;
       
    63 		}
       
    64 
       
    65 	TInt err = aIndexArray.InsertInOrder(OMX_IndexConfigTimeClientStartTime);
       
    66 	// Note that index duplication is OK.
       
    67 	if (err == KErrNone || err == KErrAlreadyExists)
       
    68 		{
       
    69 		err = aIndexArray.InsertInOrder(OMX_IndexConfigTimeMediaTimeRequest);
       
    70 		}
       
    71 				
       
    72 	if (err != KErrNone && err != KErrAlreadyExists)
       
    73 		{
       
    74 		return OMX_ErrorInsufficientResources;
       
    75 		}
       
    76 
       
    77 	return OMX_ErrorNone;
       
    78 	}
       
    79 
       
    80 OMX_ERRORTYPE COmxILClockOutputPort::GetParameter(OMX_INDEXTYPE aParamIndex,
       
    81                                                             TAny* apComponentParameterStructure) const
       
    82 	{
       
    83 	return COmxILOtherPort::GetParameter(aParamIndex, apComponentParameterStructure);
       
    84 	}
       
    85 
       
    86 OMX_ERRORTYPE COmxILClockOutputPort::SetParameter(OMX_INDEXTYPE aParamIndex,
       
    87                                                             const TAny* apComponentParameterStructure,
       
    88                                                             TBool& aUpdateProcessingFunction)
       
    89 	{
       
    90 	return COmxILOtherPort::SetParameter(aParamIndex, apComponentParameterStructure, aUpdateProcessingFunction);
       
    91 	}
       
    92 
       
    93 OMX_ERRORTYPE COmxILClockOutputPort::GetConfig(OMX_INDEXTYPE aConfigIndex,
       
    94                                                          TAny* apComponentConfigStructure) const
       
    95 	{
       
    96 	return COmxILOtherPort::GetConfig(aConfigIndex, apComponentConfigStructure);
       
    97 	}
       
    98 
       
    99 OMX_ERRORTYPE COmxILClockOutputPort::SetConfig(OMX_INDEXTYPE aConfigIndex,
       
   100                                                          const TAny* apComponentConfigStructure,
       
   101                                                          TBool& aUpdateProcessingFunction)
       
   102 	{
       
   103 	OMX_ERRORTYPE error = iProcessingFunction->ProduceRequest(aConfigIndex, CClockSupervisor::ESetConfig, const_cast<TAny*>(apComponentConfigStructure));
       
   104 	if(error != OMX_ErrorUnsupportedIndex)
       
   105 		{
       
   106 		return error;
       
   107 		}
       
   108 
       
   109 	// try base class if PF did not support the index
       
   110 	return COmxILOtherPort::SetConfig(aConfigIndex, apComponentConfigStructure, aUpdateProcessingFunction);
       
   111 	}
       
   112 
       
   113 OMX_ERRORTYPE COmxILClockOutputPort::SetFormatInPortDefinition(const OMX_PARAM_PORTDEFINITIONTYPE& /*aPortDefinition*/,
       
   114                                                                 TBool& /*aUpdateProcessingFunction*/)
       
   115 	{
       
   116 	return OMX_ErrorNone;
       
   117 	}
       
   118 
       
   119 TBool COmxILClockOutputPort::IsTunnelledPortCompatible(const OMX_PARAM_PORTDEFINITIONTYPE& /*aPortDefinition*/) const
       
   120 	{
       
   121 #ifdef _DEBUG
       
   122 	// This function only gets called on input ports, but must be implemented because it is pure virtual.
       
   123 	// Panic if this is ever called.
       
   124 	Panic(ECompatibilityCheckOnOutput);
       
   125 #endif
       
   126 	return ETrue;
       
   127 	}
       
   128 
       
   129 /**
       
   130  * Returns the number of buffers configured in the port definition.
       
   131  */
       
   132 TInt COmxILClockOutputPort::BufferCount() const
       
   133 	{
       
   134 	return iParamPortDefinition.nBufferCountActual;
       
   135 	}