ADTF  v2.14.3
cFilter Class Referenceabstract

The cFilter class implements a basic filter that supports the IFilter and IPinEventSink interfaces. More...

Inheritance diagram for cFilter:

Public Types

enum  tInitStage { StageFirst = 0, StageNormal = 1, StageGraphReady = 2 }
 The tInitStage indicates the Init Stages Call. More...
 
- Public Types inherited from IFilter
enum  tFilterState {
  State_Shutdown = 0, State_Created = 1, State_Initialized = 2, State_Ready = 3,
  State_Running = 4
}
 specifies the several types of filter states More...
 
- Public Types inherited from IPinEventSink
enum  tPinEventCode {
  PE_Unknown = 0, PE_MediaSampleReceived = 1, PE_InputConnected = 2, PE_InputDisconnected = 3,
  PE_OutputConnected = 4, PE_OutputDisconnected = 5, PE_MediaSampleTransmitted = 6, PE_MediaTypeChanged = 7
}
 The Pin events. More...
 
- Public Types inherited from IRunnable
enum  tRunnableActivationType {
  RUN_UNSPECIFIED = 0, RUN_TIMER = 1, RUN_SIGNAL = 2, RUN_EXCEPTION = 3,
  RUN_MESSAGE = 5, RUN_THREAD = 6, RUN_JOB = 7, RUN_USER = 0x1000
}
 Enumeration of the possible activation types to set a component in running state. More...
 
- Public Types inherited from IObjectInfo
enum  tOIType { OBJINFO_Class = 0x0000, OBJINFO_Raw = 0x0001, OBJINFO_Version = 0x0002, OBJINFO_User = 0x0100 }
 Information classifiers. More...
 
- Public Types inherited from cConfiguration
typedef std::map< adtf_util::cString, cProperty, adtf_util::cStringNoCaseCompareFunctPropertyMap
 
typedef std::map< adtf_util::cString, cSubConfiguration, adtf_util::cStringNoCaseCompareFunctSubConfigurationMap
 

Public Member Functions

 cFilter (const tChar *__info=NULL)
 Constructor. More...
 
virtual ~cFilter ()
 Destructor.
 
tResult GetInterface (const tChar *idInterface, tVoid **ppvObject)
 Implements ucom::IObject::GetInterface.
 
tUInt Ref ()
 Implements ucom::IObject::Ref.
 
tUInt Unref ()
 Implements ucom::IObject::Unref.
 
tVoid Destroy ()
 Implements ucom::IObject::Destroy.
 
IFilter::tFilterState GetState () const
 Retrieves the state of the filter (running or stopped). More...
 
tResult SetState (IFilter::tFilterState eState, ucom::IException **__exception_ptr=NULL)
 Sets the state of the filter. More...
 
tInt GetPinCount () const
 Retrieves the number of pins. More...
 
tResult EnumPins (ucom::IEnumObject **ppIEnum)
 Enumerates the pins on this filter. More...
 
tResult FindPin (const tChar *strName, IPin::tPinDirection ePinDirection, IPin **pPin)
 Find pin. More...
 
tResult Connect (IPin *pSource, const tChar *strDestname, ucom::IException **__exception_ptr=NULL)
 Connects a source (pSource) with a input pin. More...
 
tResult Disconnect (IPin *pSource, ucom::IException **__exception_ptr=NULL)
 Disconnects a source from all pin. More...
 
tResult Run (tInt nActivationCode, const tVoid *pvUserData, tInt szUserDataSize, ucom::IException **__exception_ptr=NULL)
 The adtf::IRunnable interface declares an object as a callback-entry point. More...
 
tResult OnPinEvent (IPin *pSource, tInt nEventCode, tInt nParam1, tInt nParam2, IMediaSample *pMediaSample)
 This Function will be called by all pins the filter is registered to. More...
 
tResult OISetInstanceName (const tChar *strName)
 Implements ucom::IObjectInfo::OISetInstanceName. More...
 
const tCharOIGetInstanceName ()
 Implements {ucom::IObjectInfo::OIGetInstanceName}. More...
 
tResult OISetClassName (const tChar *strClass)
 Implements ucom::IObjectInfo::OISetClassName.
 
const tCharOIGetClassName ()
 Implements ucom::IObjectInfo::OIGetClassName.
 
tResult OISetClassId (const tChar *strClassId)
 Implements ucom::IObjectInfo::OISetClassId.
 
const tCharOIGetClassId ()
 Implements ucom::IObjectInfo::OIGetClassId.
 
tResult OIQueryInfo (tInt nInfoId, tVoid *pBuffer, tInt nBufferSize, tInt *pnInfoSize)
 Implements ucom::IObjectInfo::OIQueryInfo.
 
tResult CreateSnapshot (ucom::IStream *pSerializationStream, __exception=NULL)
 Implements adtf::ICheckpointing::CreateSnapshot.
 
tResult RestoreSnapshot (tTimeStamp nTime, ucom::IStream *pSerializationStream, __exception=NULL)
 Implements adtf::ICheckpointing::RestoreSnapshot.
 
virtual const tCharGetPropertyStr (const tChar *strName, tChar *strBuffer=NULL, tInt nBufferSize=0, const tChar *strDefault="")
 The GetPropertyStr - Function of this default Filter Implementation Class helps to get resolved strings from the Property Store within adtf::cConfiguration. More...
 
