Lines Matching refs:buffer

51    alt="MediaCodec buffer flow diagram"></object></center>
55 (or receive) an empty input buffer, fill it up with data and send it to the codec for
57 Finally, you request (or receive) a filled output buffer, consume its contents and release it
79 this requirement is slightly relaxed in that a buffer may contain multiple encoded access units
143 state you can process data through the buffer queue manipulation described above.
147 as the first input buffer is dequeued, the codec moves to the Running sub-state, where it spends
148 most of its life. When you queue an input buffer with the {@linkplain #BUFFER_FLAG_END_OF_STREAM
230 data and submit it as a single codec-config buffer.
241 <th>CSD buffer #0</th>
242 <th>CSD buffer #1</th>
243 <th>CSD buffer #2</th>
292 after start, before any output buffer or output format change has been returned, as the codec
297 before any valid output buffer in output buffers marked with the {@linkplain
303 Each codec maintains a set of input and output buffers that are referred to by a buffer-ID in
307 buffer from the codec. In asynchronous mode, you will automatically receive available buffers via
311 Upon obtaining an input buffer, fill it with data and submit it to the codec using {@link
316 The codec in turn will return a read-only output buffer via the {@link
319 output buffer has been processed, call one of the {@link #releaseOutputBuffer
320 releaseOutputBuffer} methods to return the buffer to the codec.
339 <td>Synchronous API using buffer arrays</td>
422 <strong>Note:</strong> do not mix the methods of using buffers and buffer arrays at the same
424 #start} or after having dequeued an output buffer ID with the value of {@link
462 {@link #start}, retrieve the buffer arrays using {@link #getInputBuffers getInput}/{@link
463 #getOutputBuffers OutputBuffers()}. Use the buffer ID-s as indices into these arrays (when
499 queueInputBuffer}. You can do this on the last valid input buffer, or by submitting an additional
500 empty input buffer with the end-of-stream flag set. If using an empty buffer, the timestamp will
506 onOutputBufferAvailable}. This can be set on the last valid output buffer, or on an empty buffer
507 after the last valid output buffer. The timestamp of such empty buffer should be ignored.
520 When using an output Surface, you can select whether or not to render each output buffer on the
523 <li><strong>Do not render the buffer:</strong> Call {@link #releaseOutputBuffer(int, boolean)
525 <li><strong>Render the buffer with the default timestamp:</strong> Call {@link
527 <li><strong>Render the buffer with a specific timestamp:</strong> Call {@link
532 BufferInfo#presentationTimeUs presentation timestamp} of the buffer (converted to nanoseconds).
611 generally, before the first output buffer or output format change is received &ndash; you
623 codec-specific configuration data together with the key frame into a single buffer (including
624 any start codes), and submit it as a <strong>regular</strong> input buffer.
1368 * Per buffer metadata includes an offset and size specifying
1369 * the range of valid data in the associated codec (output) buffer.
1373 * Update the buffer metadata information.
1375 * @param newOffset the start-offset of the data in the buffer.
1376 * @param newSize the amount of data (in bytes) in the buffer.
1378 * @param newFlags buffer flags associated with the buffer. This
1391 * The start-offset of the data in the buffer.
1396 * The amount of data (in bytes) in the buffer. If this is {@code 0},
1397 * the buffer has no data in it and can be discarded. The only
1398 * use of a 0-size buffer is to carry the end-of-stream marker.
1403 * The presentation timestamp in microseconds for the buffer.
1405 * with the corresponding input buffer. This should be ignored for
1406 * a 0-sized buffer.
1411 * Buffer flags associated with the buffer. A combination of
1417 * <p>The last output buffer corresponding to the input buffer
1420 * be an empty buffer, whose sole purpose is to carry the end-of-stream
1439 * This indicates that the (encoded) buffer marked as such contains
1447 * This indicates that the (encoded) buffer marked as such contains
1453 * This indicated that the buffer marked as such contains codec
2033 * Thrown when a crypto error occurs while queueing a secure input buffer.
2100 * After filling a range of the input buffer at the specified index
2101 * submit it to the component. Once an input buffer is queued to
2137 * @param index The index of a client-owned input buffer previously returned
2139 * @param offset The byte offset into the input buffer at which the data starts.
2142 * buffer. This is normally the media time at which this
2143 * buffer should be presented (rendered). When using an output
2186 * A buffer's data is considered to be partitioned into "subSamples",
2211 * The number of subSamples that make up the buffer's contents.
2259 * Similar to {@link #queueInputBuffer queueInputBuffer} but submits a buffer that is
2263 * @param index The index of a client-owned input buffer previously returned
2265 * @param offset The byte offset into the input buffer at which the data starts.
2269 * buffer. This is normally the media time at which this
2270 * buffer should be presented (rendered).
2277 * @throws CryptoException if an error occurs while attempting to decrypt the buffer.
2308 * Returns the index of an input buffer to be filled with valid data
2309 * or -1 if no such buffer is currently available.
2311 * for the availability of an input buffer if timeoutUs &lt; 0 or wait up
2340 * get the format for a specific output buffer. This frees you from
2352 * request a current buffer using on of the get-buffer or
2367 * Dequeue an output buffer, block at most "timeoutUs" microseconds.
2368 * Returns the index of an output buffer that has been successfully
2370 * @param info Will be filled with buffer meta data.
2397 * If you are done with a buffer, use this call to return the buffer to the codec
2399 * output surface, setting {@code render} to {@code true} will first send the buffer
2400 * to that output surface. The surface will release the buffer back to the codec once
2403 * Once an output buffer is released to the codec, it MUST NOT
2408 * @param index The index of a client-owned output buffer previously returned
2411 * passing true renders this output buffer to the surface.
2428 * If you are done with a buffer, use this call to update its surface timestamp
2431 * this call will simply return the buffer to the codec.<p>
2438 * If you render your buffer on a {@link android.view.SurfaceView},
2439 * you can use the timestamp to render the buffer at a specific time (at the
2440 * VSYNC at or after the buffer timestamp). For this to work, the timestamp
2445 * <li>the buffer will not be returned to the codec until the timestamp
2446 * has passed and the buffer is no longer used by the {@link android.view.Surface}.
2455 * display the buffer at the earliest feasible time. In this mode it will not
2464 * Once an output buffer is released to the codec, it MUST NOT
2469 * @param index The index of a client-owned output buffer previously returned
2471 * @param renderTimestampNs The timestamp to associate with this buffer when
2493 * Signals end-of-stream on input. Equivalent to submitting an empty buffer with
2534 * Returns the output format for a specific output buffer.
2536 * @param index The index of a client-owned input buffer previously
2539 * @return the format for the output buffer, or null if the index
2540 * is not a dequeued output buffer.
2555 // various returned representations of the codec buffer
2577 public void setByteBuffer(@Nullable ByteBuffer buffer) {
2579 mByteBuffer = buffer;
2587 CodecBuffer buffer = mMap.get(index);
2588 if (buffer != null) {
2589 buffer.free();
2595 CodecBuffer buffer = mMap.get(index);
2596 if (buffer == null) { // likely
2597 buffer = new CodecBuffer();
2598 mMap.put(index, buffer);
2600 buffer.setByteBuffer(newBuffer);
2604 CodecBuffer buffer = mMap.get(index);
2605 if (buffer == null) { // likely
2606 buffer = new CodecBuffer();
2607 mMap.put(index, buffer);
2609 buffer.setImage(newImage);
2613 for (CodecBuffer buffer: mMap.values()) {
2614 buffer.free();
2631 ByteBuffer buffer = buffers[index];
2632 if (buffer != null) {
2633 buffer.setAccessible(false);
2641 ByteBuffer buffer = buffers[index];
2642 if (buffer != null) {
2643 buffer.setAccessible(true);
2644 buffer.clear();
2653 ByteBuffer buffer = buffers[index];
2654 if (buffer != null) {
2655 buffer.setAccessible(true);
2664 ByteBuffer buffer = buffers[index];
2665 if (buffer != null) {
2666 buffer.setAccessible(true);
2667 buffer.limit(info.offset + info.size).position(info.offset);
2674 for (ByteBuffer buffer: buffers) {
2675 if (buffer != null) {
2676 buffer.setAccessible(false);
2682 private final void freeByteBuffer(@Nullable ByteBuffer buffer) {
2683 if (buffer != null /* && buffer.isDirect() */) {
2685 java.nio.NioUtils.freeDirectBuffer(buffer);
2691 for (ByteBuffer buffer: buffers) {
2692 freeByteBuffer(buffer);
2730 * each time an input buffer is dequeued.
2753 * buffer change by returning {@link
2759 * each time an output buffer is dequeued. This method is not
2783 * object for a dequeued input buffer index to contain the input data.
2789 * @param index The index of a client-owned input buffer previously
2793 * @return the input buffer, or null if the index is not a dequeued
2794 * input buffer, or if the codec is configured for surface input.
2810 * Returns a writable Image object for a dequeued input buffer
2817 * @param index The index of a client-owned input buffer previously
2822 * dequeued input buffer, or not a ByteBuffer that contains a
2839 * Returns a read-only ByteBuffer for a dequeued output buffer
2840 * index. The position and limit of the returned buffer are set
2847 * @param index The index of a client-owned output buffer previously
2851 * @return the output buffer, or null if the index is not a dequeued
2852 * output buffer, or the codec is configured with an output surface.
2868 * Returns a read-only Image object for a dequeued output buffer
2874 * @param index The index of a client-owned output buffer previously
2879 * dequeued output buffer, not a raw video frame, or if the codec
3126 * Called when an input buffer becomes available.
3129 * @param index The index of the available input buffer.
3134 * Called when an output buffer becomes available.
3137 * @param index The index of the available output buffer.
3138 * @param info Info regarding the available output buffer {@link MediaCodec.BufferInfo}.
3282 private int readInt(@NonNull ByteBuffer buffer, boolean asLong) {
3284 return (int)buffer.getLong();
3286 return buffer.getInt();
3291 @NonNull ByteBuffer buffer, @NonNull ByteBuffer info, boolean readOnly,
3296 mIsReadOnly = buffer.isReadOnly();
3297 mBuffer = buffer.duplicate();
3338 buffer.clear();
3339 buffer.position(mBuffer.position() + planeOffset
3341 buffer.limit(buffer.position() + Utils.divUp(bitDepth, 8)
3343 mPlanes[ix] = new MediaPlane(buffer.slice(), rowInc, colInc);
3358 public MediaPlane(@NonNull ByteBuffer buffer, int rowInc, int colInc) {
3359 mData = buffer;