void graph::ops::record_expected_transitions (const OMX_STATETYPE to_state)
{
  const size_t nhandles = handles_.size ();
  clear_expected_transitions ();
  for (unsigned int i = 0; i < nhandles; ++i)
  {
    expected_transitions_lst_.push_back (
        omx_event_info (handles_[i], to_state, OMX_ErrorNone));
  }
}
OMX_ERRORTYPE
graph::ops::transition_source (const OMX_STATETYPE to_state)
{
  OMX_ERRORTYPE rc = OMX_ErrorNone;
  const int source_component_index = 0;
  rc = tiz::graph::util::transition_one (handles_, source_component_index,
                                         to_state);
  if (OMX_ErrorNone == rc)
  {
    clear_expected_transitions ();
    add_expected_transition (handles_[source_component_index], to_state);
  }
  return rc;
}
void graph::ops::do_omx_pause2exe ()
{
  assert (!handles_.empty ());
  if (last_op_succeeded ())
  {
    const int renderer_handle_index = handles_.size () - 1;
    G_OPS_BAIL_IF_ERROR (util::transition_one (handles_, renderer_handle_index,
                                               OMX_StateExecuting),
                         "Unable to transition renderer from Pause->Exe");
    clear_expected_transitions ();
    add_expected_transition (handles_[renderer_handle_index],
                             OMX_StateExecuting);
  }
}
void graph::httpclntops::do_omx_idle2exe ()
{
  if (last_op_succeeded ())
  {
    // Transition the decoder and the renderer components to Exe
    omx_comp_handle_lst_t decoder_and_renderer_handles;
    decoder_and_renderer_handles.push_back (handles_[1]);  // the decoder
    decoder_and_renderer_handles.push_back (handles_[2]);  // the renderer
    G_OPS_BAIL_IF_ERROR (
        util::transition_all (decoder_and_renderer_handles, OMX_StateExecuting,
                              OMX_StateIdle),
        "Unable to transition decoder and renderer from Idle->Exe");
    clear_expected_transitions ();
    add_expected_transition (handles_[1], OMX_StateExecuting);
    add_expected_transition (handles_[2], OMX_StateExecuting);
  }
}
void graph::gmusicops::do_loaded2idle ()
{
  if (last_op_succeeded ())
  {
    // Transition the decoder and the renderer components to Idle
    omx_comp_handle_lst_t decoder_and_renderer_handles;
    decoder_and_renderer_handles.push_back (handles_[1]);  // the decoder
    decoder_and_renderer_handles.push_back (handles_[2]);  // the renderer
    G_OPS_BAIL_IF_ERROR (
        util::transition_all (decoder_and_renderer_handles, OMX_StateIdle,
                              OMX_StateLoaded),
        "Unable to transition decoder and renderer from Loaded->Idle");
    clear_expected_transitions ();
    add_expected_transition (handles_[1], OMX_StateIdle);
    add_expected_transition (handles_[2], OMX_StateIdle);
  }
}
void graph::ops::do_omx_pause2idle ()
{
  assert (!handles_.empty ());
  if (last_op_succeeded ())
  {
    const int renderer_handle_index = handles_.size () - 1;
    G_OPS_BAIL_IF_ERROR (
        util::transition_one (handles_, renderer_handle_index, OMX_StateIdle),
        "Unable to transition renderer from Pause->Idle");
    clear_expected_transitions ();
    add_expected_transition (handles_[renderer_handle_index], OMX_StateIdle);

    for (int i = renderer_handle_index - 1; i >= 0; --i)
    {
      G_OPS_BAIL_IF_ERROR (util::transition_one (handles_, i, OMX_StateIdle),
                           "Unable to transition from Idle->Exe");
      add_expected_transition (handles_[i], OMX_StateIdle);
    }
  }
}