tResult ConfigureConnectionPins (tUInt8 nMaxConnectionPins=0)
 This Function is a convenience function to set the config_information property of a filter. More...
 
tResult ConfigureConfigPins (tBool bHasConfigPinsIn=tFalse, tBool bHasConfigPinsOut=tFalse)
 This Function is a convenience function to set the config_information property of a filter. More...
 
tResult ConfigureValidityCheck (tBool bDisableCheck=tTrue)
 This Function is a convenience function to set the config_information property of a filter. More...
 
- Public Member Functions inherited from cConfiguration
 cConfiguration ()
 Constructor.
 
 cConfiguration (const cConfiguration &oConfig)
 Default copy constructor.
 
virtual ~cConfiguration ()
 Destructor.
 
virtual tResult PropertyChanged (const tChar *strName)
 Please Overwrite this Function on a cConfiguration class to react on Property changes made. More...
 
tResult ClearProperties ()
 Clear all properties. More...
 
tResult ClearProperty (const tChar *strName)
 Clear property. More...
 
tResult SetProperty (const tChar *strName, IProperty *pProperty)
 Sets (Sub-)Properties where value and datatype are defined through the IProperty interface itself. More...
 
tBool GetPropertyBool (const tChar *strName, tBool bDefault=tFalse)
 Retrieve boolean property value. More...
 
tInt GetPropertyInt (const tChar *strName, tInt nDefault=0)
 Retrieve integer property value. More...
 
tFloat64 GetPropertyFloat (const tChar *strName, tFloat64 fDefault=0.0)
 Retrieve floating point property value. More...
 
const tVoidGetPropertyRaw (const tChar *strName, tInt *pnBufferSize)
 Retrieve binary property data. More...
 
tResult SetPropertyBool (const tChar *strName, tBool bValue)
 Store boolean property value. More...
 
tResult SetPropertyInt (const tChar *strName, tInt nValue)
 Store integer property value. More...
 
tResult SetPropertyFloat (const tChar *strName, tFloat64 fValue)
 Store floating point property value. More...
 
tResult SetPropertyStr (const tChar *strName, const tChar *strValue)
 Store string property value. More...
 
tResult SetPropertyRaw (const tChar *strName, tVoid *pData, tInt nDataSize)
 Store binary property data. More...
 
tResult EnumProperties (const tChar *strName, IEnumProperties **ppIEnum)
 Retrieves a enumeration to all properties or Sub Properties set. More...
 
tResult Next (tUInt nObjectsToFetch, IProperty **ppObjects, tUInt *pnObjectsFetched)
 Retrieves the specified number of objects in the enumeration sequence. More...
 
tResult Skip (tUInt nObjectsToSkip)
 Skips over a specified number of objects. More...
 
tResult Reset ()
 Resets the enumeration sequence to the beginning. More...
 
tResult Clone (IEnumProperties **ppEnum)
 Makes a copy of the enumerator object. More...
 

Protected Member Functions

virtual tResult Init (cFilter::tInitStage eStage, ucom::IException **__exception_ptr=NULL)
 Implements the default cFilter state machine call. More...
 
virtual tResult Start (ucom::IException **__exception_ptr=NULL)
 Implements the default cFilter state machine calls. More...
 
virtual tResult Stop (ucom::IException **__exception_ptr=NULL)
 Implements the default cFilter state machine calls. More...
 
virtual tResult Shutdown (cFilter::tInitStage eStage, ucom::IException **__exception_ptr=NULL)
 Implements the default cFilter state machine call. More...
 
virtual tResult ActivatePins ()
 Activate the pins. More...
 
virtual tResult DeactivatePins ()
 Deactivate the pins. More...
 
virtual tResult ReleasePins ()
 Release all intern pin reference. More...
 
tResult RegisterPin (IPin *pIPin)
 Registers a Pin in a pin list. More...
 
tResult UnregisterPin (IPin *pIPin)
 Unregisters a Pin from the pin list. More...
 
tVoid SyncReset ()
 Resets the SyncChannel Offsets. More...
 
tTimeStamp Sync2RefTime (tTimeStamp tmInputTime, tInt nChannel=0)
 Converts an Input TimeStamp to the StreamTime of the framework's ReferenceClock by identifying the clock offset and by compensating the clock drift. More...
 
tTimeStamp Sync2RefTime2 (tTimeStamp tmRefStreamTime, tTimeStamp tmInputTime, tInt nChannel)
 Converts an Input TimeStamp to the given StreamTime of the framework's ReferenceClock by identifying the clock offset and by compensating the clock drift. More...
 
tResult AllocMediaSample (tVoid **pvMediaSample, const tChar *strSampleOID=OID_ADTF_MEDIA_SAMPLE, const tChar *strSampleIID=IID_ADTF_MEDIA_SAMPLE, ucom::IException **__exception_ptr=NULL)
 Helper Function.to get a Media Sample Instance through the ucom::IRuntime. More...
 
tResult TransmitMediaSample (IPin *pOutputPin, const tVoid *pDataBuffer, const tInt &szSizeBuffer, const tChar *strSampleOID=OID_ADTF_MEDIA_SAMPLE, ucom::IException **__exception_ptr=NULL)
 Helper Function to allocate a Media Sample Instance by the class strSampleOID through the ucom::IRuntime and immediately transmit it through the pOutputPin. More...
 
