Exemplo n.º 1
0
static OMX_ERRORTYPE
alloc_data_stores (oggdmux_prc_t * ap_prc)
{
  OMX_PARAM_PORTDEFINITIONTYPE port_def;

  assert (ap_prc);

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

  tiz_check_omx (
    tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc),
                          OMX_IndexParamPortDefinition, &port_def));
  ap_prc->aud_buf_size_ = port_def.nBufferSize;

  assert (ap_prc->p_aud_store_ == NULL);
  ap_prc->aud_store_size_ = port_def.nBufferSize;
  tiz_check_null_ret_oom (
    (ap_prc->p_aud_store_ = tiz_mem_alloc (ap_prc->aud_store_size_)));

  port_def.nPortIndex = ARATELIA_OGG_DEMUXER_VIDEO_PORT_BASE_INDEX;
  tiz_check_omx (
    tiz_api_GetParameter (tiz_get_krn (handleOf (ap_prc)), handleOf (ap_prc),
                          OMX_IndexParamPortDefinition, &port_def));
  ap_prc->vid_buf_size_ = port_def.nBufferSize;

  assert (ap_prc->p_vid_store_ == NULL);
  ap_prc->vid_store_size_ = port_def.nBufferSize;
  tiz_check_null_ret_oom (
    (ap_prc->p_vid_store_ = tiz_mem_alloc (ap_prc->vid_store_size_)));

  return OMX_ErrorNone;
}
static OMX_ERRORTYPE
_ctx_init (cc_ctx_t * app_ctx)
{
  check_common_context_t *p_ctx =
    tiz_mem_alloc (sizeof (check_common_context_t));

  if (!p_ctx)
    {
      return OMX_ErrorInsufficientResources;
    }

  p_ctx->signaled = OMX_FALSE;

  if (tiz_mutex_init (&p_ctx->mutex))
    {
      tiz_mem_free (p_ctx);
      return OMX_ErrorInsufficientResources;
    }

  if (tiz_cond_init (&p_ctx->cond))
    {
      tiz_mutex_destroy (&p_ctx->mutex);
      tiz_mem_free (p_ctx);
      return OMX_ErrorInsufficientResources;
    }

  * app_ctx = p_ctx;

  return OMX_ErrorNone;

}
Exemplo n.º 3
0
END_TEST

START_TEST (test_vector_push_back_vector)
{
  OMX_U32 i = 0;
  OMX_ERRORTYPE error = OMX_ErrorNone;
  int *p_item = NULL;
  tiz_vector_t *p_vector = NULL;
  tiz_vector_t *p_vector2 = NULL;

  TIZ_LOG (TIZ_PRIORITY_TRACE, "test_vector_push_back_vector");

  error = tiz_vector_init (&p_vector, sizeof(int*));
  error = tiz_vector_init (&p_vector2, sizeof(tiz_vector_t*));

  fail_if (error != OMX_ErrorNone);

  for (i = 0; i < 10; i++)
    {
      p_item = (int *) tiz_mem_alloc (sizeof (int));
      fail_if (p_item == NULL);
      *p_item = i;

      error = tiz_vector_push_back (p_vector, &p_item);
      fail_if (error != OMX_ErrorNone);

      p_item = *(int **) tiz_vector_back (p_vector);
      fail_if (*p_item != i);
    }

  TIZ_LOG (TIZ_PRIORITY_TRACE, "vector length %d",
             tiz_vector_length (p_vector));
  fail_if (10 != tiz_vector_length (p_vector));


  TIZ_LOG (TIZ_PRIORITY_TRACE, "pushing vector [%p] [%p]", p_vector, &p_vector);

  tiz_vector_push_back (p_vector2, &p_vector);
  p_vector = *(tiz_vector_t **) tiz_vector_back (p_vector2);

  TIZ_LOG (TIZ_PRIORITY_TRACE, "received vector [%p] [%p] [%p]",
           p_vector, &p_vector, *(tiz_vector_t **) p_vector);

  for (i = 0; i < 10; i++)
    {
      fail_if (10 - i != tiz_vector_length (p_vector));

      p_item = * (int **) tiz_vector_back (p_vector);
      fail_if (*p_item != 10 - i - 1);

      TIZ_LOG (TIZ_PRIORITY_TRACE, "received int [%d]", *p_item);

      tiz_vector_pop_back (p_vector);
      tiz_mem_free(p_item);
    }

  fail_if (0 != tiz_vector_length (p_vector));

  tiz_vector_destroy (p_vector);
}
Exemplo n.º 4
0
END_TEST

