/** * Give a packet of the audio of this participant such that it can be * buffered and sent to the transcription once enough has been stored * * @param buffer a buffer which is expected to contain a single packet * of audio of this participant */ void giveBuffer(javax.media.Buffer buffer) { if (audioFormat == null) { audioFormat = (AudioFormat) buffer.getFormat(); } byte[] audio = (byte[]) buffer.getData(); if (USE_LOCAL_BUFFER) { buffer(audio); } else { sendRequest(audio); } }
/** * Gets the length in milliseconds of the media in a specific * <tt>Buffer</tt> (often referred to as duration). * * @param buffer the <tt>Buffer</tt> which contains media the length in * milliseconds of which is to be calculated * @return the length in milliseconds of the media in <tt>buffer</tt> if * there actually is media in <tt>buffer</tt> and its length in milliseconds * can be calculated; otherwise, <tt>0</tt> */ private long getLengthInMillis(Buffer buffer) { int length = buffer.getLength(); if (length < 1) return 0; Format format = buffer.getFormat(); if (format == null) { format = getFormat(); if (format == null) return 0; } if (!(format instanceof AudioFormat)) return 0; AudioFormat audioFormat = (AudioFormat) format; long duration = audioFormat.computeDuration(length); return (duration < 1) ? 0 : (duration / 1000000); }
format = (VideoFormat)buffer.getFormat();
VideoFormat format; format = (VideoFormat)buffer.getFormat(); if (format == null)
Format format = buffer.getFormat(); if (format != null && format != this.inputFormat
public int process(Buffer inputBuffer, Buffer outputBuffer) { if (!checkInputBuffer(inputBuffer)) return BUFFER_PROCESSED_FAILED; if (isEOM(inputBuffer)) { propagateEOM(outputBuffer); return BUFFER_PROCESSED_OK; } Format newFormat = inputBuffer.getFormat(); if (lastFormat != newFormat) initConverter((AudioFormat) newFormat); int inpLength = inputBuffer.getLength(); int outLength = calculateOutputSize(inputBuffer.getLength()); byte[] inpData = (byte[]) inputBuffer.getData(); byte[] outData = validateByteArraySize(outputBuffer, outLength); convert(inpData, inputBuffer.getOffset(), inpLength, outData, 0); updateOutput(outputBuffer, outputFormat, outLength, 0); return BUFFER_PROCESSED_OK; } }
Format format = buffer.getFormat();
format = buffer.getFormat(); if (format == null)
Format inFormat = inBuffer.getFormat();
return BUFFER_PROCESSED_OK; Format format = buffer.getFormat();
Format newFormat = inputBuffer.getFormat();
buffer.setFormat(dataFormat); Format format = buffer.getFormat();
VideoFormat inFormat = (VideoFormat) in.getFormat(); float outFrameRate = ensureFrameRate(inFormat.getFrameRate());
outputBuffer.setFormat(inputBuffer.getFormat()); outputBuffer.setHeader(inputBuffer.getHeader()); outputBuffer.setSequenceNumber(inputBuffer.getSequenceNumber());
VideoFormat inFormat = (VideoFormat) in.getFormat(); float outFrameRate = ensureFrameRate(inFormat.getFrameRate());
Format inFormat = inBuffer.getFormat();
outputBuffer.setFormat(inputBuffer.getFormat()); outputBuffer.setHeader(inputBuffer.getHeader()); outputBuffer.setSequenceNumber(inputBuffer.getSequenceNumber());
Format inFormat = inBuffer.getFormat();
AVFrameFormat format = (AVFrameFormat) inputBuffer.getFormat(); Dimension size = format.getSize(); int pixFmt = format.getPixFmt();