예제 #1
0
END_TEST
START_TEST (test_ilcore_init_and_deinit_get_hdl_free_hdl)
{
  OMX_ERRORTYPE error = OMX_ErrorNone;
  OMX_HANDLETYPE p_hdl = NULL;
  OMX_U32 appData;
  OMX_CALLBACKTYPE callBacks;

  error = OMX_Init ();
  fail_if (error != OMX_ErrorNone);

  error = OMX_GetHandle (&p_hdl,
                         TIZ_CORE_TEST_COMPONENT_NAME,
                         (OMX_PTR *) (&appData), &callBacks);
  TIZ_LOG (TIZ_PRIORITY_TRACE, "OMX_GetHandle error [%s]", tiz_err_to_str (error));
  fail_if (error != OMX_ErrorNone);

  TIZ_LOG (TIZ_PRIORITY_TRACE, "p_hdl [%p]", p_hdl);

  error = OMX_FreeHandle (p_hdl);
  fail_if (error != OMX_ErrorNone);

  error = OMX_Deinit ();
  fail_if (error != OMX_ErrorNone);
}
OMX_ERRORTYPE
graph::gmusicops::get_channels_and_rate_from_decoder (
    OMX_U32 &channels, OMX_U32 &sampling_rate, std::string &encoding_str) const
{
  OMX_ERRORTYPE rc = OMX_ErrorNone;
  const OMX_HANDLETYPE handle = handles_[1];  // mp3 decoder's handle
  const OMX_U32 port_id = 1;                  // mp3 decoder's output port

  switch (encoding_)
  {
    case OMX_AUDIO_CodingMP3:
    {
      encoding_str = "mp3";
      rc = tiz::graph::util::
          get_channels_and_rate_from_audio_port_v2< OMX_AUDIO_PARAM_PCMMODETYPE >(
              handle, port_id, OMX_IndexParamAudioPcm, channels, sampling_rate);
    }
    break;
    default:
    {
      assert (0);
    }
    break;
  };

  TIZ_LOG (TIZ_PRIORITY_TRACE, "outcome = [%s]", tiz_err_to_str (rc));

  return rc;
}
bool graphmgr::httpclntmgrops::is_fatal_error (const OMX_ERRORTYPE error,
                                               const std::string &msg)
{
  bool rc = false;
  TIZ_LOG (TIZ_PRIORITY_ERROR, "[%s] : %s", tiz_err_to_str (error),
           msg.c_str ());
  if (error == OMX_ErrorStreamCorruptFatal)
  {
    // If the decoder component reports this error, it means we can't decode
    // the incoming stream. So this is fatal for this graph.
    error_msg_.assign ("Unable to decode the input stream.");
    rc = true;
  }
  else if (error == OMX_ErrorFormatNotDetected)
  {
    // If the source component reports this error, it means we don't know how
    // to handle the incoming stream So this is fatal for this graph.
    rc = true;
  }
  else
  {
    rc = graphmgr::ops::is_fatal_error (error, msg);
  }
  return rc;
}
예제 #4
0
static OMX_ERRORTYPE
pause_SetParameter (const void *ap_obj,
                    OMX_HANDLETYPE ap_hdl,
                    OMX_INDEXTYPE a_index, OMX_PTR a_struct)
{
  const void *p_krn = tiz_get_krn (ap_hdl);
  OMX_PTR p_port = NULL;
  OMX_ERRORTYPE rc = OMX_ErrorNone;

  /* TODO: Optimization: find_managing_port is called twice, first time here,
   * then in the SetParameter implementation of the kernel object. */
  if (OMX_ErrorNone
      != (rc =
          tiz_krn_find_managing_port (p_krn, a_index, a_struct, &p_port)))
    {
      TIZ_LOG (TIZ_TRACE, "Cannot retrieve managing port (%s)...",
               tiz_err_to_str (rc));
      return rc;
    }

  assert (p_port);

  if (TIZ_PORT_IS_CONFIG_PORT (p_port)
      || (!TIZ_PORT_IS_CONFIG_PORT (p_port) && TIZ_PORT_IS_ENABLED (p_port)))
    {
      TIZ_LOG (TIZ_TRACE, "Incorrect state op "
               "(SetParameter received in Pause state)...");
      return OMX_ErrorIncorrectStateOperation;
    }

  return tiz_api_SetParameter (p_krn, ap_hdl, a_index, a_struct);

}
OMX_ERRORTYPE
graph::youtubeops::get_channels_and_rate_from_decoder (
    OMX_U32 &channels, OMX_U32 &sampling_rate, std::string &encoding_str) const
{
  OMX_ERRORTYPE rc = OMX_ErrorNone;
  const OMX_HANDLETYPE handle = handles_[2];  // decoder's handle
  const OMX_U32 port_id = 1;                  // decoder's output port

  switch (encoding_)
  {
    case OMX_AUDIO_CodingMP3:
    {
      encoding_str = "mp3";
    }
    break;
    case OMX_AUDIO_CodingAAC:
    {
      encoding_str = "aac";
    }
    break;
    case OMX_AUDIO_CodingVORBIS:
    {
      encoding_str = "vorbis";
    }
    break;
    default:
    {
      if (OMX_AUDIO_CodingOPUS == encoding_)
      {
        encoding_str = "opus";
      }
      else if (OMX_AUDIO_CodingFLAC == encoding_)
      {
        encoding_str = "flac";
      }
      else
      {
        TIZ_LOG (
            TIZ_PRIORITY_ERROR,
            "[OMX_ErrorFormatNotDetected] : Unhandled encoding type [%d]...",
            encoding_);
        rc = OMX_ErrorFormatNotDetected;
      }
    }
    break;
  };

  if (OMX_ErrorNone == rc)
  {
    rc = tiz::graph::util::
        get_channels_and_rate_from_audio_port_v2< OMX_AUDIO_PARAM_PCMMODETYPE > (
            handle, port_id, OMX_IndexParamAudioPcm, channels, sampling_rate);
  }
  TIZ_LOG (TIZ_PRIORITY_TRACE, "outcome = [%s]", tiz_err_to_str (rc));

  return rc;
}
예제 #6
0
bool graph::ops::last_op_succeeded () const
{
#ifdef _DEBUG
  if (error_code_ != OMX_ErrorNone)
  {
    TIZ_LOG (TIZ_PRIORITY_TRACE, "error_code_ [%d] [%s]...",
             tiz_err_to_str (error_code_), error_msg_);
  }
#endif
  return (error_code_ == OMX_ErrorNone);
}
예제 #7
0
void tiz::omxutil::init ()
{
  OMX_ERRORTYPE ret = OMX_ErrorNone;

  if (OMX_ErrorNone != (ret = OMX_Init ()))
  {
    fprintf (stderr, "FATAL. Could not init OpenMAX IL : %s",
             tiz_err_to_str (ret));
    exit (EXIT_FAILURE);
  }
}
예제 #8
0
static OMX_ERRORTYPE
sdlivr_prc_allocate_resources (void * ap_obj, OMX_U32 a_pid)
{
  OMX_ERRORTYPE rc = OMX_ErrorNone;
  if (-1 == SDL_Init (SDL_INIT_VIDEO))
    {
      rc = OMX_ErrorInsufficientResources;
      TIZ_ERROR (handleOf (ap_obj), "[%s] : while initializing SDL [%s]",
                 tiz_err_to_str (rc), SDL_GetError ());
    }
  return rc;
}
예제 #9
0
bool graph::ops::is_probing_result_ok () const
{
  bool rc = true;
  const OMX_ERRORTYPE int_error = internal_error ();
  if (OMX_ErrorNone != int_error)
  {
    rc = false;
  }

  TIZ_LOG (TIZ_PRIORITY_TRACE, "[%s] : is_probing_result_ok [%s]...",
           tiz_err_to_str (int_error), rc ? "YES" : "NO");
  return rc;
}
예제 #10
0
static OMX_ERRORTYPE
sdlivr_proc_prepare_to_transfer (void *ap_obj, OMX_U32 a_pid)
{
  sdlivr_prc_t *p_prc = ap_obj;
  OMX_ERRORTYPE rc = OMX_ErrorNone;
  OMX_PARAM_PORTDEFINITIONTYPE portdef;
  TIZ_INIT_OMX_PORT_STRUCT (portdef, ARATELIA_YUV_RENDERER_PORT_INDEX);

  TIZ_TRACE (handleOf (p_prc), "pid [%d]", a_pid);

  assert (NULL != p_prc);

  /* Retrieve port def from port */
  if (OMX_ErrorNone != (rc = tiz_api_GetParameter
                        (tiz_get_krn (handleOf (p_prc)),
                         handleOf (p_prc),
                         OMX_IndexParamPortDefinition, &portdef)))
    {
      TIZ_ERROR (handleOf (p_prc),
                 "[%s] : retrieving the port definition", tiz_err_to_str (rc));
      return rc;
    }

  p_prc->vportdef_ = portdef.format.video;

  TIZ_TRACE (handleOf (p_prc),
            "nFrameWidth = [%d] nFrameHeight = [%d] ",
            /*            "nStride = [%d] nSliceHeight = [%d] nBitrate = [%d] " */
            /*            "xFramerate = [%s] eCompressionFormat = [%d] eColorFormat = [%d]", */
            p_prc->vportdef_.nFrameWidth, p_prc->vportdef_.nFrameHeight);
  /*            p_prc->vportdef_.nStride, */
  /*            p_prc->vportdef_.nSliceHeight, */
  /*            p_prc->vportdef_.nBitrate, */
  /*            p_prc->vportdef_.xFramerate, */
  /*            p_prc->vportdef_.eCompressionFormat, */
  /*            p_prc->vportdef_.eColorFormat); */

  SDL_WM_SetCaption ("Tizonia OpenMAX IL YUV renderer", "YUV");


  p_prc->p_surface = SDL_SetVideoMode
    (p_prc->vportdef_.nFrameWidth, p_prc->vportdef_.nFrameHeight, 0,
     SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL | SDL_RESIZABLE);

  p_prc->p_overlay = SDL_CreateYUVOverlay
    (p_prc->vportdef_.nFrameWidth, p_prc->vportdef_.nFrameHeight,
     SDL_YV12_OVERLAY, p_prc->p_surface);
  return OMX_ErrorNone;
}
예제 #11
0
 void operator() (OMX_ERRORTYPE code, std::string msg) const
 {
   if (OMX_ErrorNone != code)
   {
     TIZ_PRINTF_BLU ("\n%s exiting (%s).\n", APP_NAME,
                     tiz_err_to_str (code));
     TIZ_PRINTF_RED ("\n %s\n\n", msg.c_str ());
     player_exit_failure ();
   }
   else
   {
     TIZ_PRINTF_BLU ("\n\n%s exiting (Quit).\n\n", APP_NAME);
     player_exit_success ();
   }
 }
