/** * {@inheritDoc} */ @Override public void setData(Object data) { super.setData(data); buf = (byte[]) data; } }
/** * {@inheritDoc} */ @Override protected void enterRunInPlayThread() { buffer = new Buffer(); bufferData = new byte[DEFAULT_BUFFER_DATA_LENGTH]; buffer.setData(bufferData); renderer = audioSystem.createRenderer(playback); }
/** * Replaces the media data contained in a specific <tt>Buffer</tt> with a * compatible representation of silence. * * @param buffer the <tt>Buffer</tt> the data contained in which is to be * replaced with silence */ public static void mute(Buffer buffer) { Object data = buffer.getData(); if (data != null) { Class<?> dataClass = data.getClass(); final int fromIndex = buffer.getOffset(); final int toIndex = fromIndex + buffer.getLength(); if (Format.byteArray.equals(dataClass)) Arrays.fill((byte[]) data, fromIndex, toIndex, (byte) 0); else if (Format.intArray.equals(dataClass)) Arrays.fill((int[]) data, fromIndex, toIndex, 0); else if (Format.shortArray.equals(dataClass)) Arrays.fill((short[]) data, fromIndex, toIndex, (short) 0); buffer.setData(data); } }
protected short[] validateShortArraySize(Buffer buffer, int newSize) { Object data = buffer.getData(); short[] newShorts; if (data instanceof short[]) { short[] shorts = (short[]) data; if (shorts.length >= newSize) return shorts; newShorts = new short[newSize]; System.arraycopy(shorts, 0, newShorts, 0, shorts.length); } else { newShorts = new short[newSize]; buffer.setLength(0); buffer.setOffset(0); } buffer.setData(newShorts); return newShorts; } }
public static int read(Buffer buffer, Format format, ByteBuffer data) { AVFrameFormat frameFormat = (AVFrameFormat) format; Object o = buffer.getData(); AVFrame frame; if (o instanceof AVFrame) frame = (AVFrame) o; else { frame = new AVFrame(); buffer.setData(frame); } return frame.avpicture_fill(data, frameFormat); }
buffer.setData(shortArray);
/** * Implements PushBufferStream#read(Buffer). Delegates to the wrapped * PushSourceStream by allocating a new byte[] buffer of size equal to * PushSourceStream#getMinimumTransferSize(). * * @param buffer the <tt>Buffer</tt> to read * @throws IOException if I/O related errors occurred during read operation */ public void read(Buffer buffer) throws IOException { byte[] data = (byte[]) buffer.getData(); int minimumTransferSize = stream.getMinimumTransferSize(); if ((data == null) || (data.length < minimumTransferSize)) { data = new byte[minimumTransferSize]; buffer.setData(data); } buffer.setOffset(0); read(buffer, data, 0, minimumTransferSize); }
buffer.setData(data); buffer.setOffset(0); buffer.setLength(frameSizeInBytes);
buffer.setData(data); buffer.setFlags(Buffer.FLAG_SYSTEM_TIME); if (format != null)
/** * decode the buffer * @param inputBuffer Buffer * @param outputBuffer Buffer * @return int */ public int process(Buffer inputBuffer, Buffer outputBuffer) { if (!checkInputBuffer(inputBuffer)) { return BUFFER_PROCESSED_FAILED; } if (isEOM(inputBuffer)) { propagateEOM(outputBuffer); return BUFFER_PROCESSED_OK; } Object outData = outputBuffer.getData(); outputBuffer.setData(inputBuffer.getData()); inputBuffer.setData(outData); outputBuffer.setLength(inputBuffer.getLength()); outputBuffer.setFormat(outputFormat); outputBuffer.setOffset(inputBuffer.getOffset()); return BUFFER_PROCESSED_OK; } }
buffer.setData(frame.getFrameData()); buffer.setOffset(0); buffer.setLength(frame.getFrameLength());
buf.setData(dst); buf.setDuration(
/** * Reads byte data from this stream into a specific <tt>Buffer</tt> * which is to use a specific array of bytes for its data. * * @param buffer the <tt>Buffer</tt> to read byte data into from this * instance * @param data the array of <tt>byte</tt>s to read data into from this * instance and to be set as the data of the specified <tt>buffer</tt> * @throws IOException if I/O related errors occurred during read operation */ protected void read(Buffer buffer, byte[] data, int offset, int length) throws IOException { int numberOfBytesRead = doRead(buffer, data, offset, length); buffer.setData(data); if (numberOfBytesRead >= 0) { buffer.setLength(numberOfBytesRead); } else { buffer.setLength(0); if (numberOfBytesRead == -1) buffer.setEOM(true); } buffer.setOffset(offset); Format format = getFormat(); if (format != null) buffer.setFormat(format); }
buf.setData(out); buf.setDuration(
byte[] data = rtpPacket.getPayload(); buffer.setData(data); buffer.setOffset(rtpPacket.getOffset()); buffer.setLength(rtpPacket.getPayloadLength());
resamplerOutBuffer.setData(resamplerData); resamplerOutBuffer.setLength(0); resamplerOutBuffer.setOffset(0);
|| (((AVFrame) outData).getPtr() != avframe)) out.setData(new AVFrame(avframe));
outputBuffer.setData(bufferData);
|| (((AVFrame) out).getPtr() != outputFrame)) outputBuffer.setData(new AVFrame(outputFrame));