All pastes #912660 Raw Edit

ensonic

public text v1 · immutable
·published 2008-02-21 15:28 UTC
rendered paste body
  if (!GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP)) {
    /* and convert the samples */
    if (!(res = audio_convert_convert (&this->ctx, src, dst,
                samples, gst_buffer_is_writable (inbuf))))
      goto convert_error;
  }
  else {
    /* need to handle the case where noiseshaping is used and has not yet
     * converged */
    if (G_UNLIKELY((this->ctx.ns != NOISE_SHAPING_NONE) &&
        (!gst_audio_quantize_is_noise_shaping_null (&this->ctx)))) {
      if (!(res = audio_convert_convert (&this->ctx, src, dst,
                samples, gst_buffer_is_writable (inbuf))))
        goto convert_error;
      GST_BUFFER_FLAG_UNSET (outbuf, GST_BUFFER_FLAG_GAP);
    }
    else {
      if(G_UNLIKELY(this->ctx.out.is_int && !this->ctx.out.sign)) {
        gint tempsize = samples * 4 * this->ctx.out.channels;
        /* we need signed 32 bit integers as a source */
        if (tempsize > this->ctx.tmpbufsize) {
          this->ctx.tmpbuf = g_realloc (this->ctx.tmpbuf, tempsize);
          this->ctx.tmpbufsize = tempsize;
        }
        memset (this->ctx.tmpbuf, 0, tempsize);
        this->ctx.pack (this->ctx.tmpbuf, dst, this->ctx.out_scale, samples * this->ctx.out.channels);
      }
      else {
        memset (dst, 0, outsize);
      }
    }
  }