tResult TransmitMediaSample (IPin *pOutputPin, const tTimeStamp &tmSampleTime, const tVoid *pDataBuffer, const tInt &szSizeBuffer, const tChar *strSampleOID=OID_ADTF_MEDIA_SAMPLE, ucom::IException **__exception_ptr=NULL)
 Helper Function to allocate a Media Sample Instance by the class strSampleOID through the ucom::IRuntime and immediately transmit it through the pOutputPin. More...
 
tResult AllocMediaSample (IMediaSample **ppMediaSample, ucom::IException **__exception_ptr=NULL)
 Helper Function.to get a Media Sample Instance through the ucom::IRuntime. More...
 
tResult AllocMediaType (tVoid **pvMediaType, tUInt32 ui32MajorType, tUInt32 ui32SubType, const tChar *strTypeOID=OID_ADTF_MEDIA_TYPE, const tChar *strTypeIID=IID_ADTF_MEDIA_TYPE, ucom::IException **__exception_ptr=NULL)
 Helper Function.to get a Media specified Media Type Instance through the ucom::IRuntime. More...
 
tResult AllocMediaType (IMediaType **ppMediaType, tUInt32 ui32MajorType, tUInt32 ui32SubType, ucom::IException **__exception_ptr=NULL)
 Helper Function.to get a Media specified Media Type Instance through the ucom::IRuntime. More...
 
tResult CheckForAcceptedVersion (ucom::IException **__exception_ptr)
 This function is called to automatically check the version (accepted_version...). More...
 
tResult UpdateProperties (ucom::IException **__exception_ptr=NULL)
 This function updates properties changed during runlevel RL_Application and RL_Running. More...
 
virtual tResult DeclareObjectInfo (adtf_util::cString &strClassId, adtf_util::cString &strClassLabel, tInt &nCategory)=0
 Default implementation for ObjectInfo. More...
 
virtual tResult DeclareVersionInfo (std::list< ucom::IObjectInfo::tVersionInfo > *plstVersionInfo)=0
 Default implementation for ObjectInfo. More...
 
- Protected Member Functions inherited from cConfiguration
tPropertyMap::iterator FindProperty (const tChar *strName, const tPropertyMap **pMap)
 Find a property in all sub configurations. More...
 
tSubConfigurationMap::iterator FindSubConfiguration (const tChar *strName)
 Find a sub-configuration by name. More...
 
tResult AllocPropertyList (tInt nElements)
 Allocates a property list with a given amout of elements. More...
 
tResult FreePropertyList ()
 
tResult SetDepth (tUInt nDepth)
 

Protected Attributes

ucom::cObjectPtr< IKernel_kernel
 A reference to the kernel service. More...
 
ucom::cObjectPtr< IReferenceClock_clock
 A reference to the clock service. More...
 
- Protected Attributes inherited from cConfiguration
tPropertyMap m_oProperties
 internal value, will move to _d-pointer implementation next minor release
 
cPropertym_pPropertyEnumList
 internal value, will move to _d-pointer implementation next minor release
 
tInt m_nPropertyEnumListSize
 internal value, will move to _d-pointer implementation next minor release
 
tPropertyMap::const_iterator m_itEnum
 internal value, will move to _d-pointer implementation next minor release
 
tSubConfigurationMap m_oSubConfigurations
 internal value, will move to _d-pointer implementation next minor release
 
tUInt m_nDepth
 internal depth of the Configuration 0=root-property 1=first sub-property
 

Detailed Description

The cFilter class implements a basic filter that supports the IFilter and IPinEventSink interfaces.

The cFilter is implemented as a state machine. Which handles the IFilter::SetState call.

Definition at line 33 of file filter.h.

Member Enumeration Documentation

enum tInitStage

The tInitStage indicates the Init Stages Call.

dot_inline_dotgraph_20.png
Enumerator
StageFirst 

Very First Init Stage.

StageNormal 

Second Init Stage.

StageGraphReady 

Third Init Stage.

Definition at line 62 of file filter.h.

Constructor & Destructor Documentation

cFilter ( const tChar __info = NULL)

Constructor.

When implementing your own filter always use a Constructor like:
In class definition:

class cMyFilter : public adtf::cFilter
{
cMyFilter(const tChar* __info);
...
};


In class implementation:

...
cMyFilter::cMyFilter(const tChar* __info) : adtf::cFilter(__info)
{
...
}
...
 @param __info   [in] This is the name of the filter instance.

Member Function Documentation

virtual tResult ActivatePins ( )
protectedvirtual

Activate the pins.

Returns
Standard result code.
This method is real-time safe.
See The ADTF Real-Time Extension.
tResult AllocMediaSample ( tVoid **  pvMediaSample,
const tChar strSampleOID = OID_ADTF_MEDIA_SAMPLE,
const tChar strSampleIID = IID_ADTF_MEDIA_SAMPLE,
ucom::IException **  __exception_ptr = NULL 
)
protected

Helper Function.to get a Media Sample Instance through the ucom::IRuntime.

