static void *
cc_youtube_cfgport_ctor (void * ap_obj, va_list * app)
{
  cc_youtube_cfgport_t * p_obj
    = super_ctor (typeOf (ap_obj, "cc_youtubecfgport"), ap_obj, app);

  assert (p_obj);

  tiz_check_omx_ret_null (
    tiz_port_register_index (p_obj, OMX_TizoniaIndexParamAudioYoutubeSession));
  tiz_check_omx_ret_null (
    tiz_port_register_index (p_obj, OMX_TizoniaIndexParamAudioYoutubePlaylist));

  /* Initialize the OMX_TIZONIA_AUDIO_PARAM_YOUTUBESESSIONTYPE structure */
  TIZ_INIT_OMX_STRUCT (p_obj->session_);
  snprintf ((char *) p_obj->session_.cApiKey, sizeof (p_obj->session_.cApiKey),
            "xyzxyzxyzxyzxyz");

  /* Initialize the OMX_TIZONIA_AUDIO_PARAM_YOUTUBEPLAYLISTTYPE structure */
  TIZ_INIT_OMX_STRUCT (p_obj->playlist_);
  snprintf ((char *) p_obj->playlist_.cPlaylistName,
            sizeof (p_obj->playlist_.cPlaylistName), "playlist");
  p_obj->playlist_.ePlaylistType = OMX_AUDIO_YoutubePlaylistTypeUnknown;
  p_obj->playlist_.bShuffle = OMX_FALSE;

  return p_obj;
}
static void *
gmusic_cfgport_ctor (void * ap_obj, va_list * app)
{
  gmusic_cfgport_t * p_obj
    = super_ctor (typeOf (ap_obj, "gmusiccfgport"), ap_obj, app);

  assert (p_obj);

  tiz_check_omx_ret_null (
    tiz_port_register_index (p_obj, OMX_TizoniaIndexParamAudioGmusicSession));
  tiz_check_omx_ret_null (
    tiz_port_register_index (p_obj, OMX_TizoniaIndexParamAudioGmusicPlaylist));

  /* Initialize the OMX_TIZONIA_AUDIO_PARAM_GMUSICSESSIONTYPE structure */
  TIZ_INIT_OMX_STRUCT (p_obj->session_);
  snprintf ((char *) p_obj->session_.cUserName,
            sizeof (p_obj->session_.cUserName), "tizonia");
  snprintf ((char *) p_obj->session_.cUserPassword,
            sizeof (p_obj->session_.cUserPassword), "pass");
  snprintf ((char *) p_obj->session_.cDeviceId,
            sizeof (p_obj->session_.cDeviceId), "deviceId");

  /* Initialize the OMX_TIZONIA_AUDIO_PARAM_GMUSICPLAYLISTTYPE structure */
  TIZ_INIT_OMX_STRUCT (p_obj->playlist_);
  snprintf ((char *) p_obj->playlist_.cPlaylistName,
            sizeof (p_obj->playlist_.cPlaylistName), "playlist");
  p_obj->playlist_.ePlaylistType = OMX_AUDIO_GmusicPlaylistTypeUnknown;
  p_obj->playlist_.bShuffle = OMX_FALSE;
  p_obj->playlist_.bUnlimitedSearch = OMX_FALSE;

  return p_obj;
}
static void *
scloud_cfgport_ctor (void * ap_obj, va_list * app)
{
  scloud_cfgport_t * p_obj
    = super_ctor (typeOf (ap_obj, "scloudcfgport"), ap_obj, app);

  assert (p_obj);

  tiz_check_omx_ret_null (tiz_port_register_index (
    p_obj, OMX_TizoniaIndexParamAudioSoundCloudSession));
  tiz_check_omx_ret_null (tiz_port_register_index (
    p_obj, OMX_TizoniaIndexParamAudioSoundCloudPlaylist));

  /* Initialize the OMX_TIZONIA_AUDIO_PARAM_SOUNDCLOUDSESSIONTYPE structure */
  TIZ_INIT_OMX_STRUCT (p_obj->session_);
  snprintf ((char *) p_obj->session_.cUserName,
            sizeof (p_obj->session_.cUserName), "tizonia");
  snprintf ((char *) p_obj->session_.cUserPassword,
            sizeof (p_obj->session_.cUserPassword), "pass");
  snprintf ((char *) p_obj->session_.cUserOauthToken,
            sizeof (p_obj->session_.cUserOauthToken),
            "1-111111-11111111-11111111111111");

  /* Initialize the OMX_TIZONIA_AUDIO_PARAM_SOUNDCLOUDPLAYLISTTYPE structure */
  TIZ_INIT_OMX_STRUCT (p_obj->playlist_);
  snprintf ((char *) p_obj->playlist_.cPlaylistName,
            sizeof (p_obj->playlist_.cPlaylistName), "playlist");
  p_obj->playlist_.ePlaylistType = OMX_AUDIO_SoundCloudPlaylistTypeUnknown;
  p_obj->playlist_.bShuffle = OMX_FALSE;

  return p_obj;
}
static void *
demuxer_cfgport_ctor (void * ap_obj, va_list * app)
{
  tiz_demuxercfgport_t * p_obj
    = super_ctor (typeOf (ap_obj, "tizdemuxercfgport"), ap_obj, app);

  /* In addition to the indexes registered by the parent class, register here
     the demuxer-specific ones */
  tiz_check_omx_ret_null (
    tiz_port_register_index (p_obj, OMX_IndexConfigTimePosition)); /* r/w */
  tiz_check_omx_ret_null (
    tiz_port_register_index (p_obj, OMX_IndexConfigTimeSeekMode)); /* r/w */

  return p_obj;
}
static void *
demuxerport_ctor (void * ap_obj, va_list * app)
{
  tiz_demuxerport_t * p_obj = NULL;
  tiz_port_options_t * p_opts = NULL;
  va_list app_copy;

  /* Make a copy of the incoming va_list before it gets parsed by the parent
     class:
     The expected arguments are:
     tiz_port_options_t

     */
  va_copy (app_copy, *app);

  /* Now give the original to the base class */
  if ((p_obj = super_ctor (typeOf (ap_obj, "tizdemuxerport"), ap_obj, app)))
    {
      /* Register the demuxer-specific indexes  */
      tiz_check_omx_ret_null (
        tiz_port_register_index (p_obj, OMX_IndexParamNumAvailableStreams));
      tiz_check_omx_ret_null (
        tiz_port_register_index (p_obj, OMX_IndexParamActiveStream));

      /* Grab the port options structure (mandatory argument) */
      p_opts = va_arg (app_copy, tiz_port_options_t *);
      assert (p_opts);

      TIZ_TRACE (handleOf (ap_obj), "min_buf_size [%d]", p_opts->min_buf_size);

      switch (p_opts->domain)
        {
          case OMX_PortDomainAudio:
            {
              /* Let's instantiate a PCM port */
              OMX_AUDIO_CODINGTYPE * p_encodings = NULL;

              /* Get the array of OMX_AUDIO_CODINGTYPE values (mandatory argument) */
              p_encodings = va_arg (app_copy, OMX_AUDIO_CODINGTYPE *);
              assert (p_encodings);

              p_obj->p_port_
                = factory_new (typeOf (ap_obj, "tizaudioport"), p_opts,
                               p_encodings);
              if (!p_obj->p_port_)
                {
                  return NULL;
                }
            }
            break;

          case OMX_PortDomainVideo:
            {
              OMX_VIDEO_PORTDEFINITIONTYPE * p_portdef = NULL;
              OMX_VIDEO_CODINGTYPE * p_encodings = NULL;
              OMX_COLOR_FORMATTYPE * p_formats = NULL;

              /* Register the raw video port indexes, so this port receives the
               get/set requests */
              tiz_check_omx_ret_null (
                tiz_port_register_index (p_obj, OMX_IndexParamVideoPortFormat));

              /* Get the OMX_VIDEO_PORTDEFINITIONTYPE structure (mandatory argument) */
              p_portdef = va_arg (app_copy, OMX_VIDEO_PORTDEFINITIONTYPE *);
              assert (p_portdef);

              /* Get the array of OMX_VIDEO_CODINGTYPE values (mandatory argument) */
              p_encodings = va_arg (app_copy, OMX_VIDEO_CODINGTYPE *);
              assert (p_encodings);

              /* Get the array of OMX_COLOR_FORMATTYPE values (mandatory argument) */
              p_formats = va_arg (app_copy, OMX_COLOR_FORMATTYPE *);
              assert (p_formats);

              if (NULL == (p_obj->p_port_ = factory_new (
                             typeOf (ap_obj, "tizvideoport"), p_opts, p_portdef,
                             p_encodings, p_formats)))
                {
                  return NULL;
                }
            }
            break;

          default:
            assert (0);
        };
    }
Beispiel #6
0
static void *
binaryport_ctor (void * ap_obj, va_list * app)
{
  tiz_binaryport_t * p_obj = NULL;
  tiz_port_options_t * p_opts = NULL;
  va_list app_copy;

  assert (ap_obj);

  /* Make a copy of the incoming va_list before it gets parsed by the parent
     class:
     The expected arguments are:
     port_opts

     */
  va_copy (app_copy, *app);

  /* Now give the original to the base class */
  if (NULL
      == (p_obj = super_ctor (typeOf (ap_obj, "tizbinaryport"), ap_obj, app)))
    {
      return NULL;
    }

  /* Now, grab the port options structure */
  p_opts = va_arg (app_copy, tiz_port_options_t *);
  assert (p_opts);

  switch (p_opts->domain)
    {
      case OMX_PortDomainAudio:
        {
          OMX_AUDIO_CODINGTYPE encodings[]
            = {OMX_AUDIO_CodingUnused, OMX_AUDIO_CodingMax};

          tiz_check_omx_ret_null (
            tiz_port_register_index (p_obj, OMX_IndexParamAudioPortFormat));

          p_obj->p_port_
            = factory_new (typeOf (ap_obj, "tizaudioport"), p_opts, &encodings);
          if (NULL == p_obj->p_port_)
            {
              return NULL;
            }
        }
        break;

      case OMX_PortDomainVideo:
        {
          OMX_VIDEO_PORTDEFINITIONTYPE portdef;
          OMX_VIDEO_CODINGTYPE encodings[]
            = {OMX_VIDEO_CodingUnused, OMX_VIDEO_CodingMax};
          OMX_COLOR_FORMATTYPE formats[]
            = {OMX_COLOR_FormatYUV420Planar, OMX_COLOR_FormatMax};
          /* NOTE: No defaults are defined in the standard for the video output
         * port of the video_reader.binary component. So for the sake of
         * completeness, simply provide some default values here. */
          portdef.pNativeRender = NULL;
          portdef.nFrameWidth = 176;
          portdef.nFrameHeight = 144;
          portdef.nStride = 0;
          portdef.nSliceHeight = 0;
          portdef.nBitrate = 0;
          portdef.xFramerate = 15;
          portdef.bFlagErrorConcealment = OMX_FALSE;
          portdef.eCompressionFormat = OMX_VIDEO_CodingUnused;
          portdef.eColorFormat = OMX_COLOR_FormatYUV420Planar;
          portdef.pNativeWindow = NULL;

          tiz_check_omx_ret_null (
            tiz_port_register_index (p_obj, OMX_IndexParamVideoPortFormat));

          p_obj->p_port_ = factory_new (typeOf (ap_obj, "tizvideoport"), p_opts,
                                        &portdef, &encodings, &formats);
          if (NULL == p_obj->p_port_)
            {
              return NULL;
            }
        }
        break;

      case OMX_PortDomainImage:
        {
          OMX_IMAGE_PORTDEFINITIONTYPE portdef;
          OMX_IMAGE_CODINGTYPE encodings[]
            = {OMX_IMAGE_CodingUnused, OMX_IMAGE_CodingMax};
          OMX_COLOR_FORMATTYPE formats[]
            = {OMX_COLOR_FormatYUV420Planar, OMX_COLOR_FormatMax};
          /* NOTE: No defaults are defined in the standard for the image output
         * port of the image_reader.binary component. So for the sake of
         * completeness, simply provide some default values here. */
          portdef.pNativeRender = NULL;
          portdef.nFrameWidth = 176;
          portdef.nFrameHeight = 144;
          portdef.nStride = 0;
          portdef.nSliceHeight = 0;
          portdef.bFlagErrorConcealment = OMX_FALSE;
          portdef.eCompressionFormat = OMX_IMAGE_CodingUnused;
          portdef.eColorFormat = OMX_COLOR_FormatYUV420Planar;
          portdef.pNativeWindow = NULL;

          tiz_check_omx_ret_null (
            tiz_port_register_index (p_obj, OMX_IndexParamImagePortFormat));

          p_obj->p_port_ = factory_new (typeOf (ap_obj, "tizimageport"), p_opts,
                                        &portdef, &encodings, &formats);
          if (NULL == p_obj->p_port_)
            {
              return NULL;
            }
        }
        break;

      case OMX_PortDomainOther:
        {
          OMX_OTHER_FORMATTYPE formats[]
            = {OMX_OTHER_FormatBinary, OMX_OTHER_FormatMax};

          tiz_check_omx_ret_null (
            tiz_port_register_index (p_obj, OMX_IndexParamOtherPortFormat));

          p_obj->p_port_
            = factory_new (typeOf (ap_obj, "tizotherport"), p_opts, &formats);
          if (NULL == p_obj->p_port_)
            {
              return NULL;
            }
        }
        break;

      default:
        assert (0);
    };

  va_end (app_copy);

  return p_obj;
}