static OMX_ERRORTYPE
cc_youtube_cfgport_GetParameter (const void * ap_obj, OMX_HANDLETYPE ap_hdl,
                              OMX_INDEXTYPE a_index, OMX_PTR ap_struct)
{
  const cc_youtube_cfgport_t * p_obj = ap_obj;
  OMX_ERRORTYPE rc = OMX_ErrorNone;

  assert (p_obj);

  TIZ_TRACE (ap_hdl, "PORT [%d] GetParameter [%s]...", tiz_port_index (ap_obj),
             tiz_idx_to_str (a_index));

  if (OMX_TizoniaIndexParamAudioYoutubeSession == a_index)
    {
      memcpy (ap_struct, &(p_obj->session_),
              sizeof (OMX_TIZONIA_AUDIO_PARAM_YOUTUBESESSIONTYPE));
    }
  else if (OMX_TizoniaIndexParamAudioYoutubePlaylist == a_index)
    {
      memcpy (ap_struct, &(p_obj->playlist_),
              sizeof (OMX_TIZONIA_AUDIO_PARAM_YOUTUBEPLAYLISTTYPE));
    }
  else
    {
      /* Delegate to the base port */
      rc = super_GetParameter (typeOf (ap_obj, "cc_youtubecfgport"), ap_obj,
                               ap_hdl, a_index, ap_struct);
    }

  return rc;
}
static OMX_ERRORTYPE httpsrc_port_GetParameter (const void *ap_obj,
                                                 OMX_HANDLETYPE ap_hdl,
                                                 OMX_INDEXTYPE a_index,
                                                 OMX_PTR ap_struct)
{
  const httpsrc_port_t *p_obj = ap_obj;
  OMX_ERRORTYPE rc = OMX_ErrorNone;

  assert (p_obj);

  TIZ_TRACE (ap_hdl, "PORT [%d] GetParameter [%s]...",
            tiz_port_index (ap_obj), tiz_idx_to_str (a_index));


  switch (a_index)
    {
    case OMX_IndexParamAudioMp3:
      {
        OMX_AUDIO_PARAM_MP3TYPE *p_mp3mode
          = (OMX_AUDIO_PARAM_MP3TYPE *) ap_struct;
        *p_mp3mode = p_obj->mp3type_;
      }
      break;

    case OMX_IndexParamAudioAac:
      {
        OMX_AUDIO_PARAM_AACPROFILETYPE *p_aacmode
          = (OMX_AUDIO_PARAM_AACPROFILETYPE *) ap_struct;
        *p_aacmode = p_obj->aactype_;
      }
      break;

    default:
      {
        if (OMX_TizoniaIndexParamAudioOpus == a_index)
          {
            OMX_TIZONIA_AUDIO_PARAM_OPUSTYPE *p_opusmode
              = (OMX_TIZONIA_AUDIO_PARAM_OPUSTYPE *) ap_struct;
            *p_opusmode = p_obj->opustype_;
          }
        else
          {
            /* Try the parent's indexes */
            rc = super_GetParameter (typeOf (ap_obj, "httpsrcport"),
                                     ap_obj, ap_hdl, a_index, ap_struct);
          }
      }
      break;
    };

  return rc;
}
Beispiel #3
0
static OMX_ERRORTYPE
binaryport_SetParameter (const void * ap_obj, OMX_HANDLETYPE ap_hdl,
                         OMX_INDEXTYPE a_index, OMX_PTR ap_struct)
{
  tiz_binaryport_t * p_obj = (tiz_binaryport_t *) ap_obj;
  OMX_ERRORTYPE rc = OMX_ErrorNone;

  TIZ_TRACE (ap_hdl, "PORT [%d] SetParameter [%s]...", tiz_port_index (ap_obj),
             tiz_idx_to_str (a_index));
  assert (p_obj);

  switch (a_index)
    {
      case OMX_IndexParamAudioPortFormat:
      case OMX_IndexParamVideoPortFormat:
      case OMX_IndexParamImagePortFormat:
      case OMX_IndexParamOtherPortFormat:
        {
          /* Delegate to the domain-specific port */
          if (OMX_ErrorUnsupportedIndex
              != (rc = tiz_api_SetParameter (p_obj->p_port_, ap_hdl, a_index,
                                             ap_struct)))
            {
              return rc;
            }
        }

      /* NOTE: Fall through if GetParameter returned
       * OMX_ErrorUnsupportedIndex. So that we delegate to the parent */
      /*@fallthrough@*/
      default:
        {
          /* Delegate to the base port */
          rc = super_SetParameter (typeOf (ap_obj, "tizbinaryport"), ap_obj,
                                   ap_hdl, a_index, ap_struct);
        }
    };

  return rc;
}
static OMX_ERRORTYPE
spfysrc_cfgport_SetParameter (const void *ap_obj,
                           OMX_HANDLETYPE ap_hdl,
                           OMX_INDEXTYPE a_index, OMX_PTR ap_struct)
{
  spfysrc_cfgport_t *p_obj = (spfysrc_cfgport_t *) ap_obj;
  OMX_ERRORTYPE rc = OMX_ErrorNone;

  assert (NULL != p_obj);

  TIZ_TRACE (ap_hdl, "PORT [%d] GetParameter [%s]...", tiz_port_index (ap_obj),
             tiz_idx_to_str (a_index));

  if (OMX_TizoniaIndexParamAudioSpotifySession == a_index)
    {
      memcpy (&(p_obj->spotifysession_), ap_struct,
              sizeof(OMX_TIZONIA_AUDIO_PARAM_SPOTIFYSESSIONTYPE));
      p_obj->spotifysession_.cUserName[OMX_MAX_STRINGNAME_SIZE - 1] = '\000';
      p_obj->spotifysession_.cUserPassword[OMX_MAX_STRINGNAME_SIZE - 1] = '\000';
      TIZ_TRACE (ap_hdl, "Spotify User Name [%s]...",
                 p_obj->spotifysession_.cUserName);
    }
  else if (OMX_TizoniaIndexParamAudioSpotifyPlaylist == a_index)
    {
      memcpy (&(p_obj->playlist_), ap_struct,
              sizeof(OMX_TIZONIA_AUDIO_PARAM_SPOTIFYPLAYLISTTYPE));
      p_obj->playlist_.cPlaylistName[OMX_MAX_STRINGNAME_SIZE - 1] = '\000';
      TIZ_TRACE (ap_hdl, "Spotify playlist [%s]...",
                 p_obj->playlist_.cPlaylistName);
    }
  else
    {
      /* Delegate to the base port */
      rc = super_SetParameter (typeOf (ap_obj, "spfysrccfgport"),
                               ap_obj, ap_hdl, a_index, ap_struct);
    }

  return rc;
}
static OMX_ERRORTYPE
scloud_cfgport_SetParameter (const void * ap_obj, OMX_HANDLETYPE ap_hdl,
                             OMX_INDEXTYPE a_index, OMX_PTR ap_struct)
{
  scloud_cfgport_t * p_obj = (scloud_cfgport_t *) ap_obj;
  OMX_ERRORTYPE rc = OMX_ErrorNone;

  assert (p_obj);

  TIZ_TRACE (ap_hdl, "PORT [%d] GetParameter [%s]...", tiz_port_index (ap_obj),
             tiz_idx_to_str (a_index));

  if (OMX_TizoniaIndexParamAudioSoundCloudSession == a_index)
    {
      memcpy (&(p_obj->session_), ap_struct,
              sizeof (OMX_TIZONIA_AUDIO_PARAM_SOUNDCLOUDSESSIONTYPE));
      p_obj->session_.cUserName[OMX_MAX_STRINGNAME_SIZE - 1] = '\000';
      p_obj->session_.cUserPassword[OMX_MAX_STRINGNAME_SIZE - 1] = '\000';
      p_obj->session_.cUserOauthToken[OMX_MAX_STRINGNAME_SIZE - 1] = '\000';
      TIZ_TRACE (ap_hdl, "SoundCloud User's OAuth Token [%s]...",
                 p_obj->session_.cUserOauthToken);
    }
  else if (OMX_TizoniaIndexParamAudioSoundCloudPlaylist == a_index)
    {
      memcpy (&(p_obj->playlist_), ap_struct,
              sizeof (OMX_TIZONIA_AUDIO_PARAM_SOUNDCLOUDPLAYLISTTYPE));
      p_obj->playlist_.cPlaylistName[OMX_MAX_STRINGNAME_SIZE - 1] = '\000';
      TIZ_TRACE (ap_hdl, "SoundCloud playlist [%s]...",
                 p_obj->playlist_.cPlaylistName);
    }
  else
    {
      /* Delegate to the base port */
      rc = super_SetParameter (typeOf (ap_obj, "scloudcfgport"), ap_obj, ap_hdl,
                               a_index, ap_struct);
    }

  return rc;
}
static OMX_ERRORTYPE
cc_plex_cfgport_SetParameter (const void * ap_obj, OMX_HANDLETYPE ap_hdl,
                             OMX_INDEXTYPE a_index, OMX_PTR ap_struct)
{
  cc_plex_cfgport_t * p_obj = (cc_plex_cfgport_t *) ap_obj;
  OMX_ERRORTYPE rc = OMX_ErrorNone;

  assert (p_obj);

  TIZ_TRACE (ap_hdl, "PORT [%d] GetParameter [%s]...", tiz_port_index (ap_obj),
             tiz_idx_to_str (a_index));

  if (OMX_TizoniaIndexParamAudioPlexSession == a_index)
    {
      memcpy (&(p_obj->session_), ap_struct,
              sizeof (OMX_TIZONIA_AUDIO_PARAM_PLEXSESSIONTYPE));
      p_obj->session_.cBaseUrl[OMX_MAX_STRINGNAME_SIZE - 1] = '\0';
      p_obj->session_.cAuthToken[OMX_MAX_STRINGNAME_SIZE - 1] = '\0';
      TIZ_TRACE (ap_hdl, "Plex Auth Token [%s]...",
                 p_obj->session_.cAuthToken);
    }
  else if (OMX_TizoniaIndexParamAudioPlexPlaylist == a_index)
    {
      memcpy (&(p_obj->playlist_), ap_struct,
              sizeof (OMX_TIZONIA_AUDIO_PARAM_PLEXPLAYLISTTYPE));
      p_obj->playlist_.cPlaylistName[OMX_MAX_STRINGNAME_SIZE - 1] = '\0';
      TIZ_TRACE (ap_hdl, "Plex playlist [%s]...",
                 p_obj->playlist_.cPlaylistName);
    }
  else
    {
      /* Delegate to the base port */
      rc = super_SetParameter (typeOf (ap_obj, "cc_plexcfgport"), ap_obj,
                               ap_hdl, a_index, ap_struct);
    }

  return rc;
}
static OMX_ERRORTYPE
httpsrc_port_apply_slaving_behaviour (void *ap_obj, void *ap_mos_port,
                                 const OMX_INDEXTYPE a_index,
                                 const OMX_PTR ap_struct,
                                 tiz_vector_t * ap_changed_idxs)
{
  httpsrc_port_t *p_obj = ap_obj;
  tiz_port_t *p_base = ap_obj;
  OMX_ERRORTYPE rc = OMX_ErrorNone;

  /* OpenMAX IL 1.2 Section 3.5 : Slaving behaviour for nSamplingRate and
   * nChannels, both in OMX_AUDIO_PARAM_MP3TYPE and OMX_AUDIO_PARAM_AACPROFILETYPE */

  assert (p_obj);
  assert (ap_struct);
  assert (ap_changed_idxs);

  {
    OMX_U32 new_rate = p_obj->mp3type_.nSampleRate;
    OMX_U32 new_channels = p_obj->mp3type_.nChannels;

    switch (a_index)
      {
      case OMX_IndexParamAudioPcm:
        {
          const OMX_AUDIO_PARAM_PCMMODETYPE *p_pcmmode = ap_struct;
          new_rate = p_pcmmode->nSamplingRate;
          new_channels = p_pcmmode->nChannels;

          TIZ_TRACE (handleOf (ap_obj),
                     "OMX_IndexParamAudioPcm : new sampling rate[%d] "
                     "new num channels[%d]", new_rate, new_channels);
        }
        break;

      case OMX_IndexParamAudioMp3:
        {
          const OMX_AUDIO_PARAM_MP3TYPE *p_mp3type = ap_struct;
          new_rate = p_mp3type->nSampleRate;
          new_channels = p_mp3type->nChannels;

          TIZ_TRACE (handleOf (ap_obj),
                     "OMX_IndexParamAudioMp3 : new sampling rate[%d] "
                     "new num channels[%d]", new_rate, new_channels);
        }
        break;

      case OMX_IndexParamAudioAac:
        {
          const OMX_AUDIO_PARAM_AACPROFILETYPE *p_aactype = ap_struct;
          new_rate = p_aactype->nSampleRate;
          new_channels = p_aactype->nChannels;

          TIZ_TRACE (handleOf (ap_obj),
                     "OMX_IndexParamAudioAac : new sampling rate[%d] "
                     "new num channels[%d]", new_rate, new_channels);
        }
        break;

      case OMX_IndexParamAudioVorbis:
        {
          const OMX_AUDIO_PARAM_VORBISTYPE *p_vortype = ap_struct;
          new_rate = p_vortype->nSampleRate;
          new_channels = p_vortype->nChannels;

          TIZ_TRACE (handleOf (ap_obj),
                     "OMX_IndexParamAudioVorbis : new sampling rate[%d] "
                     "new num channels[%d]", new_rate, new_channels);
        }
        break;

      case OMX_IndexParamAudioWma:
        {
          const OMX_AUDIO_PARAM_WMATYPE *p_wmatype = ap_struct;
          new_rate = p_wmatype->nSamplingRate;
          new_channels = p_wmatype->nChannels;

          TIZ_TRACE (handleOf (ap_obj),
                     "OMX_IndexParamAudioWma : new sampling rate[%d] "
                     "new num channels[%d]", new_rate, new_channels);
        }
        break;

      case OMX_IndexParamAudioRa:
        {
          const OMX_AUDIO_PARAM_RATYPE *p_ratype = ap_struct;
          new_rate = p_ratype->nSamplingRate;
          new_channels = p_ratype->nChannels;

          TIZ_TRACE (handleOf (ap_obj),
                     "OMX_IndexParamAudioRa : new sampling rate[%d] "
                     "new num channels[%d]", new_rate, new_channels);
        }
        break;

      case OMX_IndexParamAudioSbc:
        {
          const OMX_AUDIO_PARAM_SBCTYPE *p_sbctype = ap_struct;
          new_rate = p_sbctype->nSampleRate;
          new_channels = p_sbctype->nChannels;

          TIZ_TRACE (handleOf (ap_obj),
                     "OMX_IndexParamAudioSbc : new sampling rate[%d] "
                     "new num channels[%d]", new_rate, new_channels);
        }
        break;

      case OMX_IndexParamAudioAdpcm:
        {
          const OMX_AUDIO_PARAM_ADPCMTYPE *p_adpcmtype = ap_struct;
          new_rate = p_adpcmtype->nSampleRate;
          new_channels = p_adpcmtype->nChannels;

          TIZ_TRACE (handleOf (ap_obj),
                     "OMX_IndexParamAudioAdpcm : new sampling rate[%d] "
                     "new num channels[%d]", new_rate, new_channels);
        }
        break;

      default:
        {
          if (OMX_TizoniaIndexParamAudioOpus == a_index)
            {
              const OMX_TIZONIA_AUDIO_PARAM_OPUSTYPE *p_opustype = ap_struct;
              new_rate = p_opustype->nSampleRate;
              new_channels = p_opustype->nChannels;

              TIZ_TRACE (handleOf (ap_obj),
                         "OMX_IndexParamAudioOpus : new sampling rate[%d] "
                         "new num channels[%d]", new_rate, new_channels);
            }

          else if (OMX_TizoniaIndexParamAudioFlac == a_index)
            {
              const OMX_TIZONIA_AUDIO_PARAM_FLACTYPE *p_flactype = ap_struct;
              new_rate = p_flactype->nSampleRate;
              new_channels = p_flactype->nChannels;

              TIZ_TRACE (handleOf (ap_obj),
                         "OMX_TizoniaIndexParamAudioFlac : new sampling rate[%d] "
                         "new num channels[%d]", new_rate, new_channels);
            }
        }
      };

    {
      const tiz_audioport_t *p_audio_port = ap_obj;
      const OMX_AUDIO_CODINGTYPE encoding = p_audio_port->port_format_.eEncoding;

      if (encoding == OMX_AUDIO_CodingMP3)
        {
          if ((p_obj->mp3type_.nSampleRate != new_rate)
              || (p_obj->mp3type_.nChannels != new_channels))
            {
              OMX_INDEXTYPE id = OMX_IndexParamAudioMp3;

              p_obj->mp3type_.nSampleRate = new_rate;
              p_obj->mp3type_.nChannels = new_channels;
              tiz_vector_push_back (ap_changed_idxs, &id);

              TIZ_TRACE (handleOf (ap_obj),
                         " original pid [%d] this pid [%d] : [%s] -> "
                         "changed [OMX_IndexParamAudioMp3]...",
                         tiz_port_index (ap_mos_port),
                         p_base->portdef_.nPortIndex, tiz_idx_to_str (a_index));
            }
        }
      else if (encoding == OMX_AUDIO_CodingAAC)
        {
          if ((p_obj->aactype_.nSampleRate != new_rate)
              || (p_obj->aactype_.nChannels != new_channels))
            {
              OMX_INDEXTYPE id = OMX_IndexParamAudioAac;

              p_obj->aactype_.nSampleRate = new_rate;
              p_obj->aactype_.nChannels = new_channels;
              tiz_vector_push_back (ap_changed_idxs, &id);

              TIZ_TRACE (handleOf (ap_obj),
                         " original pid [%d] this pid [%d] : [%s] -> "
                         "changed [OMX_IndexParamAudioAac]...",
                         tiz_port_index (ap_mos_port),
                         p_base->portdef_.nPortIndex, tiz_idx_to_str (a_index));
            }
        }
    }
  }
  return rc;
}
static OMX_ERRORTYPE
ivrport_SetConfig (const void * ap_obj, OMX_HANDLETYPE ap_hdl,
                   OMX_INDEXTYPE a_index, OMX_PTR ap_struct)
{
  tiz_ivrport_t * p_obj = (tiz_ivrport_t *) ap_obj;

  TIZ_TRACE (handleOf (ap_obj), "PORT [%d] SetConfig [%s]",
             tiz_port_index (ap_obj), tiz_idx_to_str (a_index));
  assert (ap_obj);

  switch (a_index)
    {
      case OMX_IndexConfigCommonRotate:
        {
          OMX_CONFIG_ROTATIONTYPE * p_crotate
            = (OMX_CONFIG_ROTATIONTYPE *) ap_struct;
          p_obj->crotate_.nRotation = p_crotate->nRotation;
        }
        break;

      case OMX_IndexConfigCommonMirror:
        {
          OMX_CONFIG_MIRRORTYPE * p_cmirror
            = (OMX_CONFIG_MIRRORTYPE *) ap_struct;
          p_obj->cmirror_.eMirror = p_cmirror->eMirror;
        }
        break;

      case OMX_IndexConfigCommonScale:
        {
          OMX_CONFIG_SCALEFACTORTYPE * p_cscale
            = (OMX_CONFIG_SCALEFACTORTYPE *) ap_struct;
          p_obj->cscale_.xWidth = p_cscale->xWidth;
          p_obj->cscale_.xHeight = p_cscale->xHeight;
        }
        break;

      case OMX_IndexConfigCommonInputCrop:
        {
          OMX_CONFIG_RECTTYPE * p_cincrop = (OMX_CONFIG_RECTTYPE *) ap_struct;
          p_obj->cincrop_.nLeft = p_cincrop->nLeft;
          p_obj->cincrop_.nTop = p_cincrop->nTop;
          p_obj->cincrop_.nWidth = p_cincrop->nWidth;
          p_obj->cincrop_.nHeight = p_cincrop->nHeight;
        }
        break;

      case OMX_IndexConfigTimeRenderingDelay:
        {
          /* This is a read-only index. Simply ignore it. */
          TIZ_NOTICE (ap_hdl, "Ignoring read-only index [%s] ",
                      tiz_idx_to_str (a_index));
        }
        break;

      default:
        {
          /* Try the parent's indexes */
          return super_SetConfig (typeOf (ap_obj, "tizivrport"), ap_obj, ap_hdl,
                                  a_index, ap_struct);
        }
    };

  return OMX_ErrorNone;
}
static OMX_ERRORTYPE
ivrport_GetConfig (const void * ap_obj, OMX_HANDLETYPE ap_hdl,
                   OMX_INDEXTYPE a_index, OMX_PTR ap_struct)
{
  const tiz_ivrport_t * p_obj = ap_obj;

  TIZ_TRACE (handleOf (ap_obj), "PORT [%d] GetConfig [%s]",
             tiz_port_index (ap_obj), tiz_idx_to_str (a_index));
  assert (ap_obj);

  switch (a_index)
    {
      case OMX_IndexConfigCommonRotate:
        {
          OMX_CONFIG_ROTATIONTYPE * p_crotate
            = (OMX_CONFIG_ROTATIONTYPE *) ap_struct;
          *p_crotate = p_obj->crotate_;
        }
        break;

      case OMX_IndexConfigCommonMirror:
        {
          OMX_CONFIG_MIRRORTYPE * p_cmirror
            = (OMX_CONFIG_MIRRORTYPE *) ap_struct;
          *p_cmirror = p_obj->cmirror_;
        }
        break;

      case OMX_IndexConfigCommonScale:
        {
          OMX_CONFIG_SCALEFACTORTYPE * p_cscale
            = (OMX_CONFIG_SCALEFACTORTYPE *) ap_struct;
          *p_cscale = p_obj->cscale_;
        }
        break;

      case OMX_IndexConfigCommonInputCrop:
        {
          OMX_CONFIG_RECTTYPE * p_cincrop = (OMX_CONFIG_RECTTYPE *) ap_struct;
          *p_cincrop = p_obj->cincrop_;
        }
        break;

      case OMX_IndexConfigTimeRenderingDelay:
        {
          OMX_TIME_CONFIG_RENDERINGDELAYTYPE * p_crendelay
            = (OMX_TIME_CONFIG_RENDERINGDELAYTYPE *) ap_struct;
          *p_crendelay = p_obj->crendelay_;
        }
        break;

      default:
        {
          /* Try the parent's indexes */
          return super_GetConfig (typeOf (ap_obj, "tizivrport"), ap_obj, ap_hdl,
                                  a_index, ap_struct);
        }
    };

  return OMX_ErrorNone;
}