Exemplo n.º 1
0
static ssize_t ra_write(void *data, const void *buf, size_t size)
{
   roar_t *roar = (roar_t*)data;
   ssize_t rc;

   if (size == 0)
      return 0;

   int err;
   size_t written = 0;
   while (written < size)
   {
      size_t write_amt = size - written;
      if ((rc = roar_vs_write(roar->vss, (const char*)buf + written, write_amt, &err)) < (ssize_t)write_amt)
      {
         if (roar->nonblocking)
            return rc;
         else if (rc < 0)
            return -1;
      }
      written += rc;
   }

   return size;
}
Exemplo n.º 2
0
Arquivo: roar.c Projeto: Brijen/cmus
static int op_roar_write(const char *buffer, int count)
{
    int ret;
    int i;
    ret = roar_vs_write(vss, buffer, count, &err);
    for (i = 0; i < 8; i++)
        roar_vs_iterate(vss, ROAR_VS_NOWAIT, NULL);
    return ret;
}
Exemplo n.º 3
0
static size_t
roar_play(void *data, const void *chunk, size_t size, GError **error)
{
	struct roar * self = data;
	ssize_t rc;

	if (self->vss == NULL)
	{
		g_set_error(error, roar_output_quark(), 0, "Connection is invalid");
		return 0;
	}

	rc = roar_vs_write(self->vss, chunk, size, &(self->err));
	if ( rc <= 0 )
	{
		g_set_error(error, roar_output_quark(), 0, "Failed to play data");
		return 0;
	}

	return rc;
}