OMX_ERRORTYPE
graph::gmusicops::set_channels_and_rate_on_renderer (
    const OMX_U32 channels, const OMX_U32 sampling_rate,
    const std::string encoding_str)
{
  const OMX_HANDLETYPE handle = handles_[2];  // renderer's handle
  const OMX_U32 port_id = 0;                  // renderer's input port

  TIZ_LOG (TIZ_PRIORITY_TRACE, "channels = [%d] sampling_rate = [%d]", channels,
           sampling_rate);

  // Retrieve the pcm settings from the renderer component
  TIZ_INIT_OMX_PORT_STRUCT (renderer_pcmtype_, port_id);
  tiz_check_omx_err (
      OMX_GetParameter (handle, OMX_IndexParamAudioPcm, &renderer_pcmtype_));

  // Now assign the actual settings to the pcmtype structure
  renderer_pcmtype_.nChannels = channels;
  renderer_pcmtype_.nSamplingRate = sampling_rate;
  renderer_pcmtype_.eNumData = OMX_NumericalDataSigned;
  renderer_pcmtype_.eEndian
      = (encoding_ == OMX_AUDIO_CodingMP3 ? OMX_EndianBig : OMX_EndianLittle);

  // Set the new pcm settings
  tiz_check_omx_err (
      OMX_SetParameter (handle, OMX_IndexParamAudioPcm, &renderer_pcmtype_));

  std::string coding_type_str ("gmusic");
  tiz::graph::util::dump_graph_info (coding_type_str.c_str (),
                                     "Connection established",
                                     playlist_->get_current_uri ().c_str ());
  dump_stream_metadata ();

  return OMX_ErrorNone;
}
Esempio n. 2
0
static OMX_ERRORTYPE
fr_proc_buffers_ready (const void *ap_obj)
{
  const fr_prc_t *p_obj = ap_obj;
  const tiz_srv_t *p_parent = ap_obj;
  tiz_pd_set_t ports;
  void *p_krn = tiz_get_krn (p_parent->p_hdl_);
  OMX_BUFFERHEADERTYPE *p_hdr = NULL;

  if (p_obj->eos_ == false)
    {
      TIZ_PD_ZERO (&ports);

      tiz_check_omx_err (tiz_krn_select (p_krn, 1, &ports));

      if (TIZ_PD_ISSET (0, &ports))
        {
          tiz_check_omx_err (tiz_krn_claim_buffer (p_krn, 0, 0, &p_hdr));
          TIZ_LOG (TIZ_TRACE, "Claimed HEADER [%p]...", p_hdr);
          tiz_check_omx_err (fr_proc_read_buffer (ap_obj, p_hdr));
          tiz_krn_release_buffer (p_krn, 0, p_hdr);
        }
    }

  return OMX_ErrorNone;
}
Esempio n. 3
0
static bool
claim_input (const void *ap_obj)
{
  const tiz_srv_t *p_parent = ap_obj;
  struct webpdprc *p_obj = (struct webpdprc *) ap_obj;
  tiz_pd_set_t ports;
  void *p_krn = tiz_get_krn (p_parent->p_hdl_);

  TIZ_PD_ZERO (&ports);
  tiz_check_omx_err (tiz_krn_select (p_krn, 2, &ports));

  /* We need one input buffers */
  if (TIZ_PD_ISSET (0, &ports))
    {
      tiz_check_omx_err (tiz_krn_claim_buffer
                         (p_krn, 0, 0, &p_obj->pinhdr_));
      TIZ_LOG_CNAME (TIZ_TRACE, TIZ_CNAME (p_parent->p_hdl_),
                     TIZ_CBUF (p_parent->p_hdl_),
                     "Claimed INPUT HEADER [%p]...", p_obj->pinhdr_);
      return true;
    }

  TIZ_LOG_CNAME (TIZ_TRACE,
                 TIZ_CNAME (p_parent->p_hdl_),
                 TIZ_CBUF (p_parent->p_hdl_),
                 "COULD NOT CLAIM AN INPUT HEADER...");

  return false;
}
Esempio n. 4
0
OMX_ERRORTYPE
OMX_ComponentInit (OMX_HANDLETYPE ap_hdl)
{
    tiz_role_factory_t role_factory;
    const tiz_role_factory_t *rf_list[] = { &role_factory };
    tiz_type_factory_t sdlivrprc_type;
    const tiz_type_factory_t *tf_list[] = { &sdlivrprc_type};

    strcpy ((OMX_STRING) role_factory.role, ARATELIA_YUV_RENDERER_DEFAULT_ROLE);
    role_factory.pf_cport   = instantiate_config_port;
    role_factory.pf_port[0] = instantiate_input_port;
    role_factory.nports     = 1;
    role_factory.pf_proc    = instantiate_processor;

    strcpy ((OMX_STRING) sdlivrprc_type.class_name, "sdlivrprc_class");
    sdlivrprc_type.pf_class_init = sdlivr_prc_class_init;
    strcpy ((OMX_STRING) sdlivrprc_type.object_name, "sdlivrprc");
    sdlivrprc_type.pf_object_init = sdlivr_prc_init;

    /* Initialize the component infrastructure */
    tiz_check_omx_err (tiz_comp_init (ap_hdl, ARATELIA_YUV_RENDERER_COMPONENT_NAME));

    /* Register the "sdlivrprc" class */
    tiz_check_omx_err (tiz_comp_register_types (ap_hdl, tf_list, 1));

    /* Register the component role */
    tiz_check_omx_err (tiz_comp_register_roles (ap_hdl, rf_list, 1));

    return OMX_ErrorNone;
}
Esempio n. 5
0
static OMX_ERRORTYPE
sdlivr_proc_buffers_ready (const void *ap_obj)
{
  OMX_BUFFERHEADERTYPE *p_hdr = NULL;

  if (OMX_ErrorNone == tiz_krn_claim_buffer
      (tiz_get_krn (handleOf (ap_obj)), 0, 0, &p_hdr))
    {
      if (NULL != p_hdr)
        {
          tiz_check_omx_err (sdlivr_proc_render_buffer (ap_obj, p_hdr));
          if (p_hdr->nFlags & OMX_BUFFERFLAG_EOS)
            {
              TIZ_TRACE (handleOf (ap_obj),
                         "OMX_BUFFERFLAG_EOS in HEADER [%p]", p_hdr);
              tiz_srv_issue_event ((OMX_PTR) ap_obj,
                                   OMX_EventBufferFlag,
                                   0, p_hdr->nFlags, NULL);
            }
          tiz_check_omx_err
            (tiz_krn_release_buffer (tiz_get_krn (handleOf (ap_obj)), 0, p_hdr));
        }
    }

  return OMX_ErrorNone;
}
Esempio n. 6
0
static bool
claim_output (const void *ap_obj)
{
  const tiz_srv_t *p_parent = ap_obj;
  struct webpdprc *p_obj = (struct webpdprc *) ap_obj;
  tiz_pd_set_t ports;
  void *p_krn = tiz_get_krn (p_parent->p_hdl_);

  TIZ_PD_ZERO (&ports);
  tiz_check_omx_err (tiz_krn_select (p_krn, 2, &ports));

  /* We need one output buffers */
  if (TIZ_PD_ISSET (1, &ports))
    {
      tiz_check_omx_err (tiz_krn_claim_buffer
                         (p_krn, 1, 0, &p_obj->pouthdr_));
      TIZ_LOG_CNAME (TIZ_TRACE, TIZ_CNAME (p_parent->p_hdl_),
                     TIZ_CBUF (p_parent->p_hdl_),
                     "Claimed OUTPUT HEADER [%p] BUFFER [%p] "
                     "nFilledLen [%d]...", p_obj->pouthdr_,
                     p_obj->pouthdr_->pBuffer, p_obj->pouthdr_->nFilledLen);
      return true;
    }

  return false;
}
Esempio n. 7
0
OMX_ERRORTYPE
OMX_ComponentInit (OMX_HANDLETYPE ap_hdl)
{
    tiz_role_factory_t role_factory;
    const tiz_role_factory_t *rf_list[] = { &role_factory };
    tiz_type_factory_t mp3metaprc_type;
    const tiz_type_factory_t *tf_list[] = { &mp3metaprc_type };

    strcpy ((OMX_STRING)role_factory.role,
            ARATELIA_MP3_METADATA_ERASER_DEFAULT_ROLE);
    role_factory.pf_cport = instantiate_config_port;
    role_factory.pf_port[0] = instantiate_output_port;
    role_factory.nports = 1;
    role_factory.pf_proc = instantiate_processor;

    strcpy ((OMX_STRING)mp3metaprc_type.class_name, "mp3metaprc_class");
    mp3metaprc_type.pf_class_init = mp3meta_prc_class_init;
    strcpy ((OMX_STRING)mp3metaprc_type.object_name, "mp3metaprc");
    mp3metaprc_type.pf_object_init = mp3meta_prc_init;

    /* Initialize the component infrastructure */
    tiz_check_omx_err (
        tiz_comp_init (ap_hdl, ARATELIA_MP3_METADATA_ERASER_COMPONENT_NAME));

    /* Register the "mp3metaprc" class */
    tiz_check_omx_err (tiz_comp_register_types (ap_hdl, tf_list, 1));

    /* Register the various roles */
    tiz_check_omx_err (tiz_comp_register_roles (ap_hdl, rf_list, 1));

    return OMX_ErrorNone;
}
OMX_ERRORTYPE
graph::oggopusdecops::set_opus_settings ()
{
  // Retrieve the current opus settings from the decoder's port #0
  OMX_TIZONIA_AUDIO_PARAM_OPUSTYPE opustype_orig;
  TIZ_INIT_OMX_PORT_STRUCT (opustype_orig, 0 /* port id */);

  tiz_check_omx_err (OMX_GetParameter (
      handles_[1], static_cast< OMX_INDEXTYPE >(OMX_TizoniaIndexParamAudioOpus),
      &opustype_orig));

  // Set the opus settings on decoder's port #0
  OMX_TIZONIA_AUDIO_PARAM_OPUSTYPE opustype;
  TIZ_INIT_OMX_PORT_STRUCT (opustype, 0 /* port id */);

  probe_ptr_->get_opus_codec_info (opustype);
  opustype.nPortIndex = 0;
  tiz_check_omx_err (OMX_SetParameter (
      handles_[1], static_cast< OMX_INDEXTYPE >(OMX_TizoniaIndexParamAudioOpus),
      &opustype));

  // Record whether we need to wait for a port settings change event or not
  // (the decoder output port implements the "slaving" behaviour)
  //
  // TODO: Add bitrate to the list of things that might change. And then remove
  // the probe_stream_hook hack (see function below)
  need_port_settings_changed_evt_
      = ((opustype_orig.nSampleRate != opustype.nSampleRate)
         || (opustype_orig.nChannels != opustype.nChannels));

  return OMX_ErrorNone;
}
Esempio n. 9
0
OMX_ERRORTYPE
OMX_ComponentInit (OMX_HANDLETYPE ap_hdl)
{
  tiz_role_factory_t role_factory;
  const tiz_role_factory_t *rf_list[] = { &role_factory };
  tiz_type_factory_t mp3eprc_type;
  const tiz_type_factory_t *tf_list[] = { &mp3eprc_type};

  TIZ_LOG (TIZ_PRIORITY_TRACE, "OMX_ComponentInit: "
           "Inititializing [%s]", ARATELIA_MP3_ENCODER_COMPONENT_NAME);

  strcpy ((OMX_STRING) role_factory.role, ARATELIA_MP3_ENCODER_DEFAULT_ROLE);
  role_factory.pf_cport   = instantiate_config_port;
  role_factory.pf_port[0] = instantiate_pcm_port;
  role_factory.pf_port[1] = instantiate_mp3_port;
  role_factory.nports     = 2;
  role_factory.pf_proc    = instantiate_processor;

  strcpy ((OMX_STRING) mp3eprc_type.class_name, "mp3eprc_class");
  mp3eprc_type.pf_class_init = mp3e_prc_class_init;
  strcpy ((OMX_STRING) mp3eprc_type.object_name, "mp3eprc");
  mp3eprc_type.pf_object_init = mp3e_prc_init;

  /* Initialize the component infrastructure */
  tiz_check_omx_err (tiz_comp_init (ap_hdl, ARATELIA_MP3_ENCODER_COMPONENT_NAME));

  /* Register the "mp3eprc" class */
  tiz_check_omx_err (tiz_comp_register_types (ap_hdl, tf_list, 1));

  /* Register the component role */
  tiz_check_omx_err (tiz_comp_register_roles (ap_hdl, rf_list, 1));

  return OMX_ErrorNone;
}
OMX_ERRORTYPE
graph::vorbisdecops::set_vorbis_settings ()
{
  // Retrieve the current vorbis settings from the decoder's port #0
  OMX_AUDIO_PARAM_VORBISTYPE vorbistype_orig;
  TIZ_INIT_OMX_PORT_STRUCT (vorbistype_orig, 0 /* port id */);

  tiz_check_omx_err (OMX_GetParameter (handles_[1], OMX_IndexParamAudioVorbis,
                                       &vorbistype_orig));

  // Set the vorbis settings on decoder's port #0
  OMX_AUDIO_PARAM_VORBISTYPE vorbistype;
  TIZ_INIT_OMX_PORT_STRUCT (vorbistype, 0 /* port id */);

  probe_ptr_->get_vorbis_codec_info (vorbistype);
  vorbistype.nPortIndex = 0;
  tiz_check_omx_err (
      OMX_SetParameter (handles_[1], OMX_IndexParamAudioVorbis, &vorbistype));

  // Record whether we need to wait for a port settings change event or not
  // (the decoder output port implements the "slaving" behaviour)
  need_port_settings_changed_evt_
      = ((vorbistype_orig.nSampleRate != vorbistype.nSampleRate)
         || (vorbistype_orig.nChannels != vorbistype.nChannels));

  return OMX_ErrorNone;
}
Esempio n. 11
0
OMX_ERRORTYPE
OMX_ComponentInit (OMX_HANDLETYPE ap_hdl)
{
  tiz_role_factory_t audio_role;
  tiz_role_factory_t video_role;
  tiz_role_factory_t image_role;
  tiz_role_factory_t other_role;
  const tiz_role_factory_t *rf_list[] = { &audio_role, &video_role,
    &image_role, &other_role
  };
  tiz_type_factory_t frprc_type;
  const tiz_type_factory_t *tf_list[] = { &frprc_type };

  strcpy ((OMX_STRING) audio_role.role,
          ARATELIA_FILE_READER_AUDIO_READER_ROLE);
  audio_role.pf_cport   = instantiate_config_port;
  audio_role.pf_port[0] = instantiate_audio_port;
  audio_role.nports     = 1;
  audio_role.pf_proc    = instantiate_processor;

  strcpy ((OMX_STRING) video_role.role,
          ARATELIA_FILE_READER_VIDEO_READER_ROLE);
  video_role.pf_cport   = instantiate_config_port;
  video_role.pf_port[0] = instantiate_video_port;
  video_role.nports     = 1;
  video_role.pf_proc    = instantiate_processor;

  strcpy ((OMX_STRING) image_role.role,
          ARATELIA_FILE_READER_IMAGE_READER_ROLE);
  image_role.pf_cport   = instantiate_config_port;
  image_role.pf_port[0] = instantiate_image_port;
  image_role.nports     = 1;
  image_role.pf_proc    = instantiate_processor;

  strcpy ((OMX_STRING) other_role.role,
          ARATELIA_FILE_READER_OTHER_READER_ROLE);
  other_role.pf_cport   = instantiate_config_port;
  other_role.pf_port[0] = instantiate_other_port;
  other_role.nports     = 1;
  other_role.pf_proc    = instantiate_processor;

  strcpy ((OMX_STRING) frprc_type.class_name, "frprc_class");
  frprc_type.pf_class_init = fr_prc_class_init;
  strcpy ((OMX_STRING) frprc_type.object_name, "frprc");
  frprc_type.pf_object_init = fr_prc_init;

  /* Initialize the component infrastructure */
  tiz_check_omx_err (tiz_comp_init (ap_hdl, ARATELIA_FILE_READER_COMPONENT_NAME));

  /* Register the "frprc" class */
  tiz_check_omx_err (tiz_comp_register_types (ap_hdl, tf_list, 1));

  /* Register the various roles */
  tiz_check_omx_err (tiz_comp_register_roles (ap_hdl, rf_list, 4));

  return OMX_ErrorNone;
}
Esempio n. 12
0
OMX_ERRORTYPE
OMX_ComponentInit (OMX_HANDLETYPE ap_hdl)
{
  tiz_role_factory_t role_factory1, role_factory2;
  const tiz_role_factory_t *rf_list[] = { &role_factory1, &role_factory2 };
  tiz_type_factory_t type_factory;
  const tiz_type_factory_t *tf_list[] = { &type_factory};
  const tiz_alloc_hooks_t new_hooks =
    { 0, pcm_port_alloc_hook, pcm_port_free_hook, NULL };
  tiz_alloc_hooks_t old_hooks = { 0, NULL, NULL, NULL };

  strcpy ((OMX_STRING) role_factory1.role, TC_DEFAULT_ROLE1);
  role_factory1.pf_cport = instantiate_config_port;
  role_factory1.pf_port[0] = instantiate_pcm_port;
  role_factory1.nports = 1;
  role_factory1.pf_proc = instantiate_processor;

  strcpy ((OMX_STRING) role_factory2.role, TC_DEFAULT_ROLE2);
  role_factory2.pf_cport = instantiate_config_port;
  role_factory2.pf_port[0] = instantiate_pcm_port;
  role_factory2.nports = 1;
  role_factory2.pf_proc = instantiate_processor;

  strcpy ((OMX_STRING) type_factory.class_name, "tiztcprc_class");
  type_factory.pf_class_init = tiz_tcprc_class_init;
  strcpy ((OMX_STRING) type_factory.object_name, "tiztcprc");
  type_factory.pf_object_init = tiz_tcprc_init;

  TIZ_LOG (TIZ_PRIORITY_TRACE, "OMX_ComponentInit: "
           "Inititializing the test component");

  assert (NULL != ap_hdl);

  /* Initialize the component infrastructure */
  tiz_check_omx_err (tiz_comp_init (ap_hdl, TC_COMPONENT_NAME));

  /* Register the "tiztcprc" class */
  tiz_check_omx_err (tiz_comp_register_types (ap_hdl, tf_list, 1));

  /* Register two roles */
  tiz_check_omx_err (tiz_comp_register_roles (ap_hdl, rf_list, 2));

  /* Register alloc hooks */
  tiz_check_omx_err (tiz_comp_register_alloc_hooks
                     (ap_hdl, &new_hooks, &old_hooks));

  /* Verify that the old hooks have been returned */
  assert (NULL != old_hooks.pf_alloc);
  assert (NULL != old_hooks.pf_free);

  return OMX_ErrorNone;
}
OMX_ERRORTYPE
graph::gmusicops::apply_pcm_codec_info_from_decoder ()
{
  OMX_U32 channels = 2;
  OMX_U32 sampling_rate = 44100;
  std::string encoding_str;

  tiz_check_omx_err (get_channels_and_rate_from_decoder (
      channels, sampling_rate, encoding_str));
  tiz_check_omx_err (set_channels_and_rate_on_renderer (channels, sampling_rate,
                                                        encoding_str));
  return OMX_ErrorNone;
}
OMX_ERRORTYPE
graph::httpclntops::set_channels_and_rate_on_renderer (
    const OMX_U32 channels, const OMX_U32 sampling_rate,
    const std::string encoding_str)
{
  const OMX_HANDLETYPE handle = handles_[2];  // renderer's handle
  const OMX_U32 port_id = 0;                  // renderer's input port

  TIZ_LOG (TIZ_PRIORITY_TRACE, "channels = [%d] sampling_rate = [%d]", channels,
           sampling_rate);

  // Retrieve the pcm settings from the renderer component
  OMX_AUDIO_PARAM_PCMMODETYPE renderer_pcmtype;
  TIZ_INIT_OMX_PORT_STRUCT (renderer_pcmtype, port_id);
  tiz_check_omx_err (
      OMX_GetParameter (handle, OMX_IndexParamAudioPcm, &renderer_pcmtype));

  // Now assign the actual settings to the pcmtype structure
  renderer_pcmtype.nChannels = channels;
  renderer_pcmtype.nSamplingRate = sampling_rate;
  renderer_pcmtype.eNumData = OMX_NumericalDataSigned;
  renderer_pcmtype.eEndian
      = (encoding_ == OMX_AUDIO_CodingMP3 ? OMX_EndianBig : OMX_EndianLittle);

  if (OMX_AUDIO_CodingOPUS == encoding_ || OMX_AUDIO_CodingVORBIS == encoding_)
  {
    // Opus and Vorbis decoders output 32 bit samples (floats)
    renderer_pcmtype.nBitPerSample = 32;
  }

  // Set the new pcm settings
  tiz_check_omx_err (
      OMX_SetParameter (handle, OMX_IndexParamAudioPcm, &renderer_pcmtype));

  std::string coding_type_str ("http/");
  coding_type_str.append (encoding_str);
  tiz::graph::util::dump_graph_info (coding_type_str.c_str (),
                                     "Connection established",
                                     playlist_->get_current_uri ().c_str ());

  TIZ_PRINTF_YEL ("   %ld Ch, %g KHz, %lu:%s:%s\n",
           renderer_pcmtype.nChannels,
           ((float)renderer_pcmtype.nSamplingRate) / 1000,
           renderer_pcmtype.nBitPerSample,
           renderer_pcmtype.eNumData == OMX_NumericalDataSigned ? "s" : "u",
           renderer_pcmtype.eEndian == OMX_EndianBig ? "b" : "l");

  return OMX_ErrorNone;
}
OMX_ERRORTYPE
graph::gmusicops::set_gmusic_playlist (const OMX_HANDLETYPE handle,
                                       const std::string &playlist)
{
  // Set the Google Music playlist
  OMX_TIZONIA_AUDIO_PARAM_GMUSICPLAYLISTTYPE playlisttype;
  TIZ_INIT_OMX_STRUCT (playlisttype);
  tiz_check_omx_err (OMX_GetParameter (
      handle,
      static_cast< OMX_INDEXTYPE >(OMX_TizoniaIndexParamAudioGmusicPlaylist),
      &playlisttype));
  copy_omx_string (playlisttype.cPlaylistName, playlist);

  tizgmusicconfig_ptr_t gmusic_config
    = boost::dynamic_pointer_cast< gmusicconfig >(config_);
  assert (gmusic_config);

  playlisttype.ePlaylistType = gmusic_config->get_playlist_type ();
  playlisttype.bShuffle = playlist_->shuffle ();

  return OMX_SetParameter (
      handle,
      static_cast< OMX_INDEXTYPE >(OMX_TizoniaIndexParamAudioGmusicPlaylist),
      &playlisttype);
}
OMX_ERRORTYPE graph::httpclntops::get_encoding_type_from_http_source ()
{
  OMX_PARAM_PORTDEFINITIONTYPE port_def;
  const OMX_U32 port_id = 0;
  TIZ_INIT_OMX_PORT_STRUCT (port_def, port_id);
  tiz_check_omx_err (
      OMX_GetParameter (handles_[0], OMX_IndexParamPortDefinition, &port_def));
  encoding_ = port_def.format.audio.eEncoding;
  return OMX_ErrorNone;
}
Esempio n. 17
0
static OMX_ERRORTYPE
webpd_proc_buffers_ready (const void *ap_obj)
{
  struct webpdprc *p_obj = (struct webpdprc *) ap_obj;
  const tiz_srv_t *p_parent = ap_obj;
  void *p_krn = tiz_get_krn (p_parent->p_hdl_);

  TIZ_LOG_CNAME (TIZ_TRACE,
                 TIZ_CNAME (p_parent->p_hdl_),
                 TIZ_CBUF (p_parent->p_hdl_), "Buffers ready...");

  while (1)
    {

      if (!p_obj->pinhdr_)
        {
          if (!claim_input (ap_obj) || !p_obj->pinhdr_)
            {
              break;
            }
        }

      if (!p_obj->pouthdr_)
        {
          if (!claim_output (ap_obj))
            {
              break;
            }
        }

      tiz_check_omx_err (webpd_proc_transform_buffer (ap_obj));
      if (p_obj->pinhdr_ && (0 == p_obj->pinhdr_->nFilledLen))
        {
          p_obj->pinhdr_->nOffset = 0;
          tiz_krn_release_buffer (p_krn, 0, p_obj->pinhdr_);
          p_obj->pinhdr_ = NULL;
        }
    }

  if (p_obj->eos_ && p_obj->pouthdr_)
    {
      /* EOS has been received and all the input data has been consumed
       * already, so its time to propagate the EOS flag */
      TIZ_LOG_CNAME (TIZ_TRACE,
                     TIZ_CNAME (p_parent->p_hdl_),
                     TIZ_CBUF (p_parent->p_hdl_),
                     "p_obj->eos OUTPUT HEADER [%p]...", p_obj->pouthdr_);
      p_obj->pouthdr_->nFlags |= OMX_BUFFERFLAG_EOS;
      tiz_krn_release_buffer (p_krn, 1, p_obj->pouthdr_);
      p_obj->pouthdr_ = NULL;
    }

  return OMX_ErrorNone;
}
Esempio n. 18
0
OMX_ERRORTYPE
OMX_ComponentInit (OMX_HANDLETYPE ap_hdl)
{
  tiz_role_factory_t role_factory;
  const tiz_role_factory_t *rf_list[] = { &role_factory };

  assert (ap_hdl);

  TIZ_LOG (TIZ_TRACE, "OMX_ComponentInit: Inititializing [%s]",
           ARATELIA_HTTP_RENDERER_COMPONENT_NAME);

  strcpy ((OMX_STRING) role_factory.role, ARATELIA_HTTP_RENDERER_DEFAULT_ROLE);
  role_factory.pf_cport   = instantiate_config_port;
  role_factory.pf_port[0] = instantiate_mp3_port;
  role_factory.nports     = 1;
  role_factory.pf_proc    = instantiate_processor;

  tiz_check_omx_err (tiz_comp_init (ap_hdl, ARATELIA_HTTP_RENDERER_COMPONENT_NAME));
  tiz_check_omx_err (tiz_comp_register_roles (ap_hdl, rf_list, 1));

  return OMX_ErrorNone;
}
Esempio n. 19
0
static OMX_ERRORTYPE
tiztc_proc_buffers_ready (const void *ap_obj)
{
  const tiz_srv_t *p_parent = ap_obj;
  tiz_pd_set_t ports;
  void *p_ker = tiz_get_krn (p_parent->p_hdl_);
  OMX_BUFFERHEADERTYPE *p_hdr = NULL;

  TIZ_LOG (TIZ_TRACE, "Buffers ready...");

  TIZ_PD_ZERO (&ports);

  tiz_check_omx_err (tiz_krn_select (p_ker, 1, &ports));

  if (TIZ_PD_ISSET (0, &ports))
    {
      tiz_check_omx_err (tiz_krn_claim_buffer (p_ker, 0, 0, &p_hdr));
      tiz_check_omx_err (tiztc_proc_render_buffer (p_hdr));
      (void) tiz_krn_release_buffer (p_ker, 0, p_hdr);
    }

  return OMX_ErrorNone;
}
Esempio n. 20
0
OMX_ERRORTYPE
OMX_ComponentInit (OMX_HANDLETYPE ap_hdl)
{
  tiz_role_factory_t role_factory;
  const tiz_role_factory_t *rf_list[] = { &role_factory };
  tiz_type_factory_t spfysrcprc_type;
  tiz_type_factory_t spfysrccfgport_type;
  const tiz_type_factory_t *tf_list[] = { &spfysrcprc_type, &spfysrccfgport_type };

  strcpy ((OMX_STRING) role_factory.role, ARATELIA_SPOTIFY_SOURCE_DEFAULT_ROLE);
  role_factory.pf_cport   = instantiate_config_port;
  role_factory.pf_port[0] = instantiate_pcm_port;
  role_factory.nports     = 1;
  role_factory.pf_proc    = instantiate_processor;

  strcpy ((OMX_STRING) spfysrcprc_type.class_name, "spfysrcprc_class");
  spfysrcprc_type.pf_class_init = spfysrc_prc_class_init;
  strcpy ((OMX_STRING) spfysrcprc_type.object_name, "spfysrcprc");
  spfysrcprc_type.pf_object_init = spfysrc_prc_init;

  strcpy ((OMX_STRING) spfysrccfgport_type.class_name, "spfysrccfgport_class");
  spfysrccfgport_type.pf_class_init = spfysrc_cfgport_class_init;
  strcpy ((OMX_STRING) spfysrccfgport_type.object_name, "spfysrccfgport");
  spfysrccfgport_type.pf_object_init = spfysrc_cfgport_init;

  /* Initialize the component infrastructure */
  tiz_check_omx_err (tiz_comp_init (ap_hdl, ARATELIA_SPOTIFY_SOURCE_COMPONENT_NAME));

  /* Register the "spfysrcprc" and "spfysrccfgport" classes */
  tiz_check_omx_err (tiz_comp_register_types (ap_hdl, tf_list, 2));

  /* Register this component's role */
  tiz_check_omx_err (tiz_comp_register_roles (ap_hdl, rf_list, 1));

  return OMX_ErrorNone;
}
OMX_ERRORTYPE
graph::gmusicops::set_gmusic_user_and_device_id (const OMX_HANDLETYPE handle,
                                                 const std::string &user,
                                                 const std::string &pass,
                                                 const std::string &device_id)
{
  // Set the Google Music user and pass
  OMX_TIZONIA_AUDIO_PARAM_GMUSICSESSIONTYPE sessiontype;
  TIZ_INIT_OMX_STRUCT (sessiontype);
  tiz_check_omx_err (OMX_GetParameter (
      handle,
      static_cast< OMX_INDEXTYPE >(OMX_TizoniaIndexParamAudioGmusicSession),
      &sessiontype));
  copy_omx_string (sessiontype.cUserName, user);
  copy_omx_string (sessiontype.cUserPassword, pass);
  copy_omx_string (sessiontype.cDeviceId, device_id);
  return OMX_SetParameter (handle, static_cast< OMX_INDEXTYPE >(
                                       OMX_TizoniaIndexParamAudioGmusicSession),
                           &sessiontype);
}
Esempio n. 22
0
static OMX_ERRORTYPE alloc_temp_data_store (vorbisd_prc_t *ap_prc)
{
  OMX_PARAM_PORTDEFINITIONTYPE port_def;

  assert (NULL != ap_prc);

  port_def.nSize = (OMX_U32)sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
  port_def.nVersion.nVersion = OMX_VERSION;
  port_def.nPortIndex = ARATELIA_VORBIS_DECODER_INPUT_PORT_INDEX;

  tiz_check_omx_err (
      tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc),
                            OMX_IndexParamPortDefinition, &port_def));

  assert (ap_prc->p_store_ == NULL);
  ap_prc->store_size_ = port_def.nBufferSize;
  tiz_check_null_ret_oom (
      (ap_prc->p_store_ = tiz_mem_alloc (ap_prc->store_size_)));

  return OMX_ErrorNone;
}
Esempio n. 23
0
static OMX_ERRORTYPE
transform_buffer (fr_prc_t *ap_prc)
{
  OMX_ERRORTYPE rc = OMX_ErrorNone;
  OMX_BUFFERHEADERTYPE *p_in
      = tiz_filter_prc_get_header (ap_prc, ARATELIA_FILE_READER_INPUT_PORT_INDEX);
  OMX_BUFFERHEADERTYPE *p_out
      = tiz_filter_prc_get_header (ap_prc, ARATELIA_FILE_READER_OUTPUT_PORT_INDEX);

  if (NULL == p_in || NULL == p_out)
    {
      TIZ_TRACE (handleOf (ap_prc), "IN HEADER [%p] OUT HEADER [%p]", p_in,
                 p_out);
      return OMX_ErrorNone;
    }

  assert (ap_prc);

  if (0 == p_in->nFilledLen)
    {
      TIZ_TRACE (handleOf (ap_prc), "HEADER [%p] nFlags [%d] is empty", p_in,
                 p_in->nFlags);
      if ((p_in->nFlags & OMX_BUFFERFLAG_EOS) > 0)
        {
          /* Inmediately propagate EOS flag to output */
          TIZ_TRACE (handleOf (ap_prc), "Propagate EOS flag to output HEADER [%p]",
                     p_out);
          p_out->nFlags |= OMX_BUFFERFLAG_EOS;
          tiz_filter_prc_update_eos_flag (ap_prc, true);
          p_in->nFlags   = 0;
          tiz_check_omx_err
            (tiz_filter_prc_release_header (ap_prc, ARATELIA_FILE_READER_OUTPUT_PORT_INDEX));
        }
    }

  return rc;
}
Esempio n. 24
0
static OMX_ERRORTYPE transform_buffer (vorbisd_prc_t *ap_prc)
{
  OMX_ERRORTYPE rc = OMX_ErrorNone;
  OMX_BUFFERHEADERTYPE *p_in
    = tiz_filter_prc_get_header
    (ap_prc, ARATELIA_VORBIS_DECODER_INPUT_PORT_INDEX);
  OMX_BUFFERHEADERTYPE *p_out
    = tiz_filter_prc_get_header
    (ap_prc, ARATELIA_VORBIS_DECODER_OUTPUT_PORT_INDEX);

  if (NULL == p_in || NULL == p_out)
    {
      TIZ_TRACE (handleOf (ap_prc), "IN HEADER [%p] OUT HEADER [%p]", p_in,
                 p_out);
      return OMX_ErrorNone;
    }

  assert (NULL != ap_prc);

  if (0 == p_in->nFilledLen)
    {
      TIZ_TRACE (handleOf (ap_prc), "HEADER [%p] nFlags [%d] is empty", p_in,
                 p_in->nFlags);
      if ((p_in->nFlags & OMX_BUFFERFLAG_EOS) > 0)
        {
          /* Inmediately propagate EOS flag to output */
          TIZ_TRACE (handleOf (ap_prc), "Let's propagate EOS flag to output");
          p_out->nFlags |= OMX_BUFFERFLAG_EOS;
          p_in->nFlags &= ~(1 << OMX_BUFFERFLAG_EOS);
          tiz_check_omx_err
            (tiz_filter_prc_release_header
            (ap_prc, ARATELIA_VORBIS_DECODER_OUTPUT_PORT_INDEX));
        }
    }

  if (p_in->nFilledLen > 0)
    {
      unsigned char *p_data = p_in->pBuffer + p_in->nOffset;
      const long len = p_in->nFilledLen;
      long bytes_consumed = fish_sound_decode (ap_prc->p_fsnd_, p_data, len);
      TIZ_TRACE (handleOf (ap_prc), "p_in->nFilledLen [%d] ", p_in->nFilledLen);
      TIZ_TRACE (handleOf (ap_prc), "bytes_consumed [%d] ", bytes_consumed);

      if (bytes_consumed >= 0)
        {
          assert (p_in->nFilledLen >= bytes_consumed);
          p_in->nFilledLen = 0;
          p_in->nOffset = 0;
        }
      else
        {
          switch (bytes_consumed)
            {
              case FISH_SOUND_STOP_ERR:
                {
                  /* Decoding was stopped by a FishSoundDecode* */
                  /* callback returning FISH_SOUND_STOP_ERR before any input
                   * bytes were consumed. */
                  /* This will occur when PCM is decoded from previously
                   * buffered input, and */
                  /* stopping is immediately requested. */
                  TIZ_ERROR (handleOf (ap_prc),
                             "[FISH_SOUND_ERR_STOP_ERR] : "
                             "While decoding the input stream.");
                  rc = OMX_ErrorStreamCorruptFatal;
                }
                break;
              case FISH_SOUND_ERR_OUT_OF_MEMORY:
                {
                  TIZ_ERROR (handleOf (ap_prc),
                             "[FISH_SOUND_ERR_OUT_OF_MEMORY] : "
                             "While decoding the input stream.");
                  rc = OMX_ErrorInsufficientResources;
                }
                break;
              case FISH_SOUND_ERR_BAD:
                {
                  TIZ_ERROR (handleOf (ap_prc),
                             "[FISH_SOUND_ERR_BAD] : "
                             "While decoding the input stream.");
                  rc = OMX_ErrorStreamCorruptFatal;
                }
                break;
              default:
                {
                  TIZ_ERROR (handleOf (ap_prc),
                             "[%s] : "
                             "While decoding the input stream.",
                             bytes_consumed);
                  assert (0);
                  rc = OMX_ErrorStreamCorruptFatal;
                }
            };
        }
    }

  assert (p_in->nFilledLen >= 0);

  if (0 == p_in->nFilledLen)
    {
      TIZ_TRACE (handleOf (ap_prc), "HEADER [%p] nFlags [%d] is empty", p_in,
                 p_in->nFlags);
      if ((p_in->nFlags & OMX_BUFFERFLAG_EOS) > 0)
        {
          /* Let's propagate EOS flag to output */
          TIZ_TRACE (handleOf (ap_prc), "Let's propagate EOS flag to output");
          tiz_filter_prc_update_eos_flag (ap_prc, true);
          p_in->nFlags &= ~(1 << OMX_BUFFERFLAG_EOS);
        }
      rc = tiz_filter_prc_release_header
        (ap_prc, ARATELIA_VORBIS_DECODER_INPUT_PORT_INDEX);
    }

  return rc;
}
Esempio n. 25
0
static OMX_ERRORTYPE vorbisd_prc_allocate_resources (void *ap_obj,
                                                     OMX_U32 a_pid)
{
  tiz_check_omx_err (alloc_temp_data_store (ap_obj));
  return init_vorbis_decoder (ap_obj);
}