Пример #1
0
int poll_ogg_file(OGGFILE *ogg) {
  char *data;
  long len;

  data = (char *)alogg_get_oggstream_buffer(ogg->s);
  if (data) {
    len = pack_fread(data, DATASZ, ogg->f);
    if (len < DATASZ)
      alogg_free_oggstream_buffer(ogg->s, len);
    else
      alogg_free_oggstream_buffer(ogg->s, -1);
  }

  return alogg_poll_oggstream(ogg->s);
}
Пример #2
0
  int poll()
  {
    if (done)
      return done;
    if (paused)
      return 0;

    if ((!done) && (in->todo > 0))
    {
      // update the buffer
      char *tempbuf = (char *)alogg_get_oggstream_buffer(stream);
      if (tempbuf != NULL)
      {
        int free_val = -1;
        if (chunksize > in->todo)
        {
          chunksize = in->todo;
          free_val = chunksize;
        }
        pack_fread(tempbuf, chunksize, in);
        alogg_free_oggstream_buffer(stream, free_val);
      }
    }
    if (alogg_poll_oggstream(stream) == ALOGG_POLL_PLAYJUSTFINISHED) {
      done = 1;
    }
    else get_pos_ms();  // call this to keep the last_but_one stuff up to date

    return done;
  }
Пример #3
0
int MYOGG::poll()
{
    _mutex.Lock();

    if (!done && _destroyThis)
    {
      internal_destroy();
      _destroyThis = false;
    }

    if (done)
    {
        _mutex.Unlock();
        return done;
    }
    if (paused)
    {
        _mutex.Unlock();
        return 0;
    }

    if ((!done) && (in->todo > 0))
    {
        // update the buffer
        char *tempbuf = (char *)alogg_get_oggstream_buffer(stream);
        if (tempbuf != NULL)
        {
            int free_val = -1;
            if (chunksize > in->todo)
            {
                chunksize = in->todo;
                free_val = chunksize;
            }
            pack_fread(tempbuf, chunksize, in);
            alogg_free_oggstream_buffer(stream, free_val);
        }
    }
    if (alogg_poll_oggstream(stream) == ALOGG_POLL_PLAYJUSTFINISHED) {
        done = 1;
        if (psp_audio_multithreaded)
            internal_destroy();
    }
    else get_pos_ms();  // call this to keep the last_but_one stuff up to date

    _mutex.Unlock();

    return done;
}