Parameters
pvMediaSample[out] Address of Media Sample if succeeded. Please use a ucom::cObjectPtr.
strSampleOID[in] Sample object identifier (class id) of the sample class. If strSampleOID is NULL then the OID_ADTF_MEDIA_SAMPLE will be used.
strSampleIID[in] Sample interface identifier of the object. If strSampleIID is NULL then the IID_ADTF_MEDIA_SAMPLE will be used.
__exception_ptr[inout] An Exception pointer where exceptions will be put when failed. If not using the cException smart pointer, the interface has to be released by calling Unref().
Returns
Standard result code.
This method is real-time safe only when the following conditions are met:
The sample pool and the memory manager services must be avaliable. See The ADTF Real-Time Extension.
tResult AllocMediaSample ( IMediaSample **  ppMediaSample,
ucom::IException **  __exception_ptr = NULL 
)
protected

Helper Function.to get a Media Sample Instance through the ucom::IRuntime.

Parameters
[in,out]ppMediaSampleAddress of Media Sample if succeeded. Please use a ucom::cObjectPtr.
[in,out]__exception_ptrAn Exception pointer where exceptions will be put when failed.
see Exception interface and its usage
Returns
Standard result code. See Exception.
Attention
This is the re-defined function of the "old".
tResult cFilter::AllocMediaSample(IMediaSample** ppMediaSample,
const tChar* strSampleOID=OID_ADTF_MEDIA_SAMPLE,
const tChar* strSampleIID=IID_ADTF_MEDIA_SAMPLE,
ucom::IException** __exception_ptr=NULL);
Remarks
Please use the AllocMediaSample with tVoid** cast to get a typed MediaSample like OID_ADTF_MEDIA_SAMPLE_CAN_RAW.
cObjectPtr<IMediaSample> pSample;
This method is real-time safe only when the following conditions are met:
The sample pool and the memory manager services must be avaliable. See The ADTF Real-Time Extension.
tResult AllocMediaType ( tVoid **  pvMediaType,
tUInt32  ui32MajorType,
tUInt32  ui32SubType,
const tChar strTypeOID = OID_ADTF_MEDIA_TYPE,
const tChar strTypeIID = IID_ADTF_MEDIA_TYPE,
ucom::IException **  __exception_ptr = NULL 
)
protected

Helper Function.to get a Media specified Media Type Instance through the ucom::IRuntime.

Parameters
[in,out]pvMediaTypeAddress of Media Type if succeeded. Please use a ucom::cObjectPtr.
[in]ui32MajorTypemajor type to set.
[in]ui32SubTypesub type to set.
[in]strTypeOIDType object identifier (class id) of the type class. If strTypeOID is NULL then the OID_ADTF_MEDIA_TYPE will be used.
[in]strTypeIIDType interface identifier of the object. If strTypeIID is NULL then the IID_ADTF_MEDIA_TYPE will be used.
[in,out]__exception_ptrAn Exception pointer where exceptions will be put when failed.
see Exception interface and its usage
Returns
Standard result code.
tResult AllocMediaType ( IMediaType **  ppMediaType,
tUInt32  ui32MajorType,
tUInt32  ui32SubType,
ucom::IException **  __exception_ptr = NULL 
)
protected

Helper Function.to get a Media specified Media Type Instance through the ucom::IRuntime.

Parameters
[in,out]ppMediaTypeAddress of Media Type if succeeded. Please use a ucom::cObjectPtr.
[in]ui32MajorTypemajor type to set.
[in]ui32SubTypesub type to set.
[in,out]__exception_ptrAn Exception pointer where exceptions will be put when failed.
see Exception interface and its usage
Returns
Standard result code.
tResult CheckForAcceptedVersion ( ucom::IException **  __exception_ptr)
protected

This function is called to automatically check the version (accepted_version...).

and compare with the filters versions in the Init(StageNormal).

Parameters
__exception_ptr[inout] An Exception pointer where exceptions will be put when failed. If not using the cException smart pointer, the interface has to be released by calling Unref().
Returns
Standard result code.
Remarks
This function only works when namespace is available and global settings "version_check_active" is set to true. The default is to check the "accepted_version_%s" property where s is the user_defined version. Then check if major minor and build.
See also
Documentation (developer) how.
tResult ConfigureConfigPins ( tBool  bHasConfigPinsIn = tFalse,
tBool  bHasConfigPinsOut = tFalse 
)

This Function is a convenience function to set the config_information property of a filter.

Defines if input and output pins are Config Pins.

Parameters
[in]bHasConfigPinsInare input pins Config Pins
[in]bHasConfigPinsOutare output pins Config Pins
Returns
Standard result.
tResult ConfigureConnectionPins ( tUInt8  nMaxConnectionPins = 0)

This Function is a convenience function to set the config_information property of a filter.

Defines the maximum number of Dynamic Connection Pins that can be created.

Parameters
[in]nMaxConnectionPinsmaximum number of Dynamic Connection Pins (includes static pins too)
Returns
Standard result.
tResult ConfigureValidityCheck ( tBool  bDisableCheck = tTrue)

This Function is a convenience function to set the config_information property of a filter.

Defines the validity check for connections.

Parameters
[in]bDisableCheckIf set to tTrue validation will be disabled.
Returns
Standard result.
tResult Connect ( IPin pSource,
const tChar strDestname,
ucom::IException **  __exception_ptr = NULL 
)
virtual

Connects a source (pSource) with a input pin.

This default implementation of cFilter::Connect method will expect an Output Pin in pSource

  • It will look for an Input Pin named strDestname via FindPin call.
  • If the pin found, the IPin::Connect method is called.

