EMIPLIB
Public Member Functions | Protected Member Functions

MIPComponent Class Reference

Base class of a component which can be placed in a component chain. More...

#include <mipcomponent.h>

Inherits MIPErrorBase.

Inherited by MIPALawDecoder, MIPALawEncoder, MIPAlsaOutput, MIPAudio3DBase, MIPAudioFileInput, MIPAudioFilter, MIPAudioMixer, MIPAudioRecorderInput, MIPAudioSplitter, MIPAudioTrackOutput, MIPAVCodecDecoder, MIPAVCodecEncoder, MIPAVCodecFrameConverter, MIPAverageTimer, MIPComponentAlias, MIPEsdOutput, MIPFrequencyGenerator, MIPGSMDecoder, MIPGSMEncoder, MIPInterChainTimer, MIPInterChainTimer::TriggerComponent, MIPJackInput, MIPJackOutput, MIPLPCDecoder, MIPLPCEncoder, MIPMediaBuffer, MIPMessageDumper, MIPOpenALOutput, MIPOSSInputOutput, MIPPAInputOutput, MIPPushEventTimer, MIPQtOutput, MIPRTPComponent, MIPRTPDecoder, MIPRTPEncoder, MIPSampleEncoder, MIPSamplingRateConverter, MIPSDLAudioOutput, MIPSILKDecoder, MIPSILKEncoder, MIPSndFileInput, MIPSndFileOutput, MIPSpeexDecoder, MIPSpeexEchoCanceller, MIPSpeexEchoCanceller::OutputAnalyzer, MIPSpeexEncoder, MIPTinyJPEGDecoder, MIPULawDecoder, MIPULawEncoder, MIPV4L2Input, MIPV4LInput, MIPVideoFrameStorage, MIPVideoMixer, MIPWAVInput, MIPWAVOutput, MIPWinMMInput, MIPWinMMOutput, MIPYUV420FileInput, and MIPYUV420FrameCutter.

Collaboration diagram for MIPComponent:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual void lock ()
 Locks the current component.
virtual void unlock ()
 Unlocks the current component.
virtual bool push (const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg)=0
 Feeds a message into the component.
virtual bool pull (const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg)=0
 Retrieve a message from the component.
virtual bool processFeedback (const MIPComponentChain &chain, int64_t feedbackChainID, MIPFeedback *feedback)
 Add feedback information about this component.
std::string getComponentName () const
 Returns the name of the component.

Protected Member Functions

 MIPComponent (const std::string &componentName)
 Create a component with the specified name.

Detailed Description

This class serves as a base class from which actual components can be derived. A working component needs to implement the MIPComponent::pull and MIPComponent::push methods.


Constructor & Destructor Documentation

MIPComponent::MIPComponent ( const std::string &  componentName) [protected]

Constructor which can only be called from derived classes and which stores the name of the component.


Member Function Documentation

std::string MIPComponent::getComponentName ( ) const [inline]

This function returns the name of the component, as it was specified in the constructor.

virtual void MIPComponent::lock ( ) [inline, virtual]

This function locks the component. It is used in the MIPComponentChain background thread to prevent a component being accessed at the same time in different threads.

virtual bool MIPComponent::processFeedback ( const MIPComponentChain chain,
int64_t  feedbackChainID,
MIPFeedback feedback 
) [inline, virtual]

If the component implements this function, it can add feedback information to the MIPFeedback object passed as the third argument. As with the push and pull functions, the current chain is also passed as an argument. Since it is possible that two feedback chains end in the same component, an identifier describing the specific feedback chain is passed as the second argument.

virtual bool MIPComponent::pull ( const MIPComponentChain chain,
int64_t  iteration,
MIPMessage **  pMsg 
) [pure virtual]

This function needs to be implemented by a derived class. It is part of the message passing system and is intended to retrieve messages from the current component. The function is called from the background thread of a MIPComponentChain object. In principle, it is possible that a component can be accessed by different chains. For this reason, the calling chain is passed as the first argument. The second argument describes the current iteration in the chain's background thread. Finally, in the third parameter a pointer to the retrieved message is stored.

In one specific iteration of the background thread, it is possible that multiple messages need to be retrieved (received RTP packets for example). To make this possible, the component should have a list of messages ready and each time the pull function is called, another message should be stored in the pMsg parameter. After the last message has been passed, a NULL pointer should be stored in pMsg to indicate that it was indeed the last message. At this point, the retrieval system should be reinitialized in such a way that a successive call to the pull function will again store the first message in pMsg. This way it is possible to pass messages from one component to multiple components.

virtual bool MIPComponent::push ( const MIPComponentChain chain,
int64_t  iteration,
MIPMessage pMsg 
) [pure virtual]

This function needs to be implemented by a derived class. It is part of the message passing system and is intended to feed messages to the current component. The function is called from the background thread of a MIPComponentChain object. In principle, it is possible that a component can be accessed by different chains. For this reason, the calling chain is passed as the first argument. The second argument describes the current iteration in the chain's background thread. Finally, the third argument is a pointer to the message itself.

virtual void MIPComponent::unlock ( ) [inline, virtual]

This function removes the lock on the current component. It too is used in the MIPComponentChain background thread.


The documentation for this class was generated from the following file: