bool graph::ops::is_trans_complete (const OMX_HANDLETYPE handle, const OMX_STATETYPE to_state) { bool rc = false; assert (std::find (handles_.begin (), handles_.end (), handle) != handles_.end ()); assert (to_state <= OMX_StateWaitForResources); TIZ_LOG (TIZ_PRIORITY_TRACE, "[%s] to_state [%s] expected transitions [%d] handles [%d]...", handle2name (handle).c_str (), tiz_state_to_str (to_state), expected_transitions_lst_.size (), handles_.size ()); if (!handles_.empty () && !expected_transitions_lst_.empty ()) { omx_event_info_lst_t::iterator it = std::find ( expected_transitions_lst_.begin (), expected_transitions_lst_.end (), omx_event_info (handle, to_state, OMX_ErrorNone)); if (expected_transitions_lst_.end () != it) { expected_transitions_lst_.erase (it); assert (util::verify_transition_one (handle, to_state)); } } if (expected_transitions_lst_.empty ()) { rc = true; } return rc; }
static OMX_ERRORTYPE loadedtoidle_state_set (const void * ap_obj, OMX_HANDLETYPE ap_hdl, OMX_COMMANDTYPE a_cmd, OMX_U32 a_param1, OMX_PTR ap_cmd_data) { tiz_state_t * p_base = (tiz_state_t *) ap_obj; tiz_fsm_state_id_t new_state = EStateMax; assert (ap_obj); assert (ap_hdl); assert (a_cmd == OMX_CommandStateSet); TIZ_TRACE (ap_hdl, "Requested transition " "[ESubStateLoadedToIdle -> %s]...", tiz_fsm_state_to_str (a_param1)); /* Allowed transitions are OMX_StateLoaded only (a.k.a. transition * cancellation). */ switch (a_param1) { case OMX_StateLoaded: { new_state = ESubStateIdleToLoaded; } break; default: { TIZ_ERROR (ap_hdl, "[OMX_ErrorIncorrectStateTransition] : " "ESubStateLoadedToIdle -> [%s]", tiz_state_to_str (a_param1)); return OMX_ErrorIncorrectStateTransition; } }; /* reset here the servants count */ p_base->servants_count_ = 0; if (ESubStateIdleToLoaded == new_state) { OMX_ERRORTYPE rc = OMX_ErrorNone; if (OMX_ErrorNone != (rc = tiz_fsm_set_state (tiz_get_fsm (ap_hdl), new_state, ESubStateLoadedToIdle))) { return rc; } } /* IL resource deallocation should take place now */ /* NOTE: This will call the 'tiz_state_state_set' function and not * 'tizloaded_state_set' (we are passing 'tizloaded' as the 1st * parameter */ return tiz_state_super_state_set (typeOf (ap_obj, "tizloaded"), ap_obj, ap_hdl, a_cmd, a_param1, ap_cmd_data); }
bool operator()(EVT const& evt, FSM& fsm, SourceState& source, TargetState& target) { bool rc = false; if (fsm.pp_ops_ && *(fsm.pp_ops_)) { if ((*(fsm.pp_ops_))->is_trans_complete (evt.handle_, evt.state_)) { TIZ_LOG (TIZ_PRIORITY_NOTICE, "evt.state_ [%s] target state [%s]...", tiz_state_to_str (evt.state_), tiz_state_to_str (source.target_omx_state ())); assert (evt.state_ == source.target_omx_state ()); rc = true; } } G_GUARD_LOG (rc); return rc; }
OMX_ERRORTYPE check_EventHandler (OMX_HANDLETYPE ap_hdl, OMX_PTR ap_app_data, OMX_EVENTTYPE eEvent, OMX_U32 nData1, OMX_U32 nData2, OMX_PTR pEventData) { check_common_context_t *p_ctx = NULL; cc_ctx_t *pp_ctx = NULL; assert (ap_app_data); pp_ctx = (cc_ctx_t *) ap_app_data; p_ctx = *pp_ctx; TIZ_LOG (TIZ_TRACE, "Component Event [%s]", tiz_evt_to_str (eEvent)); if (OMX_EventCmdComplete == eEvent) { switch ((OMX_COMMANDTYPE) (nData1)) { case OMX_CommandStateSet: { TIZ_LOG (TIZ_TRACE, "Component transitioned to [%s]", tiz_state_to_str ((OMX_STATETYPE) (nData2))); p_ctx->state = (OMX_STATETYPE) (nData2); _ctx_signal (pp_ctx); break; } case OMX_CommandPortDisable: case OMX_CommandPortEnable: default: { assert (0); } }; } if (OMX_EventBufferFlag == eEvent) { if (nData2 & OMX_BUFFERFLAG_EOS) { TIZ_LOG (TIZ_TRACE, "Received EOS from [%s] port[%i]", TIZ_FILE_WRITER_COMPONENT_NAME, nData1); } else { fail_if (0); } } return OMX_ErrorNone; }
OMX_ERRORTYPE check_EventHandler (OMX_HANDLETYPE ap_hdl, OMX_PTR ap_app_data, OMX_EVENTTYPE eEvent, OMX_U32 nData1, OMX_U32 nData2, OMX_PTR pEventData) { check_common_context_t *p_ctx = NULL; cc_ctx_t *pp_ctx = NULL; assert (ap_app_data); pp_ctx = (cc_ctx_t *) ap_app_data; p_ctx = *pp_ctx; const char *p_cname = NULL; fail_if(!(p_cname = hdl2cname(ap_hdl))); if (OMX_EventCmdComplete == eEvent) { switch ((OMX_COMMANDTYPE) (nData1)) { case OMX_CommandStateSet: { TIZ_LOG (TIZ_PRIORITY_TRACE, "[%s] OMX_CommandStateSet : " "Component transitioned to [%s]", p_cname, tiz_state_to_str ((OMX_STATETYPE) (nData2))); p_ctx->state = (OMX_STATETYPE) (nData2); _ctx_signal (pp_ctx, OMX_EventCmdComplete); break; } case OMX_CommandPortDisable: case OMX_CommandPortEnable: default: { assert (0); } }; } if (OMX_EventBufferFlag == eEvent) { if (nData2 & OMX_BUFFERFLAG_EOS) { TIZ_LOG (TIZ_PRIORITY_TRACE, "Received EOS from [%s] port[%i]", p_cname, nData1); p_ctx->flags = nData2; _ctx_signal (pp_ctx, OMX_EventBufferFlag); } else { fail_if (0); } } if (OMX_EventPortSettingsChanged == eEvent) { p_ctx->port = nData1; p_ctx->index = nData2; _ctx_signal (pp_ctx, OMX_EventPortSettingsChanged); } return OMX_ErrorNone; }
std::string graph::omx_event_info::to_string () const { std::string info ("["); info.append (tiz_evt_to_str (static_cast< OMX_EVENTTYPE >(event_))); info.append ("]"); switch (event_) { case OMX_EventCmdComplete: { info.append (" ["); info.append (tiz_cmd_to_str (static_cast< OMX_COMMANDTYPE >(ndata1_))); info.append ("]"); if (OMX_CommandStateSet == ndata1_) { info.append (" ["); info.append (tiz_state_to_str (static_cast< OMX_STATETYPE >(ndata2_))); info.append ("]"); } else { info.append (" PORT ["); info.append (boost::lexical_cast< std::string >(ndata2_)); info.append ("]"); } } break; case OMX_EventError: { info.append (" ["); info.append (tiz_err_to_str (static_cast< OMX_ERRORTYPE >(ndata1_))); info.append ("]"); info.append (" ["); info.append (boost::lexical_cast< std::string >(ndata2_)); info.append ("]"); } break; case OMX_EventPortSettingsChanged: { info.append (" PORT ["); info.append (boost::lexical_cast< std::string >(ndata1_)); info.append ("]"); info.append (" ["); info.append (tiz_idx_to_str (static_cast< OMX_INDEXTYPE >(ndata2_))); info.append ("]"); } break; case OMX_EventBufferFlag: { info.append (" PORT ["); info.append (boost::lexical_cast< std::string >(ndata1_)); info.append ("]"); info.append (" nFlags ["); info.append (boost::lexical_cast< std::string >(ndata2_)); info.append ("]"); } break; default: { info.append (" [TO BE DONE]"); } break; }; return info; }