By default the cPin::Connect method will check the acceptance connection via IMediaType::QueryAccept. The default implementation of IMediaType::QueryAccept (within cMediaType::QueryAccept) will again decide via IMediaType::IsEqual.

Connections will eventually be accepted by default only if the rules of cMediaType::IsEqual are met.

To support dynamic pins this function must be overwritten.

Parameters
[in]pSourceSource pin.
[in]strDestnameDestination name.
[in,out]__exception_ptrThe exception pointer reference. (will be supported in final release)
Returns
Return the standard result code.

Implements IFilter.

Reimplemented in cBaseDisplayFilter, and cBaseVideoDisplayFilter.

virtual tResult DeactivatePins ( )
protectedvirtual

Deactivate the pins.

Returns
Standard result code.
This method is real-time safe.
See The ADTF Real-Time Extension.
virtual tResult DeclareObjectInfo ( adtf_util::cString strClassId,
adtf_util::cString strClassLabel,
tInt nCategory 
)
protectedpure virtual

Default implementation for ObjectInfo.

[pure virtual] Used by the Macro ADTF_FILTER or ADTF_FILTER_VERSION. Because of this, you will never be able to create a instance of cFilter, you need to implement this function!

Parameters
[out]strClassIdIs the class id is retrieved be OISetClassId.
[out]strClassLabelIs the class id is retrieved be OIGetClassName.
[out]nCategoryIs retrieved by OIQueryInfo with parameter ucom::IObjectInfo::OBJINFO_Class. (see also ucom::IObjectInfo).
Returns
Standard result code.
Remarks
Use only the ADTF_FILTER and ADTF_FILTER_VERSION, when using the cFIlter implementation.
See also
ucom::cObject::DeclareObjectInfo.
virtual tResult DeclareVersionInfo ( std::list< ucom::IObjectInfo::tVersionInfo > *  plstVersionInfo)
protectedpure virtual

Default implementation for ObjectInfo.

[pure virtual] Used by the Macro ADTF_FILTER or ADTF_FILTER_VERSION. Because of this, you will never be able to create a instance of cFilter, you need to implement this function!

Parameters
[out]plstVersionInforetrieves a list containing tVersionsInfo
Returns
Standard result code.
Remarks
Use only the ADTF_FILTER and ADTF_FILTER_VERSION, when using the cFilter implementation.
See also
ucom::cObject::DeclareVersionInfo.
tResult Disconnect ( IPin pSource,
ucom::IException **  __exception_ptr = NULL 
)
virtual

Disconnects a source from all pin.

Parameters
pSource[in] The reference to the source Pin
__exception_ptr[inout] An Exception pointer where exceptions will be put when failed. If not using the cException smart pointer, the interface has to be released by calling Unref().
Returns
Standard return value

Implements IFilter.

tResult EnumPins ( ucom::IEnumObject **  ppIEnum)
virtual

Enumerates the pins on this filter.

The EnumPins method enumerates the pins on this filter.

Parameters
ppIEnum[out] Address of a variable that receives a pointer to the IEnumPins interface.
Returns
Returns a standard result code.

Always use Reference Counting for the returning Object pointer.

RETURN_IF_FAILED(pMyFilter->EnumPins(&pEnumPins));
Remarks
Implements {IFilter::EnumPins}.
This method is real-time safe.
See The ADTF Real-Time Extension.

Implements IFilter.

tResult FindPin ( const tChar strName,
IPin::tPinDirection  ePinDirection,
IPin **  pPin 
)
virtual

Find pin.

Parameters
strName[in] Pointer to a string that identifies the pin that searches for. Call the IPin::GetName method to retrieve a pin's identifier.
ePinDirection[in] Direction of pin to find.
pPin[out] contains the pin if found.
Returns
Returns a standard result code. Implements IFilter::FindPin.
This method is real-time safe.
See The ADTF Real-Time Extension.

Implements IFilter.

tInt GetPinCount ( ) const
virtual

Retrieves the number of pins.

The GetPinCount method retrieves the number of pins.

Returns
Returns the number of pins.
Remarks
Implements IFilter::GetPinCount.
This method is real-time safe.
See The ADTF Real-Time Extension.

Implements IFilter.

virtual const tChar* GetPropertyStr ( const tChar strName,
tChar strBuffer = NULL,
tInt  nBufferSize = 0,
const tChar strDefault = "" 
)
virtual

The GetPropertyStr - Function of this default Filter Implementation Class helps to get resolved strings from the Property Store within adtf::cConfiguration.

It uses the Macro Resolver IMacroResolver (implemented at your application) which resolves Macros: $APPDIR$, ... or Environment Variables like $PATH$. It is possible to specify regular expressions for properties (with the name file name or the sub property IsFilename)

Warning
When not using the strBuffer parameter, always copy the return value immediately.
The Pointer will be valid until the next property function call.
See also
adtf::IConfiguration::GetPropertyStr.
Parameters
[in]strNamename of the property
[in,out]strBufferBuffer to safe the property value
[in]nBufferSizesize of given buffer
[in]strDefaultgiven default value
Returns
The property value
Returns the reference to the resolved string from property, when there was a macro within the property. Otherwise it only returns the reference to the property.

Reimplemented from cConfiguration.

