void graph::httpclntops::do_load ()
{
  assert (!comp_lst_.empty ());
  assert (!role_lst_.empty ());

  // At this point we are going to instantiate the two remaining components in
  // the graph, the audio decoder and the pcm renderer. The http source is
  // already instantiated and in Executing state.

  assert (comp_lst_.size () == 1);

  dump_stream_metadata ();

  G_OPS_BAIL_IF_ERROR (
      get_encoding_type_from_http_source (),
      "Unable to retrieve the audio encoding from the http source.");

  omx_comp_name_lst_t comp_list;
  omx_comp_role_lst_t role_list;
  G_OPS_BAIL_IF_ERROR (add_decoder_to_component_list (comp_list, role_list),
                       "Unknown/unhandled stream format.");

  comp_list.push_back (tiz::graph::util::get_default_pcm_renderer ());
  role_list.push_back ("audio_renderer.pcm");

  tiz::graph::cbackhandler &cbacks = get_cback_handler ();
  G_OPS_BAIL_IF_ERROR (
      util::instantiate_comp_list (comp_list, handles_, h2n_, &(cbacks),
                                   cbacks.get_omx_cbacks ()),
      "Unable to instantiate the component list.");

  // Now add the the new components to the base class lists
  comp_lst_.insert (comp_lst_.begin (), comp_list.begin (), comp_list.end ());
  role_lst_.insert (role_lst_.begin (), role_list.begin (), role_list.end ());
}
void graph::youtubeops::do_load_decoder ()
{
  assert (comp_lst_.size () == 2);
  assert (role_lst_.size () == 2);
  assert (handles_.size () == 2);

  // The audio decoder needs to be instantiated next.

  G_OPS_BAIL_IF_ERROR (
      get_encoding_type_from_container_demuxer (),
      "Unable to retrieve the audio encoding from the container demuxer.");

  omx_comp_name_lst_t comp_list;
  omx_comp_role_lst_t role_list;
  G_OPS_RECORD_IF_ERROR (add_decoder_to_component_list (comp_list, role_list),
                         "Unknown/unhandled stream format.");

  tiz::graph::cbackhandler &cbacks = get_cback_handler ();
  G_OPS_RECORD_IF_ERROR (
      util::instantiate_comp_list (comp_list, handles_, h2n_, &(cbacks),
                                   cbacks.get_omx_cbacks ()),
      "Unable to instantiate the component list.");

  // Now add the new components to the base class lists
  comp_lst_.insert (comp_lst_.begin (), comp_list.begin (), comp_list.end ());
  role_lst_.insert (role_lst_.begin (), role_list.begin (), role_list.end ());
}
void graph::youtubeops::do_load_demuxer ()
{
  assert (comp_lst_.size () == 1);
  assert (role_lst_.size () == 1);
  assert (handles_.size () == 1);

  // The youtube source is already instantiated. The container demuxer needs to
  // be instantiated next.

  G_OPS_BAIL_IF_ERROR (
      get_container_type_from_youtube_source (),
      "Unable to retrieve the audio encoding from the container demuxer.");

  omx_comp_handle_lst_t hdl_list;
  omx_comp_name_lst_t comp_list;
  omx_comp_role_lst_t role_list;
  G_OPS_BAIL_IF_ERROR (add_demuxer_to_component_list (comp_list, role_list),
                       "Unknown/unhandled container format.");

  G_OPS_BAIL_IF_ERROR (util::verify_comp_list (comp_list),
                       "Unable to verify the component list.");

  omx_comp_role_pos_lst_t role_positions;
  G_OPS_BAIL_IF_ERROR (
      util::verify_role_list (comp_list, role_list, role_positions),
      "Unable to verify the role list.");

  tiz::graph::cbackhandler &cbacks = get_cback_handler ();
  G_OPS_BAIL_IF_ERROR (
      util::instantiate_comp_list (comp_list, handles_, h2n_, &(cbacks),
                                   cbacks.get_omx_cbacks ()),
      "Unable to instantiate the component list.");

  hdl_list.insert (hdl_list.begin (), handles_.rbegin (),
                   handles_.rbegin () + 1);
  G_OPS_BAIL_IF_ERROR (
      util::set_role_list (hdl_list, role_list, role_positions),
      "Unable to instantiate the component list.");

  // Now add the new components to the base class lists
  comp_lst_.insert (comp_lst_.begin (), comp_list.begin (), comp_list.end ());
  role_lst_.insert (role_lst_.begin (), role_list.begin (), role_list.end ());
}
void graph::youtubeops::do_load_http_source ()
{
  assert (comp_lst_.size () == 0);
  assert (role_lst_.size () == 0);
  assert (handles_.size () == 0);

  // The youtube source will be instantiated now.

  omx_comp_name_lst_t comp_list;
  comp_list.push_back ("OMX.Aratelia.audio_source.http");

  omx_comp_role_lst_t role_list;
  role_list.push_back ("audio_source.http.youtube");

  G_OPS_BAIL_IF_ERROR (util::verify_comp_list (comp_list),
                       "Unable to verify the component list.");

  omx_comp_role_pos_lst_t role_positions;
  G_OPS_BAIL_IF_ERROR (
      util::verify_role_list (comp_list, role_list, role_positions),
      "Unable to verify the role list.");

  tiz::graph::cbackhandler &cbacks = get_cback_handler ();
  G_OPS_BAIL_IF_ERROR (
      util::instantiate_comp_list (comp_list, handles_, h2n_, &(cbacks),
                                   cbacks.get_omx_cbacks ()),
      "Unable to instantiate the component list.");

  G_OPS_BAIL_IF_ERROR (
      util::set_role_list (handles_, role_list, role_positions),
      "Unable to instantiate the component list.");

  // Now add the new component to the base class lists
  comp_lst_.insert (comp_lst_.begin (), comp_list.begin (), comp_list.end ());
  role_lst_.insert (role_lst_.begin (), role_list.begin (), role_list.end ());

  if (inital_graph_load_)
  {
    inital_graph_load_ = false;
    tiz::graph::util::dump_graph_info ("Youtube", "Connecting", "");
  }
}
void graph::youtubeops::do_load_renderer ()
{
  assert (comp_lst_.size () == 3);
  assert (role_lst_.size () == 3);
  assert (handles_.size () == 3);

  // The audio renderer needs to be instantiated next.
  omx_comp_name_lst_t comp_list;
  omx_comp_role_lst_t role_list;
  comp_list.push_back (tiz::graph::util::get_default_pcm_renderer ());
  role_list.push_back ("audio_renderer.pcm");

  tiz::graph::cbackhandler &cbacks = get_cback_handler ();
  G_OPS_RECORD_IF_ERROR (
      util::instantiate_comp_list (comp_list, handles_, h2n_, &(cbacks),
                                   cbacks.get_omx_cbacks ()),
      "Unable to instantiate the component list.");

  // Now add the new components to the base class lists
  comp_lst_.insert (comp_lst_.begin (), comp_list.begin (), comp_list.end ());
  role_lst_.insert (role_lst_.begin (), role_list.begin (), role_list.end ());
}
void graph::gmusicops::do_load ()
{
  assert (!comp_lst_.empty ());
  assert (!role_lst_.empty ());

  // At this point we are going to instantiate the remaining component in the
  // graph, the audio decoder and the pcm renderer. The gmusic source is already
  // instantiated and in
  // Executing state.

  assert (comp_lst_.size () == 1);
  assert (handles_.size () == 1);

  G_OPS_BAIL_IF_ERROR (
      get_encoding_type_from_gmusic_source (),
      "Unable to retrieve the audio encoding from the gmusic source.");

  omx_comp_name_lst_t comp_list;
  omx_comp_role_lst_t role_list;

  comp_list.push_back ("OMX.Aratelia.audio_decoder.mp3");
  role_list.push_back ("audio_decoder.mp3");

  comp_list.push_back (tiz::graph::util::get_default_pcm_renderer ());
  role_list.push_back ("audio_renderer.pcm");

  tiz::graph::cbackhandler &cbacks = get_cback_handler ();
  G_OPS_BAIL_IF_ERROR (
      util::instantiate_comp_list (comp_list, handles_, h2n_, &(cbacks),
                                   cbacks.get_omx_cbacks ()),
      "Unable to instantiate the component list.");

  // Now add the new components to the base class lists
  comp_lst_.insert (comp_lst_.begin (), comp_list.begin (), comp_list.end ());
  role_lst_.insert (role_lst_.begin (), role_list.begin (), role_list.end ());
}