예제 #12
0
void graph::ops::do_record_fatal_error (const OMX_HANDLETYPE handle,
                                        const OMX_ERRORTYPE error,
                                        const OMX_U32 port)
{
  std::string msg ("[");
  msg.append (handle2name (handle));
  if (port != OMX_ALL)
  {
    msg.append (":port:");
    msg.append (boost::lexical_cast< std::string >(port));
  }
  msg.append ("]\n [");
  msg.append (std::string (tiz_err_to_str (error)));
  msg.append ("]");
  record_error (error, msg);
}
bool graph::gmusicops::is_fatal_error (const OMX_ERRORTYPE error) const
{
  bool rc = false;
  TIZ_LOG (TIZ_PRIORITY_ERROR, "[%s] ", tiz_err_to_str (error));
  if (error == error_code_)
  {
    // if this error is already being handled, then ignore it.
    rc = false;
  }
  else
  {
    rc |= tiz::graph::ops::is_fatal_error (error);
    rc |= (OMX_ErrorContentURIError == error);
  }
  return rc;
}
예제 #14
0
static OMX_ERRORTYPE
httpr_prc_config_change (const void * ap_prc, const OMX_U32 a_pid,
                         const OMX_INDEXTYPE a_config_idx)
{
  const httpr_prc_t * p_prc = ap_prc;
  OMX_ERRORTYPE rc = OMX_ErrorNone;

  assert (ap_prc);

  if (p_prc->p_server_ && OMX_TizoniaIndexConfigIcecastMetadata == a_config_idx
      && ARATELIA_HTTP_RENDERER_PORT_INDEX == a_pid)
    {
      OMX_TIZONIA_ICECASTMETADATATYPE * p_metadata
        = (OMX_TIZONIA_ICECASTMETADATATYPE *) tiz_mem_calloc (
          1, sizeof (OMX_TIZONIA_ICECASTMETADATATYPE)
               + OMX_TIZONIA_MAX_SHOUTCAST_METADATA_SIZE + 1);

      tiz_check_null_ret_oom (p_metadata);

      /* Retrieve the updated icecast metadata from the input port */
      TIZ_INIT_OMX_PORT_STRUCT (*p_metadata, ARATELIA_HTTP_RENDERER_PORT_INDEX);
      p_metadata->nSize = sizeof (OMX_TIZONIA_ICECASTMETADATATYPE)
                          + OMX_TIZONIA_MAX_SHOUTCAST_METADATA_SIZE;

      if (OMX_ErrorNone
          != (rc = tiz_api_GetConfig (
                tiz_get_krn (handleOf (p_prc)), handleOf (p_prc),
                OMX_TizoniaIndexConfigIcecastMetadata, p_metadata)))
        {
          TIZ_ERROR (handleOf (p_prc),
                     "[%s] : Error retrieving "
                     "OMX_TizoniaIndexConfigIcecastMetadata from port",
                     tiz_err_to_str (rc));
        }
      else
        {
          httpr_srv_set_stream_title (p_prc->p_server_,
                                      p_metadata->cStreamTitle);
        }

      tiz_mem_free (p_metadata);
      p_metadata = NULL;
    }
  return rc;
}
예제 #15
0
bool graphmgr::dirblemgrops::is_fatal_error (const OMX_ERRORTYPE error,
                                              const std::string &msg)
{
  bool rc = false;
  TIZ_LOG (TIZ_PRIORITY_ERROR, "[%s] : %s", tiz_err_to_str (error),
           msg.c_str ());
  if (error == OMX_ErrorContentURIError)
  {
    // If the source component reports this error, the playlist is not avaiable.
    error_msg_.assign ("Playlist not found.");
    rc = true;
  }
  else
  {
    rc = graphmgr::ops::is_fatal_error (error, msg);
  }
  return rc;
}
예제 #16
0
static OMX_ERRORTYPE
demuxer_cfgport_GetConfig (const void * ap_obj, OMX_HANDLETYPE ap_hdl,
                           OMX_INDEXTYPE a_index, OMX_PTR ap_struct)
{
  tiz_demuxercfgport_t * p_obj = (tiz_demuxercfgport_t *) ap_obj;
  OMX_ERRORTYPE rc = OMX_ErrorNone;

  TIZ_TRACE (ap_hdl, "GetConfig [%s]...", tiz_idx_to_str (a_index));
  assert (p_obj);

  switch (a_index)
    {
      case OMX_IndexConfigTimePosition:
      case OMX_IndexConfigTimeSeekMode:
        {
          /* Only the processor knows about current position or seek mode. So
           lets get the processor to fill this info for us. */
          void * p_prc = tiz_get_prc (ap_hdl);
          assert (p_prc);
          if (OMX_ErrorNone
              != (rc = tiz_api_GetConfig (p_prc, ap_hdl, a_index, ap_struct)))
            {
              TIZ_ERROR (ap_hdl,
                         "[%s] : Error retrieving [%s] "
                         "from the processor",
                         tiz_err_to_str (rc), tiz_idx_to_str (a_index));
            }
        }
        break;

      default:
        {
          /* Delegate to the base port */
          rc = super_GetConfig (typeOf (ap_obj, "tizdemuxercfgport"), ap_obj,
                                ap_hdl, a_index, ap_struct);
        }
    };

  return rc;
}
예제 #17
0
static OMX_ERRORTYPE
alloc_uri (oggdmux_prc_t * ap_prc)
{
  OMX_ERRORTYPE rc = OMX_ErrorNone;
  const long pathname_max = PATH_MAX + NAME_MAX;

  assert (ap_prc);
  assert (!ap_prc->p_uri_);

  if (!(ap_prc->p_uri_ = tiz_mem_calloc (
          1, sizeof (OMX_PARAM_CONTENTURITYPE) + pathname_max + 1)))
    {
      TIZ_ERROR (handleOf (ap_prc),
                 "Error allocating memory for the content uri struct");
      rc = OMX_ErrorInsufficientResources;
    }
  else
    {
      ap_prc->p_uri_->nSize
        = sizeof (OMX_PARAM_CONTENTURITYPE) + pathname_max + 1;
      ap_prc->p_uri_->nVersion.nVersion = OMX_VERSION;

      if (OMX_ErrorNone
          != (rc = tiz_api_GetParameter (
                tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc),
                OMX_IndexParamContentURI, ap_prc->p_uri_)))
        {
          TIZ_ERROR (handleOf (ap_prc),
                     "[%s] : Error retrieving the URI param from port",
                     tiz_err_to_str (rc));
        }
      else
        {
          TIZ_NOTICE (handleOf (ap_prc), "URI [%s]",
                      ap_prc->p_uri_->contentURI);
        }
    }
  return rc;
}
예제 #18
0
END_TEST
START_TEST (test_ilcore_role_of_comp_enum)
{
  OMX_ERRORTYPE error = OMX_ErrorNone;
  OMX_U32 index = 0;
  OMX_S8 role[OMX_MAX_STRINGNAME_SIZE];

  error = OMX_Init ();
  fail_if (error != OMX_ErrorNone);

  do
    {
      error = OMX_RoleOfComponentEnum ((OMX_STRING) role,
                                       TIZ_CORE_TEST_COMPONENT_NAME, index++);
      TIZ_LOG (TIZ_PRIORITY_TRACE, "[%s] : Role [%s] error [%s]",
               TIZ_CORE_TEST_COMPONENT_NAME, role, tiz_err_to_str (error));
    } while (OMX_ErrorNone == error);

  fail_if (OMX_ErrorNoMore != error);

  error = OMX_Deinit ();
  fail_if (error != OMX_ErrorNone);
}
예제 #19
0
END_TEST
START_TEST (test_ilcore_comp_of_role_enum)
{
  OMX_ERRORTYPE error = OMX_ErrorNone;
  OMX_U32 index = 0;
  OMX_S8 comp_name[OMX_MAX_STRINGNAME_SIZE];

  error = OMX_Init ();
  fail_if (error != OMX_ErrorNone);

  do
    {
      error = OMX_ComponentOfRoleEnum ((OMX_STRING) comp_name,
                                       TIZ_CORE_TEST_COMPONENT_ROLE, index++);
      TIZ_LOG (TIZ_PRIORITY_TRACE, "[%s] : component [%s] error [%s]",
               TIZ_CORE_TEST_COMPONENT_ROLE, comp_name, tiz_err_to_str (error));
    } while (OMX_ErrorNone == error);

  fail_if (OMX_ErrorNoMore != error);
  fail_if (index != 2);

  error = OMX_Deinit ();
  fail_if (error != OMX_ErrorNone);
}
예제 #20
0
bool graph::ops::is_fatal_error (const OMX_ERRORTYPE error) const
{
  TIZ_LOG (TIZ_PRIORITY_ERROR, "[%s] ", tiz_err_to_str (error));
  return tiz::graph::util::is_fatal_error (error);
}
예제 #21
0
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;
}