IFilter::tFilterState GetState ( ) const
virtual

Retrieves the state of the filter (running or stopped).

The GetState method retrieves the filters's state (running or stopped).

Returns
Returns the filter's current state.
See also
IFilter::tFilterState.
Remarks
Implements {IFilter::GetState}.
This method is real-time safe.
See The ADTF Real-Time Extension.

Implements IFilter.

virtual tResult Init ( cFilter::tInitStage  eStage,
ucom::IException **  __exception_ptr = NULL 
)
protectedvirtual

Implements the default cFilter state machine call.

It will be called automatically by changing the filters state and needs to be overwritten by the special filter. Please see The Lifecycle of an ADTF Filter for further information on when the state of a filter changes.

Parameters
[in,out]__exception_ptrAn Exception pointer where exceptions will be put when failed. If not using the cException smart pointer, the interface has to be released by calling Unref().
[in]eStageThe Init function will be called when the filter state changes as follows:
dot_inline_dotgraph_21.png
Returns
Standard Result Code.

Reimplemented in cBaseIODeviceFilter, cBaseCaptureFilter, cBaseAudioPlaybackFilter, cBaseVideoDisplayFilter, cBaseDisplayHistoryFilter, cBaseDisplayFilter, cBaseAudioCaptureFilter, cBaseQtFilter, cConditionTriggeredFilter, cAsyncDataTriggeredFilter, and cDynamicBindingFilter.

const tChar* OIGetInstanceName ( )
virtual

Implements {ucom::IObjectInfo::OIGetInstanceName}.

Keep in mind: This method returns the filter instance name. However, while ADTF is starting or while using 'Create Pins and Properties from Configuration...', a non-specific filter object instance named “unnamed” is created to retrieve filter properties.

Returns
Returns a standard result code.

Implements IObjectInfo.

tResult OISetInstanceName ( const tChar strName)
virtual

Implements ucom::IObjectInfo::OISetInstanceName.

Keep in mind: This method can't be used to change Filter names in the Configuration Editor. The Filter name has to be known during initialization.

Returns
Returns a standard result code.

Sets the object instance name.

Parameters
[in]strNamename of the instance
Returns
Returns a standard result code.

Implements IObjectInfo.

tResult OnPinEvent ( IPin pSource,
tInt  nEventCode,
tInt  nParam1,
tInt  nParam2,
IMediaSample pMediaSample 
)
virtual

This Function will be called by all pins the filter is registered to.

Parameters
[in]pSourcePointer to the sending pin's IPin interface.
[in]nEventCodeEvent code. For allowed values see IPinEventSink::tPinEventCode
[in]nParam1Optional integer parameter.
[in]nParam2Optional integer parameter.
[in]pMediaSampleAddress of an IMediaSample interface pointers.
Returns
Returns a standard result code.
Warning
This function will not implement a thread-safe synchronization between the calls from different sources. You need to synchronize this call by your own. Have a look to adtf_util::__synchronized , adtf_util::__synchronized_obj .

Implements IPinEventSink.

Reimplemented in cBaseDisplayFilter, and cBaseVideoDisplayFilter.

tResult RegisterPin ( IPin pIPin)
protected

Registers a Pin in a pin list.

Parameters
pIPin[in] Pin to register.
Returns
Standard result code.
virtual tResult ReleasePins ( )
protectedvirtual

Release all intern pin reference.

Returns
Standard result code.
tResult Run ( tInt  nActivationCode,
const tVoid pvUserData,
tInt  szUserDataSize,
ucom::IException **  __exception_ptr = NULL 
)
virtual

The adtf::IRunnable interface declares an object as a callback-entry point.

Overwrite these function when handling system events, thread calls or other activation calls. Have a look to adtf::IRunnable and adtf::IKernel.

For receiving System Events use within your overwritten cFilter::Init function:

_kernel->SignalRegister(static_cast<IRunnable*>(this));


Your nActivationCode for the Run call will be IRunnable::RUN_SIGNAL. The pvUserData will be a pointer to adtf::tEventInfo.

See also
adtf::IEvent for Event Table,
adtf::cEventInfo for Helper Class
Warning
IMPORTANT: When registered for signals, never forget to unregister:
_kernel->SignalUnregister(static_cast<IRunnable*>(this));
Parameters
[in]nActivationCodeThe activation type for running.
[in]pvUserDatapointer to a activation structure depending on the activation type.
[in]szUserDataSizeSize of the activation structure. (in byte)
[in,out]__exception_ptrAddress of variable that points to an IException interface. If not using the cException smart pointer, the interface has to be released by calling Unref()..
Return values
ERR_NOERROR

Implements IRunnable.

Reimplemented in cTimeTriggeredFilter.

tResult SetState ( IFilter::tFilterState  eState,
ucom::IException **  __exception_ptr = NULL 
)
virtual

Sets the state of the filter.

The SetState method sets the filters's state (running or stopped). Please see The Lifecycle of an ADTF Filter for further information on when the state of a filter changes.

Parameters
[in]eStateThe filters state to switch to.
[in,out]__exception_ptrThe exception pointer reference.
Returns
Returns a standard result code.
Remarks
Implements IFilter::SetState.

Implements IFilter.

virtual tResult Shutdown ( cFilter::tInitStage  eStage,
ucom::IException **  __exception_ptr = NULL 
)
protectedvirtual

