Exemplo n.º 1
0
static OMX_ERRORTYPE
mp3d_proc_prepare_to_transfer (void * ap_obj, OMX_U32 a_pid)
{
  mp3d_prc_t * p_prc = ap_obj;
  OMX_AUDIO_PARAM_MP3TYPE mp3type;

  assert (p_prc);

  /* NOTE: init the decoder here, as it might have been de-inited in a
     transition Exe->Idle */
  init_mad_decoder (ap_obj);

  TIZ_INIT_OMX_PORT_STRUCT (mp3type, ARATELIA_MP3_DECODER_INPUT_PORT_INDEX);
  tiz_check_omx (tiz_api_GetParameter (tiz_get_krn (handleOf (p_prc)),
                                       handleOf (p_prc), OMX_IndexParamAudioMp3,
                                       &mp3type));

  TIZ_INIT_OMX_PORT_STRUCT (p_prc->pcmmode_,
                            ARATELIA_MP3_DECODER_OUTPUT_PORT_INDEX);
  tiz_check_omx (tiz_api_GetParameter (tiz_get_krn (handleOf (p_prc)),
                                       handleOf (p_prc), OMX_IndexParamAudioPcm,
                                       &(p_prc->pcmmode_)));

  TIZ_TRACE (handleOf (p_prc),
             "sample rate decoder = [%d] channels decoder = [%d]",
             mp3type.nSampleRate, mp3type.nChannels);

  TIZ_TRACE (handleOf (p_prc),
             "sample rate renderer = [%d] channels renderer = [%d]",
             p_prc->pcmmode_.nSamplingRate, p_prc->pcmmode_.nChannels);

  reset_stream_parameters (ap_obj);

  return OMX_ErrorNone;
}
Exemplo n.º 2
0
static OMX_ERRORTYPE
prepare_port_auto_detection (mp4dmuxflt_prc_t * ap_prc)
{
  OMX_PARAM_PORTDEFINITIONTYPE port_def;
  assert (ap_prc);

  /* Prepare audio port */
  TIZ_INIT_OMX_PORT_STRUCT (port_def, ARATELIA_MP4_DEMUXER_FILTER_PORT_1_INDEX);
  tiz_check_omx (
    tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc),
                          OMX_IndexParamPortDefinition, &port_def));
  ap_prc->audio_coding_type_ = port_def.format.audio.eEncoding;
  ap_prc->audio_auto_detect_on_
    = (OMX_AUDIO_CodingAutoDetect == ap_prc->audio_coding_type_) ? true : false;

  /* Prepare video port */
  TIZ_INIT_OMX_PORT_STRUCT (port_def, ARATELIA_MP4_DEMUXER_FILTER_PORT_2_INDEX);
  tiz_check_omx (
    tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc),
                          OMX_IndexParamPortDefinition, &port_def));
  ap_prc->video_coding_type_ = port_def.format.video.eCompressionFormat;
  ap_prc->video_auto_detect_on_
    = (OMX_VIDEO_CodingAutoDetect == ap_prc->video_coding_type_) ? true : false;

  return OMX_ErrorNone;
}
void graph::gmusicops::do_reconfigure_first_tunnel ()
{
  // Retrieve the mp3 settings from the gmusic source component
  OMX_AUDIO_PARAM_MP3TYPE gmusic_mp3type;
  const OMX_U32 gmusic_port_id = 0;
  TIZ_INIT_OMX_PORT_STRUCT (gmusic_mp3type, gmusic_port_id);
  G_OPS_BAIL_IF_ERROR (
      OMX_GetParameter (handles_[0], OMX_IndexParamAudioMp3, &gmusic_mp3type),
      "Unable to retrieve the MP3 settings from the gmusic source");

  // Retrieve the mp3 settings from the decoder component
  OMX_AUDIO_PARAM_MP3TYPE decoder_mp3type;
  const OMX_U32 decoder_port_id = 0;
  TIZ_INIT_OMX_PORT_STRUCT (decoder_mp3type, decoder_port_id);
  G_OPS_BAIL_IF_ERROR (
      OMX_GetParameter (handles_[1], OMX_IndexParamAudioMp3, &decoder_mp3type),
      "Unable to retrieve the MP3 settings from the audio decoder");

  // Now assign the current settings to the decoder structure
  decoder_mp3type.nChannels = gmusic_mp3type.nChannels;
  decoder_mp3type.nSampleRate = gmusic_mp3type.nSampleRate;

  // Set the new mp3 settings
  G_OPS_BAIL_IF_ERROR (
      OMX_SetParameter (handles_[1], OMX_IndexParamAudioMp3, &decoder_mp3type),
      "Unable to set the MP3 settings on the audio decoder");
}
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;
}
void graph::gmusicops::do_reconfigure_second_tunnel ()
{
  // Retrieve the pcm settings from the decoder component
  OMX_AUDIO_PARAM_PCMMODETYPE decoder_pcmtype;
  const OMX_U32 decoder_port_id = 1;
  TIZ_INIT_OMX_PORT_STRUCT (decoder_pcmtype, decoder_port_id);
  G_OPS_BAIL_IF_ERROR (
      OMX_GetParameter (handles_[1], OMX_IndexParamAudioPcm, &decoder_pcmtype),
      "Unable to retrieve the PCM settings from the Mp3 decoder");

  // Retrieve the pcm settings from the renderer component
  OMX_AUDIO_PARAM_PCMMODETYPE renderer_pcmtype;
  const OMX_U32 renderer_port_id = 0;
  TIZ_INIT_OMX_PORT_STRUCT (renderer_pcmtype, renderer_port_id);
  G_OPS_BAIL_IF_ERROR (
      OMX_GetParameter (handles_[2], OMX_IndexParamAudioPcm, &renderer_pcmtype),
      "Unable to retrieve the PCM settings from the pcm renderer");

  // Now assign the current settings to the renderer structure
  renderer_pcmtype.nChannels = decoder_pcmtype.nChannels;
  renderer_pcmtype.nSamplingRate = decoder_pcmtype.nSamplingRate;

  // Set the new pcm settings
  G_OPS_BAIL_IF_ERROR (
      OMX_SetParameter (handles_[2], OMX_IndexParamAudioPcm, &renderer_pcmtype),
      "Unable to set the PCM settings on the audio renderer");

  TIZ_PRINTF_MAG (
      "     %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");
}
Exemplo n.º 6
0
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 (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 (
      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;
}
//
// gmusicops
//
graph::gmusicops::gmusicops (graph *p_graph,
                             const omx_comp_name_lst_t &comp_lst,
                             const omx_comp_role_lst_t &role_lst)
  : tiz::graph::ops (p_graph, comp_lst, role_lst),
    encoding_ (OMX_AUDIO_CodingAutoDetect)
{
  TIZ_INIT_OMX_PORT_STRUCT (decoder_mp3type_, 0);
  TIZ_INIT_OMX_PORT_STRUCT (renderer_pcmtype_, 0);
}
OMX_ERRORTYPE
graph::gmusicops::set_channels_and_rate_on_decoder (
    const OMX_U32 channels, const OMX_U32 sampling_rate)
{
  const OMX_HANDLETYPE handle = handles_[1];  // decoder's handle
  const OMX_U32 port_id = 0;                  // decoder's input port

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

  // Retrieve the mp3 settings from the decoder component
  TIZ_INIT_OMX_PORT_STRUCT (decoder_mp3type_, port_id);
  tiz_check_omx (
      OMX_GetParameter (handle, OMX_IndexParamAudioMp3, &decoder_mp3type_));

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

  // Now assign the actual settings to the pcmtype structure
  decoder_mp3type_.nChannels = channels;
  decoder_mp3type_.nSampleRate = sampling_rate;

  // Set the new mp3 settings
  tiz_check_omx (
      OMX_SetParameter (handle, OMX_IndexParamAudioMp3, &decoder_mp3type_));

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

  return OMX_ErrorNone;
}
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;
}
Exemplo n.º 10
0
static OMX_ERRORTYPE
retrieve_buffer_size (scloud_prc_t * ap_prc)
{
  TIZ_INIT_OMX_PORT_STRUCT (ap_prc->buffer_size_, ARATELIA_HTTP_SOURCE_PORT_INDEX);
  return tiz_api_GetParameter (
    tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc),
    OMX_TizoniaIndexParamStreamingBuffer, &(ap_prc->buffer_size_));
}
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;
}
//
// youtubeops
//
graph::youtubeops::youtubeops (graph *p_graph,
                               const omx_comp_name_lst_t &comp_lst,
                               const omx_comp_role_lst_t &role_lst)
  : tiz::graph::ops (p_graph, comp_lst, role_lst),
    encoding_ (OMX_AUDIO_CodingAutoDetect),
    container_ (OMX_AUDIO_CodingAutoDetect),
    inital_graph_load_ (false)
{
  TIZ_INIT_OMX_PORT_STRUCT (renderer_pcmtype_, 0);
}
OMX_ERRORTYPE graph::youtubeops::get_container_type_from_youtube_source ()
{
  OMX_PARAM_PORTDEFINITIONTYPE port_def;
  const OMX_U32 port_id = 0;
  TIZ_INIT_OMX_PORT_STRUCT (port_def, port_id);
  tiz_check_omx (
      OMX_GetParameter (handles_[0], OMX_IndexParamPortDefinition, &port_def));
  container_ = port_def.format.audio.eEncoding;
  TIZ_LOG (TIZ_PRIORITY_DEBUG, "container_ = [%X]", container_);
  return OMX_ErrorNone;
}
OMX_ERRORTYPE graph::youtubeops::get_encoding_type_from_container_demuxer ()
{
  OMX_PARAM_PORTDEFINITIONTYPE port_def;
  const OMX_U32 port_id = 1;
  TIZ_INIT_OMX_PORT_STRUCT (port_def, port_id);
  tiz_check_omx (
      OMX_GetParameter (handles_[1], OMX_IndexParamPortDefinition, &port_def));
  encoding_ = port_def.format.audio.eEncoding;
  TIZ_LOG (TIZ_PRIORITY_DEBUG, "encoding_ = [%s]",
           tiz_audio_coding_to_str (encoding_));
  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;
}
Exemplo n.º 16
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;
}
Exemplo n.º 17
0
static inline OMX_ERRORTYPE
retrieve_mp3_settings (const void * ap_prc,
                       OMX_AUDIO_PARAM_MP3TYPE * ap_mp3type)
{
  const httpr_prc_t * p_prc = ap_prc;
  assert (ap_prc);
  assert (ap_mp3type);

  /* Retrieve the mp3 settings from the input port */
  TIZ_INIT_OMX_PORT_STRUCT (*ap_mp3type, ARATELIA_HTTP_RENDERER_PORT_INDEX);
  tiz_check_omx (tiz_api_GetParameter (tiz_get_krn (handleOf (p_prc)),
                                           handleOf (p_prc),
                                           OMX_IndexParamAudioMp3, ap_mp3type));
  return OMX_ErrorNone;
}
Exemplo n.º 18
0
static inline OMX_ERRORTYPE
retrieve_mountpoint_settings (const void * ap_prc,
                              OMX_TIZONIA_ICECASTMOUNTPOINTTYPE * ap_mountpoint)
{
  const httpr_prc_t * p_prc = ap_prc;
  assert (p_prc);
  assert (ap_mountpoint);

  /* Retrieve the mountpoint settings from the input port */
  TIZ_INIT_OMX_PORT_STRUCT (*ap_mountpoint, ARATELIA_HTTP_RENDERER_PORT_INDEX);
  tiz_check_omx (tiz_api_GetParameter (
    tiz_get_krn (handleOf (p_prc)), handleOf (p_prc),
    OMX_TizoniaIndexParamIcecastMountpoint, ap_mountpoint));
  return OMX_ErrorNone;
}
Exemplo n.º 19
0
static OMX_ERRORTYPE h264d_prc_prepare_to_transfer(void *ap_obj, OMX_U32 a_pid)
{
   vid_dec_PrivateType*priv = ap_obj;
   assert(priv);

   TIZ_INIT_OMX_PORT_STRUCT(priv->out_port_def_,
                            OMX_VID_DEC_AVC_OUTPUT_PORT_INDEX);
   tiz_check_omx(
      tiz_api_GetParameter(tiz_get_krn(handleOf(priv)), handleOf(priv),
                           OMX_IndexParamPortDefinition, &(priv->out_port_def_)));

   priv->first_buf_in_frame = true;
   priv->eos_ = false;
   return OMX_ErrorNone;
}
Exemplo n.º 20
0
void graph::oggopusdecops::get_pcm_codec_info (OMX_AUDIO_PARAM_PCMMODETYPE &pcmtype)
{
  probe_ptr_->get_pcm_codec_info (pcmtype);

  OMX_AUDIO_PARAM_PCMMODETYPE decoder_pcmtype;
  TIZ_INIT_OMX_PORT_STRUCT (decoder_pcmtype, 1 /* port id */);

  G_OPS_BAIL_IF_ERROR (
      OMX_GetParameter (handles_[1],
                        static_cast< OMX_INDEXTYPE > (OMX_IndexParamAudioPcm),
                        &decoder_pcmtype),
      "Unable to set OMX_IndexParamAudioPcm");

  pcmtype.nBitPerSample = decoder_pcmtype.nBitPerSample;
  pcmtype.nSamplingRate = 48000; //decoder_pcmtype.nSamplingRate;
}
Exemplo n.º 21
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;
}
Exemplo n.º 22
0
static void reset_stream_parameters(vid_dec_PrivateType* apriv)
{
   assert(apriv);
   TIZ_INIT_OMX_PORT_STRUCT(apriv->out_port_def_,
                            OMX_VID_DEC_AVC_OUTPUT_PORT_INDEX);

   tiz_api_GetParameter (tiz_get_krn (handleOf (apriv)), handleOf (apriv),
                          OMX_IndexParamPortDefinition, &(apriv->out_port_def_));

   apriv->p_inhdr_ = 0;
   apriv->num_in_buffers = 0;
   apriv->first_buf_in_frame = true;
   apriv->eos_ = false;
   apriv->frame_finished = false;
   apriv->frame_started = false;
   apriv->picture.h264.field_order_cnt[0] = apriv->picture.h264.field_order_cnt[1] = INT_MAX;
   apriv->slice = NULL;
}
Exemplo n.º 23
0
void graph::pcmdecops::get_pcm_codec_info (OMX_AUDIO_PARAM_PCMMODETYPE &pcmtype)
{
  OMX_U32 dec_port_id = 1;
  OMX_AUDIO_PARAM_PCMMODETYPE dec_pcmtype;
  TIZ_INIT_OMX_PORT_STRUCT (dec_pcmtype, dec_port_id);

  G_OPS_BAIL_IF_ERROR (
      OMX_GetParameter (handles_[1], OMX_IndexParamAudioPcm, &dec_pcmtype),
      "Unable to get OMX_IndexParamAudioPcm from decoder");

  assert (probe_ptr_);
  probe_ptr_->get_pcm_codec_info (pcmtype);

  // Ammend the endianness, sign, and interleave config as per the decoder values
  pcmtype.eEndian = dec_pcmtype.eEndian;
  pcmtype.eNumData = dec_pcmtype.eNumData;
  pcmtype.bInterleaved = dec_pcmtype.bInterleaved;
}
Exemplo n.º 24
0
static OMX_ERRORTYPE
set_auto_detect_on_port (dirble_prc_t * ap_prc)
{
  OMX_PARAM_PORTDEFINITIONTYPE port_def;
  assert (ap_prc);

  TIZ_INIT_OMX_PORT_STRUCT (port_def, ARATELIA_HTTP_SOURCE_PORT_INDEX);
  tiz_check_omx (
    tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc),
                          OMX_IndexParamPortDefinition, &port_def));

  /* Set the new value */
  port_def.format.audio.eEncoding = OMX_AUDIO_CodingAutoDetect;

  tiz_check_omx (tiz_krn_SetParameter_internal (
    tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc),
    OMX_IndexParamPortDefinition, &port_def));
  return OMX_ErrorNone;
}
Exemplo n.º 25
0
static OMX_ERRORTYPE
prepare_for_port_auto_detection (dirble_prc_t * ap_prc)
{
  OMX_PARAM_PORTDEFINITIONTYPE port_def;
  assert (ap_prc);

  TIZ_INIT_OMX_PORT_STRUCT (port_def, ARATELIA_HTTP_SOURCE_PORT_INDEX);
  tiz_check_omx (
    tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc),
                          OMX_IndexParamPortDefinition, &port_def));
  ap_prc->audio_coding_type_ = port_def.format.audio.eEncoding;
  ap_prc->auto_detect_on_
    = (OMX_AUDIO_CodingAutoDetect == ap_prc->audio_coding_type_) ? true : false;

  TIZ_TRACE (
    handleOf (ap_prc), "auto_detect_on_ [%s]...audio_coding_type_ [%d]",
    ap_prc->auto_detect_on_ ? "true" : "false", ap_prc->audio_coding_type_);

  return OMX_ErrorNone;
}
Exemplo n.º 26
0
static OMX_ERRORTYPE
sdlivr_prc_prepare_to_transfer (void * ap_obj, OMX_U32 a_pid)
{
  sdlivr_prc_t * p_prc = ap_obj;
  OMX_PARAM_PORTDEFINITIONTYPE portdef;
  TIZ_INIT_OMX_PORT_STRUCT (portdef, ARATELIA_YUV_RENDERER_PORT_INDEX);

  assert (p_prc);

  /* Retrieve port def from port */
  tiz_check_omx (tiz_api_GetParameter (tiz_get_krn (handleOf (p_prc)),
                                       handleOf (p_prc),
                                       OMX_IndexParamPortDefinition, &portdef));

  p_prc->port_def_ = portdef.format.video;

  TIZ_TRACE (
    handleOf (p_prc),
    "nFrameWidth = [%u] nFrameHeight = [%u] "
    "nStride = [%d] nSliceHeight = [%u] nBitrate = [%u] "
    "xFramerate = [%u] eCompressionFormat = [%0x] eColorFormat = [%0x]",
    p_prc->port_def_.nFrameWidth, p_prc->port_def_.nFrameHeight,
    p_prc->port_def_.nStride, p_prc->port_def_.nSliceHeight,
    p_prc->port_def_.nBitrate, p_prc->port_def_.xFramerate,
    p_prc->port_def_.eCompressionFormat, p_prc->port_def_.eColorFormat);

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

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

  assert (!p_prc->p_overlay);
  p_prc->p_overlay = SDL_CreateYUVOverlay (p_prc->port_def_.nFrameWidth,
                                           p_prc->port_def_.nFrameHeight,
                                           SDL_YV12_OVERLAY, p_prc->p_surface);

  return p_prc->p_overlay ? OMX_ErrorNone : OMX_ErrorInsufficientResources;
}
OMX_ERRORTYPE
graph::gmusicops::set_channels_and_rate_on_renderer (
    const OMX_U32 channels, const OMX_U32 sampling_rate)
{
  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 (
      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 (
      OMX_SetParameter (handle, OMX_IndexParamAudioPcm, &renderer_pcmtype_));

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

  std::string coding_type_str ("Google Play Music");
  tiz::graph::util::dump_graph_info (coding_type_str.c_str (),
                                     "Connected",
                                     gmusic_config->get_user_name ().c_str ());

  return OMX_ErrorNone;
}