START_TEST (test_pqueue_removep)
{

  OMX_S32 i;
  OMX_ERRORTYPE error = OMX_ErrorNone;
  tiz_pqueue_t *p_queue = NULL;
  OMX_PTR p_received = NULL;
  int *p_item = NULL;
  int *p_item_cat_one = NULL;

  TIZ_LOG (TIZ_TRACE, "test_pqueue_removep");

  error = tiz_pqueue_init (&p_queue, 2, &pqueue_cmp, NULL, "tizkrn");

  fail_if (error != OMX_ErrorNone);

  error = tiz_pqueue_first (p_queue, &p_received);

  fail_if (error != OMX_ErrorNoMore);

  for (i = 2; i >= 0; i--)
    {
      p_item = (int *) tiz_mem_alloc (sizeof (int));
      fail_if (p_item == NULL);
      *p_item = i;
      error = tiz_pqueue_send (p_queue, p_item, i);
      fail_if (error != OMX_ErrorNone);
      if (1 == i)
        {
          p_item_cat_one = p_item;
        }
    }

  tiz_pqueue_dump (p_queue, &pqueue_dump_item);

  error = tiz_pqueue_removep (p_queue, p_item_cat_one, 1);
  fail_if (error != OMX_ErrorNone);
  fail_if (tiz_pqueue_length (p_queue) != 2);

  tiz_pqueue_dump (p_queue, &pqueue_dump_item);

  for (i = 0; i < 2; i++)
    {
      error = tiz_pqueue_receive (p_queue, &p_received);
      fail_if (error != OMX_ErrorNone);
      p_item = (int *) p_received;
      TIZ_LOG (TIZ_TRACE, "*p_item [%d]", *p_item);
      if (0 == i)
        fail_if (*p_item != 0);
      if (1 == i)
        fail_if (*p_item != 2);
      tiz_mem_free (p_received);
    }

  tiz_pqueue_destroy (p_queue);

}
Exemplo n.º 5
0
END_TEST

START_TEST (test_pqueue_send_and_receive_one_group)
{
  OMX_U32 i;
  OMX_PTR p_received = NULL;
  OMX_ERRORTYPE error = OMX_ErrorNone;
  int *p_item = NULL;
  tiz_pqueue_t *p_queue = NULL;
  tiz_soa_t *p_soa = NULL;

  TIZ_LOG (TIZ_TRACE, "test_pqueue_send_and_receive_one_group");

  fail_if (tiz_soa_init (&p_soa) != OMX_ErrorNone);

  error = tiz_pqueue_init (&p_queue, 0, &pqueue_cmp, p_soa, "tizkrn");

  fail_if (error != OMX_ErrorNone);

  for (i = 0; i < 10; i++)
    {
      p_item = (int *) tiz_mem_alloc (sizeof (int));
      fail_if (p_item == NULL);
      *p_item = i;
      error = tiz_pqueue_send (p_queue, p_item, 0);
      fail_if (error != OMX_ErrorNone);
    }

  TIZ_LOG (TIZ_TRACE, "queue length %d",
             tiz_pqueue_length (p_queue));
  fail_if (10 != tiz_pqueue_length (p_queue));

  for (i = 0; i <= 10; i++)
    {
      error = tiz_pqueue_receive (p_queue, &p_received);
      if (i > 9)
        {
          fail_if (error != OMX_ErrorNoMore);
        }
      else
        {
          fail_if (error != OMX_ErrorNone);
        }

      fail_if (p_received == NULL);
      p_item = (int *) p_received;
      if (i < 9)
        {
          TIZ_LOG (TIZ_TRACE, "item [%d]", *p_item);
          fail_if (*p_item != i);
          tiz_mem_free (p_received);
        }
    }

  tiz_pqueue_destroy (p_queue);
  tiz_soa_destroy (p_soa);
}
Exemplo n.º 6
0
static OMX_U8 *
pcm_port_alloc_hook (OMX_U32 * ap_size,
                     OMX_PTR * app_port_priv, void *ap_args)
{
  OMX_U8 *p = NULL;
  assert (ap_size);
  p = tiz_mem_alloc (*ap_size * sizeof (OMX_U8));
  TIZ_LOG (TIZ_PRIORITY_TRACE, "Test Component Alloc Hook :size[%u] p=[%p]",
           *ap_size, p);
  return p;
}
Exemplo n.º 7
0
END_TEST

START_TEST (test_map_insert_find_erase_size_empty_at_for_each)
{
  OMX_U32 i;
  OMX_ERRORTYPE error = OMX_ErrorNone;
  int *p_item = NULL;
  tiz_map_t *p_map = NULL;;
  OMX_U32 index = 0;

  error = tiz_map_init (&p_map, check_map_cmp_f, check_map_free_f, NULL);
  fail_if (error != OMX_ErrorNone);

  fail_if (false == tiz_map_empty (p_map));

  for (i = 0; i < 10; i++)
    {
      p_item = (int *) tiz_mem_alloc (sizeof (int));
      fail_if (p_item == NULL);
      *p_item = i;
      error = tiz_map_insert (p_map, p_item, p_item, &index);
      fail_if (error != OMX_ErrorNone);
      fail_if (index != i);
      fail_if (tiz_map_size (p_map) != i+1);
    }

  fail_if (10 != tiz_map_size (p_map));
  fail_if (true == tiz_map_empty (p_map));

  i = 5;
  fail_if (5 != *(p_item = tiz_map_find (p_map, &i)));

  fail_if (5 != *(p_item = tiz_map_value_at (p_map, i)));

  fail_if (OMX_ErrorNone != tiz_map_for_each (p_map,
                                              check_map_for_each_f,
                                              NULL));


  for (i = 0; i < 10; i++)
    {
      int d = i;
      tiz_map_erase (p_map, &d);
      fail_if (tiz_map_size (p_map) != 9-i);
    }

  tiz_map_destroy (p_map);

}
Exemplo n.º 8
0
static OMX_ERRORTYPE init_lst (tiz_shuffle_lst_t *ap_shuffle_lst)
{
  OMX_ERRORTYPE rc = OMX_ErrorInsufficientResources;
  assert (NULL != ap_shuffle_lst);
  ap_shuffle_lst->p_lst
      = tiz_mem_alloc (ap_shuffle_lst->length * sizeof(OMX_S32));
  if (ap_shuffle_lst->p_lst)
    {
      OMX_S32 i = 0;
      rc = OMX_ErrorNone;
      for (i = 0; i < ap_shuffle_lst->length; ++i)
        {
          ap_shuffle_lst->p_lst[i] = i;
        }
    }
  return rc;
}
Exemplo n.º 9
0
END_TEST

