void CFlashUIMCPosRotScaleBaseNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo ) { if (event == eFE_Initialize) { UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIMovieClip)), pActInfo, m_isTemplate ); } else if (event == eFE_Activate) { if (IsPortActive( pActInfo, GetInputPort(eI_UIMovieClip))) { UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIMovieClip)), pActInfo, m_isTemplate ); } if (IsTemplate() && !UpdateTmplDesc( GetPortString( pActInfo, GetInputPort(eI_TemplateInstanceName)), pActInfo )) return; if (GetElement()) { const int instanceId = GetPortInt( pActInfo, GetInputPort(eI_InstanceID)); if (IsPortActive ( pActInfo, GetInputPort(eI_Set))) { const Vec3 pos = GetPortVec3( pActInfo, GetInputPort(eI_Pos)); const Vec3 rot = GetPortVec3( pActInfo, GetInputPort(eI_Rot)); const Vec3 scale = GetPortVec3( pActInfo, GetInputPort(eI_Scale)); SPerInstanceCall3< const Vec3 &, const Vec3 &, const Vec3 & > caller; caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIMCPosRotScaleBaseNode::SetValues), pos, rot, scale); ActivateOutput( pActInfo, eO_OnSet, true ); ActivateOutput( pActInfo, eO_Pos, pos ); ActivateOutput( pActInfo, eO_Rot, rot ); ActivateOutput( pActInfo, eO_Scale, scale ); } else if (IsPortActive( pActInfo, GetInputPort(eI_Get))) { Vec3 pos; Vec3 rot; Vec3 scale; SPerInstanceCall3< Vec3 &, Vec3 &, Vec3 & > caller; if (!caller.Execute(GetElement(), instanceId, functor(*this, &CFlashUIMCPosRotScaleBaseNode::GetValues), pos, rot, scale, false)) { UIACTION_WARNING( "FG: UIElement \"%s\" called get PosRotScale for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetElement()->GetName(),instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID )); } ActivateOutput( pActInfo, eO_Pos, pos ); ActivateOutput( pActInfo, eO_Rot, rot ); ActivateOutput( pActInfo, eO_Scale, scale ); } } } }
void AudioIO::Process(UnsignedType SampleCount) { if (!m_RefCount) return; if (m_RealMode == 4) return; if (m_RealMode==2 || m_RealMode==3) { OUTPUTCLIENT::Get()->SendStereo(GetInputPort(LeftIn),GetInputPort(RightIn)); } if (m_RealMode==1 || m_RealMode==3) OUTPUTCLIENT::Get()->GetStereo(GetOutputPort(LeftOut),GetOutputPort(RightOut)); }
double OMXClock::ClockAdjustment(bool lock) { if (!GetComponent()) return 0.0; if (lock) Lock(); OMX_ERRORTYPE omxErr = OMX_ErrorNone; double pts = 0.0; OMX_TIME_CONFIG_TIMESTAMPTYPE timestamp; OMX_INIT_STRUCTURE(timestamp); timestamp.nPortIndex = GetInputPort(); omxErr = GetConfig(OMX_IndexConfigClockAdjustment, ×tamp); if (omxErr != OMX_ErrorNone) { if (lock) Unlock(); return 0.0; } pts = (double)FromOMXTime(timestamp.nTimestamp); if (lock) Unlock(); return pts; }
void CFlashUIMCVisibleBaseNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo ) { if (event == eFE_Initialize) { UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIMovieClip)), pActInfo, m_isTemplate ); } else if (event == eFE_Activate) { if (IsPortActive( pActInfo, GetInputPort(eI_UIMovieClip))) { UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIMovieClip)), pActInfo, m_isTemplate ); } if (IsTemplate() && !UpdateTmplDesc( GetPortString( pActInfo, GetInputPort(eI_TemplateInstanceName)), pActInfo )) return; if (GetElement()) { const int instanceId = GetPortInt( pActInfo, GetInputPort(eI_InstanceID)); if (IsPortActive ( pActInfo, GetInputPort(eI_Set))) { const bool bVis = GetPortBool( pActInfo, GetInputPort(eI_Visible)); const float alpha = clamp_tpl( GetPortFloat( pActInfo, GetInputPort(eI_Alpha)), 0.0f, 1.f ); SPerInstanceCall2< bool, float > caller; caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIMCVisibleBaseNode::SetValues), bVis, alpha ); ActivateOutput( pActInfo, eO_OnSet, true ); ActivateOutput( pActInfo, eO_Visible, bVis ); ActivateOutput( pActInfo, eO_Alpha, alpha ); } else if (IsPortActive( pActInfo, GetInputPort(eI_Get))) { bool bVis = false; float alpha = 0.f; SPerInstanceCall2< bool &, float & > caller; if (!caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIMCVisibleBaseNode::GetValues), bVis, alpha, false )) { UIACTION_WARNING( "FG: UIElement \"%s\" called get Array for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetElement()->GetName(),instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID )); } ActivateOutput( pActInfo, eO_Visible, bVis ); ActivateOutput( pActInfo, eO_Alpha, alpha ); } } } }
double OMXClock::GetMediaTime(bool lock) { if (!GetComponent()) { return 0.0; } double pts = 0.0; double now = GetAbsoluteClock(); if (((now - m_lastMediaTimeRead) > CLOCK_MSEC_TO_TIME(100)) || (m_lastMediaTime == 0.0)) { if (lock) Lock(); OMX_ERRORTYPE omxErr = OMX_ErrorNone; OMX_TIME_CONFIG_TIMESTAMPTYPE timestamp; OMX_INIT_STRUCTURE(timestamp); timestamp.nPortIndex = GetInputPort(); omxErr = GetConfig(OMX_IndexConfigTimeCurrentMediaTime, ×tamp); if (omxErr != OMX_ErrorNone) { if (lock) Unlock(); return 0.0; } pts = (double)FromOMXTime(timestamp.nTimestamp); //OMXLogger::OutputLog( "OMXClock::GetMediaTime - %.2f (%.2f, %.2f)", LogLevel::Debug, pts, m_lastMediaTime, now - m_lastMediaTime ); m_lastMediaTime = pts; m_lastMediaTimeRead = now; if (lock) Unlock(); } else { double speed = m_pause ? 0.0 : (double)m_omxSpeed / CLOCK_PLAYSPEED_NORMAL; pts = m_lastMediaTime + (now - m_lastMediaTimeRead) * speed; //OMXLogger::OutputLog( "OMXClock::GetMediaTime - cached %.2f (%.2f, %.2f)", LogLevel::Debug, pts, m_lastMediaTime, now - m_lastMediaTime ); } //OMXLogger::OutputLog( "OMXClock::GetMediaTime - Returning PTS %f", LogLevel::Debug, pts ); return pts; }
void CFlashUIVariableBaseNode::ProcessEvent( EFlowEvent event, SActivationInfo* pActInfo ) { if (event == eFE_Initialize) { UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIVariable)), pActInfo, m_isTemplate ); } else if (event == eFE_Activate) { if (IsPortActive( pActInfo, GetInputPort(eI_UIVariable))) { UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIVariable)), pActInfo, m_isTemplate ); } if (IsTemplate() && !UpdateTmplDesc( GetPortString( pActInfo, GetInputPort(eI_TemplateInstanceName)), pActInfo )) return; const int instanceId = GetPortInt( pActInfo, GetInputPort(eI_InstanceID)); if (IsPortActive ( pActInfo, GetInputPort(eI_Set))) { const TFlowInputData &data = GetPortAny( pActInfo, GetInputPort(eI_Value)); TUIData value; ConvertToUIData(data, value, pActInfo); SPerInstanceCall1< const TUIData & > caller; caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIVariableBaseNode::SetVariable), value ); ActivateOutput( pActInfo, eO_OnSet, true ); } if (IsPortActive( pActInfo, GetInputPort(eI_Get))) { TUIData out; SPerInstanceCall1< TUIData & > caller; if (!caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIVariableBaseNode::GetVariable), out, false )) { UIACTION_WARNING( "FG: UIElement \"%s\" called get Variable for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetElement()->GetName(),instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID )); } string res; out.GetValueWithConversion( res ); ActivateOutput( pActInfo, eO_Value, res ); } } }
void CFlashUIGotoAndPlayBaseNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo ) { if (event == eFE_Initialize) { UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIMovieClip)), pActInfo, m_isTemplate ); } else if (event == eFE_Activate) { if (IsPortActive( pActInfo, GetInputPort(eI_UIMovieClip))) { UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIMovieClip)), pActInfo, m_isTemplate ); } if (IsTemplate() && !UpdateTmplDesc( GetPortString( pActInfo, GetInputPort(eI_TemplateInstanceName)), pActInfo )) return; if (GetElement()) { const int frameId = GetPortInt( pActInfo, GetInputPort(eI_FrameNum)); const string frameName = GetPortString( pActInfo, GetInputPort(eI_FrameName)); const int instanceId = GetPortInt( pActInfo, GetInputPort(eI_InstanceID)); if (IsPortActive ( pActInfo, GetInputPort(eI_GotoAndPlay))) { SPerInstanceCall2< int, const char* > caller; caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIGotoAndPlayBaseNode::GotoAndPlay), frameId, frameName ); ActivateOutput( pActInfo, eO_OnGotoAndPlay, true ); } else if (IsPortActive( pActInfo, GetInputPort(eI_GotoAndStop))) { SPerInstanceCall2< int, const char* > caller; caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIGotoAndPlayBaseNode::GotoAndStop), frameId, frameName ); ActivateOutput( pActInfo, eO_OnGotoAndStop, true ); } } } }
void CFlashUIArrayBaseNode::ProcessEvent( EFlowEvent event,SActivationInfo* pActInfo ) { if (event == eFE_Initialize) { UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIArray)), pActInfo, m_isTemplate ); } else if (event == eFE_Activate) { if (IsPortActive( pActInfo, GetInputPort(eI_UIArray))) { UpdateObjectDesc( GetPortString( pActInfo, GetInputPort(eI_UIArray)), pActInfo, m_isTemplate ); } if (IsTemplate() && !UpdateTmplDesc( GetPortString( pActInfo, GetInputPort(eI_TemplateInstanceName)), pActInfo )) return; if (GetElement()) { const int instanceId = GetPortInt( pActInfo, GetInputPort(eI_InstanceID)); if (IsPortActive ( pActInfo, GetInputPort(eI_Set))) { SUIArguments values( GetPortString( pActInfo, GetInputPort(eI_Value)).c_str()); SPerInstanceCall1< const SUIArguments & > caller; caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIArrayBaseNode::SetArray), values ); ActivateOutput( pActInfo, eO_OnSet, true ); } else if (IsPortActive( pActInfo, GetInputPort(eI_Get))) { SUIArguments out; SPerInstanceCall1< SUIArguments & > caller; if (!caller.Execute( GetElement(), instanceId, functor(*this, &CFlashUIArrayBaseNode::GetArray), out, false )) { UIACTION_WARNING( "FG: UIElement \"%s\" called get Array for multiple instances! (passed instanceId %i), referenced at node \"%s\"", GetElement()->GetName(),instanceId, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID )); } ActivateOutput( pActInfo, eO_Value, string( out.GetAsString())); } } } }
void Counter::Process(UnsignedType SampleCount) { UnsignedType count = m_Count->Value(); bool Triggered = StateValue(m_TriggeredInd)->AsBoolean; UnsignedType Current = StateValue(m_CurrentInd)->AsUnsigned; FloatType CurrentLevel = StateValue(m_CurrentLevelInd)->AsFloat; for (UnsignedType n=0; n<SampleCount; n++) { if (GetInput(GetInputPort(In),n)>0) { if(!Triggered) { Triggered=true; Current++; } } else { if (Triggered) { Triggered=false; Current++; } } if (Current>=count) { CurrentLevel=-CurrentLevel; Current=0; } SetOutput(GetOutputPort(Out),n,CurrentLevel); } StateValue(m_TriggeredInd)->AsBoolean = Triggered; StateValue(m_CurrentInd)->AsUnsigned = Current; StateValue(m_CurrentLevelInd)->AsFloat = CurrentLevel; }
bool OMXClock::SetMediaTime(double pts, bool lock) { if (!GetComponent()) return false; if (lock) Lock(); OMX_ERRORTYPE omxErr = OMX_ErrorNone; OMX_INDEXTYPE index; OMX_TIME_CONFIG_TIMESTAMPTYPE timestamp; OMX_INIT_STRUCTURE(timestamp); timestamp.nPortIndex = GetInputPort(); if (m_eClock == OMX_TIME_RefClockAudio) index = OMX_IndexConfigTimeCurrentAudioReference; else index = OMX_IndexConfigTimeCurrentVideoReference; timestamp.nTimestamp = ToOMXTime(pts); omxErr = SetConfig(index, ×tamp); if (omxErr != OMX_ErrorNone) { if (lock) Unlock(); return false; } m_lastMediaTime = 0.0f; if (lock) Unlock(); return true; }
OMX_ERRORTYPE COMXCoreComponent::AllocInputBuffers(bool use_buffers /* = false **/) { OMX_ERRORTYPE omx_err = OMX_ErrorNone; m_omx_input_use_buffers = use_buffers; if(!m_handle) return OMX_ErrorUndefined; OMX_PARAM_PORTDEFINITIONTYPE portFormat; OMX_INIT_STRUCTURE(portFormat); portFormat.nPortIndex = m_input_port; omx_err = OMX_GetParameter(m_handle, OMX_IndexParamPortDefinition, &portFormat); if(omx_err != OMX_ErrorNone) return omx_err; if(GetState() != OMX_StateIdle) { if(GetState() != OMX_StateLoaded) SetStateForComponent(OMX_StateLoaded); SetStateForComponent(OMX_StateIdle); } omx_err = EnablePort(m_input_port, false); if(omx_err != OMX_ErrorNone) return omx_err; m_input_alignment = portFormat.nBufferAlignment; m_input_buffer_count = portFormat.nBufferCountActual; m_input_buffer_size = portFormat.nBufferSize; CLog::Log(LOGDEBUG, "COMXCoreComponent::AllocInputBuffers component(%s) - port(%d), nBufferCountMin(%lu), nBufferCountActual(%lu), nBufferSize(%lu), nBufferAlignmen(%lu)\n", m_componentName.c_str(), GetInputPort(), portFormat.nBufferCountMin, portFormat.nBufferCountActual, portFormat.nBufferSize, portFormat.nBufferAlignment); for (size_t i = 0; i < portFormat.nBufferCountActual; i++) { OMX_BUFFERHEADERTYPE *buffer = NULL; OMX_U8* data = NULL; if(m_omx_input_use_buffers) { data = (OMX_U8*)_aligned_malloc(portFormat.nBufferSize, m_input_alignment); omx_err = OMX_UseBuffer(m_handle, &buffer, m_input_port, NULL, portFormat.nBufferSize, data); } else { omx_err = OMX_AllocateBuffer(m_handle, &buffer, m_input_port, NULL, portFormat.nBufferSize); } if(omx_err != OMX_ErrorNone) { CLog::Log(LOGERROR, "COMXCoreComponent::AllocInputBuffers component(%s) - OMX_UseBuffer failed with omx_err(0x%x)\n", m_componentName.c_str(), omx_err); if(m_omx_input_use_buffers && data) _aligned_free(data); return omx_err; } buffer->nInputPortIndex = m_input_port; buffer->nFilledLen = 0; buffer->nOffset = 0; buffer->pAppPrivate = (void*)i; m_omx_input_buffers.push_back(buffer); m_omx_input_avaliable.push(buffer); } omx_err = WaitForCommand(OMX_CommandPortEnable, m_input_port); m_flush_input = false; return omx_err; }
void CFlashUIVariableBaseNode::ConvertToUIData( const TFlowInputData &in, TUIData &out, SActivationInfo* pActInfo) { if (!GetObjectDesc()) { UIACTION_WARNING( "FG: No valid Variable \"%s\"! (Referenced at node \"%s\")", GetPortString(pActInfo, GetInputPort(eI_UIVariable)).c_str(), pActInfo->pGraph->GetNodeTypeName( pActInfo->myID )); return; } bool ok = false; const char* vartype = "any"; switch (GetObjectDesc()->eType) { case SUIParameterDesc::eUIPT_Bool: { bool value; ok = in.GetValueWithConversion(value); out = TUIData(value); vartype = "bool"; } break; case SUIParameterDesc::eUIPT_Int: { int value; ok = in.GetValueWithConversion(value); out = TUIData(value); vartype = "int"; } break; case SUIParameterDesc::eUIPT_Float: { float value; ok = in.GetValueWithConversion(value); out = TUIData(value); vartype = "float"; } break; case SUIParameterDesc::eUIPT_String: // fall through, just change the type desc vartype = "string"; case SUIParameterDesc::eUIPT_Any: default: { string value; ok = in.GetValueWithConversion(value); out = TUIData(value); } break; } if (!ok) { UIACTION_WARNING( "FG: UIElement \"%s\" Variable \"%s\" expected type \"%s\" given value was not compatible! (Referenced at node \"%s\")", GetElement()->GetName(),GetObjectDesc()->sDisplayName, vartype, pActInfo->pGraph->GetNodeTypeName( pActInfo->myID )); } }