SCSIPersistentReserveOut::SCSIPersistentReserveOut(ServiceAction action,
                                                   unsigned int allocationLength) :
        SCSIRequest(10),
        mServiceAction(action)
{
    setCdbByte(0x00, SCSI_OPCODE_PERSISTENTRESERVEOUT);
    setCdbByte(0x01, (uint8_t) mServiceAction);
    setCdbShort(0x07, allocationLength);
    createOutBuffer(allocationLength);
    SetXferDir(SCSI_XFER_WRITE);
}
void SCSIPersistentReserveOut::SetTransportIdList(uint8_t *buffer, unsigned int length) {
    if (buffer == NULL || length == 0)
        throw CException("Invalid Value");

    // copy shared_array, end of function call will call oldbuffer to be destroyed
    boost::shared_array<uint8_t> oldBuffer = mOutBuffer;

    createOutBuffer(length + 24);
    setCdbShort(0x07, length + 24);

    memcpy(mOutBuffer.get(), oldBuffer.get(), 24);
    memcpy(&mOutBuffer[24], buffer, length);
    SetOutBufferBool(20, 4, true); // set SPEC_I_PT
}
Example #3
0
GstBuffer* Resampler::produceResampledBuffer ()
{
  gint64 numFramesAvailable = getNumFramesAvailable ();
  size_t numOutFrames = numFramesAvailable * m_targetSR / m_sourceSR;

  if (numFramesAvailable <= 0)
    numOutFrames = 0;

  GstBuffer* out = createOutBuffer (numOutFrames);
  GstMapInfo outInfo;
  if (gst_buffer_map (out, &outInfo, GST_MAP_WRITE))
  {
    doResampling (outInfo, numOutFrames);
    gst_buffer_unmap (out, &outInfo);
  }
  return out;
}