START_TEST (test_vector_push_and_pop_length_front_back_ints)
{
  OMX_U32 i;
  OMX_ERRORTYPE error = OMX_ErrorNone;
  int *p_item = NULL;
  tiz_vector_t *p_vector = NULL;

  TIZ_LOG (TIZ_PRIORITY_TRACE, "test_vector_push_and_pop_length_front_back_ints");

  error = tiz_vector_init (&p_vector, sizeof(int));
  fail_if (error != OMX_ErrorNone);

  for (i = 0; i < 10; i++)
    {
      p_item = (int *) tiz_mem_alloc (sizeof (int));
      fail_if (p_item == NULL);
      *p_item = i;

      error = tiz_vector_push_back (p_vector, p_item);
      fail_if (error != OMX_ErrorNone);

      p_item = tiz_vector_back (p_vector);
      fail_if (*p_item != i);
    }

  TIZ_LOG (TIZ_PRIORITY_TRACE, "vector length %d",
             tiz_vector_length (p_vector));
  fail_if (10 != tiz_vector_length (p_vector));

  for (i = 0; i < 10; i++)
    {
      fail_if (10 - i != tiz_vector_length (p_vector));

      p_item = tiz_vector_back (p_vector);
      fail_if (*p_item != 10 - i - 1);

      tiz_vector_pop_back (p_vector);
    }

  fail_if (0 != tiz_vector_length (p_vector));

  tiz_vector_destroy (p_vector);
}
Exemplo n.º 10
0
END_TEST

START_TEST (test_queue_send_and_receive)
{

  OMX_U32 i;
  OMX_PTR p_received = NULL;
  OMX_ERRORTYPE error = OMX_ErrorNone;
  int *p_item = NULL;
  tiz_queue_t *p_queue = NULL;;

  error = tiz_queue_init (&p_queue, 10);

  fail_if (error != OMX_ErrorNone);

  for (i = 0; i < 10; i++)
    {
      p_item = (int *) tiz_mem_alloc (sizeof (int));
      fail_if (p_item == NULL);
      *p_item = i;
      error = tiz_queue_send (p_queue, p_item);
      fail_if (error != OMX_ErrorNone);
      TIZ_LOG (TIZ_PRIORITY_TRACE, "queue length [%d]",
                 tiz_queue_length (p_queue));
    }

  TIZ_LOG (TIZ_PRIORITY_TRACE, "queue length [%d]",
             tiz_queue_length (p_queue));
  fail_if (10 != tiz_queue_length (p_queue));

  for (i = 0; i < 10; i++)
    {
      error = tiz_queue_receive (p_queue, &p_received);
      fail_if (error != OMX_ErrorNone);
      fail_if (p_received == NULL);
      p_item = (int *) p_received;
      fail_if (*p_item != i);
      tiz_mem_free (p_received);
    }

  tiz_queue_destroy (p_queue);

}
Exemplo n.º 11
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;
}
Exemplo n.º 12
0
END_TEST

START_TEST (test_map_clear)
{
  OMX_U32 i;
  OMX_ERRORTYPE error = OMX_ErrorNone;
  int *p_item = NULL;
  tiz_map_t *p_map = NULL;;
  OMX_U32 index = 0;

  error = tiz_map_init (&p_map, check_map_cmp_f, check_map_free_f, NULL);
  fail_if (error != OMX_ErrorNone);

  fail_if (false == tiz_map_empty (p_map));

  for (i = 0; i < 10; i++)
    {
      p_item = (int *) tiz_mem_alloc (sizeof (int));
      fail_if (p_item == NULL);
      *p_item = i;
      error = tiz_map_insert (p_map, p_item, p_item, &index);
      fail_if (error != OMX_ErrorNone);
      fail_if (index != i);
      fail_if (tiz_map_size (p_map) != i+1);
    }

  fail_if (10 != tiz_map_size (p_map));
  fail_if (true == tiz_map_empty (p_map));

  fail_if (OMX_ErrorNone != tiz_map_clear (p_map));

  fail_if (0 != tiz_map_size (p_map));
  fail_if (false == tiz_map_empty (p_map));

  tiz_map_destroy (p_map);
}