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