Implements the default cFilter state machine call.

It will be called automatically by changing the filters state and needs to be overwritten by the special filter. Please see The Lifecycle of an ADTF Filter for further information on when the state of a filter changes.

Parameters
eStage[in] The Init function will be called when the filter state changes as follows:
IFilter::State_Shutdown <- IFilter::State_Created ... eStage = cFilter::StageFirst
IFilter::State_Created <- IFilter::State_Initialized ... eStage = cFilter::StageNormal
IFilter::State_Initialized <- IFilter::State_Ready ... eStage = cFilter::StageGraphReady
IFilter::State_Ready <- IFilter::State_Stopped ... eStage = cFilter::StageLast
__exception_ptr[inout] An Exception pointer where exceptions will be put when failed. If not using the cException smart pointer, the interface has to be released by calling Unref().
Returns
Standard Result Code.

Reimplemented in cBaseIODeviceFilter, cBaseAudioPlaybackFilter, cBaseCaptureFilter, cBaseDisplayFilter, cBaseAudioCaptureFilter, cBaseVideoDisplayFilter, cBaseDisplayHistoryFilter, cBaseQtFilter, cConditionTriggeredFilter, cAsyncDataTriggeredFilter, and cDynamicBindingFilter.

virtual tResult Start ( ucom::IException **  __exception_ptr = NULL)
protectedvirtual

Implements the default cFilter state machine calls.

It will be called automatically by changing the filters state IFilter::State_Ready -> IFilter::State_Running and can be overwritten by the special filter.

Parameters
__exception_ptr[inout] An Exception pointer where exceptions will be put when failed. If not using the cException smart pointer, the interface has to be released by calling Unref().
Returns
Standard Result Code.
Note
This method will be also called during the shutdown of a configuration if the Filter is connected to the Message Bus. (see: Message Bus Service)! This has to be done, to disconnect the Message Bus and to avoid Race Conditions.

Reimplemented in cBaseIODeviceFilter, cBaseAudioPlaybackFilter, cBaseCaptureFilter, cBaseVideoDisplayFilter, cBaseDisplayFilter, cBaseAudioCaptureFilter, cConditionTriggeredFilter, cAsyncDataTriggeredFilter, and cTimeTriggeredFilter.

virtual tResult Stop ( ucom::IException **  __exception_ptr = NULL)
protectedvirtual

Implements the default cFilter state machine calls.

It will be called automatically by changing the filters state IFilter::State_Running -> IFilter::State_Ready and can be overwritten by the special filter.

Parameters
__exception_ptr[inout] An Exception pointer where exceptions will be put when failed. If not using the cException smart pointer, the interface has to be released by calling Unref().
Returns
Standard Result Code.
Note
This method will be also called during the shutdown of a configuration if the Filter is connected to the Message Bus. (see: Message Bus Service)! This has to be done, to disconnect the Message Bus and to avoid Race Conditions.

Reimplemented in cBaseIODeviceFilter, cBaseAudioPlaybackFilter, cBaseCaptureFilter, cBaseDisplayFilter, cBaseVideoDisplayFilter, cBaseAudioCaptureFilter, cConditionTriggeredFilter, cAsyncDataTriggeredFilter, and cTimeTriggeredFilter.

tTimeStamp Sync2RefTime ( tTimeStamp  tmInputTime,
tInt  nChannel = 0 
)
protected

Converts an Input TimeStamp to the StreamTime of the framework's ReferenceClock by identifying the clock offset and by compensating the clock drift.

If there are several asynchronous input channels, the respective channel of the current input time stamp can be specified.

This function will call the Sync2RefTime2 as follows

Sync2RefTime2(_clock->GetStreamTime(), tmInputTime, nChannel);

For more information see the documentation of Sync2RefTime2 and The ADTF Timings.


IMPORTANT: The call needs to be as early as possible to get the best stream time.

Parameters
tmInputTime[in] The InputTimestamp which must be synchronized. IMPORTANT: tmInputTime should not be lower than the tmInputTime of the last call of Sync2RefTime. Otherwise this will result in a internal offset reset.
nChannel[in] The channel source dependency if in one filter more than one data set needs to be synchronized. (every channel-offset is independent from the other)
Returns
Synchronized timestamp of StreamTime corresponding to the InputTimestamp
This method is real-time safe.
See The ADTF Real-Time Extension.
See also
page_add_adtf_times
tTimeStamp Sync2RefTime2 ( tTimeStamp  tmRefStreamTime,
tTimeStamp  tmInputTime,
tInt  nChannel 
)
protected

Converts an Input TimeStamp to the given StreamTime of the framework's ReferenceClock by identifying the clock offset and by compensating the clock drift.

If there are several asynchronous input channels, the respective channel of the current input time stamp can be specified.

The main goal of this function is to identify a clock offset between an InputTime (i.e. a HardwareTime) and the StreamTime (see also The ADTF Timings).

The function returns the synchronized timestamp of the StreamTime which corresponds to the InputTimestamp. This return value must be the new SampleTimeS (sample timestamp by IMediaSample::SetTime ) of the new MediaSample that contains the InputData reeated to the InputTimestamp.

The offset will be identified by using the appeared minimum offset between StreamTime and InputTime.

The function will remember the offset of every call and will adjust the internal offset every 5 seconds automatically to compensate a clock drift between the InputTime and StreamTime.

