Merge "Consistently say "Available since API level"." am: 2218ec1a22

am: 22cd27bcc5

Change-Id: Ie36d064efd7913a3a921dd1f5fb57d3c0d68b8c5
gugelfrei
Elliott Hughes 5 years ago committed by android-build-merger
commit 8a58e72823

@ -472,6 +472,8 @@ typedef struct AAudioStreamBuilderStruct AAudioStreamBuilder;
* This is intended for developers to use when debugging.
* It is not for display to users.
*
* Available since API level 26.
*
* @return pointer to a text representation of an AAudio result code.
*/
AAUDIO_API const char * AAudio_convertResultToText(aaudio_result_t returnCode) __INTRODUCED_IN(26);
@ -482,6 +484,8 @@ AAUDIO_API const char * AAudio_convertResultToText(aaudio_result_t returnCode) _
* This is intended for developers to use when debugging.
* It is not for display to users.
*
* Available since API level 26.
*
* @return pointer to a text representation of an AAudio state.
*/
AAUDIO_API const char * AAudio_convertStreamStateToText(aaudio_stream_state_t state)
@ -502,6 +506,8 @@ AAUDIO_API const char * AAudio_convertStreamStateToText(aaudio_stream_state_t st
* chosen by the device when it is opened.
*
* AAudioStreamBuilder_delete() must be called when you are done using the builder.
*
* Available since API level 26.
*/
AAUDIO_API aaudio_result_t AAudio_createStreamBuilder(AAudioStreamBuilder** builder)
__INTRODUCED_IN(26);
@ -513,6 +519,8 @@ AAUDIO_API aaudio_result_t AAudio_createStreamBuilder(AAudioStreamBuilder** buil
* The default, if you do not call this function, is {@link #AAUDIO_UNSPECIFIED},
* in which case the primary device will be used.
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param deviceId device identifier or {@link #AAUDIO_UNSPECIFIED}
*/
@ -530,6 +538,8 @@ AAUDIO_API void AAudioStreamBuilder_setDeviceId(AAudioStreamBuilder* builder,
* If an exact value is specified then an opened stream will use that value.
* If a stream cannot be opened with the specified value then the open will fail.
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param sampleRate frames per second. Common rates include 44100 and 48000 Hz.
*/
@ -547,6 +557,8 @@ AAUDIO_API void AAudioStreamBuilder_setSampleRate(AAudioStreamBuilder* builder,
* If an exact value is specified then an opened stream will use that value.
* If a stream cannot be opened with the specified value then the open will fail.
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param channelCount Number of channels desired.
*/
@ -556,6 +568,8 @@ AAUDIO_API void AAudioStreamBuilder_setChannelCount(AAudioStreamBuilder* builder
/**
* Identical to AAudioStreamBuilder_setChannelCount().
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param samplesPerFrame Number of samples in a frame.
*/
@ -573,6 +587,8 @@ AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* buil
* If an exact value is specified then an opened stream will use that value.
* If a stream cannot be opened with the specified value then the open will fail.
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param format common formats are {@link #AAUDIO_FORMAT_PCM_FLOAT} and
* {@link #AAUDIO_FORMAT_PCM_I16}.
@ -588,6 +604,8 @@ AAUDIO_API void AAudioStreamBuilder_setFormat(AAudioStreamBuilder* builder,
* The requested sharing mode may not be available.
* The application can query for the actual mode after the stream is opened.
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param sharingMode {@link #AAUDIO_SHARING_MODE_SHARED} or {@link #AAUDIO_SHARING_MODE_EXCLUSIVE}
*/
@ -599,6 +617,8 @@ AAUDIO_API void AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder* builder,
*
* The default, if you do not call this function, is {@link #AAUDIO_DIRECTION_OUTPUT}.
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param direction {@link #AAUDIO_DIRECTION_OUTPUT} or {@link #AAUDIO_DIRECTION_INPUT}
*/
@ -611,6 +631,8 @@ AAUDIO_API void AAudioStreamBuilder_setDirection(AAudioStreamBuilder* builder,
*
* The default, if you do not call this function, is {@link #AAUDIO_UNSPECIFIED}.
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param numFrames the desired buffer capacity in frames or {@link #AAUDIO_UNSPECIFIED}
*/
@ -629,6 +651,8 @@ AAUDIO_API void AAudioStreamBuilder_setBufferCapacityInFrames(AAudioStreamBuilde
* You can call AAudioStream_getPerformanceMode()
* to find out the final mode for the stream.
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param mode the desired performance mode, eg. {@link #AAUDIO_PERFORMANCE_MODE_LOW_LATENCY}
*/
@ -644,7 +668,7 @@ AAUDIO_API void AAudioStreamBuilder_setPerformanceMode(AAudioStreamBuilder* buil
*
* The default, if you do not call this function, is {@link #AAUDIO_USAGE_MEDIA}.
*
* Added in API level 28.
* Available since API level 28.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param usage the desired usage, eg. {@link #AAUDIO_USAGE_GAME}
@ -661,7 +685,7 @@ AAUDIO_API void AAudioStreamBuilder_setUsage(AAudioStreamBuilder* builder,
*
* The default, if you do not call this function, is {@link #AAUDIO_CONTENT_TYPE_MUSIC}.
*
* Added in API level 28.
* Available since API level 28.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param contentType the type of audio data, eg. {@link #AAUDIO_CONTENT_TYPE_SPEECH}
@ -681,7 +705,7 @@ AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder,
* That is because VOICE_RECOGNITION is the preset with the lowest latency
* on many platforms.
*
* Added in API level 28.
* Available since API level 28.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param inputPreset the desired configuration for recording
@ -697,7 +721,7 @@ AAUDIO_API void AAudioStreamBuilder_setInputPreset(AAudioStreamBuilder* builder,
* Note that an application can also set its global policy, in which case the most restrictive
* policy is always applied. See {@link android.media.AudioAttributes#setAllowedCapturePolicy(int)}
*
* Added in API level 29.
* Available since API level 29.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param inputPreset the desired level of opt-out from being captured.
@ -727,7 +751,7 @@ AAUDIO_API void AAudioStreamBuilder_setAllowedCapturePolicy(AAudioStreamBuilder*
*
* Allocated session IDs will always be positive and nonzero.
*
* Added in API level 28.
* Available since API level 28.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param sessionId an allocated sessionID or {@link #AAUDIO_SESSION_ID_ALLOCATE}
@ -826,6 +850,8 @@ typedef aaudio_data_callback_result_t (*AAudioStream_dataCallback)(
*
* Note that the AAudio callbacks will never be called simultaneously from multiple threads.
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param callback pointer to a function that will process audio data.
* @param userData pointer to an application data structure that will be passed
@ -854,6 +880,8 @@ AAUDIO_API void AAudioStreamBuilder_setDataCallback(AAudioStreamBuilder* builder
* If you do call this function then the requested size should be less than
* half the buffer capacity, to allow double buffering.
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param numFrames the desired buffer size in frames or {@link #AAUDIO_UNSPECIFIED}
*/
@ -905,6 +933,8 @@ typedef void (*AAudioStream_errorCallback)(
*
* Note that the AAudio callbacks will never be called simultaneously from multiple threads.
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param callback pointer to a function that will be called if an error occurs.
* @param userData pointer to an application data structure that will be passed
@ -919,6 +949,8 @@ AAUDIO_API void AAudioStreamBuilder_setErrorCallback(AAudioStreamBuilder* builde
* AAudioStream_close() must be called when finished with the stream to recover
* the memory and to free the associated resources.
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @param stream pointer to a variable to receive the new stream reference
* @return {@link #AAUDIO_OK} or a negative error.
@ -929,6 +961,8 @@ AAUDIO_API aaudio_result_t AAudioStreamBuilder_openStream(AAudioStreamBuilder*
/**
* Delete the resources associated with the StreamBuilder.
*
* Available since API level 26.
*
* @param builder reference provided by AAudio_createStreamBuilder()
* @return {@link #AAUDIO_OK} or a negative error.
*/
@ -942,6 +976,8 @@ AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder* buil
/**
* Free the resources associated with a stream created by AAudioStreamBuilder_openStream()
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return {@link #AAUDIO_OK} or a negative error.
*/
@ -954,6 +990,8 @@ AAUDIO_API aaudio_result_t AAudioStream_close(AAudioStream* stream) __INTRODUCE
* After this call the state will be in {@link #AAUDIO_STREAM_STATE_STARTING} or
* {@link #AAUDIO_STREAM_STATE_STARTED}.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return {@link #AAUDIO_OK} or a negative error.
*/
@ -969,6 +1007,8 @@ AAUDIO_API aaudio_result_t AAudioStream_requestStart(AAudioStream* stream) __IN
* This will return {@link #AAUDIO_ERROR_UNIMPLEMENTED} for input streams.
* For input streams use AAudioStream_requestStop().
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return {@link #AAUDIO_OK} or a negative error.
*/
@ -984,6 +1024,8 @@ AAUDIO_API aaudio_result_t AAudioStream_requestPause(AAudioStream* stream) __IN
*
* This will return {@link #AAUDIO_ERROR_UNIMPLEMENTED} for input streams.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return {@link #AAUDIO_OK} or a negative error.
*/
@ -995,6 +1037,8 @@ AAUDIO_API aaudio_result_t AAudioStream_requestFlush(AAudioStream* stream) __IN
* After this call the state will be in {@link #AAUDIO_STREAM_STATE_STOPPING} or
* {@link #AAUDIO_STREAM_STATE_STOPPED}.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return {@link #AAUDIO_OK} or a negative error.
*/
@ -1008,6 +1052,8 @@ AAUDIO_API aaudio_result_t AAudioStream_requestStop(AAudioStream* stream) __INT
* call AAudioStream_waitForStateChange() with currentState
* set to {@link #AAUDIO_STREAM_STATE_UNKNOWN} and a zero timeout.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
*/
AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream) __INTRODUCED_IN(26);
@ -1028,6 +1074,8 @@ AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream) __I
* }
* </code></pre>
*
* Available since API level 26.
*
* @param stream A reference provided by AAudioStreamBuilder_openStream()
* @param inputState The state we want to avoid.
* @param nextState Pointer to a variable that will be set to the new state.
@ -1056,6 +1104,8 @@ AAUDIO_API aaudio_result_t AAudioStream_waitForStateChange(AAudioStream* stream,
*
* If the call times out then zero or a partial frame count will be returned.
*
* Available since API level 26.
*
* @param stream A stream created using AAudioStreamBuilder_openStream().
* @param buffer The address of the first sample.
* @param numFrames Number of frames to read. Only complete frames will be written.
@ -1079,6 +1129,8 @@ AAUDIO_API aaudio_result_t AAudioStream_read(AAudioStream* stream,
*
* If the call times out then zero or a partial frame count will be returned.
*
* Available since API level 26.
*
* @param stream A stream created using AAudioStreamBuilder_openStream().
* @param buffer The address of the first sample.
* @param numFrames Number of frames to write. Only complete frames will be written.
@ -1104,6 +1156,8 @@ AAUDIO_API aaudio_result_t AAudioStream_write(AAudioStream* stream,
* You can check the return value or call AAudioStream_getBufferSizeInFrames()
* to see what the actual final size is.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @param numFrames requested number of frames that can be filled without blocking
* @return actual buffer size in frames or a negative error
@ -1114,6 +1168,8 @@ AAUDIO_API aaudio_result_t AAudioStream_setBufferSizeInFrames(AAudioStream* stre
/**
* Query the maximum number of frames that can be filled without blocking.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return buffer size in frames.
*/
@ -1129,6 +1185,8 @@ AAUDIO_API int32_t AAudioStream_getBufferSizeInFrames(AAudioStream* stream) __IN
* For some endpoints, the burst size can vary dynamically.
* But these tend to be devices with high latency.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return burst size
*/
@ -1137,6 +1195,8 @@ AAUDIO_API int32_t AAudioStream_getFramesPerBurst(AAudioStream* stream) __INTROD
/**
* Query maximum buffer capacity in frames.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return buffer capacity in frames
*/
@ -1158,6 +1218,8 @@ AAUDIO_API int32_t AAudioStream_getBufferCapacityInFrames(AAudioStream* stream)
* {@link #AAUDIO_UNSPECIFIED} indicates that the callback buffer size for this stream
* may vary from one dataProc callback to the next.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return callback buffer size in frames or {@link #AAUDIO_UNSPECIFIED}
*/
@ -1175,12 +1237,16 @@ AAUDIO_API int32_t AAudioStream_getFramesPerDataCallback(AAudioStream* stream) _
* Note that some INPUT devices may not support this function.
* In that case a 0 will always be returned.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return the underrun or overrun count
*/
AAUDIO_API int32_t AAudioStream_getXRunCount(AAudioStream* stream) __INTRODUCED_IN(26);
/**
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return actual sample rate
*/
@ -1190,6 +1256,8 @@ AAUDIO_API int32_t AAudioStream_getSampleRate(AAudioStream* stream) __INTRODUCED
* A stream has one or more channels of data.
* A frame will contain one sample for each channel.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return actual number of channels
*/
@ -1198,18 +1266,24 @@ AAUDIO_API int32_t AAudioStream_getChannelCount(AAudioStream* stream) __INTRODUC
/**
* Identical to AAudioStream_getChannelCount().
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return actual number of samples frame
*/
AAUDIO_API int32_t AAudioStream_getSamplesPerFrame(AAudioStream* stream) __INTRODUCED_IN(26);
/**
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return actual device ID
*/
AAUDIO_API int32_t AAudioStream_getDeviceId(AAudioStream* stream) __INTRODUCED_IN(26);
/**
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return actual data format
*/
@ -1217,6 +1291,9 @@ AAUDIO_API aaudio_format_t AAudioStream_getFormat(AAudioStream* stream) __INTROD
/**
* Provide actual sharing mode.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return actual sharing mode
*/
@ -1226,12 +1303,16 @@ AAUDIO_API aaudio_sharing_mode_t AAudioStream_getSharingMode(AAudioStream* strea
/**
* Get the performance mode used by the stream.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
*/
AAUDIO_API aaudio_performance_mode_t AAudioStream_getPerformanceMode(AAudioStream* stream)
__INTRODUCED_IN(26);
/**
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return direction
*/
@ -1245,6 +1326,8 @@ AAUDIO_API aaudio_direction_t AAudioStream_getDirection(AAudioStream* stream) __
*
* The frame position is monotonically increasing.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return frames written
*/
@ -1258,6 +1341,8 @@ AAUDIO_API int64_t AAudioStream_getFramesWritten(AAudioStream* stream) __INTRODU
*
* The frame position is monotonically increasing.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return frames read
*/
@ -1281,7 +1366,7 @@ AAUDIO_API int64_t AAudioStream_getFramesRead(AAudioStream* stream) __INTRODUCED
*
* The sessionID for a stream should not change once the stream has been opened.
*
* Added in API level 28.
* Available since API level 28.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return session ID or {@link #AAUDIO_SESSION_ID_NONE}
@ -1304,6 +1389,8 @@ AAUDIO_API aaudio_session_id_t AAudioStream_getSessionId(AAudioStream* stream) _
*
* The position and time passed back are monotonically increasing.
*
* Available since API level 26.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @param clockid CLOCK_MONOTONIC or CLOCK_BOOTTIME
* @param framePosition pointer to a variable to receive the position
@ -1316,7 +1403,7 @@ AAUDIO_API aaudio_result_t AAudioStream_getTimestamp(AAudioStream* stream,
/**
* Return the use case for the stream.
*
* Added in API level 28.
* Available since API level 28.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return frames read
@ -1326,7 +1413,7 @@ AAUDIO_API aaudio_usage_t AAudioStream_getUsage(AAudioStream* stream) __INTRODUC
/**
* Return the content type for the stream.
*
* Added in API level 28.
* Available since API level 28.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return content type, for example {@link #AAUDIO_CONTENT_TYPE_MUSIC}
@ -1337,7 +1424,7 @@ AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* strea
/**
* Return the input preset for the stream.
*
* Added in API level 28.
* Available since API level 28.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return input preset, for example {@link #AAUDIO_INPUT_PRESET_CAMCORDER}
@ -1349,7 +1436,7 @@ AAUDIO_API aaudio_input_preset_t AAudioStream_getInputPreset(AAudioStream* strea
* Return the policy that determines whether the audio may or may not be captured
* by other apps or the system.
*
* Added in API level 29.
* Available since API level 29.
*
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return the allowed capture policy, for example {@link #AAUDIO_ALLOW_CAPTURE_BY_ALL}

@ -570,6 +570,8 @@ typedef struct AImageCropRect {
* return {@link AMEDIA_ERROR_INVALID_OBJECT}. Application still needs to call this method on those
* {@link AImage} objects to fully delete the {@link AImage} object from memory.</p>
*
* Available since API level 24.
*
* @param image The {@link AImage} to be deleted.
*/
void AImage_delete(AImage* image) __INTRODUCED_IN(24);
@ -577,6 +579,8 @@ void AImage_delete(AImage* image) __INTRODUCED_IN(24);
/**
* Query the width of the input {@link AImage}.
*
* Available since API level 24.
*
* @param image the {@link AImage} of interest.
* @param width the width of the image will be filled here if the method call succeeeds.
*
@ -591,6 +595,8 @@ media_status_t AImage_getWidth(const AImage* image, /*out*/int32_t* width) __INT
/**
* Query the height of the input {@link AImage}.
*
* Available since API level 24.
*
* @param image the {@link AImage} of interest.
* @param height the height of the image will be filled here if the method call succeeeds.
*
@ -607,6 +613,8 @@ media_status_t AImage_getHeight(const AImage* image, /*out*/int32_t* height) __I
*
* <p>The format value will be one of AIMAGE_FORMAT_* enum value.</p>
*
* Available since API level 24.
*
* @param image the {@link AImage} of interest.
* @param format the format of the image will be filled here if the method call succeeeds.
*
@ -624,6 +632,8 @@ media_status_t AImage_getFormat(const AImage* image, /*out*/int32_t* format) __I
* <p>The crop rectangle specifies the region of valid pixels in the image, using coordinates in the
* largest-resolution plane.</p>
*
* Available since API level 24.
*
* @param image the {@link AImage} of interest.
* @param rect the cropped rectangle of the image will be filled here if the method call succeeeds.
*
@ -648,6 +658,8 @@ media_status_t AImage_getCropRect(const AImage* image, /*out*/AImageCropRect* re
* {@link ACameraCaptureSession_captureCallbacks#onCaptureCompleted} callback.
* </p>
*
* Available since API level 24.
*
* @param image the {@link AImage} of interest.
* @param timestampNs the timestamp of the image will be filled here if the method call succeeeds.
*
@ -665,6 +677,8 @@ media_status_t AImage_getTimestamp(const AImage* image, /*out*/int64_t* timestam
* <p>The number of plane of an {@link AImage} is determined by its format, which can be queried by
* {@link AImage_getFormat} method.</p>
*
* Available since API level 24.
*
* @param image the {@link AImage} of interest.
* @param numPlanes the number of planes of the image will be filled here if the method call
* succeeeds.
@ -687,6 +701,8 @@ media_status_t AImage_getNumberOfPlanes(const AImage* image, /*out*/int32_t* num
* being returned.
* For formats where pixel stride is well defined, the pixel stride is always greater than 0.</p>
*
* Available since API level 24.
*
* @param image the {@link AImage} of interest.
* @param planeIdx the index of the plane. Must be less than the number of planes of input image.
* @param pixelStride the pixel stride of the image will be filled here if the method call succeeeds.
@ -714,6 +730,8 @@ media_status_t AImage_getPlanePixelStride(
* being returned.
* For formats where row stride is well defined, the row stride is always greater than 0.</p>
*
* Available since API level 24.
*
* @param image the {@link AImage} of interest.
* @param planeIdx the index of the plane. Must be less than the number of planes of input image.
* @param rowStride the row stride of the image will be filled here if the method call succeeeds.
@ -739,6 +757,8 @@ media_status_t AImage_getPlaneRowStride(
* pointer from previous AImage_getPlaneData call becomes invalid. Do NOT use it after the
* {@link AImage} or the parent {@link AImageReader} is deleted.</p>
*
* Available since API level 24.
*
* @param image the {@link AImage} of interest.
* @param planeIdx the index of the plane. Must be less than the number of planes of input image.
* @param data the data pointer of the image will be filled here if the method call succeeeds.
@ -769,6 +789,8 @@ media_status_t AImage_getPlaneData(
* signal the release of the hardware buffer back to the {@link AImageReader}'s queue using
* releaseFenceFd.</p>
*
* Available since API level 26.
*
* @param image The {@link AImage} to be deleted.
* @param releaseFenceFd A sync fence fd defined in {@link sync.h}, which signals the release of
* underlying {@link AHardwareBuffer}.
@ -794,6 +816,8 @@ void AImage_deleteAsync(AImage* image, int releaseFenceFd) __INTRODUCED_IN(26);
* {@link AImageReader_setBufferRemovedListener} to be notified when the buffer is no longer used
* by {@link AImageReader}.</p>
*
* Available since API level 26.
*
* @param image the {@link AImage} of interest.
* @param outBuffer The memory area pointed to by buffer will contain the acquired AHardwareBuffer
* handle.

@ -67,6 +67,8 @@ typedef struct AImageReader AImageReader;
* The valid sizes and formats depend on the source of the image data.
* </p>
*
* Available since API level 24.
*
* @param width The default width in pixels of the Images that this reader will produce.
* @param height The default height in pixels of the Images that this reader will produce.
* @param format The format of the Image that this reader will produce. This must be one of the
@ -101,6 +103,8 @@ media_status_t AImageReader_new(
* making any of data pointers obtained from {@link AImage_getPlaneData} invalid. Do NOT access
* the reader object or any of those data pointers after this method returns.</p>
*
* Available since API level 24.
*
* @param reader The image reader to be deleted.
*/
void AImageReader_delete(AImageReader* reader) __INTRODUCED_IN(24);
@ -108,6 +112,8 @@ void AImageReader_delete(AImageReader* reader) __INTRODUCED_IN(24);
/**
* Get a {@link ANativeWindow} that can be used to produce {@link AImage} for this image reader.
*
* Available since API level 24.
*
* @param reader The image reader of interest.
* @param window The output {@link ANativeWindow} will be filled here if the method call succeeds.
* The {@link ANativeWindow} is managed by this image reader. Do NOT call
@ -126,6 +132,8 @@ media_status_t AImageReader_getWindow(AImageReader* reader, /*out*/ANativeWindow
* {@link ANativeWindow}. If so, the actual width of the images can be found using
* {@link AImage_getWidth}.</p>
*
* Available since API level 24.
*
* @param reader The image reader of interest.
* @param width the default width of the reader will be filled here if the method call succeeeds.
*
@ -142,6 +150,8 @@ media_status_t AImageReader_getWidth(const AImageReader* reader, /*out*/int32_t*
* {@link ANativeWindow}. If so, the actual height of the images can be found using
* {@link AImage_getHeight}.</p>
*
* Available since API level 24.
*
* @param reader The image reader of interest.
* @param height the default height of the reader will be filled here if the method call succeeeds.
*
@ -154,6 +164,8 @@ media_status_t AImageReader_getHeight(const AImageReader* reader, /*out*/int32_t
/**
* Query the format of the {@link AImage} generated by this reader.
*
* Available since API level 24.
*
* @param reader The image reader of interest.
* @param format the fromat of the reader will be filled here if the method call succeeeds. The
* value will be one of the AIMAGE_FORMAT_* enum value defiend in {@link NdkImage.h}.
@ -167,6 +179,8 @@ media_status_t AImageReader_getFormat(const AImageReader* reader, /*out*/int32_t
/**
* Query the maximum number of concurrently acquired {@link AImage}s of this reader.
*
* Available since API level 24.
*
* @param reader The image reader of interest.
* @param maxImages the maximum number of concurrently acquired images of the reader will be filled
* here if the method call succeeeds.
@ -197,6 +211,8 @@ media_status_t AImageReader_getMaxImages(const AImageReader* reader, /*out*/int3
* {@link AImage_delete}.
* </p>
*
* Available since API level 24.
*
* @param reader The image reader of interest.
* @param image the acquired {@link AImage} will be filled here if the method call succeeeds.
*
@ -214,7 +230,6 @@ media_status_t AImageReader_getMaxImages(const AImageReader* reader, /*out*/int3
media_status_t AImageReader_acquireNextImage(AImageReader* reader, /*out*/AImage** image) __INTRODUCED_IN(24);
/**
* Acquire the latest {@link AImage} from the image reader's queue, dropping older images.
*
* <p>
@ -241,6 +256,8 @@ media_status_t AImageReader_acquireNextImage(AImageReader* reader, /*out*/AImage
* {@link AImage_delete}.
* </p>
*
* Available since API level 24.
*
* @param reader The image reader of interest.
* @param image the acquired {@link AImage} will be filled here if the method call succeeeds.
*
@ -290,6 +307,8 @@ typedef struct AImageReader_ImageListener {
*
* Calling this method will replace previously registered listeners.
*
* Available since API level 24.
*
* @param reader The image reader of interest.
* @param listener The {@link AImageReader_ImageListener} to be registered. Set this to NULL if
* the application no longer needs to listen to new images.
@ -356,6 +375,9 @@ media_status_t AImageReader_setImageListener(
* {@link AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE}, or combined</td>
* </tr>
* </table>
*
* Available since API level 26.
*
* @return <ul>
* <li>{@link AMEDIA_OK} if the method call succeeds.</li>
* <li>{@link AMEDIA_ERROR_INVALID_PARAMETER} if reader is NULL, or one or more of width,
@ -377,6 +399,8 @@ media_status_t AImageReader_newWithUsage(
* additional parameter for the sync fence. All other parameters and the return values are
* identical to those passed to {@link AImageReader_acquireNextImage}.</p>
*
* Available since API level 26.
*
* @param acquireFenceFd A sync fence fd defined in {@link sync.h}, which is used to signal when the
* buffer is ready to consume. When synchronization fence is not needed, fence will be set
* to -1 and the {@link AImage} returned is ready for use immediately. Otherwise, user shall
@ -397,6 +421,8 @@ media_status_t AImageReader_acquireNextImageAsync(
* additional parameter for the sync fence. All other parameters and the return values are
* identical to those passed to {@link AImageReader_acquireLatestImage}.</p>
*
* Available since API level 26.
*
* @param acquireFenceFd A sync fence fd defined in {@link sync.h}, which is used to signal when the
* buffer is ready to consume. When synchronization fence is not needed, fence will be set
* to -1 and the {@link AImage} returned is ready for use immediately. Otherwise, user shall
@ -408,6 +434,7 @@ media_status_t AImageReader_acquireNextImageAsync(
*/
media_status_t AImageReader_acquireLatestImageAsync(
AImageReader* reader, /*out*/AImage** image, /*out*/int* acquireFenceFd) __INTRODUCED_IN(26);
/**
* Signature of the callback which is called when {@link AImageReader} is about to remove a buffer.
*
@ -451,6 +478,8 @@ typedef struct AImageReader_BufferRemovedListener {
*
* <p>Note that calling this method will replace previously registered listeners.</p>
*
* Available since API level 26.
*
* @param reader The image reader of interest.
* @param listener the {@link AImageReader_BufferRemovedListener} to be registered. Set this to
* NULL if application no longer needs to listen to buffer removed events.

@ -127,27 +127,37 @@ struct AMediaCodecOnAsyncNotifyCallback {
* Create codec by name. Use this if you know the exact codec you want to use.
* When configuring, you will need to specify whether to use the codec as an
* encoder or decoder.
*
* Available since API level 21.
*/
AMediaCodec* AMediaCodec_createCodecByName(const char *name) __INTRODUCED_IN(21);
/**
* Create codec by mime type. Most applications will use this, specifying a
* mime type obtained from media extractor.
*
* Available since API level 21.
*/
AMediaCodec* AMediaCodec_createDecoderByType(const char *mime_type) __INTRODUCED_IN(21);
/**
* Create encoder by name.
*
* Available since API level 21.
*/
AMediaCodec* AMediaCodec_createEncoderByType(const char *mime_type) __INTRODUCED_IN(21);
/**
* delete the codec and free its resources
* Delete the codec and free its resources.
*
* Available since API level 21.
*/
media_status_t AMediaCodec_delete(AMediaCodec*) __INTRODUCED_IN(21);
/**
* Configure the codec. For decoding you would typically get the format from an extractor.
*
* Available since API level 21.
*/
media_status_t AMediaCodec_configure(
AMediaCodec*,
@ -159,29 +169,39 @@ media_status_t AMediaCodec_configure(
/**
* Start the codec. A codec must be configured before it can be started, and must be started
* before buffers can be sent to it.
*
* Available since API level 21.
*/
media_status_t AMediaCodec_start(AMediaCodec*) __INTRODUCED_IN(21);
/**
* Stop the codec.
*
* Available since API level 21.
*/
media_status_t AMediaCodec_stop(AMediaCodec*) __INTRODUCED_IN(21);
/*
* Flush the codec's input and output. All indices previously returned from calls to
* AMediaCodec_dequeueInputBuffer and AMediaCodec_dequeueOutputBuffer become invalid.
*
* Available since API level 21.
*/
media_status_t AMediaCodec_flush(AMediaCodec*) __INTRODUCED_IN(21);
/**
* Get an input buffer. The specified buffer index must have been previously obtained from
* dequeueInputBuffer, and not yet queued.
*
* Available since API level 21.
*/
uint8_t* AMediaCodec_getInputBuffer(AMediaCodec*, size_t idx, size_t *out_size) __INTRODUCED_IN(21);
/**
* Get an output buffer. The specified buffer index must have been previously obtained from
* dequeueOutputBuffer, and not yet queued.
*
* Available since API level 21.
*/
uint8_t* AMediaCodec_getOutputBuffer(AMediaCodec*, size_t idx, size_t *out_size) __INTRODUCED_IN(21);
@ -189,6 +209,8 @@ uint8_t* AMediaCodec_getOutputBuffer(AMediaCodec*, size_t idx, size_t *out_size)
* Get the index of the next available input buffer. An app will typically use this with
* getInputBuffer() to get a pointer to the buffer, then copy the data to be encoded or decoded
* into the buffer before passing it to the codec.
*
* Available since API level 21.
*/
ssize_t AMediaCodec_dequeueInputBuffer(AMediaCodec*, int64_t timeoutUs) __INTRODUCED_IN(21);
@ -218,6 +240,8 @@ static_assert(sizeof(_off_t_compat) == sizeof(long),
/**
* Send the specified buffer to the codec for processing.
*
* Available since API level 21.
*/
media_status_t AMediaCodec_queueInputBuffer(AMediaCodec*, size_t idx,
_off_t_compat offset, size_t size,
@ -225,6 +249,8 @@ media_status_t AMediaCodec_queueInputBuffer(AMediaCodec*, size_t idx,
/**
* Send the specified buffer to the codec for processing.
*
* Available since API level 21.
*/
media_status_t AMediaCodec_queueSecureInputBuffer(AMediaCodec*, size_t idx,
_off_t_compat offset,
@ -235,15 +261,23 @@ media_status_t AMediaCodec_queueSecureInputBuffer(AMediaCodec*, size_t idx,
/**
* Get the index of the next available buffer of processed data.
*
* Available since API level 21.
*/
ssize_t AMediaCodec_dequeueOutputBuffer(AMediaCodec*, AMediaCodecBufferInfo *info,
int64_t timeoutUs) __INTRODUCED_IN(21);
/**
* Available since API level 21.
*/
AMediaFormat* AMediaCodec_getOutputFormat(AMediaCodec*) __INTRODUCED_IN(21);
/**
* If you are done with a buffer, use this call to return the buffer to
* the codec. If you previously specified a surface when configuring this
* video decoder you can optionally render the buffer.
*
* Available since API level 21.
*/
media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool render) __INTRODUCED_IN(21);
@ -256,6 +290,8 @@ media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool re
* to ImageReader (software readable) output.
*
* For more details, see the Java documentation for MediaCodec.setOutputSurface.
*
* Available since API level 21.
*/
media_status_t AMediaCodec_setOutputSurface(AMediaCodec*, ANativeWindow* surface) __INTRODUCED_IN(21);
@ -266,6 +302,8 @@ media_status_t AMediaCodec_setOutputSurface(AMediaCodec*, ANativeWindow* surface
* this call will simply return the buffer to the codec.
*
* For more details, see the Java documentation for MediaCodec.releaseOutputBuffer.
*
* Available since API level 21.
*/
media_status_t AMediaCodec_releaseOutputBufferAtTime(
AMediaCodec *mData, size_t idx, int64_t timestampNs) __INTRODUCED_IN(21);
@ -282,6 +320,8 @@ media_status_t AMediaCodec_releaseOutputBufferAtTime(
* ANativeWindow_release() when done.
*
* For more details, see the Java documentation for MediaCodec.createInputSurface.
*
* Available since API level 26.
*/
media_status_t AMediaCodec_createInputSurface(
AMediaCodec *mData, ANativeWindow **surface) __INTRODUCED_IN(26);
@ -298,6 +338,8 @@ media_status_t AMediaCodec_createInputSurface(
* ANativeWindow_release() when done.
*
* For more details, see the Java documentation for MediaCodec.createPersistentInputSurface.
*
* Available since API level 26.
*/
media_status_t AMediaCodec_createPersistentInputSurface(
ANativeWindow **surface) __INTRODUCED_IN(26);
@ -311,6 +353,8 @@ media_status_t AMediaCodec_createPersistentInputSurface(
* AMediaCodec_configure(..); and before AMediaCodec_start() has been called.
*
* For more details, see the Java documentation for MediaCodec.setInputSurface.
*
* Available since API level 26.
*/
media_status_t AMediaCodec_setInputSurface(
AMediaCodec *mData, ANativeWindow *surface) __INTRODUCED_IN(26);
@ -322,6 +366,8 @@ media_status_t AMediaCodec_setInputSurface(
* after AMediaCodec_start() has been called.
*
* NOTE: Some of these parameter changes may silently fail to apply.
*
* Available since API level 26.
*/
media_status_t AMediaCodec_setParameters(
AMediaCodec *mData, const AMediaFormat* params) __INTRODUCED_IN(26);
@ -339,6 +385,8 @@ media_status_t AMediaCodec_setParameters(
* Returns AMEDIA_OK when completed succesfully.
*
* For more details, see the Java documentation for MediaCodec.signalEndOfInputStream.
*
* Available since API level 26.
*/
media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData) __INTRODUCED_IN(26);
@ -349,6 +397,8 @@ media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData) __INTRODUC
/**
* Get format of the buffer. The specified buffer index must have been previously obtained from
* dequeueOutputBuffer.
*
* Available since API level 28.
*/
AMediaFormat* AMediaCodec_getBufferFormat(AMediaCodec*, size_t index) __INTRODUCED_IN(28);
@ -356,11 +406,15 @@ AMediaFormat* AMediaCodec_getBufferFormat(AMediaCodec*, size_t index) __INTRODUC
* Get the component name. If the codec was created by createDecoderByType
* or createEncoderByType, what component is chosen is not known beforehand.
* Caller shall call AMediaCodec_releaseName to free the returned pointer.
*
* Available since API level 28.
*/
media_status_t AMediaCodec_getName(AMediaCodec*, char** out_name) __INTRODUCED_IN(28);
/**
* Free the memory pointed by name which is returned by AMediaCodec_getName.
*
* Available since API level 28.
*/
void AMediaCodec_releaseName(AMediaCodec*, char* name) __INTRODUCED_IN(28);
@ -382,6 +436,8 @@ void AMediaCodec_releaseName(AMediaCodec*, char* name) __INTRODUCED_IN(28);
* All callbacks are fired on one NDK internal thread.
* AMediaCodec_setAsyncNotifyCallback should not be called on the callback thread.
* No heavy duty task should be performed on callback thread.
*
* Available since API level 28.
*/
media_status_t AMediaCodec_setAsyncNotifyCallback(
AMediaCodec*,
@ -390,6 +446,8 @@ media_status_t AMediaCodec_setAsyncNotifyCallback(
/**
* Release the crypto if applicable.
*
* Available since API level 28.
*/
media_status_t AMediaCodec_releaseCrypto(AMediaCodec*) __INTRODUCED_IN(28);
@ -397,12 +455,16 @@ media_status_t AMediaCodec_releaseCrypto(AMediaCodec*) __INTRODUCED_IN(28);
* Call this after AMediaCodec_configure() returns successfully to get the input
* format accepted by the codec. Do this to determine what optional configuration
* parameters were supported by the codec.
*
* Available since API level 28.
*/
AMediaFormat* AMediaCodec_getInputFormat(AMediaCodec*) __INTRODUCED_IN(28);
/**
* Returns true if the codec cannot proceed further, but can be recovered by stopping,
* configuring, and starting again.
*
* Available since API level 28.
*/
bool AMediaCodecActionCode_isRecoverable(int32_t actionCode) __INTRODUCED_IN(28);
@ -410,6 +472,8 @@ bool AMediaCodecActionCode_isRecoverable(int32_t actionCode) __INTRODUCED_IN(28)
* Returns true if the codec error is a transient issue, perhaps due to
* resource constraints, and that the method (or encoding/decoding) may be
* retried at a later time.
*
* Available since API level 28.
*/
bool AMediaCodecActionCode_isTransient(int32_t actionCode) __INTRODUCED_IN(28);
@ -440,6 +504,8 @@ typedef struct {
* numBytesOfClearData can be null to indicate that all data is encrypted.
* This information encapsulates per-sample metadata as outlined in
* ISO/IEC FDIS 23001-7:2011 "Common encryption in ISO base media file format files".
*
* Available since API level 21.
*/
AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new(
int numsubsamples,
@ -450,13 +516,17 @@ AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new(
size_t *encryptedbytes) __INTRODUCED_IN(21);
/**
* delete an AMediaCodecCryptoInfo created previously with AMediaCodecCryptoInfo_new, or
* obtained from AMediaExtractor
* Delete an AMediaCodecCryptoInfo created previously with AMediaCodecCryptoInfo_new, or
* obtained from AMediaExtractor.
*
* Available since API level 21.
*/
media_status_t AMediaCodecCryptoInfo_delete(AMediaCodecCryptoInfo*) __INTRODUCED_IN(21);
/**
* Set the crypto pattern on an AMediaCryptoInfo object
* Set the crypto pattern on an AMediaCryptoInfo object.
*
* Available since API level 21.
*/
void AMediaCodecCryptoInfo_setPattern(
AMediaCodecCryptoInfo *info,
@ -464,32 +534,44 @@ void AMediaCodecCryptoInfo_setPattern(
/**
* The number of subsamples that make up the buffer's contents.
*
* Available since API level 21.
*/
size_t AMediaCodecCryptoInfo_getNumSubSamples(AMediaCodecCryptoInfo*) __INTRODUCED_IN(21);
/**
* A 16-byte opaque key
* A 16-byte opaque key.
*
* Available since API level 21.
*/
media_status_t AMediaCodecCryptoInfo_getKey(AMediaCodecCryptoInfo*, uint8_t *dst) __INTRODUCED_IN(21);
/**
* A 16-byte initialization vector
* A 16-byte initialization vector.
*
* Available since API level 21.
*/
media_status_t AMediaCodecCryptoInfo_getIV(AMediaCodecCryptoInfo*, uint8_t *dst) __INTRODUCED_IN(21);
/**
* The type of encryption that has been applied,
* one of AMEDIACODECRYPTOINFO_MODE_CLEAR or AMEDIACODECRYPTOINFO_MODE_AES_CTR.
*
* Available since API level 21.
*/
cryptoinfo_mode_t AMediaCodecCryptoInfo_getMode(AMediaCodecCryptoInfo*) __INTRODUCED_IN(21);
/**
* The number of leading unencrypted bytes in each subsample.
*
* Available since API level 21.
*/
media_status_t AMediaCodecCryptoInfo_getClearBytes(AMediaCodecCryptoInfo*, size_t *dst) __INTRODUCED_IN(21);
/**
* The number of trailing encrypted bytes in each subsample.
*
* Available since API level 21.
*/
media_status_t AMediaCodecCryptoInfo_getEncryptedBytes(AMediaCodecCryptoInfo*, size_t *dst) __INTRODUCED_IN(21);

@ -49,12 +49,24 @@ typedef uint8_t AMediaUUID[16];
#if __ANDROID_API__ >= 21
/**
* Available since API level 21.
*/
bool AMediaCrypto_isCryptoSchemeSupported(const AMediaUUID uuid) __INTRODUCED_IN(21);
/**
* Available since API level 21.
*/
bool AMediaCrypto_requiresSecureDecoderComponent(const char *mime) __INTRODUCED_IN(21);
/**
* Available since API level 21.
*/
AMediaCrypto* AMediaCrypto_new(const AMediaUUID uuid, const void *initData, size_t initDataSize) __INTRODUCED_IN(21);
/**
* Available since API level 21.
*/
void AMediaCrypto_delete(AMediaCrypto* crypto) __INTRODUCED_IN(21);
#endif /* __ANDROID_API__ >= 21 */

@ -88,6 +88,8 @@ typedef void (*AMediaDataSourceClose)(void *userdata);
/**
* Create new media data source. Returns NULL if memory allocation
* for the new data source object fails.
*
* Available since API level 28.
*/
AMediaDataSource* AMediaDataSource_new() __INTRODUCED_IN(28);
@ -116,6 +118,7 @@ typedef ssize_t (*AMediaDataSourceGetAvailableSize)(void *userdata, off64_t offs
* ...
* key_values[(numheaders - 1) * 2]:key_values[(numheaders - 1) * 2 + 1]
*
* Available since API level 29.
*/
AMediaDataSource* AMediaDataSource_newUri(const char *uri,
int numheaders,
@ -125,12 +128,16 @@ AMediaDataSource* AMediaDataSource_newUri(const char *uri,
/**
* Delete a previously created media data source.
*
* Available since API level 28.
*/
void AMediaDataSource_delete(AMediaDataSource*) __INTRODUCED_IN(28);
/**
* Set an user provided opaque handle. This opaque handle is passed as
* the first argument to the data source callbacks.
*
* Available since API level 28.
*/
void AMediaDataSource_setUserdata(
AMediaDataSource*, void *userdata) __INTRODUCED_IN(28);
@ -145,6 +152,8 @@ void AMediaDataSource_setUserdata(
*
* Please refer to the definition of AMediaDataSourceReadAt for
* additional details.
*
* Available since API level 28.
*/
void AMediaDataSource_setReadAt(
AMediaDataSource*,
@ -156,6 +165,8 @@ void AMediaDataSource_setReadAt(
*
* Please refer to the definition of AMediaDataSourceGetSize for
* additional details.
*
* Available since API level 28.
*/
void AMediaDataSource_setGetSize(
AMediaDataSource*,
@ -167,6 +178,8 @@ void AMediaDataSource_setGetSize(
*
* Please refer to the definition of AMediaDataSourceClose for
* additional details.
*
* Available since API level 28.
*/
void AMediaDataSource_setClose(
AMediaDataSource*,
@ -181,6 +194,8 @@ void AMediaDataSource_setClose(
*
* Please refer to the definition of AMediaDataSourceClose for
* additional details.
*
* Available since API level 29.
*/
void AMediaDataSource_close(AMediaDataSource*) __INTRODUCED_IN(29);
@ -191,6 +206,8 @@ void AMediaDataSource_close(AMediaDataSource*) __INTRODUCED_IN(29);
*
* Please refer to the definition of AMediaDataSourceGetAvailableSize
* for additional details.
*
* Available since API level 29.
*/
void AMediaDataSource_setGetAvailableSize(
AMediaDataSource*,

@ -174,41 +174,53 @@ typedef void (*AMediaDrmKeysChangeListener)(AMediaDrm *,
* uuid identifies the universal unique ID of the crypto scheme. uuid must be 16 bytes.
* mimeType is the MIME type of the media container, e.g. "video/mp4". If mimeType
* is not known or required, it can be provided as NULL.
*
* Available since API level 21.
*/
bool AMediaDrm_isCryptoSchemeSupported(const uint8_t *uuid,
const char *mimeType) __INTRODUCED_IN(21);
/**
* Create a MediaDrm instance from a UUID
* Create a MediaDrm instance from a UUID.
* uuid identifies the universal unique ID of the crypto scheme. uuid must be 16 bytes.
*
* Available since API level 21.
*/
AMediaDrm* AMediaDrm_createByUUID(const uint8_t *uuid) __INTRODUCED_IN(21);
/**
* Release a MediaDrm object
* Release a MediaDrm object.
*
* Available since API level 21.
*/
void AMediaDrm_release(AMediaDrm *) __INTRODUCED_IN(21);
/**
* Register a callback to be invoked when an event occurs
* Register a callback to be invoked when an event occurs.
*
* listener is the callback that will be invoked on event.
*
* listener is the callback that will be invoked on event
* Available since API level 21.
*/
media_status_t AMediaDrm_setOnEventListener(AMediaDrm *,
AMediaDrmEventListener listener) __INTRODUCED_IN(21);
/**
* Register a callback to be invoked when an expiration update event occurs
* Register a callback to be invoked when an expiration update event occurs.
*
* listener is the callback that will be invoked on event
* listener is the callback that will be invoked on event.
*
* Available since API level 29.
*/
media_status_t AMediaDrm_setOnExpirationUpdateListener(AMediaDrm *,
AMediaDrmExpirationUpdateListener listener) __INTRODUCED_IN(29);
/**
* Register a callback to be invoked when a key status change event occurs
* Register a callback to be invoked when a key status change event occurs.
*
* listener is the callback that will be invoked on event.
*
* listener is the callback that will be invoked on event
* Available since API level 29.
*/
media_status_t AMediaDrm_setOnKeysChangeListener(AMediaDrm *,
AMediaDrmKeysChangeListener listener) __INTRODUCED_IN(29);
@ -216,8 +228,10 @@ media_status_t AMediaDrm_setOnKeysChangeListener(AMediaDrm *,
/**
* Open a new session with the MediaDrm object. A session ID is returned.
*
* returns MEDIADRM_NOT_PROVISIONED_ERROR if provisioning is needed
* returns MEDIADRM_RESOURCE_BUSY_ERROR if required resources are in use
* Returns MEDIADRM_NOT_PROVISIONED_ERROR if provisioning is needed.
* Returns MEDIADRM_RESOURCE_BUSY_ERROR if required resources are in use.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_openSession(AMediaDrm *,
AMediaDrmSessionId *sessionId) __INTRODUCED_IN(21);
@ -225,6 +239,8 @@ media_status_t AMediaDrm_openSession(AMediaDrm *,
/**
* Close a session on the MediaDrm object that was previously opened
* with AMediaDrm_openSession.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_closeSession(AMediaDrm *,
const AMediaDrmSessionId *sessionId) __INTRODUCED_IN(21);
@ -272,9 +288,11 @@ media_status_t AMediaDrm_closeSession(AMediaDrm *,
* MediaDrm object is released.
* 2. keyRequestSize will be set to the size of the request
*
* returns MEDIADRM_NOT_PROVISIONED_ERROR if reprovisioning is needed, due to a
* Returns MEDIADRM_NOT_PROVISIONED_ERROR if reprovisioning is needed, due to a
* problem with the device certificate.
*/
*
* Available since API level 21.
*/
media_status_t AMediaDrm_getKeyRequest(AMediaDrm *, const AMediaDrmScope *scope,
const uint8_t *init, size_t initSize, const char *mimeType, AMediaDrmKeyType keyType,
const AMediaDrmKeyValue *optionalParameters, size_t numOptionalParameters,
@ -295,8 +313,9 @@ media_status_t AMediaDrm_getKeyRequest(AMediaDrm *, const AMediaDrmScope *scope,
*
* response points to the opaque response from the server
* responseSize should be set to the size of the response in bytes
*
* Available since API level 21.
*/
media_status_t AMediaDrm_provideKeyResponse(AMediaDrm *, const AMediaDrmScope *scope,
const uint8_t *response, size_t responseSize,
AMediaDrmKeySetId *keySetId) __INTRODUCED_IN(21);
@ -305,8 +324,10 @@ media_status_t AMediaDrm_provideKeyResponse(AMediaDrm *, const AMediaDrmScope *s
* Restore persisted offline keys into a new session. keySetId identifies the
* keys to load, obtained from a prior call to AMediaDrm_provideKeyResponse.
*
* sessionId is the session ID for the DRM session
* keySetId identifies the saved key set to restore
* sessionId is the session ID for the DRM session.
* keySetId identifies the saved key set to restore.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_restoreKeys(AMediaDrm *, const AMediaDrmSessionId *sessionId,
const AMediaDrmKeySetId *keySetId) __INTRODUCED_IN(21);
@ -314,7 +335,9 @@ media_status_t AMediaDrm_restoreKeys(AMediaDrm *, const AMediaDrmSessionId *sess
/**
* Remove the current keys from a session.
*
* keySetId identifies keys to remove
* keySetId identifies keys to remove.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_removeKeys(AMediaDrm *,
const AMediaDrmSessionId *keySetId) __INTRODUCED_IN(21);
@ -331,6 +354,8 @@ media_status_t AMediaDrm_removeKeys(AMediaDrm *,
* to the number of entries written to the array. If the number of {key, value} pairs
* to be returned is greater than *numPairs, MEDIADRM_SHORT_BUFFER will be returned
* and numPairs will be set to the number of pairs available.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_queryKeyStatus(AMediaDrm *, const AMediaDrmSessionId *sessionId,
AMediaDrmKeyValue *keyValuePairs, size_t *numPairs) __INTRODUCED_IN(21);
@ -350,6 +375,8 @@ media_status_t AMediaDrm_queryKeyStatus(AMediaDrm *, const AMediaDrmSessionId *s
* 3. serverUrl will reference a NULL terminated string containing the URL
* the provisioning request should be sent to. It will remain accessible until
* the next call to getProvisionRequest.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_getProvisionRequest(AMediaDrm *, const uint8_t **provisionRequest,
size_t *provisionRequestSize, const char **serverUrl) __INTRODUCED_IN(21);
@ -363,8 +390,10 @@ media_status_t AMediaDrm_getProvisionRequest(AMediaDrm *, const uint8_t **provis
* DRM engine plugin.
* responseSize is the length of the provisioning response in bytes.
*
* returns MEDIADRM_DEVICE_REVOKED_ERROR if the response indicates that the
* Returns MEDIADRM_DEVICE_REVOKED_ERROR if the response indicates that the
* server rejected the request
*
* Available since API level 21.
*/
media_status_t AMediaDrm_provideProvisionResponse(AMediaDrm *,
const uint8_t *response, size_t responseSize) __INTRODUCED_IN(21);
@ -390,6 +419,8 @@ media_status_t AMediaDrm_provideProvisionResponse(AMediaDrm *,
* If *numSecureStops is too small for the number of secure stops available,
* MEDIADRM_SHORT_BUFFER will be returned and *numSecureStops will be set to the
* number required.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_getSecureStops(AMediaDrm *,
AMediaDrmSecureStop *secureStops, size_t *numSecureStops) __INTRODUCED_IN(21);
@ -399,6 +430,8 @@ media_status_t AMediaDrm_getSecureStops(AMediaDrm *,
* the message, remove the SecureStops identified in the response.
*
* ssRelease is the server response indicating which secure stops to release
*
* Available since API level 21.
*/
media_status_t AMediaDrm_releaseSecureStops(AMediaDrm *,
const AMediaDrmSecureStop *ssRelease) __INTRODUCED_IN(21);
@ -432,6 +465,8 @@ media_status_t AMediaDrm_releaseSecureStops(AMediaDrm *,
* On return, propertyValue will be set to point to the property value. The
* memory that the value resides in is owned by the NDK MediaDrm API and
* will remain valid until the next call to AMediaDrm_getPropertyString.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_getPropertyString(AMediaDrm *, const char *propertyName,
const char **propertyValue) __INTRODUCED_IN(21);
@ -447,18 +482,24 @@ media_status_t AMediaDrm_getPropertyString(AMediaDrm *, const char *propertyName
* On return, *propertyValue will be set to point to the property value. The
* memory that the value resides in is owned by the NDK MediaDrm API and
* will remain valid until the next call to AMediaDrm_getPropertyByteArray.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_getPropertyByteArray(AMediaDrm *, const char *propertyName,
AMediaDrmByteArray *propertyValue) __INTRODUCED_IN(21);
/**
* Set a DRM engine plugin String property value.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_setPropertyString(AMediaDrm *, const char *propertyName,
const char *value) __INTRODUCED_IN(21);
/**
* Set a DRM engine plugin byte array property value.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_setPropertyByteArray(AMediaDrm *, const char *propertyName,
const uint8_t *value, size_t valueSize) __INTRODUCED_IN(21);
@ -487,6 +528,8 @@ media_status_t AMediaDrm_setPropertyByteArray(AMediaDrm *, const char *propertyN
* ensure that the output buffer is large enough to accept dataSize bytes. The key
* to use is identified by the 16 byte keyId. The key must have been loaded into
* the session using provideKeyResponse.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_encrypt(AMediaDrm *, const AMediaDrmSessionId *sessionId,
const char *cipherAlgorithm, uint8_t *keyId, uint8_t *iv,
@ -498,6 +541,8 @@ media_status_t AMediaDrm_encrypt(AMediaDrm *, const AMediaDrmSessionId *sessionI
* ensure that the output buffer is large enough to accept dataSize bytes. The key
* to use is identified by the 16 byte keyId. The key must have been loaded into
* the session using provideKeyResponse.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_decrypt(AMediaDrm *, const AMediaDrmSessionId *sessionId,
const char *cipherAlgorithm, uint8_t *keyId, uint8_t *iv,
@ -511,6 +556,8 @@ media_status_t AMediaDrm_decrypt(AMediaDrm *, const AMediaDrmSessionId *sessionI
* *signatureSize is set to the buffer size required. The key to use is identified
* by the 16 byte keyId. The key must have been loaded into the session using
* provideKeyResponse.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_sign(AMediaDrm *, const AMediaDrmSessionId *sessionId,
const char *macAlgorithm, uint8_t *keyId, uint8_t *message, size_t messageSize,
@ -522,6 +569,8 @@ media_status_t AMediaDrm_sign(AMediaDrm *, const AMediaDrmSessionId *sessionId,
* if the signature matches, otherwise MEDAIDRM_VERIFY_FAILED is returned. The key to
* use is identified by the 16 byte keyId. The key must have been loaded into the
* session using provideKeyResponse.
*
* Available since API level 21.
*/
media_status_t AMediaDrm_verify(AMediaDrm *, const AMediaDrmSessionId *sessionId,
const char *macAlgorithm, uint8_t *keyId, const uint8_t *message, size_t messageSize,

@ -52,23 +52,31 @@ typedef struct AMediaExtractor AMediaExtractor;
#if __ANDROID_API__ >= 21
/**
* Create new media extractor
* Create new media extractor.
*
* Available since API level 21.
*/
AMediaExtractor* AMediaExtractor_new() __INTRODUCED_IN(21);
/**
* Delete a previously created media extractor
* Delete a previously created media extractor.
*
* Available since API level 21.
*/
media_status_t AMediaExtractor_delete(AMediaExtractor*) __INTRODUCED_IN(21);
/**
* Set the file descriptor from which the extractor will read.
* Set the file descriptor from which the extractor will read.
*
* Available since API level 21.
*/
media_status_t AMediaExtractor_setDataSourceFd(AMediaExtractor*, int fd, off64_t offset,
off64_t length) __INTRODUCED_IN(21);
/**
* Set the URI from which the extractor will read.
*
* Available since API level 21.
*/
media_status_t AMediaExtractor_setDataSource(AMediaExtractor*,
const char *location) __INTRODUCED_IN(21);
@ -77,6 +85,8 @@ media_status_t AMediaExtractor_setDataSource(AMediaExtractor*,
/**
* Set the custom data source implementation from which the extractor will read.
*
* Available since API level 28.
*/
media_status_t AMediaExtractor_setDataSourceCustom(AMediaExtractor*,
AMediaDataSource *src) __INTRODUCED_IN(28);
@ -85,11 +95,15 @@ media_status_t AMediaExtractor_setDataSourceCustom(AMediaExtractor*,
/**
* Return the number of tracks in the previously specified media file
*
* Available since API level 21.
*/
size_t AMediaExtractor_getTrackCount(AMediaExtractor*) __INTRODUCED_IN(21);
/**
* Return the format of the specified track. The caller must free the returned format
*
* Available since API level 21.
*/
AMediaFormat* AMediaExtractor_getTrackFormat(AMediaExtractor*, size_t idx) __INTRODUCED_IN(21);
@ -98,41 +112,55 @@ AMediaFormat* AMediaExtractor_getTrackFormat(AMediaExtractor*, size_t idx) __INT
* getSampleTime only retrieve information for the subset of tracks selected.
* Selecting the same track multiple times has no effect, the track is
* only selected once.
*
* Available since API level 21.
*/
media_status_t AMediaExtractor_selectTrack(AMediaExtractor*, size_t idx) __INTRODUCED_IN(21);
/**
* Unselect the specified track. Subsequent calls to readSampleData, getSampleTrackIndex and
* getSampleTime only retrieve information for the subset of tracks selected..
* getSampleTime only retrieve information for the subset of tracks selected.
*
* Available since API level 21.
*/
media_status_t AMediaExtractor_unselectTrack(AMediaExtractor*, size_t idx) __INTRODUCED_IN(21);
/**
* Read the current sample.
*
* Available since API level 21.
*/
ssize_t AMediaExtractor_readSampleData(AMediaExtractor*,
uint8_t *buffer, size_t capacity) __INTRODUCED_IN(21);
/**
* Read the current sample's flags.
*
* Available since API level 21.
*/
uint32_t AMediaExtractor_getSampleFlags(AMediaExtractor*) __INTRODUCED_IN(21);
/**
* Returns the track index the current sample originates from (or -1
* if no more samples are available)
*
* Available since API level 21.
*/
int AMediaExtractor_getSampleTrackIndex(AMediaExtractor*) __INTRODUCED_IN(21);
/**
* Returns the current sample's presentation time in microseconds.
* or -1 if no more samples are available.
*
* Available since API level 21.
*/
int64_t AMediaExtractor_getSampleTime(AMediaExtractor*) __INTRODUCED_IN(21);
/**
* Advance to the next sample. Returns false if no more sample data
* is available (end of stream).
*
* Available since API level 21.
*/
bool AMediaExtractor_advance(AMediaExtractor*) __INTRODUCED_IN(21);
@ -143,7 +171,7 @@ typedef enum {
} SeekMode;
/**
*
* Available since API level 21.
*/
media_status_t AMediaExtractor_seekTo(AMediaExtractor*,
int64_t seekPosUs, SeekMode mode) __INTRODUCED_IN(21);
@ -167,10 +195,14 @@ typedef struct PsshInfo {
/**
* Get the PSSH info if present.
*
* Available since API level 21.
*/
PsshInfo* AMediaExtractor_getPsshInfo(AMediaExtractor*) __INTRODUCED_IN(21);
/**
* Available since API level 21.
*/
AMediaCodecCryptoInfo *AMediaExtractor_getSampleCryptoInfo(AMediaExtractor *) __INTRODUCED_IN(21);
enum {
@ -186,6 +218,8 @@ enum {
*
* This function will always return a format; however, the format could be empty
* (no key-value pairs) if the media container does not provide format information.
*
* Available since API level 28.
*/
AMediaFormat* AMediaExtractor_getFileFormat(AMediaExtractor*) __INTRODUCED_IN(28);
@ -198,6 +232,7 @@ AMediaFormat* AMediaExtractor_getFileFormat(AMediaExtractor*) __INTRODUCED_IN(28
* uint8_t *buf = new uint8_t[sampleSize];
* AMediaExtractor_readSampleData(ex, buf, sampleSize);
*
* Available since API level 28.
*/
ssize_t AMediaExtractor_getSampleSize(AMediaExtractor*) __INTRODUCED_IN(28);
@ -211,6 +246,8 @@ ssize_t AMediaExtractor_getSampleSize(AMediaExtractor*) __INTRODUCED_IN(28);
* Returns -1 when the extractor is not reading from a network data source, or when the
* cached duration cannot be calculated (bitrate, duration, and file size information
* not available).
*
* Available since API level 28.
*/
int64_t AMediaExtractor_getCachedDuration(AMediaExtractor *) __INTRODUCED_IN(28);
@ -222,6 +259,8 @@ int64_t AMediaExtractor_getCachedDuration(AMediaExtractor *) __INTRODUCED_IN(28)
* Returns AMEDIA_OK on success or AMEDIA_ERROR_* to indicate failure reason.
* Existing key-value pairs in |fmt| would be removed if this API returns AMEDIA_OK.
* The contents of |fmt| is undefined if this API returns AMEDIA_ERROR_*.
*
* Available since API level 28.
*/
media_status_t AMediaExtractor_getSampleFormat(AMediaExtractor *ex,
AMediaFormat *fmt) __INTRODUCED_IN(28);

@ -48,40 +48,78 @@ typedef struct AMediaFormat AMediaFormat;
#if __ANDROID_API__ >= 21
/**
* Available since API level 21.
*/
AMediaFormat *AMediaFormat_new() __INTRODUCED_IN(21);
/**
* Available since API level 21.
*/
media_status_t AMediaFormat_delete(AMediaFormat*) __INTRODUCED_IN(21);
/**
* Human readable representation of the format. The returned string is owned by the format,
* and remains valid until the next call to toString, or until the format is deleted.
*
* Available since API level 21.
*/
const char* AMediaFormat_toString(AMediaFormat*) __INTRODUCED_IN(21);
/**
* Available since API level 21.
*/
bool AMediaFormat_getInt32(AMediaFormat*, const char *name, int32_t *out) __INTRODUCED_IN(21);
/**
* Available since API level 21.
*/
bool AMediaFormat_getInt64(AMediaFormat*, const char *name, int64_t *out) __INTRODUCED_IN(21);
/**
* Available since API level 21.
*/
bool AMediaFormat_getFloat(AMediaFormat*, const char *name, float *out) __INTRODUCED_IN(21);
/**
* Available since API level 21.
*/
bool AMediaFormat_getSize(AMediaFormat*, const char *name, size_t *out) __INTRODUCED_IN(21);
/**
* The returned data is owned by the format and remains valid as long as the named entry
* is part of the format.
*
* Available since API level 21.
*/
bool AMediaFormat_getBuffer(AMediaFormat*, const char *name, void** data, size_t *size) __INTRODUCED_IN(21);
/**
* The returned string is owned by the format, and remains valid until the next call to getString,
* or until the format is deleted.
*
* Available since API level 21.
*/
bool AMediaFormat_getString(AMediaFormat*, const char *name, const char **out) __INTRODUCED_IN(21);
/**
* Available since API level 21.
*/
void AMediaFormat_setInt32(AMediaFormat*, const char* name, int32_t value) __INTRODUCED_IN(21);
/**
* Available since API level 21.
*/
void AMediaFormat_setInt64(AMediaFormat*, const char* name, int64_t value) __INTRODUCED_IN(21);
/**
* Available since API level 21.
*/
void AMediaFormat_setFloat(AMediaFormat*, const char* name, float value) __INTRODUCED_IN(21);
/**
* The provided string is copied into the format.
*
* Available since API level 21.
*/
void AMediaFormat_setString(AMediaFormat*, const char* name, const char* value) __INTRODUCED_IN(21);
/**
* The provided data is copied into the format.
*
* Available since API level 21.
*/
void AMediaFormat_setBuffer(AMediaFormat*, const char* name, const void* data, size_t size) __INTRODUCED_IN(21);
@ -155,24 +193,43 @@ extern const char* AMEDIAFORMAT_KEY_WIDTH __INTRODUCED_IN(21);
#endif /* __ANDROID_API__ >= 21 */
#if __ANDROID_API__ >= 28
/**
* Available since API level 28.
*/
bool AMediaFormat_getDouble(AMediaFormat*, const char *name, double *out) __INTRODUCED_IN(28);
/**
* Available since API level 28.
*/
bool AMediaFormat_getRect(AMediaFormat*, const char *name,
int32_t *left, int32_t *top, int32_t *right, int32_t *bottom) __INTRODUCED_IN(28);
/**
* Available since API level 28.
*/
void AMediaFormat_setDouble(AMediaFormat*, const char* name, double value) __INTRODUCED_IN(28);
/**
* Available since API level 28.
*/
void AMediaFormat_setSize(AMediaFormat*, const char* name, size_t value) __INTRODUCED_IN(28);
/**
* Available since API level 28.
*/
void AMediaFormat_setRect(AMediaFormat*, const char* name,
int32_t left, int32_t top, int32_t right, int32_t bottom) __INTRODUCED_IN(28);
#endif /* __ANDROID_API__ >= 28 */
#if __ANDROID_API__ >= 29
/**
* remove all key/value pairs from the given AMediaFormat
* Remove all key/value pairs from the given AMediaFormat.
*
* Available since API level 29.
*/
void AMediaFormat_clear(AMediaFormat*) __INTRODUCED_IN(29);
/**
* copy one AMediaFormat to another
* Copy one AMediaFormat to another.
*
* Available since API level 29.
*/
media_status_t AMediaFormat_copy(AMediaFormat *to, AMediaFormat *from) __INTRODUCED_IN(29);

@ -56,12 +56,16 @@ typedef enum {
#if __ANDROID_API__ >= 21
/**
* Create new media muxer
* Create new media muxer.
*
* Available since API level 21.
*/
AMediaMuxer* AMediaMuxer_new(int fd, OutputFormat format) __INTRODUCED_IN(21);
/**
* Delete a previously created media muxer
* Delete a previously created media muxer.
*
* Available since API level 21.
*/
media_status_t AMediaMuxer_delete(AMediaMuxer*) __INTRODUCED_IN(21);
@ -75,6 +79,8 @@ media_status_t AMediaMuxer_delete(AMediaMuxer*) __INTRODUCED_IN(21);
* Both values are specified in degrees.
* Latitude must be in the range [-90, 90].
* Longitude must be in the range [-180, 180].
*
* Available since API level 21.
*/
media_status_t AMediaMuxer_setLocation(AMediaMuxer*,
float latitude, float longitude) __INTRODUCED_IN(21);
@ -90,6 +96,8 @@ media_status_t AMediaMuxer_setLocation(AMediaMuxer*,
* during playback.
* The angle is specified in degrees, clockwise.
* The supported angles are 0, 90, 180, and 270 degrees.
*
* Available since API level 21.
*/
media_status_t AMediaMuxer_setOrientationHint(AMediaMuxer*, int degrees) __INTRODUCED_IN(21);
@ -97,18 +105,24 @@ media_status_t AMediaMuxer_setOrientationHint(AMediaMuxer*, int degrees) __INTRO
* Adds a track with the specified format.
* Returns the index of the new track or a negative value in case of failure,
* which can be interpreted as a media_status_t.
*
* Available since API level 21.
*/
ssize_t AMediaMuxer_addTrack(AMediaMuxer*, const AMediaFormat* format) __INTRODUCED_IN(21);
/**
* Start the muxer. Should be called after AMediaMuxer_addTrack and
* before AMediaMuxer_writeSampleData.
*
* Available since API level 21.
*/
media_status_t AMediaMuxer_start(AMediaMuxer*) __INTRODUCED_IN(21);
/**
* Stops the muxer.
* Once the muxer stops, it can not be restarted.
*
* Available since API level 21.
*/
media_status_t AMediaMuxer_stop(AMediaMuxer*) __INTRODUCED_IN(21);
@ -118,6 +132,8 @@ media_status_t AMediaMuxer_stop(AMediaMuxer*) __INTRODUCED_IN(21);
* the right tracks. Also, it needs to make sure the samples for each track
* are written in chronological order (e.g. in the order they are provided
* by the encoder.)
*
* Available since API level 21.
*/
media_status_t AMediaMuxer_writeSampleData(AMediaMuxer *muxer,
size_t trackIdx, const uint8_t *data,

Loading…
Cancel
Save