Remind: Every Timestamp in tTimeStamp is expected in micoseconds as long as the function documentation does not define something else!

The function can only handle positive tmRefStreamTime and tmInputTime values.

If you have more than one InputTime within your Filter use different channels to get different offset evaluations.

Parameters
tmRefStreamTime[in] StreamTimestamp to reference to [microseconds]
tmInputTime[in] The InputTimestamp which must be synchronized. IMPORTANT: tmInputTime should not be lower than the tmInputTime of the last call of Sync2RefTime. Otherwise this will result in a internal offset reset. [microseconds]
nChannel[in] The channel source dependency if in one filter more than one data set needs to be synchronized. (every channel-offset is independent from the other)
Returns
Synchronized Timestamp of StreamTime corresponding to the InputTimestamp
This method is real-time safe.
See The ADTF Real-Time Extension.
See also
The ADTF Timings
tVoid SyncReset ( )
protected

Resets the SyncChannel Offsets.

Returns
Standard result code.
This method is real-time safe.
See The ADTF Real-Time Extension.
tResult TransmitMediaSample ( IPin pOutputPin,
const tVoid pDataBuffer,
const tInt szSizeBuffer,
const tChar strSampleOID = OID_ADTF_MEDIA_SAMPLE,
ucom::IException **  __exception_ptr = NULL 
)
protected

Helper Function to allocate a Media Sample Instance by the class strSampleOID through the ucom::IRuntime and immediately transmit it through the pOutputPin.

Remarks
Synchronization must be done outside of this function by yourself.
Sample Time will be set to current streamtime.
Parameters
pOutputPin[in] output pin where to transmit the data.
pDataBuffer[in] data pointer copied to the Buffer of the MediaSample.
szSizeBuffer[in] size of buffer data pointer.
strSampleOID[in] Sample object identifier (class id) of the sample class. If strSampleOID is NULL then the OID_ADTF_MEDIA_SAMPLE will be used.
__exception_ptr[inout] An Exception pointer where exceptions will be put when failed. If not using the cException smart pointer, the interface has to be released by calling Unref().
Remarks
The Parameter pDataBuffer may not be a C++ object, use only memory, pointer to plain data types or plain old C-Style Structure definitions.
Returns
Standard result code.
This method is real-time safe only when the following conditions are met:
The sample pool and the memory manager services must be avaliable. See The ADTF Real-Time Extension.
tResult TransmitMediaSample ( IPin pOutputPin,
const tTimeStamp tmSampleTime,
const tVoid pDataBuffer,
const tInt szSizeBuffer,
const tChar strSampleOID = OID_ADTF_MEDIA_SAMPLE,
ucom::IException **  __exception_ptr = NULL 
)
protected

Helper Function to allocate a Media Sample Instance by the class strSampleOID through the ucom::IRuntime and immediately transmit it through the pOutputPin.

Remarks
Synchronization must be done outside of this function by yourself.
Sample Time will be set to the value of tmSampleTime.
Parameters
pOutputPin[in] output pin where to transmit the data.
tmSampleTime[in] sample time to set on sample
pDataBuffer[in] data pointer copied to the Buffer of the MediaSample.
szSizeBuffer[in] size of buffer data pointer.
strSampleOID[in] Sample object identifier (class id) of the sample class. If strSampleOID is NULL then the OID_ADTF_MEDIA_SAMPLE will be used.
__exception_ptr[inout] An Exception pointer where exceptions will be put when failed. If not using the cException smart pointer, the interface has to be released by calling Unref().
Remarks
The Parameter pDataBuffer may not be a C++ object, use only memory, plain data types or plain old C-Style Structure definitions.
Returns
Standard result code.
This method is real-time safe only when the following conditions are met:
The sample pool and the memory manager services must be avaliable. See The ADTF Real-Time Extension.
tResult UnregisterPin ( IPin pIPin)
protected

Unregisters a Pin from the pin list.

Parameters
pIPin[in] Pin to unregister.
Returns
Standard result code.
tResult UpdateProperties ( ucom::IException **  __exception_ptr = NULL)
protected

This function updates properties changed during runlevel RL_Application and RL_Running.

If an property has additional sub property NSSUBPROP_ISCHANGEABLE the property will be copied from the filter instance to the namespace and it will also update in the property browser.

This function is very time-consuming. It would be wise to use this method only during a PropertyChanged call in runlevel RL_Running.

Parameters
__exception_ptr[in,out] An Exception pointer where exceptions will be put when failed. see Exception interface and its usage
Returns
Standard result code.
Remarks
This function only works when namespace is available.

Member Data Documentation

ucom::cObjectPtr<IReferenceClock> _clock
protected

A reference to the clock service.

The variable will be set, in Init(eStage == StageFirst).

See also
IReferenceClock.
Warning
Always check for NULL, it is possible the filter will run within an environment where the clock is not available.

Definition at line 86 of file filter.h.

ucom::cObjectPtr<IKernel> _kernel
protected

A reference to the kernel service.

The filter method will try to connect to a kernel in Init(eStage == StageFirst).

See also
IKernel.
Warning
This implementation of the filter interface will not initialize, when kernel is not available in system environment.

Definition at line 79 of file filter.h.


Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Fri Mar 22 2019 by doxygen 1.8.10)