diff options
64 files changed, 850 insertions, 2459 deletions
diff --git a/camera/VendorTagDescriptor.cpp b/camera/VendorTagDescriptor.cpp index 4c28789b01..a86cc87da9 100644 --- a/camera/VendorTagDescriptor.cpp +++ b/camera/VendorTagDescriptor.cpp @@ -566,7 +566,7 @@ status_t VendorTagDescriptor::createDescriptorFromOps(const vendor_tag_ops_t* vO for (size_t i = 0; i < static_cast<size_t>(tagCount); ++i) { uint32_t tag = tagArray[i]; - String8 sectionString = tagToSectionMap.valueFor(tag); + const String8& sectionString = tagToSectionMap.valueFor(tag); // Set up tag to section index map ssize_t index = sections.indexOf(sectionString); diff --git a/camera/ndk/include/camera/NdkCameraCaptureSession.h b/camera/ndk/include/camera/NdkCameraCaptureSession.h index 51cef8c7a3..5e0db60c17 100644 --- a/camera/ndk/include/camera/NdkCameraCaptureSession.h +++ b/camera/ndk/include/camera/NdkCameraCaptureSession.h @@ -38,6 +38,7 @@ #include <android/native_window.h> #include "NdkCameraError.h" #include "NdkCameraMetadata.h" +#include "NdkCaptureRequest.h" #ifndef _NDK_CAMERA_CAPTURE_SESSION_H #define _NDK_CAMERA_CAPTURE_SESSION_H @@ -433,7 +434,7 @@ typedef struct ACameraDevice ACameraDevice; * */ camera_status_t ACameraCaptureSession_getDevice( - ACameraCaptureSession* session, /*out*/ACameraDevice** device); + ACameraCaptureSession* session, /*out*/ACameraDevice** device) __INTRODUCED_IN(24); /** * Submit an array of requests to be captured in sequence as a burst in the minimum of time possible. @@ -471,7 +472,7 @@ camera_status_t ACameraCaptureSession_capture( ACameraCaptureSession* session, /*optional*/ACameraCaptureSession_captureCallbacks* callbacks, int numRequests, ACaptureRequest** requests, - /*optional*/int* captureSequenceId); + /*optional*/int* captureSequenceId) __INTRODUCED_IN(24); /** * Request endlessly repeating capture of a sequence of images by this capture session. @@ -525,7 +526,7 @@ camera_status_t ACameraCaptureSession_setRepeatingRequest( ACameraCaptureSession* session, /*optional*/ACameraCaptureSession_captureCallbacks* callbacks, int numRequests, ACaptureRequest** requests, - /*optional*/int* captureSequenceId); + /*optional*/int* captureSequenceId) __INTRODUCED_IN(24); /** * Cancel any ongoing repeating capture set by {@link ACameraCaptureSession_setRepeatingRequest}. @@ -548,7 +549,8 @@ camera_status_t ACameraCaptureSession_setRepeatingRequest( * <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error</li> * <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons</li></ul> */ -camera_status_t ACameraCaptureSession_stopRepeating(ACameraCaptureSession* session); +camera_status_t ACameraCaptureSession_stopRepeating(ACameraCaptureSession* session) + __INTRODUCED_IN(24); /** * Discard all captures currently pending and in-progress as fast as possible. @@ -588,7 +590,8 @@ camera_status_t ACameraCaptureSession_stopRepeating(ACameraCaptureSession* sessi * <li>{@link ACAMERA_ERROR_CAMERA_SERVICE} if the camera service encounters fatal error</li> * <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons</li></ul> */ -camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* session); +camera_status_t ACameraCaptureSession_abortCaptures(ACameraCaptureSession* session) + __INTRODUCED_IN(24); #endif /* __ANDROID_API__ >= 24 */ @@ -637,7 +640,7 @@ typedef struct ACaptureSessionOutput ACaptureSessionOutput; * <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons</li></ul> */ camera_status_t ACameraCaptureSession_updateSharedOutput(ACameraCaptureSession* session, - ACaptureSessionOutput* output); + ACaptureSessionOutput* output) __INTRODUCED_IN(28); #endif /* __ANDROID_API__ >= 28 */ __END_DECLS diff --git a/camera/ndk/include/camera/NdkCameraDevice.h b/camera/ndk/include/camera/NdkCameraDevice.h index b715b12e15..7c13b34a82 100644 --- a/camera/ndk/include/camera/NdkCameraDevice.h +++ b/camera/ndk/include/camera/NdkCameraDevice.h @@ -176,7 +176,7 @@ typedef ACameraDevice_StateCallbacks ACameraDevice_stateCallbacks; * <li>{@link ACAMERA_OK} if the method call succeeds.</li> * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if device is NULL.</li></ul> */ -camera_status_t ACameraDevice_close(ACameraDevice* device); +camera_status_t ACameraDevice_close(ACameraDevice* device) __INTRODUCED_IN(24); /** * Return the camera id associated with this camera device. @@ -187,7 +187,7 @@ camera_status_t ACameraDevice_close(ACameraDevice* device); * delete/free by the application. Also the returned string must not be used after the device * has been closed. */ -const char* ACameraDevice_getId(const ACameraDevice* device); +const char* ACameraDevice_getId(const ACameraDevice* device) __INTRODUCED_IN(24); typedef enum { /** @@ -290,7 +290,7 @@ typedef enum { */ camera_status_t ACameraDevice_createCaptureRequest( const ACameraDevice* device, ACameraDevice_request_template templateId, - /*out*/ACaptureRequest** request); + /*out*/ACaptureRequest** request) __INTRODUCED_IN(24); typedef struct ACaptureSessionOutputContainer ACaptureSessionOutputContainer; @@ -313,7 +313,7 @@ typedef struct ACaptureSessionOutput ACaptureSessionOutput; * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if container is NULL.</li></ul> */ camera_status_t ACaptureSessionOutputContainer_create( - /*out*/ACaptureSessionOutputContainer** container); + /*out*/ACaptureSessionOutputContainer** container) __INTRODUCED_IN(24); /** * Free a capture session output container. @@ -322,7 +322,8 @@ camera_status_t ACaptureSessionOutputContainer_create( * * @see ACaptureSessionOutputContainer_create */ -void ACaptureSessionOutputContainer_free(ACaptureSessionOutputContainer* container); +void ACaptureSessionOutputContainer_free(ACaptureSessionOutputContainer* container) + __INTRODUCED_IN(24); /** * Create a ACaptureSessionOutput object. @@ -344,7 +345,7 @@ void ACaptureSessionOutputContainer_free(ACaptureSessionOutputContain * @see ACaptureSessionOutputContainer_add */ camera_status_t ACaptureSessionOutput_create( - ANativeWindow* anw, /*out*/ACaptureSessionOutput** output); + ANativeWindow* anw, /*out*/ACaptureSessionOutput** output) __INTRODUCED_IN(24); /** * Free a ACaptureSessionOutput object. @@ -353,7 +354,7 @@ camera_status_t ACaptureSessionOutput_create( * * @see ACaptureSessionOutput_create */ -void ACaptureSessionOutput_free(ACaptureSessionOutput* output); +void ACaptureSessionOutput_free(ACaptureSessionOutput* output) __INTRODUCED_IN(24); /** * Add an {@link ACaptureSessionOutput} object to {@link ACaptureSessionOutputContainer}. @@ -366,7 +367,8 @@ void ACaptureSessionOutput_free(ACaptureSessionOutput* output); * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if container or output is NULL.</li></ul> */ camera_status_t ACaptureSessionOutputContainer_add( - ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output); + ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output) + __INTRODUCED_IN(24); /** * Remove an {@link ACaptureSessionOutput} object from {@link ACaptureSessionOutputContainer}. @@ -382,7 +384,8 @@ camera_status_t ACaptureSessionOutputContainer_add( * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if container or output is NULL.</li></ul> */ camera_status_t ACaptureSessionOutputContainer_remove( - ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output); + ACaptureSessionOutputContainer* container, const ACaptureSessionOutput* output) + __INTRODUCED_IN(24); /** * Create a new camera capture session by providing the target output set of {@link ANativeWindow} @@ -663,7 +666,7 @@ camera_status_t ACameraDevice_createCaptureSession( ACameraDevice* device, const ACaptureSessionOutputContainer* outputs, const ACameraCaptureSession_stateCallbacks* callbacks, - /*out*/ACameraCaptureSession** session); + /*out*/ACameraCaptureSession** session) __INTRODUCED_IN(24); #endif /* __ANDROID_API__ >= 24 */ @@ -691,7 +694,7 @@ camera_status_t ACameraDevice_createCaptureSession( * @see ACaptureSessionOutputContainer_add */ camera_status_t ACaptureSessionSharedOutput_create( - ANativeWindow* anw, /*out*/ACaptureSessionOutput** output); + ANativeWindow* anw, /*out*/ACaptureSessionOutput** output) __INTRODUCED_IN(28); /** * Add a native window to shared ACaptureSessionOutput. @@ -708,7 +711,8 @@ camera_status_t ACaptureSessionSharedOutput_create( * window associated with ACaptureSessionOutput; or anw is already present inside * ACaptureSessionOutput.</li></ul> */ -camera_status_t ACaptureSessionSharedOutput_add(ACaptureSessionOutput *output, ANativeWindow *anw); +camera_status_t ACaptureSessionSharedOutput_add(ACaptureSessionOutput *output, + ANativeWindow *anw) __INTRODUCED_IN(28); /** * Remove a native window from shared ACaptureSessionOutput. @@ -724,7 +728,7 @@ camera_status_t ACaptureSessionSharedOutput_add(ACaptureSessionOutput *output, A * ACaptureSessionOutput.</li></ul> */ camera_status_t ACaptureSessionSharedOutput_remove(ACaptureSessionOutput *output, - ANativeWindow* anw); + ANativeWindow* anw) __INTRODUCED_IN(28); /** * Create a new camera capture session similar to {@link ACameraDevice_createCaptureSession}. This @@ -757,7 +761,7 @@ camera_status_t ACameraDevice_createCaptureSessionWithSessionParameters( const ACaptureSessionOutputContainer* outputs, const ACaptureRequest* sessionParameters, const ACameraCaptureSession_stateCallbacks* callbacks, - /*out*/ACameraCaptureSession** session); + /*out*/ACameraCaptureSession** session) __INTRODUCED_IN(28); #endif /* __ANDROID_API__ >= 28 */ diff --git a/camera/ndk/include/camera/NdkCameraManager.h b/camera/ndk/include/camera/NdkCameraManager.h index e5b3ad8aac..ea76738806 100644 --- a/camera/ndk/include/camera/NdkCameraManager.h +++ b/camera/ndk/include/camera/NdkCameraManager.h @@ -65,14 +65,14 @@ typedef struct ACameraManager ACameraManager; * @return a {@link ACameraManager} instance. * */ -ACameraManager* ACameraManager_create(); +ACameraManager* ACameraManager_create() __INTRODUCED_IN(24); /** * <p>Delete the {@link ACameraManager} instance and free its resources. </p> * * @param manager the {@link ACameraManager} instance to be deleted. */ -void ACameraManager_delete(ACameraManager* manager); +void ACameraManager_delete(ACameraManager* manager) __INTRODUCED_IN(24); /// Struct to hold list of camera devices typedef struct ACameraIdList { @@ -102,14 +102,14 @@ typedef struct ACameraIdList { * <li>{@link ACAMERA_ERROR_NOT_ENOUGH_MEMORY} if allocating memory fails.</li></ul> */ camera_status_t ACameraManager_getCameraIdList(ACameraManager* manager, - /*out*/ACameraIdList** cameraIdList); + /*out*/ACameraIdList** cameraIdList) __INTRODUCED_IN(24); /** * Delete a list of camera devices allocated via {@link ACameraManager_getCameraIdList}. * * @param cameraIdList the {@link ACameraIdList} to be deleted. */ -void ACameraManager_deleteCameraIdList(ACameraIdList* cameraIdList); +void ACameraManager_deleteCameraIdList(ACameraIdList* cameraIdList) __INTRODUCED_IN(24); /** * Definition of camera availability callbacks. @@ -120,7 +120,8 @@ void ACameraManager_deleteCameraIdList(ACameraIdList* cameraIdList); * argument is owned by camera framework and will become invalid immediately after * this callback returns. */ -typedef void (*ACameraManager_AvailabilityCallback)(void* context, const char* cameraId); +typedef void (*ACameraManager_AvailabilityCallback)(void* context, + const char* cameraId); /** * A listener for camera devices becoming available or unavailable to open. @@ -168,7 +169,8 @@ typedef struct ACameraManager_AvailabilityListener { * {ACameraManager_AvailabilityCallbacks#onCameraUnavailable} is NULL.</li></ul> */ camera_status_t ACameraManager_registerAvailabilityCallback( - ACameraManager* manager, const ACameraManager_AvailabilityCallbacks* callback); + ACameraManager* manager, + const ACameraManager_AvailabilityCallbacks* callback) __INTRODUCED_IN(24); /** * Unregister camera availability callbacks. @@ -185,7 +187,8 @@ camera_status_t ACameraManager_registerAvailabilityCallback( * {ACameraManager_AvailabilityCallbacks#onCameraUnavailable} is NULL.</li></ul> */ camera_status_t ACameraManager_unregisterAvailabilityCallback( - ACameraManager* manager, const ACameraManager_AvailabilityCallbacks* callback); + ACameraManager* manager, + const ACameraManager_AvailabilityCallbacks* callback) __INTRODUCED_IN(24); /** * Query the capabilities of a camera device. These capabilities are @@ -211,7 +214,7 @@ camera_status_t ACameraManager_unregisterAvailabilityCallback( */ camera_status_t ACameraManager_getCameraCharacteristics( ACameraManager* manager, const char* cameraId, - /*out*/ACameraMetadata** characteristics); + /*out*/ACameraMetadata** characteristics) __INTRODUCED_IN(24); /** * Open a connection to a camera with the given ID. The opened camera device will be @@ -271,7 +274,7 @@ camera_status_t ACameraManager_getCameraCharacteristics( camera_status_t ACameraManager_openCamera( ACameraManager* manager, const char* cameraId, ACameraDevice_StateCallbacks* callback, - /*out*/ACameraDevice** device); + /*out*/ACameraDevice** device) __INTRODUCED_IN(24); #endif /* __ANDROID_API__ >= 24 */ diff --git a/camera/ndk/include/camera/NdkCameraMetadata.h b/camera/ndk/include/camera/NdkCameraMetadata.h index f2aec98617..611e270e56 100644 --- a/camera/ndk/include/camera/NdkCameraMetadata.h +++ b/camera/ndk/include/camera/NdkCameraMetadata.h @@ -36,6 +36,7 @@ #ifndef _NDK_CAMERA_METADATA_H #define _NDK_CAMERA_METADATA_H +#include <stdint.h> #include <sys/cdefs.h> #include "NdkCameraError.h" @@ -190,7 +191,8 @@ typedef struct ACameraMetadata_const_entry { * of input tag value.</li></ul> */ camera_status_t ACameraMetadata_getConstEntry( - const ACameraMetadata* metadata, uint32_t tag, /*out*/ACameraMetadata_const_entry* entry); + const ACameraMetadata* metadata, + uint32_t tag, /*out*/ACameraMetadata_const_entry* entry) __INTRODUCED_IN(24); /** * List all the entry tags in input {@link ACameraMetadata}. @@ -207,7 +209,8 @@ camera_status_t ACameraMetadata_getConstEntry( * <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul> */ camera_status_t ACameraMetadata_getAllTags( - const ACameraMetadata* metadata, /*out*/int32_t* numEntries, /*out*/const uint32_t** tags); + const ACameraMetadata* metadata, + /*out*/int32_t* numEntries, /*out*/const uint32_t** tags) __INTRODUCED_IN(24); /** * Create a copy of input {@link ACameraMetadata}. @@ -219,14 +222,14 @@ camera_status_t ACameraMetadata_getAllTags( * * @return a valid ACameraMetadata pointer or NULL if the input metadata cannot be copied. */ -ACameraMetadata* ACameraMetadata_copy(const ACameraMetadata* src); +ACameraMetadata* ACameraMetadata_copy(const ACameraMetadata* src) __INTRODUCED_IN(24); /** * Free a {@link ACameraMetadata} structure. * * @param metadata the {@link ACameraMetadata} to be freed. */ -void ACameraMetadata_free(ACameraMetadata* metadata); +void ACameraMetadata_free(ACameraMetadata* metadata) __INTRODUCED_IN(24); #endif /* __ANDROID_API__ >= 24 */ diff --git a/camera/ndk/include/camera/NdkCaptureRequest.h b/camera/ndk/include/camera/NdkCaptureRequest.h index 4961ce39f6..5340e76044 100644 --- a/camera/ndk/include/camera/NdkCaptureRequest.h +++ b/camera/ndk/include/camera/NdkCaptureRequest.h @@ -101,7 +101,8 @@ typedef struct ACaptureRequest ACaptureRequest; * * @see ACaptureRequest_addTarget */ -camera_status_t ACameraOutputTarget_create(ANativeWindow* window, ACameraOutputTarget** output); +camera_status_t ACameraOutputTarget_create(ANativeWindow* window, + ACameraOutputTarget** output) __INTRODUCED_IN(24); /** * Free a ACameraOutputTarget object. @@ -110,7 +111,7 @@ camera_status_t ACameraOutputTarget_create(ANativeWindow* window, ACameraOutputT * * @see ACameraOutputTarget_create */ -void ACameraOutputTarget_free(ACameraOutputTarget* output); +void ACameraOutputTarget_free(ACameraOutputTarget* output) __INTRODUCED_IN(24); /** * Add an {@link ACameraOutputTarget} object to {@link ACaptureRequest}. @@ -123,7 +124,7 @@ void ACameraOutputTarget_free(ACameraOutputTarget* output); * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request or output is NULL.</li></ul> */ camera_status_t ACaptureRequest_addTarget(ACaptureRequest* request, - const ACameraOutputTarget* output); + const ACameraOutputTarget* output) __INTRODUCED_IN(24); /** * Remove an {@link ACameraOutputTarget} object from {@link ACaptureRequest}. @@ -138,7 +139,7 @@ camera_status_t ACaptureRequest_addTarget(ACaptureRequest* request, * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request or output is NULL.</li></ul> */ camera_status_t ACaptureRequest_removeTarget(ACaptureRequest* request, - const ACameraOutputTarget* output); + const ACameraOutputTarget* output) __INTRODUCED_IN(24); /** * Get a metadata entry from input {@link ACaptureRequest}. @@ -158,7 +159,7 @@ camera_status_t ACaptureRequest_removeTarget(ACaptureRequest* request, * entry of input tag value.</li></ul> */ camera_status_t ACaptureRequest_getConstEntry( - const ACaptureRequest* request, uint32_t tag, ACameraMetadata_const_entry* entry); + const ACaptureRequest* request, uint32_t tag, ACameraMetadata_const_entry* entry) __INTRODUCED_IN(24); /* * List all the entry tags in input {@link ACaptureRequest}. @@ -179,7 +180,7 @@ camera_status_t ACaptureRequest_getConstEntry( * <li>{@link ACAMERA_ERROR_UNKNOWN} if the method fails for some other reasons.</li></ul> */ camera_status_t ACaptureRequest_getAllTags( - const ACaptureRequest* request, /*out*/int32_t* numTags, /*out*/const uint32_t** tags); + const ACaptureRequest* request, /*out*/int32_t* numTags, /*out*/const uint32_t** tags) __INTRODUCED_IN(24); /** * Set/change a camera capture control entry with unsigned 8 bits data type. @@ -198,7 +199,7 @@ camera_status_t ACaptureRequest_getAllTags( * the tag is not controllable by application.</li></ul> */ camera_status_t ACaptureRequest_setEntry_u8( - ACaptureRequest* request, uint32_t tag, uint32_t count, const uint8_t* data); + ACaptureRequest* request, uint32_t tag, uint32_t count, const uint8_t* data) __INTRODUCED_IN(24); /** * Set/change a camera capture control entry with signed 32 bits data type. @@ -217,7 +218,7 @@ camera_status_t ACaptureRequest_setEntry_u8( * the tag is not controllable by application.</li></ul> */ camera_status_t ACaptureRequest_setEntry_i32( - ACaptureRequest* request, uint32_t tag, uint32_t count, const int32_t* data); + ACaptureRequest* request, uint32_t tag, uint32_t count, const int32_t* data) __INTRODUCED_IN(24); /** * Set/change a camera capture control entry with float data type. @@ -236,7 +237,7 @@ camera_status_t ACaptureRequest_setEntry_i32( * the tag is not controllable by application.</li></ul> */ camera_status_t ACaptureRequest_setEntry_float( - ACaptureRequest* request, uint32_t tag, uint32_t count, const float* data); + ACaptureRequest* request, uint32_t tag, uint32_t count, const float* data) __INTRODUCED_IN(24); /** * Set/change a camera capture control entry with signed 64 bits data type. @@ -255,7 +256,7 @@ camera_status_t ACaptureRequest_setEntry_float( * the tag is not controllable by application.</li></ul> */ camera_status_t ACaptureRequest_setEntry_i64( - ACaptureRequest* request, uint32_t tag, uint32_t count, const int64_t* data); + ACaptureRequest* request, uint32_t tag, uint32_t count, const int64_t* data) __INTRODUCED_IN(24); /** * Set/change a camera capture control entry with double data type. @@ -274,7 +275,7 @@ camera_status_t ACaptureRequest_setEntry_i64( * the tag is not controllable by application.</li></ul> */ camera_status_t ACaptureRequest_setEntry_double( - ACaptureRequest* request, uint32_t tag, uint32_t count, const double* data); + ACaptureRequest* request, uint32_t tag, uint32_t count, const double* data) __INTRODUCED_IN(24); /** * Set/change a camera capture control entry with rational data type. @@ -294,14 +295,14 @@ camera_status_t ACaptureRequest_setEntry_double( */ camera_status_t ACaptureRequest_setEntry_rational( ACaptureRequest* request, uint32_t tag, uint32_t count, - const ACameraMetadata_rational* data); + const ACameraMetadata_rational* data) __INTRODUCED_IN(24); /** * Free a {@link ACaptureRequest} structure. * * @param request the {@link ACaptureRequest} to be freed. */ -void ACaptureRequest_free(ACaptureRequest* request); +void ACaptureRequest_free(ACaptureRequest* request) __INTRODUCED_IN(24); #endif /* __ANDROID_API__ >= 24 */ @@ -325,7 +326,7 @@ void ACaptureRequest_free(ACaptureRequest* request); * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL.</li></ul> */ camera_status_t ACaptureRequest_setUserContext( - ACaptureRequest* request, void* context); + ACaptureRequest* request, void* context) __INTRODUCED_IN(28); /** * Get the user context pointer of the {@link ACaptureRequest} @@ -341,7 +342,7 @@ camera_status_t ACaptureRequest_setUserContext( * <li>{@link ACAMERA_ERROR_INVALID_PARAMETER} if request is NULL.</li></ul> */ camera_status_t ACaptureRequest_getUserContext( - const ACaptureRequest* request, /*out*/void** context); + const ACaptureRequest* request, /*out*/void** context) __INTRODUCED_IN(28); /** * Create a copy of input {@link ACaptureRequest}. @@ -353,7 +354,7 @@ camera_status_t ACaptureRequest_getUserContext( * * @return a valid ACaptureRequest pointer or NULL if the input request cannot be copied. */ -ACaptureRequest* ACaptureRequest_copy(const ACaptureRequest* src); +ACaptureRequest* ACaptureRequest_copy(const ACaptureRequest* src) __INTRODUCED_IN(28); #endif /* __ANDROID_API__ >= 28 */ diff --git a/camera/ndk/libcamera2ndk.map.txt b/camera/ndk/libcamera2ndk.map.txt index d179aa01f0..a29e96df34 100644 --- a/camera/ndk/libcamera2ndk.map.txt +++ b/camera/ndk/libcamera2ndk.map.txt @@ -6,11 +6,11 @@ LIBCAMERA2NDK { ACameraCaptureSession_getDevice; ACameraCaptureSession_setRepeatingRequest; ACameraCaptureSession_stopRepeating; - ACameraCaptureSession_updateSharedOutput; + ACameraCaptureSession_updateSharedOutput; # introduced=28 ACameraDevice_close; ACameraDevice_createCaptureRequest; ACameraDevice_createCaptureSession; - ACameraDevice_createCaptureSessionWithSessionParameters; + ACameraDevice_createCaptureSessionWithSessionParameters; # introduced=28 ACameraDevice_getId; ACameraManager_create; ACameraManager_delete; @@ -27,11 +27,11 @@ LIBCAMERA2NDK { ACameraOutputTarget_create; ACameraOutputTarget_free; ACaptureRequest_addTarget; - ACaptureRequest_copy; + ACaptureRequest_copy; # introduced=28 ACaptureRequest_free; ACaptureRequest_getAllTags; ACaptureRequest_getConstEntry; - ACaptureRequest_getUserContext; + ACaptureRequest_getUserContext; # introduced=28 ACaptureRequest_removeTarget; ACaptureRequest_setEntry_double; ACaptureRequest_setEntry_float; @@ -39,15 +39,15 @@ LIBCAMERA2NDK { ACaptureRequest_setEntry_i64; ACaptureRequest_setEntry_rational; ACaptureRequest_setEntry_u8; - ACaptureRequest_setUserContext; + ACaptureRequest_setUserContext; # introduced=28 ACaptureSessionOutputContainer_add; ACaptureSessionOutputContainer_create; ACaptureSessionOutputContainer_free; ACaptureSessionOutputContainer_remove; ACaptureSessionOutput_create; - ACaptureSessionSharedOutput_create; - ACaptureSessionSharedOutput_add; - ACaptureSessionSharedOutput_remove; + ACaptureSessionSharedOutput_create; # introduced=28 + ACaptureSessionSharedOutput_add; # introduced=28 + ACaptureSessionSharedOutput_remove; # introduced=28 ACaptureSessionOutput_free; local: *; diff --git a/drm/common/Android.bp b/drm/common/Android.bp index 1552c3f340..272684c29d 100644 --- a/drm/common/Android.bp +++ b/drm/common/Android.bp @@ -35,7 +35,7 @@ cc_library_static { cflags: ["-Wall", "-Werror"], - static_libs: ["libbinder"], + shared_libs: ["libbinder"], export_include_dirs: ["include"], } diff --git a/include/common_time/ICommonClock.h b/include/common_time/ICommonClock.h deleted file mode 100644 index d7073f1337..0000000000 --- a/include/common_time/ICommonClock.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_ICOMMONCLOCK_H -#define ANDROID_ICOMMONCLOCK_H - -#include <stdint.h> -#include <linux/socket.h> - -#include <binder/IInterface.h> -#include <binder/IServiceManager.h> - -namespace android { - -class ICommonClockListener : public IInterface { - public: - DECLARE_META_INTERFACE(CommonClockListener); - - virtual void onTimelineChanged(uint64_t timelineID) = 0; -}; - -class BnCommonClockListener : public BnInterface<ICommonClockListener> { - public: - virtual status_t onTransact(uint32_t code, const Parcel& data, - Parcel* reply, uint32_t flags = 0); -}; - -class ICommonClock : public IInterface { - public: - DECLARE_META_INTERFACE(CommonClock); - - // Name of the ICommonClock service registered with the service manager. - static const String16 kServiceName; - - // a reserved invalid timeline ID - static const uint64_t kInvalidTimelineID; - - // a reserved invalid error estimate - static const int32_t kErrorEstimateUnknown; - - enum State { - // the device just came up and is trying to discover the master - STATE_INITIAL, - - // the device is a client of a master - STATE_CLIENT, - - // the device is acting as master - STATE_MASTER, - - // the device has lost contact with its master and needs to participate - // in the election of a new master - STATE_RONIN, - - // the device is waiting for announcement of the newly elected master - STATE_WAIT_FOR_ELECTION, - }; - - virtual status_t isCommonTimeValid(bool* valid, uint32_t* timelineID) = 0; - virtual status_t commonTimeToLocalTime(int64_t commonTime, - int64_t* localTime) = 0; - virtual status_t localTimeToCommonTime(int64_t localTime, - int64_t* commonTime) = 0; - virtual status_t getCommonTime(int64_t* commonTime) = 0; - virtual status_t getCommonFreq(uint64_t* freq) = 0; - virtual status_t getLocalTime(int64_t* localTime) = 0; - virtual status_t getLocalFreq(uint64_t* freq) = 0; - virtual status_t getEstimatedError(int32_t* estimate) = 0; - virtual status_t getTimelineID(uint64_t* id) = 0; - virtual status_t getState(State* state) = 0; - virtual status_t getMasterAddr(struct sockaddr_storage* addr) = 0; - - virtual status_t registerListener( - const sp<ICommonClockListener>& listener) = 0; - virtual status_t unregisterListener( - const sp<ICommonClockListener>& listener) = 0; - - // Simple helper to make it easier to connect to the CommonClock service. - static inline sp<ICommonClock> getInstance() { - sp<IBinder> binder = defaultServiceManager()->checkService( - ICommonClock::kServiceName); - sp<ICommonClock> clk = interface_cast<ICommonClock>(binder); - return clk; - } -}; - -class BnCommonClock : public BnInterface<ICommonClock> { - public: - virtual status_t onTransact(uint32_t code, const Parcel& data, - Parcel* reply, uint32_t flags = 0); -}; - -}; // namespace android - -#endif // ANDROID_ICOMMONCLOCK_H diff --git a/include/common_time/ICommonTimeConfig.h b/include/common_time/ICommonTimeConfig.h deleted file mode 100644 index 497b666de6..0000000000 --- a/include/common_time/ICommonTimeConfig.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_ICOMMONTIMECONFIG_H -#define ANDROID_ICOMMONTIMECONFIG_H - -#include <stdint.h> -#include <linux/socket.h> - -#include <binder/IInterface.h> -#include <binder/IServiceManager.h> - -namespace android { - -class String16; - -class ICommonTimeConfig : public IInterface { - public: - DECLARE_META_INTERFACE(CommonTimeConfig); - - // Name of the ICommonTimeConfig service registered with the service - // manager. - static const String16 kServiceName; - - virtual status_t getMasterElectionPriority(uint8_t *priority) = 0; - virtual status_t setMasterElectionPriority(uint8_t priority) = 0; - virtual status_t getMasterElectionEndpoint(struct sockaddr_storage *addr) = 0; - virtual status_t setMasterElectionEndpoint(const struct sockaddr_storage *addr) = 0; - virtual status_t getMasterElectionGroupId(uint64_t *id) = 0; - virtual status_t setMasterElectionGroupId(uint64_t id) = 0; - virtual status_t getInterfaceBinding(String16& ifaceName) = 0; - virtual status_t setInterfaceBinding(const String16& ifaceName) = 0; - virtual status_t getMasterAnnounceInterval(int *interval) = 0; - virtual status_t setMasterAnnounceInterval(int interval) = 0; - virtual status_t getClientSyncInterval(int *interval) = 0; - virtual status_t setClientSyncInterval(int interval) = 0; - virtual status_t getPanicThreshold(int *threshold) = 0; - virtual status_t setPanicThreshold(int threshold) = 0; - virtual status_t getAutoDisable(bool *autoDisable) = 0; - virtual status_t setAutoDisable(bool autoDisable) = 0; - virtual status_t forceNetworklessMasterMode() = 0; - - // Simple helper to make it easier to connect to the CommonTimeConfig service. - static inline sp<ICommonTimeConfig> getInstance() { - sp<IBinder> binder = defaultServiceManager()->checkService( - ICommonTimeConfig::kServiceName); - sp<ICommonTimeConfig> clk = interface_cast<ICommonTimeConfig>(binder); - return clk; - } -}; - -class BnCommonTimeConfig : public BnInterface<ICommonTimeConfig> { - public: - virtual status_t onTransact(uint32_t code, const Parcel& data, - Parcel* reply, uint32_t flags = 0); -}; - -}; // namespace android - -#endif // ANDROID_ICOMMONTIMECONFIG_H diff --git a/include/common_time/cc_helper.h b/include/common_time/cc_helper.h deleted file mode 100644 index 8c4d5c063d..0000000000 --- a/include/common_time/cc_helper.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __CC_HELPER_H__ -#define __CC_HELPER_H__ - -#include <stdint.h> -#include <common_time/ICommonClock.h> -#include <utils/threads.h> - -namespace android { - -// CCHelper is a simple wrapper class to help with centralizing access to the -// Common Clock service and implementing lifetime managment, as well as to -// implement a simple policy of making a basic attempt to reconnect to the -// common clock service when things go wrong. -// -// On platforms which run the native common_time service in auto-disable mode, -// the service will go into networkless mode whenever it has no active clients. -// It tracks active clients using registered CommonClockListeners (the callback -// interface for onTimelineChanged) since this provides a convienent death -// handler notification for when the service's clients die unexpectedly. This -// means that users of the common time service should really always have a -// CommonClockListener, unless they know that the time service is not running in -// auto disabled mode, or that there is at least one other registered listener -// active in the system. The CCHelper makes this a little easier by sharing a -// ref counted ICommonClock interface across all clients and automatically -// registering and unregistering a listener whenever there are CCHelper -// instances active in the process. -class CCHelper { - public: - CCHelper(); - ~CCHelper(); - - status_t isCommonTimeValid(bool* valid, uint32_t* timelineID); - status_t commonTimeToLocalTime(int64_t commonTime, int64_t* localTime); - status_t localTimeToCommonTime(int64_t localTime, int64_t* commonTime); - status_t getCommonTime(int64_t* commonTime); - status_t getCommonFreq(uint64_t* freq); - status_t getLocalTime(int64_t* localTime); - status_t getLocalFreq(uint64_t* freq); - - private: - class CommonClockListener : public BnCommonClockListener { - public: - void onTimelineChanged(uint64_t timelineID); - }; - - static bool verifyClock_l(); - - static Mutex lock_; - static sp<ICommonClock> common_clock_; - static sp<ICommonClockListener> common_clock_listener_; - static uint32_t ref_count_; -}; - - -} // namespace android -#endif // __CC_HELPER_H__ diff --git a/include/common_time/local_clock.h b/include/common_time/local_clock.h deleted file mode 100644 index 384c3dec01..0000000000 --- a/include/common_time/local_clock.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -#ifndef __LOCAL_CLOCK_H__ -#define __LOCAL_CLOCK_H__ - -#include <stdint.h> - -#include <hardware/local_time_hal.h> -#include <utils/Errors.h> -#include <utils/threads.h> - -namespace android { - -class LocalClock { - public: - LocalClock(); - - bool initCheck(); - - int64_t getLocalTime(); - uint64_t getLocalFreq(); - status_t setLocalSlew(int16_t rate); - int32_t getDebugLog(struct local_time_debug_event* records, - int max_records); - - private: - static Mutex dev_lock_; - static local_time_hw_device_t* dev_; -}; - -} // namespace android -#endif // __LOCAL_CLOCK_H__ diff --git a/media/OWNERS b/media/OWNERS index d49eb8d9a7..1f687a2d68 100644 --- a/media/OWNERS +++ b/media/OWNERS @@ -15,5 +15,6 @@ pmclean@google.com rachad@google.com rago@google.com robertshih@google.com +taklee@google.com wjia@google.com wonsik@google.com diff --git a/media/audioserver/audioserver.rc b/media/audioserver/audioserver.rc index 75675a9705..1f2e82f542 100644 --- a/media/audioserver/audioserver.rc +++ b/media/audioserver/audioserver.rc @@ -2,7 +2,8 @@ service audioserver /system/bin/audioserver class core user audioserver # media gid needed for /dev/fm (radio) and for /data/misc/media (tee) - group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct + group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock + capabilities BLOCK_SUSPEND ioprio rt 4 writepid /dev/cpuset/foreground/tasks /dev/stune/foreground/tasks onrestart restart vendor.audio-hal-2-0 diff --git a/media/common_time/Android.mk b/media/common_time/Android.mk deleted file mode 100644 index aaa0db2899..0000000000 --- a/media/common_time/Android.mk +++ /dev/null @@ -1,24 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -# -# libcommon_time_client -# (binder marshalers for ICommonClock as well as common clock and local clock -# helper code) -# - -include $(CLEAR_VARS) - -LOCAL_MODULE := libcommon_time_client -LOCAL_MODULE_TAGS := optional -LOCAL_SRC_FILES := cc_helper.cpp \ - local_clock.cpp \ - ICommonClock.cpp \ - ICommonTimeConfig.cpp \ - utils.cpp -LOCAL_SHARED_LIBRARIES := libbinder \ - libhardware \ - libutils \ - liblog - -LOCAL_CFLAGS := -Wall -Werror - -include $(BUILD_SHARED_LIBRARY) diff --git a/media/common_time/ICommonClock.cpp b/media/common_time/ICommonClock.cpp deleted file mode 100644 index f1f1fcac7e..0000000000 --- a/media/common_time/ICommonClock.cpp +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <sys/socket.h> - -#include <common_time/ICommonClock.h> -#include <binder/Parcel.h> - -#include "utils.h" - -namespace android { - -/***** ICommonClock *****/ - -enum { - IS_COMMON_TIME_VALID = IBinder::FIRST_CALL_TRANSACTION, - COMMON_TIME_TO_LOCAL_TIME, - LOCAL_TIME_TO_COMMON_TIME, - GET_COMMON_TIME, - GET_COMMON_FREQ, - GET_LOCAL_TIME, - GET_LOCAL_FREQ, - GET_ESTIMATED_ERROR, - GET_TIMELINE_ID, - GET_STATE, - GET_MASTER_ADDRESS, - REGISTER_LISTENER, - UNREGISTER_LISTENER, -}; - -const String16 ICommonClock::kServiceName("common_time.clock"); -const uint64_t ICommonClock::kInvalidTimelineID = 0; -const int32_t ICommonClock::kErrorEstimateUnknown = 0x7FFFFFFF; - -class BpCommonClock : public BpInterface<ICommonClock> -{ - public: - explicit BpCommonClock(const sp<IBinder>& impl) - : BpInterface<ICommonClock>(impl) {} - - virtual status_t isCommonTimeValid(bool* valid, uint32_t* timelineID) { - Parcel data, reply; - data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - status_t status = remote()->transact(IS_COMMON_TIME_VALID, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *valid = reply.readInt32(); - *timelineID = reply.readInt32(); - } - } - return status; - } - - virtual status_t commonTimeToLocalTime(int64_t commonTime, - int64_t* localTime) { - Parcel data, reply; - data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - data.writeInt64(commonTime); - status_t status = remote()->transact(COMMON_TIME_TO_LOCAL_TIME, - data, &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *localTime = reply.readInt64(); - } - } - return status; - } - - virtual status_t localTimeToCommonTime(int64_t localTime, - int64_t* commonTime) { - Parcel data, reply; - data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - data.writeInt64(localTime); - status_t status = remote()->transact(LOCAL_TIME_TO_COMMON_TIME, - data, &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *commonTime = reply.readInt64(); - } - } - return status; - } - - virtual status_t getCommonTime(int64_t* commonTime) { - Parcel data, reply; - data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_COMMON_TIME, data, &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *commonTime = reply.readInt64(); - } - } - return status; - } - - virtual status_t getCommonFreq(uint64_t* freq) { - Parcel data, reply; - data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_COMMON_FREQ, data, &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *freq = reply.readInt64(); - } - } - return status; - } - - virtual status_t getLocalTime(int64_t* localTime) { - Parcel data, reply; - data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_LOCAL_TIME, data, &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *localTime = reply.readInt64(); - } - } - return status; - } - - virtual status_t getLocalFreq(uint64_t* freq) { - Parcel data, reply; - data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_LOCAL_FREQ, data, &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *freq = reply.readInt64(); - } - } - return status; - } - - virtual status_t getEstimatedError(int32_t* estimate) { - Parcel data, reply; - data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_ESTIMATED_ERROR, data, &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *estimate = reply.readInt32(); - } - } - return status; - } - - virtual status_t getTimelineID(uint64_t* id) { - Parcel data, reply; - data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_TIMELINE_ID, data, &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *id = static_cast<uint64_t>(reply.readInt64()); - } - } - return status; - } - - virtual status_t getState(State* state) { - Parcel data, reply; - data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_STATE, data, &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *state = static_cast<State>(reply.readInt32()); - } - } - return status; - } - - virtual status_t getMasterAddr(struct sockaddr_storage* addr) { - Parcel data, reply; - data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_MASTER_ADDRESS, data, &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) - deserializeSockaddr(&reply, addr); - } - return status; - } - - virtual status_t registerListener( - const sp<ICommonClockListener>& listener) { - Parcel data, reply; - data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - data.writeStrongBinder(IInterface::asBinder(listener)); - - status_t status = remote()->transact(REGISTER_LISTENER, data, &reply); - - if (status == OK) { - status = reply.readInt32(); - } - - return status; - } - - virtual status_t unregisterListener( - const sp<ICommonClockListener>& listener) { - Parcel data, reply; - data.writeInterfaceToken(ICommonClock::getInterfaceDescriptor()); - data.writeStrongBinder(IInterface::asBinder(listener)); - status_t status = remote()->transact(UNREGISTER_LISTENER, data, &reply); - - if (status == OK) { - status = reply.readInt32(); - } - - return status; - } -}; - -IMPLEMENT_META_INTERFACE(CommonClock, "android.os.ICommonClock"); - -status_t BnCommonClock::onTransact(uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags) { - switch(code) { - case IS_COMMON_TIME_VALID: { - CHECK_INTERFACE(ICommonClock, data, reply); - bool valid; - uint32_t timelineID; - status_t status = isCommonTimeValid(&valid, &timelineID); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt32(valid); - reply->writeInt32(timelineID); - } - return OK; - } break; - - case COMMON_TIME_TO_LOCAL_TIME: { - CHECK_INTERFACE(ICommonClock, data, reply); - int64_t commonTime = data.readInt64(); - int64_t localTime; - status_t status = commonTimeToLocalTime(commonTime, &localTime); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt64(localTime); - } - return OK; - } break; - - case LOCAL_TIME_TO_COMMON_TIME: { - CHECK_INTERFACE(ICommonClock, data, reply); - int64_t localTime = data.readInt64(); - int64_t commonTime; - status_t status = localTimeToCommonTime(localTime, &commonTime); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt64(commonTime); - } - return OK; - } break; - - case GET_COMMON_TIME: { - CHECK_INTERFACE(ICommonClock, data, reply); - int64_t commonTime; - status_t status = getCommonTime(&commonTime); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt64(commonTime); - } - return OK; - } break; - - case GET_COMMON_FREQ: { - CHECK_INTERFACE(ICommonClock, data, reply); - uint64_t freq; - status_t status = getCommonFreq(&freq); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt64(freq); - } - return OK; - } break; - - case GET_LOCAL_TIME: { - CHECK_INTERFACE(ICommonClock, data, reply); - int64_t localTime; - status_t status = getLocalTime(&localTime); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt64(localTime); - } - return OK; - } break; - - case GET_LOCAL_FREQ: { - CHECK_INTERFACE(ICommonClock, data, reply); - uint64_t freq; - status_t status = getLocalFreq(&freq); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt64(freq); - } - return OK; - } break; - - case GET_ESTIMATED_ERROR: { - CHECK_INTERFACE(ICommonClock, data, reply); - int32_t error; - status_t status = getEstimatedError(&error); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt32(error); - } - return OK; - } break; - - case GET_TIMELINE_ID: { - CHECK_INTERFACE(ICommonClock, data, reply); - uint64_t id; - status_t status = getTimelineID(&id); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt64(static_cast<int64_t>(id)); - } - return OK; - } break; - - case GET_STATE: { - CHECK_INTERFACE(ICommonClock, data, reply); - State state; - status_t status = getState(&state); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt32(static_cast<int32_t>(state)); - } - return OK; - } break; - - case GET_MASTER_ADDRESS: { - CHECK_INTERFACE(ICommonClock, data, reply); - struct sockaddr_storage addr; - status_t status = getMasterAddr(&addr); - - if ((status == OK) && !canSerializeSockaddr(&addr)) { - status = UNKNOWN_ERROR; - } - - reply->writeInt32(status); - - if (status == OK) { - serializeSockaddr(reply, &addr); - } - - return OK; - } break; - - case REGISTER_LISTENER: { - CHECK_INTERFACE(ICommonClock, data, reply); - sp<ICommonClockListener> listener = - interface_cast<ICommonClockListener>(data.readStrongBinder()); - status_t status = registerListener(listener); - reply->writeInt32(status); - return OK; - } break; - - case UNREGISTER_LISTENER: { - CHECK_INTERFACE(ICommonClock, data, reply); - sp<ICommonClockListener> listener = - interface_cast<ICommonClockListener>(data.readStrongBinder()); - status_t status = unregisterListener(listener); - reply->writeInt32(status); - return OK; - } break; - } - return BBinder::onTransact(code, data, reply, flags); -} - -/***** ICommonClockListener *****/ - -enum { - ON_TIMELINE_CHANGED = IBinder::FIRST_CALL_TRANSACTION, -}; - -class BpCommonClockListener : public BpInterface<ICommonClockListener> -{ - public: - explicit BpCommonClockListener(const sp<IBinder>& impl) - : BpInterface<ICommonClockListener>(impl) {} - - virtual void onTimelineChanged(uint64_t timelineID) { - Parcel data, reply; - data.writeInterfaceToken( - ICommonClockListener::getInterfaceDescriptor()); - data.writeInt64(timelineID); - remote()->transact(ON_TIMELINE_CHANGED, data, &reply); - } -}; - -IMPLEMENT_META_INTERFACE(CommonClockListener, - "android.os.ICommonClockListener"); - -status_t BnCommonClockListener::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { - case ON_TIMELINE_CHANGED: { - CHECK_INTERFACE(ICommonClockListener, data, reply); - uint32_t timelineID = data.readInt64(); - onTimelineChanged(timelineID); - return NO_ERROR; - } break; - } - - return BBinder::onTransact(code, data, reply, flags); -} - -}; // namespace android diff --git a/media/common_time/ICommonTimeConfig.cpp b/media/common_time/ICommonTimeConfig.cpp deleted file mode 100644 index e587b394c8..0000000000 --- a/media/common_time/ICommonTimeConfig.cpp +++ /dev/null @@ -1,509 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <sys/socket.h> - -#include <common_time/ICommonTimeConfig.h> -#include <binder/Parcel.h> - -#include "utils.h" - -namespace android { - -/***** ICommonTimeConfig *****/ - -enum { - GET_MASTER_ELECTION_PRIORITY = IBinder::FIRST_CALL_TRANSACTION, - SET_MASTER_ELECTION_PRIORITY, - GET_MASTER_ELECTION_ENDPOINT, - SET_MASTER_ELECTION_ENDPOINT, - GET_MASTER_ELECTION_GROUP_ID, - SET_MASTER_ELECTION_GROUP_ID, - GET_INTERFACE_BINDING, - SET_INTERFACE_BINDING, - GET_MASTER_ANNOUNCE_INTERVAL, - SET_MASTER_ANNOUNCE_INTERVAL, - GET_CLIENT_SYNC_INTERVAL, - SET_CLIENT_SYNC_INTERVAL, - GET_PANIC_THRESHOLD, - SET_PANIC_THRESHOLD, - GET_AUTO_DISABLE, - SET_AUTO_DISABLE, - FORCE_NETWORKLESS_MASTER_MODE, -}; - -const String16 ICommonTimeConfig::kServiceName("common_time.config"); - -class BpCommonTimeConfig : public BpInterface<ICommonTimeConfig> -{ - public: - explicit BpCommonTimeConfig(const sp<IBinder>& impl) - : BpInterface<ICommonTimeConfig>(impl) {} - - virtual status_t getMasterElectionPriority(uint8_t *priority) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_MASTER_ELECTION_PRIORITY, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *priority = static_cast<uint8_t>(reply.readInt32()); - } - } - - return status; - } - - virtual status_t setMasterElectionPriority(uint8_t priority) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - data.writeInt32(static_cast<int32_t>(priority)); - status_t status = remote()->transact(SET_MASTER_ELECTION_PRIORITY, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - } - - return status; - } - - virtual status_t getMasterElectionEndpoint(struct sockaddr_storage *addr) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_MASTER_ELECTION_ENDPOINT, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - deserializeSockaddr(&reply, addr); - } - } - - return status; - } - - virtual status_t setMasterElectionEndpoint( - const struct sockaddr_storage *addr) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - if (!canSerializeSockaddr(addr)) - return BAD_VALUE; - if (NULL == addr) { - data.writeInt32(0); - } else { - data.writeInt32(1); - serializeSockaddr(&data, addr); - } - status_t status = remote()->transact(SET_MASTER_ELECTION_ENDPOINT, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - } - - return status; - } - - virtual status_t getMasterElectionGroupId(uint64_t *id) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_MASTER_ELECTION_GROUP_ID, - data, - &reply); - - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *id = static_cast<uint64_t>(reply.readInt64()); - } - } - - return status; - } - - virtual status_t setMasterElectionGroupId(uint64_t id) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - data.writeInt64(id); - status_t status = remote()->transact(SET_MASTER_ELECTION_GROUP_ID, - data, - &reply); - - if (status == OK) { - status = reply.readInt32(); - } - - return status; - } - - virtual status_t getInterfaceBinding(String16& ifaceName) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_INTERFACE_BINDING, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - ifaceName = reply.readString16(); - } - } - - return status; - } - - virtual status_t setInterfaceBinding(const String16& ifaceName) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - data.writeString16(ifaceName); - status_t status = remote()->transact(SET_INTERFACE_BINDING, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - } - - return status; - } - - virtual status_t getMasterAnnounceInterval(int *interval) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_MASTER_ANNOUNCE_INTERVAL, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *interval = reply.readInt32(); - } - } - - return status; - } - - virtual status_t setMasterAnnounceInterval(int interval) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - data.writeInt32(interval); - status_t status = remote()->transact(SET_MASTER_ANNOUNCE_INTERVAL, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - } - - return status; - } - - virtual status_t getClientSyncInterval(int *interval) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_CLIENT_SYNC_INTERVAL, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *interval = reply.readInt32(); - } - } - - return status; - } - - virtual status_t setClientSyncInterval(int interval) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - data.writeInt32(interval); - status_t status = remote()->transact(SET_CLIENT_SYNC_INTERVAL, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - } - - return status; - } - - virtual status_t getPanicThreshold(int *threshold) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_PANIC_THRESHOLD, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *threshold = reply.readInt32(); - } - } - - return status; - } - - virtual status_t setPanicThreshold(int threshold) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - data.writeInt32(threshold); - status_t status = remote()->transact(SET_PANIC_THRESHOLD, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - } - - return status; - } - - virtual status_t getAutoDisable(bool *autoDisable) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - status_t status = remote()->transact(GET_AUTO_DISABLE, - data, - &reply); - if (status == OK) { - status = reply.readInt32(); - if (status == OK) { - *autoDisable = (0 != reply.readInt32()); - } - } - - return status; - } - - virtual status_t setAutoDisable(bool autoDisable) { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - data.writeInt32(autoDisable ? 1 : 0); - status_t status = remote()->transact(SET_AUTO_DISABLE, - data, - &reply); - - if (status == OK) { - status = reply.readInt32(); - } - - return status; - } - - virtual status_t forceNetworklessMasterMode() { - Parcel data, reply; - data.writeInterfaceToken(ICommonTimeConfig::getInterfaceDescriptor()); - status_t status = remote()->transact(FORCE_NETWORKLESS_MASTER_MODE, - data, - &reply); - - if (status == OK) { - status = reply.readInt32(); - } - - return status; - } -}; - -IMPLEMENT_META_INTERFACE(CommonTimeConfig, "android.os.ICommonTimeConfig"); - -status_t BnCommonTimeConfig::onTransact(uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags) { - switch(code) { - case GET_MASTER_ELECTION_PRIORITY: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - uint8_t priority; - status_t status = getMasterElectionPriority(&priority); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt32(static_cast<int32_t>(priority)); - } - return OK; - } break; - - case SET_MASTER_ELECTION_PRIORITY: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - uint8_t priority = static_cast<uint8_t>(data.readInt32()); - status_t status = setMasterElectionPriority(priority); - reply->writeInt32(status); - return OK; - } break; - - case GET_MASTER_ELECTION_ENDPOINT: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - struct sockaddr_storage addr; - status_t status = getMasterElectionEndpoint(&addr); - - if ((status == OK) && !canSerializeSockaddr(&addr)) { - status = UNKNOWN_ERROR; - } - - reply->writeInt32(status); - - if (status == OK) { - serializeSockaddr(reply, &addr); - } - - return OK; - } break; - - case SET_MASTER_ELECTION_ENDPOINT: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - struct sockaddr_storage addr; - int hasAddr = data.readInt32(); - - status_t status; - if (hasAddr) { - deserializeSockaddr(&data, &addr); - status = setMasterElectionEndpoint(&addr); - } else { - status = setMasterElectionEndpoint(&addr); - } - - reply->writeInt32(status); - return OK; - } break; - - case GET_MASTER_ELECTION_GROUP_ID: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - uint64_t id; - status_t status = getMasterElectionGroupId(&id); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt64(id); - } - return OK; - } break; - - case SET_MASTER_ELECTION_GROUP_ID: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - uint64_t id = static_cast<uint64_t>(data.readInt64()); - status_t status = setMasterElectionGroupId(id); - reply->writeInt32(status); - return OK; - } break; - - case GET_INTERFACE_BINDING: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - String16 ret; - status_t status = getInterfaceBinding(ret); - reply->writeInt32(status); - if (status == OK) { - reply->writeString16(ret); - } - return OK; - } break; - - case SET_INTERFACE_BINDING: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - String16 ifaceName; - ifaceName = data.readString16(); - status_t status = setInterfaceBinding(ifaceName); - reply->writeInt32(status); - return OK; - } break; - - case GET_MASTER_ANNOUNCE_INTERVAL: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - int interval; - status_t status = getMasterAnnounceInterval(&interval); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt32(interval); - } - return OK; - } break; - - case SET_MASTER_ANNOUNCE_INTERVAL: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - int interval = data.readInt32(); - status_t status = setMasterAnnounceInterval(interval); - reply->writeInt32(status); - return OK; - } break; - - case GET_CLIENT_SYNC_INTERVAL: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - int interval; - status_t status = getClientSyncInterval(&interval); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt32(interval); - } - return OK; - } break; - - case SET_CLIENT_SYNC_INTERVAL: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - int interval = data.readInt32(); - status_t status = setClientSyncInterval(interval); - reply->writeInt32(status); - return OK; - } break; - - case GET_PANIC_THRESHOLD: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - int threshold; - status_t status = getPanicThreshold(&threshold); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt32(threshold); - } - return OK; - } break; - - case SET_PANIC_THRESHOLD: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - int threshold = data.readInt32(); - status_t status = setPanicThreshold(threshold); - reply->writeInt32(status); - return OK; - } break; - - case GET_AUTO_DISABLE: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - bool autoDisable; - status_t status = getAutoDisable(&autoDisable); - reply->writeInt32(status); - if (status == OK) { - reply->writeInt32(autoDisable ? 1 : 0); - } - return OK; - } break; - - case SET_AUTO_DISABLE: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - bool autoDisable = (0 != data.readInt32()); - status_t status = setAutoDisable(autoDisable); - reply->writeInt32(status); - return OK; - } break; - - case FORCE_NETWORKLESS_MASTER_MODE: { - CHECK_INTERFACE(ICommonTimeConfig, data, reply); - status_t status = forceNetworklessMasterMode(); - reply->writeInt32(status); - return OK; - } break; - } - return BBinder::onTransact(code, data, reply, flags); -} - -}; // namespace android - diff --git a/media/common_time/MODULE_LICENSE_APACHE2 b/media/common_time/MODULE_LICENSE_APACHE2 deleted file mode 100644 index e69de29bb2..0000000000 --- a/media/common_time/MODULE_LICENSE_APACHE2 +++ /dev/null diff --git a/media/common_time/NOTICE b/media/common_time/NOTICE deleted file mode 100644 index c5b1efa7aa..0000000000 --- a/media/common_time/NOTICE +++ /dev/null @@ -1,190 +0,0 @@ - - Copyright (c) 2005-2008, The Android Open Source Project - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff --git a/media/common_time/cc_helper.cpp b/media/common_time/cc_helper.cpp deleted file mode 100644 index 6a7de74ac0..0000000000 --- a/media/common_time/cc_helper.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <stdint.h> - -#include <common_time/cc_helper.h> -#include <common_time/ICommonClock.h> -#include <utils/threads.h> - -namespace android { - -Mutex CCHelper::lock_; -sp<ICommonClock> CCHelper::common_clock_; -sp<ICommonClockListener> CCHelper::common_clock_listener_; -uint32_t CCHelper::ref_count_ = 0; - -bool CCHelper::verifyClock_l() { - bool ret = false; - - if (common_clock_ == NULL) { - common_clock_ = ICommonClock::getInstance(); - if (common_clock_ == NULL) - goto bailout; - } - - if (ref_count_ > 0) { - if (common_clock_listener_ == NULL) { - common_clock_listener_ = new CommonClockListener(); - if (common_clock_listener_ == NULL) - goto bailout; - - if (OK != common_clock_->registerListener(common_clock_listener_)) - goto bailout; - } - } - - ret = true; - -bailout: - if (!ret) { - common_clock_listener_ = NULL; - common_clock_ = NULL; - } - return ret; -} - -CCHelper::CCHelper() { - Mutex::Autolock lock(&lock_); - ref_count_++; - verifyClock_l(); -} - -CCHelper::~CCHelper() { - Mutex::Autolock lock(&lock_); - - assert(ref_count_ > 0); - ref_count_--; - - // If we were the last CCHelper instance in the system, and we had - // previously register a listener, unregister it now so that the common time - // service has the chance to go into auto-disabled mode. - if (!ref_count_ && - (common_clock_ != NULL) && - (common_clock_listener_ != NULL)) { - common_clock_->unregisterListener(common_clock_listener_); - common_clock_listener_ = NULL; - } -} - -void CCHelper::CommonClockListener::onTimelineChanged(uint64_t /*timelineID*/) { - // do nothing; listener is only really used as a token so the server can - // find out when clients die. -} - -// Helper methods which attempts to make calls to the common time binder -// service. If the first attempt fails with DEAD_OBJECT, the helpers will -// attempt to make a connection to the service again (assuming that the process -// hosting the service had crashed and the client proxy we are holding is dead) -// If the second attempt fails, or no connection can be made, the we let the -// error propagate up the stack and let the caller deal with the situation as -// best they can. -#define CCHELPER_METHOD(decl, call) \ - status_t CCHelper::decl { \ - Mutex::Autolock lock(&lock_); \ - \ - if (!verifyClock_l()) \ - return DEAD_OBJECT; \ - \ - status_t status = common_clock_->call; \ - if (DEAD_OBJECT == status) { \ - if (!verifyClock_l()) \ - return DEAD_OBJECT; \ - status = common_clock_->call; \ - } \ - \ - return status; \ - } - -#define VERIFY_CLOCK() - -CCHELPER_METHOD(isCommonTimeValid(bool* valid, uint32_t* timelineID), - isCommonTimeValid(valid, timelineID)) -CCHELPER_METHOD(commonTimeToLocalTime(int64_t commonTime, int64_t* localTime), - commonTimeToLocalTime(commonTime, localTime)) -CCHELPER_METHOD(localTimeToCommonTime(int64_t localTime, int64_t* commonTime), - localTimeToCommonTime(localTime, commonTime)) -CCHELPER_METHOD(getCommonTime(int64_t* commonTime), - getCommonTime(commonTime)) -CCHELPER_METHOD(getCommonFreq(uint64_t* freq), - getCommonFreq(freq)) -CCHELPER_METHOD(getLocalTime(int64_t* localTime), - getLocalTime(localTime)) -CCHELPER_METHOD(getLocalFreq(uint64_t* freq), - getLocalFreq(freq)) - -} // namespace android diff --git a/media/common_time/local_clock.cpp b/media/common_time/local_clock.cpp deleted file mode 100644 index a7c61fc76a..0000000000 --- a/media/common_time/local_clock.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2011 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "common_time" -#include <utils/Log.h> - -#include <assert.h> -#include <stdint.h> - -#include <common_time/local_clock.h> -#include <hardware/hardware.h> -#include <hardware/local_time_hal.h> -#include <utils/Errors.h> -#include <utils/threads.h> - -namespace android { - -Mutex LocalClock::dev_lock_; -local_time_hw_device_t* LocalClock::dev_ = NULL; - -LocalClock::LocalClock() { - int res; - const hw_module_t* mod; - - AutoMutex lock(&dev_lock_); - - if (dev_ != NULL) - return; - - res = hw_get_module_by_class(LOCAL_TIME_HARDWARE_MODULE_ID, NULL, &mod); - if (res) { - ALOGE("Failed to open local time HAL module (res = %d)", res); - } else { - res = local_time_hw_device_open(mod, &dev_); - if (res) { - ALOGE("Failed to open local time HAL device (res = %d)", res); - dev_ = NULL; - } - } -} - -bool LocalClock::initCheck() { - return (NULL != dev_); -} - -int64_t LocalClock::getLocalTime() { - assert(NULL != dev_); - assert(NULL != dev_->get_local_time); - - return dev_->get_local_time(dev_); -} - -uint64_t LocalClock::getLocalFreq() { - assert(NULL != dev_); - assert(NULL != dev_->get_local_freq); - - return dev_->get_local_freq(dev_); -} - -status_t LocalClock::setLocalSlew(int16_t rate) { - assert(NULL != dev_); - - if (!dev_->set_local_slew) - return INVALID_OPERATION; - - return static_cast<status_t>(dev_->set_local_slew(dev_, rate)); -} - -int32_t LocalClock::getDebugLog(struct local_time_debug_event* records, - int max_records) { - assert(NULL != dev_); - - if (!dev_->get_debug_log) - return INVALID_OPERATION; - - return dev_->get_debug_log(dev_, records, max_records); -} - -} // namespace android diff --git a/media/common_time/utils.cpp b/media/common_time/utils.cpp deleted file mode 100644 index 91cf2fd4b1..0000000000 --- a/media/common_time/utils.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include <arpa/inet.h> -#include <linux/socket.h> - -#include <binder/Parcel.h> - -namespace android { - -bool canSerializeSockaddr(const struct sockaddr_storage* addr) { - switch (addr->ss_family) { - case AF_INET: - case AF_INET6: - return true; - default: - return false; - } -} - -void serializeSockaddr(Parcel* p, const struct sockaddr_storage* addr) { - switch (addr->ss_family) { - case AF_INET: { - const struct sockaddr_in* s = - reinterpret_cast<const struct sockaddr_in*>(addr); - p->writeInt32(AF_INET); - p->writeInt32(ntohl(s->sin_addr.s_addr)); - p->writeInt32(static_cast<int32_t>(ntohs(s->sin_port))); - } break; - - case AF_INET6: { - const struct sockaddr_in6* s = - reinterpret_cast<const struct sockaddr_in6*>(addr); - const int32_t* a = - reinterpret_cast<const int32_t*>(s->sin6_addr.s6_addr); - p->writeInt32(AF_INET6); - p->writeInt32(ntohl(a[0])); - p->writeInt32(ntohl(a[1])); - p->writeInt32(ntohl(a[2])); - p->writeInt32(ntohl(a[3])); - p->writeInt32(static_cast<int32_t>(ntohs(s->sin6_port))); - p->writeInt32(ntohl(s->sin6_flowinfo)); - p->writeInt32(ntohl(s->sin6_scope_id)); - } break; - } -} - -void deserializeSockaddr(const Parcel* p, struct sockaddr_storage* addr) { - memset(addr, 0, sizeof(*addr)); - - addr->ss_family = p->readInt32(); - switch(addr->ss_family) { - case AF_INET: { - struct sockaddr_in* s = - reinterpret_cast<struct sockaddr_in*>(addr); - s->sin_addr.s_addr = htonl(p->readInt32()); - s->sin_port = htons(static_cast<uint16_t>(p->readInt32())); - } break; - - case AF_INET6: { - struct sockaddr_in6* s = - reinterpret_cast<struct sockaddr_in6*>(addr); - int32_t* a = reinterpret_cast<int32_t*>(s->sin6_addr.s6_addr); - - a[0] = htonl(p->readInt32()); - a[1] = htonl(p->readInt32()); - a[2] = htonl(p->readInt32()); - a[3] = htonl(p->readInt32()); - s->sin6_port = htons(static_cast<uint16_t>(p->readInt32())); - s->sin6_flowinfo = htonl(p->readInt32()); - s->sin6_scope_id = htonl(p->readInt32()); - } break; - } -} - -} // namespace android diff --git a/media/common_time/utils.h b/media/common_time/utils.h deleted file mode 100644 index ce79d0d74c..0000000000 --- a/media/common_time/utils.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ANDROID_LIBCOMMONCLOCK_UTILS_H -#define ANDROID_LIBCOMMONCLOCK_UTILS_H - -#include <linux/socket.h> - -#include <binder/Parcel.h> -#include <utils/Errors.h> - -namespace android { - -extern bool canSerializeSockaddr(const struct sockaddr_storage* addr); -extern void serializeSockaddr(Parcel* p, const struct sockaddr_storage* addr); -extern status_t deserializeSockaddr(const Parcel* p, - struct sockaddr_storage* addr); - -}; // namespace android - -#endif // ANDROID_LIBCOMMONCLOCK_UTILS_H diff --git a/media/extractors/mp3/XINGSeeker.cpp b/media/extractors/mp3/XINGSeeker.cpp index 95ca556b3e..01e06ca51d 100644 --- a/media/extractors/mp3/XINGSeeker.cpp +++ b/media/extractors/mp3/XINGSeeker.cpp @@ -44,7 +44,7 @@ bool XINGSeeker::getDuration(int64_t *durationUs) { } bool XINGSeeker::getOffsetForTime(int64_t *timeUs, off64_t *pos) { - if (mSizeBytes == 0 || !mTOCValid || mDurationUs < 0) { + if (mSizeBytes == 0 || mDurationUs < 0) { return false; } @@ -54,7 +54,7 @@ bool XINGSeeker::getOffsetForTime(int64_t *timeUs, off64_t *pos) { fx = 0.0f; } else if( percent >= 100.0f ) { fx = 256.0f; - } else { + } else if (mTOCValid) { int a = (int)percent; float fa, fb; if ( a == 0 ) { @@ -68,6 +68,8 @@ bool XINGSeeker::getOffsetForTime(int64_t *timeUs, off64_t *pos) { fb = 256.0f; } fx = fa + (fb-fa)*(percent-a); + } else { + fx = percent * 2.56f; } *pos = (int)((1.0f/256.0f)*fx*mSizeBytes) + mFirstFramePos; diff --git a/media/libaaudio/include/aaudio/AAudio.h b/media/libaaudio/include/aaudio/AAudio.h index 5b29419535..1493b261e2 100644 --- a/media/libaaudio/include/aaudio/AAudio.h +++ b/media/libaaudio/include/aaudio/AAudio.h @@ -423,7 +423,7 @@ typedef struct AAudioStreamBuilderStruct AAudioStreamBuilder; * * @return pointer to a text representation of an AAudio result code. */ -AAUDIO_API const char * AAudio_convertResultToText(aaudio_result_t returnCode); +AAUDIO_API const char * AAudio_convertResultToText(aaudio_result_t returnCode) __INTRODUCED_IN(26); /** * The text is the ASCII symbol corresponding to the stream state, @@ -433,7 +433,8 @@ AAUDIO_API const char * AAudio_convertResultToText(aaudio_result_t returnCode); * * @return pointer to a text representation of an AAudio state. */ -AAUDIO_API const char * AAudio_convertStreamStateToText(aaudio_stream_state_t state); +AAUDIO_API const char * AAudio_convertStreamStateToText(aaudio_stream_state_t state) + __INTRODUCED_IN(26); // ============================================================ // StreamBuilder @@ -451,7 +452,8 @@ AAUDIO_API const char * AAudio_convertStreamStateToText(aaudio_stream_state_t st * * AAudioStreamBuilder_delete() must be called when you are done using the builder. */ -AAUDIO_API aaudio_result_t AAudio_createStreamBuilder(AAudioStreamBuilder** builder); +AAUDIO_API aaudio_result_t AAudio_createStreamBuilder(AAudioStreamBuilder** builder) + __INTRODUCED_IN(26); /** * Request an audio device identified device using an ID. @@ -464,7 +466,7 @@ AAUDIO_API aaudio_result_t AAudio_createStreamBuilder(AAudioStreamBuilder** buil * @param deviceId device identifier or AAUDIO_UNSPECIFIED */ AAUDIO_API void AAudioStreamBuilder_setDeviceId(AAudioStreamBuilder* builder, - int32_t deviceId); + int32_t deviceId) __INTRODUCED_IN(26); /** * Request a sample rate in Hertz. @@ -481,7 +483,7 @@ AAUDIO_API void AAudioStreamBuilder_setDeviceId(AAudioStreamBuilder* builder, * @param sampleRate frames per second. Common rates include 44100 and 48000 Hz. */ AAUDIO_API void AAudioStreamBuilder_setSampleRate(AAudioStreamBuilder* builder, - int32_t sampleRate); + int32_t sampleRate) __INTRODUCED_IN(26); /** * Request a number of channels for the stream. @@ -498,7 +500,7 @@ AAUDIO_API void AAudioStreamBuilder_setSampleRate(AAudioStreamBuilder* builder, * @param channelCount Number of channels desired. */ AAUDIO_API void AAudioStreamBuilder_setChannelCount(AAudioStreamBuilder* builder, - int32_t channelCount); + int32_t channelCount) __INTRODUCED_IN(26); /** * Identical to AAudioStreamBuilder_setChannelCount(). @@ -507,7 +509,7 @@ AAUDIO_API void AAudioStreamBuilder_setChannelCount(AAudioStreamBuilder* builder * @param samplesPerFrame Number of samples in a frame. */ AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* builder, - int32_t samplesPerFrame); + int32_t samplesPerFrame) __INTRODUCED_IN(26); /** * Request a sample data format, for example AAUDIO_FORMAT_PCM_I16. @@ -524,7 +526,7 @@ AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* buil * @param format common formats are AAUDIO_FORMAT_PCM_FLOAT and AAUDIO_FORMAT_PCM_I16. */ AAUDIO_API void AAudioStreamBuilder_setFormat(AAudioStreamBuilder* builder, - aaudio_format_t format); + aaudio_format_t format) __INTRODUCED_IN(26); /** * Request a mode for sharing the device. @@ -538,7 +540,7 @@ AAUDIO_API void AAudioStreamBuilder_setFormat(AAudioStreamBuilder* builder, * @param sharingMode AAUDIO_SHARING_MODE_SHARED or AAUDIO_SHARING_MODE_EXCLUSIVE */ AAUDIO_API void AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder* builder, - aaudio_sharing_mode_t sharingMode); + aaudio_sharing_mode_t sharingMode) __INTRODUCED_IN(26); /** * Request the direction for a stream. @@ -549,7 +551,7 @@ AAUDIO_API void AAudioStreamBuilder_setSharingMode(AAudioStreamBuilder* builder, * @param direction AAUDIO_DIRECTION_OUTPUT or AAUDIO_DIRECTION_INPUT */ AAUDIO_API void AAudioStreamBuilder_setDirection(AAudioStreamBuilder* builder, - aaudio_direction_t direction); + aaudio_direction_t direction) __INTRODUCED_IN(26); /** * Set the requested buffer capacity in frames. @@ -561,7 +563,7 @@ AAUDIO_API void AAudioStreamBuilder_setDirection(AAudioStreamBuilder* builder, * @param numFrames the desired buffer capacity in frames or AAUDIO_UNSPECIFIED */ AAUDIO_API void AAudioStreamBuilder_setBufferCapacityInFrames(AAudioStreamBuilder* builder, - int32_t numFrames); + int32_t numFrames) __INTRODUCED_IN(26); /** * Set the requested performance mode. @@ -578,7 +580,7 @@ AAUDIO_API void AAudioStreamBuilder_setBufferCapacityInFrames(AAudioStreamBuilde * @param mode the desired performance mode, eg. AAUDIO_PERFORMANCE_MODE_LOW_LATENCY */ AAUDIO_API void AAudioStreamBuilder_setPerformanceMode(AAudioStreamBuilder* builder, - aaudio_performance_mode_t mode); + aaudio_performance_mode_t mode) __INTRODUCED_IN(26); /** * Set the intended use case for the stream. @@ -595,7 +597,7 @@ AAUDIO_API void AAudioStreamBuilder_setPerformanceMode(AAudioStreamBuilder* buil * @param usage the desired usage, eg. AAUDIO_USAGE_GAME */ AAUDIO_API void AAudioStreamBuilder_setUsage(AAudioStreamBuilder* builder, - aaudio_usage_t usage); + aaudio_usage_t usage) __INTRODUCED_IN(28); /** * Set the type of audio data that the stream will carry. @@ -612,7 +614,7 @@ AAUDIO_API void AAudioStreamBuilder_setUsage(AAudioStreamBuilder* builder, * @param contentType the type of audio data, eg. AAUDIO_CONTENT_TYPE_SPEECH */ AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder, - aaudio_content_type_t contentType); + aaudio_content_type_t contentType) __INTRODUCED_IN(28); /** * Set the input (capture) preset for the stream. @@ -632,7 +634,7 @@ AAUDIO_API void AAudioStreamBuilder_setContentType(AAudioStreamBuilder* builder, * @param inputPreset the desired configuration for recording */ AAUDIO_API void AAudioStreamBuilder_setInputPreset(AAudioStreamBuilder* builder, - aaudio_input_preset_t inputPreset); + aaudio_input_preset_t inputPreset) __INTRODUCED_IN(28); /** Set the requested session ID. * @@ -662,7 +664,7 @@ AAUDIO_API void AAudioStreamBuilder_setInputPreset(AAudioStreamBuilder* builder, * @param sessionId an allocated sessionID or AAUDIO_SESSION_ID_ALLOCATE */ AAUDIO_API void AAudioStreamBuilder_setSessionId(AAudioStreamBuilder* builder, - aaudio_session_id_t sessionId); + aaudio_session_id_t sessionId) __INTRODUCED_IN(28); /** * Return one of these values from the data callback function. @@ -760,8 +762,7 @@ typedef aaudio_data_callback_result_t (*AAudioStream_dataCallback)( * to the callback functions. */ AAUDIO_API void AAudioStreamBuilder_setDataCallback(AAudioStreamBuilder* builder, - AAudioStream_dataCallback callback, - void *userData); + AAudioStream_dataCallback callback, void *userData) __INTRODUCED_IN(26); /** * Set the requested data callback buffer size in frames. @@ -787,7 +788,7 @@ AAUDIO_API void AAudioStreamBuilder_setDataCallback(AAudioStreamBuilder* builder * @param numFrames the desired buffer size in frames or AAUDIO_UNSPECIFIED */ AAUDIO_API void AAudioStreamBuilder_setFramesPerDataCallback(AAudioStreamBuilder* builder, - int32_t numFrames); + int32_t numFrames) __INTRODUCED_IN(26); /** * Prototype for the callback function that is passed to @@ -840,8 +841,7 @@ typedef void (*AAudioStream_errorCallback)( * to the callback functions. */ AAUDIO_API void AAudioStreamBuilder_setErrorCallback(AAudioStreamBuilder* builder, - AAudioStream_errorCallback callback, - void *userData); + AAudioStream_errorCallback callback, void *userData) __INTRODUCED_IN(26); /** * Open a stream based on the options in the StreamBuilder. @@ -854,7 +854,7 @@ AAUDIO_API void AAudioStreamBuilder_setErrorCallback(AAudioStreamBuilder* builde * @return AAUDIO_OK or a negative error. */ AAUDIO_API aaudio_result_t AAudioStreamBuilder_openStream(AAudioStreamBuilder* builder, - AAudioStream** stream); + AAudioStream** stream) __INTRODUCED_IN(26); /** * Delete the resources associated with the StreamBuilder. @@ -862,7 +862,8 @@ AAUDIO_API aaudio_result_t AAudioStreamBuilder_openStream(AAudioStreamBuilder* * @param builder reference provided by AAudio_createStreamBuilder() * @return AAUDIO_OK or a negative error. */ -AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder* builder); +AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder* builder) + __INTRODUCED_IN(26); // ============================================================ // Stream Control @@ -874,7 +875,7 @@ AAUDIO_API aaudio_result_t AAudioStreamBuilder_delete(AAudioStreamBuilder* buil * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. */ -AAUDIO_API aaudio_result_t AAudioStream_close(AAudioStream* stream); +AAUDIO_API aaudio_result_t AAudioStream_close(AAudioStream* stream) __INTRODUCED_IN(26); /** * Asynchronously request to start playing the stream. For output streams, one should @@ -885,7 +886,7 @@ AAUDIO_API aaudio_result_t AAudioStream_close(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. */ -AAUDIO_API aaudio_result_t AAudioStream_requestStart(AAudioStream* stream); +AAUDIO_API aaudio_result_t AAudioStream_requestStart(AAudioStream* stream) __INTRODUCED_IN(26); /** * Asynchronous request for the stream to pause. @@ -899,7 +900,7 @@ AAUDIO_API aaudio_result_t AAudioStream_requestStart(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. */ -AAUDIO_API aaudio_result_t AAudioStream_requestPause(AAudioStream* stream); +AAUDIO_API aaudio_result_t AAudioStream_requestPause(AAudioStream* stream) __INTRODUCED_IN(26); /** * Asynchronous request for the stream to flush. @@ -913,7 +914,7 @@ AAUDIO_API aaudio_result_t AAudioStream_requestPause(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. */ -AAUDIO_API aaudio_result_t AAudioStream_requestFlush(AAudioStream* stream); +AAUDIO_API aaudio_result_t AAudioStream_requestFlush(AAudioStream* stream) __INTRODUCED_IN(26); /** * Asynchronous request for the stream to stop. @@ -923,7 +924,7 @@ AAUDIO_API aaudio_result_t AAudioStream_requestFlush(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return AAUDIO_OK or a negative error. */ -AAUDIO_API aaudio_result_t AAudioStream_requestStop(AAudioStream* stream); +AAUDIO_API aaudio_result_t AAudioStream_requestStop(AAudioStream* stream) __INTRODUCED_IN(26); /** * Query the current state of the client, eg. AAUDIO_STREAM_STATE_PAUSING @@ -935,7 +936,7 @@ AAUDIO_API aaudio_result_t AAudioStream_requestStop(AAudioStream* stream); * * @param stream reference provided by AAudioStreamBuilder_openStream() */ -AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream); +AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream) __INTRODUCED_IN(26); /** * Wait until the current state no longer matches the input state. @@ -960,9 +961,8 @@ AAUDIO_API aaudio_stream_state_t AAudioStream_getState(AAudioStream* stream); * @return AAUDIO_OK or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_waitForStateChange(AAudioStream* stream, - aaudio_stream_state_t inputState, - aaudio_stream_state_t *nextState, - int64_t timeoutNanoseconds); + aaudio_stream_state_t inputState, aaudio_stream_state_t *nextState, + int64_t timeoutNanoseconds) __INTRODUCED_IN(26); // ============================================================ // Stream I/O @@ -989,9 +989,7 @@ AAUDIO_API aaudio_result_t AAudioStream_waitForStateChange(AAudioStream* stream, * @return The number of frames actually read or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_read(AAudioStream* stream, - void *buffer, - int32_t numFrames, - int64_t timeoutNanoseconds); + void *buffer, int32_t numFrames, int64_t timeoutNanoseconds) __INTRODUCED_IN(26); /** * Write data to the stream. @@ -1014,9 +1012,7 @@ AAUDIO_API aaudio_result_t AAudioStream_read(AAudioStream* stream, * @return The number of frames actually written or a negative error. */ AAUDIO_API aaudio_result_t AAudioStream_write(AAudioStream* stream, - const void *buffer, - int32_t numFrames, - int64_t timeoutNanoseconds); + const void *buffer, int32_t numFrames, int64_t timeoutNanoseconds) __INTRODUCED_IN(26); // ============================================================ // Stream - queries @@ -1039,7 +1035,7 @@ AAUDIO_API aaudio_result_t AAudioStream_write(AAudioStream* stream, * @return actual buffer size in frames or a negative error */ AAUDIO_API aaudio_result_t AAudioStream_setBufferSizeInFrames(AAudioStream* stream, - int32_t numFrames); + int32_t numFrames) __INTRODUCED_IN(26); /** * Query the maximum number of frames that can be filled without blocking. @@ -1047,7 +1043,7 @@ AAUDIO_API aaudio_result_t AAudioStream_setBufferSizeInFrames(AAudioStream* stre * @param stream reference provided by AAudioStreamBuilder_openStream() * @return buffer size in frames. */ -AAUDIO_API int32_t AAudioStream_getBufferSizeInFrames(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getBufferSizeInFrames(AAudioStream* stream) __INTRODUCED_IN(26); /** * Query the number of frames that the application should read or write at @@ -1062,7 +1058,7 @@ AAUDIO_API int32_t AAudioStream_getBufferSizeInFrames(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return burst size */ -AAUDIO_API int32_t AAudioStream_getFramesPerBurst(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getFramesPerBurst(AAudioStream* stream) __INTRODUCED_IN(26); /** * Query maximum buffer capacity in frames. @@ -1070,7 +1066,7 @@ AAUDIO_API int32_t AAudioStream_getFramesPerBurst(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return buffer capacity in frames */ -AAUDIO_API int32_t AAudioStream_getBufferCapacityInFrames(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getBufferCapacityInFrames(AAudioStream* stream) __INTRODUCED_IN(26); /** * Query the size of the buffer that will be passed to the dataProc callback @@ -1091,7 +1087,7 @@ AAUDIO_API int32_t AAudioStream_getBufferCapacityInFrames(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return callback buffer size in frames or AAUDIO_UNSPECIFIED */ -AAUDIO_API int32_t AAudioStream_getFramesPerDataCallback(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getFramesPerDataCallback(AAudioStream* stream) __INTRODUCED_IN(26); /** * An XRun is an Underrun or an Overrun. @@ -1108,13 +1104,13 @@ AAUDIO_API int32_t AAudioStream_getFramesPerDataCallback(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return the underrun or overrun count */ -AAUDIO_API int32_t AAudioStream_getXRunCount(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getXRunCount(AAudioStream* stream) __INTRODUCED_IN(26); /** * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual sample rate */ -AAUDIO_API int32_t AAudioStream_getSampleRate(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getSampleRate(AAudioStream* stream) __INTRODUCED_IN(26); /** * A stream has one or more channels of data. @@ -1123,7 +1119,7 @@ AAUDIO_API int32_t AAudioStream_getSampleRate(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual number of channels */ -AAUDIO_API int32_t AAudioStream_getChannelCount(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getChannelCount(AAudioStream* stream) __INTRODUCED_IN(26); /** * Identical to AAudioStream_getChannelCount(). @@ -1131,39 +1127,41 @@ AAUDIO_API int32_t AAudioStream_getChannelCount(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual number of samples frame */ -AAUDIO_API int32_t AAudioStream_getSamplesPerFrame(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getSamplesPerFrame(AAudioStream* stream) __INTRODUCED_IN(26); /** * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual device ID */ -AAUDIO_API int32_t AAudioStream_getDeviceId(AAudioStream* stream); +AAUDIO_API int32_t AAudioStream_getDeviceId(AAudioStream* stream) __INTRODUCED_IN(26); /** * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual data format */ -AAUDIO_API aaudio_format_t AAudioStream_getFormat(AAudioStream* stream); +AAUDIO_API aaudio_format_t AAudioStream_getFormat(AAudioStream* stream) __INTRODUCED_IN(26); /** * Provide actual sharing mode. * @param stream reference provided by AAudioStreamBuilder_openStream() * @return actual sharing mode */ -AAUDIO_API aaudio_sharing_mode_t AAudioStream_getSharingMode(AAudioStream* stream); +AAUDIO_API aaudio_sharing_mode_t AAudioStream_getSharingMode(AAudioStream* stream) + __INTRODUCED_IN(26); /** * Get the performance mode used by the stream. * * @param stream reference provided by AAudioStreamBuilder_openStream() */ -AAUDIO_API aaudio_performance_mode_t AAudioStream_getPerformanceMode(AAudioStream* stream); +AAUDIO_API aaudio_performance_mode_t AAudioStream_getPerformanceMode(AAudioStream* stream) + __INTRODUCED_IN(26); /** * @param stream reference provided by AAudioStreamBuilder_openStream() * @return direction */ -AAUDIO_API aaudio_direction_t AAudioStream_getDirection(AAudioStream* stream); +AAUDIO_API aaudio_direction_t AAudioStream_getDirection(AAudioStream* stream) __INTRODUCED_IN(26); /** * Passes back the number of frames that have been written since the stream was created. @@ -1176,7 +1174,7 @@ AAUDIO_API aaudio_direction_t AAudioStream_getDirection(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return frames written */ -AAUDIO_API int64_t AAudioStream_getFramesWritten(AAudioStream* stream); +AAUDIO_API int64_t AAudioStream_getFramesWritten(AAudioStream* stream) __INTRODUCED_IN(26); /** * Passes back the number of frames that have been read since the stream was created. @@ -1189,7 +1187,7 @@ AAUDIO_API int64_t AAudioStream_getFramesWritten(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return frames read */ -AAUDIO_API int64_t AAudioStream_getFramesRead(AAudioStream* stream); +AAUDIO_API int64_t AAudioStream_getFramesRead(AAudioStream* stream) __INTRODUCED_IN(26); /** * Passes back the session ID associated with this stream. @@ -1213,7 +1211,7 @@ AAUDIO_API int64_t AAudioStream_getFramesRead(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return session ID or AAUDIO_SESSION_ID_NONE */ -AAUDIO_API aaudio_session_id_t AAudioStream_getSessionId(AAudioStream* stream); +AAUDIO_API aaudio_session_id_t AAudioStream_getSessionId(AAudioStream* stream) __INTRODUCED_IN(28); /** * Passes back the time at which a particular frame was presented. @@ -1238,9 +1236,7 @@ AAUDIO_API aaudio_session_id_t AAudioStream_getSessionId(AAudioStream* stream); * @return AAUDIO_OK or a negative error */ AAUDIO_API aaudio_result_t AAudioStream_getTimestamp(AAudioStream* stream, - clockid_t clockid, - int64_t *framePosition, - int64_t *timeNanoseconds); + clockid_t clockid, int64_t *framePosition, int64_t *timeNanoseconds) __INTRODUCED_IN(26); /** * Return the use case for the stream. @@ -1250,7 +1246,7 @@ AAUDIO_API aaudio_result_t AAudioStream_getTimestamp(AAudioStream* stream, * @param stream reference provided by AAudioStreamBuilder_openStream() * @return frames read */ -AAUDIO_API aaudio_usage_t AAudioStream_getUsage(AAudioStream* stream); +AAUDIO_API aaudio_usage_t AAudioStream_getUsage(AAudioStream* stream) __INTRODUCED_IN(28); /** * Return the content type for the stream. @@ -1260,7 +1256,8 @@ AAUDIO_API aaudio_usage_t AAudioStream_getUsage(AAudioStream* stream); * @param stream reference provided by AAudioStreamBuilder_openStream() * @return content type, for example AAUDIO_CONTENT_TYPE_MUSIC */ -AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* stream); +AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* stream) + __INTRODUCED_IN(28); /** * Return the input preset for the stream. @@ -1270,7 +1267,8 @@ AAUDIO_API aaudio_content_type_t AAudioStream_getContentType(AAudioStream* strea * @param stream reference provided by AAudioStreamBuilder_openStream() * @return input preset, for example AAUDIO_INPUT_PRESET_CAMCORDER */ -AAUDIO_API aaudio_input_preset_t AAudioStream_getInputPreset(AAudioStream* stream); +AAUDIO_API aaudio_input_preset_t AAudioStream_getInputPreset(AAudioStream* stream) + __INTRODUCED_IN(28); #ifdef __cplusplus } diff --git a/media/libeffects/config/include/media/EffectsConfig.h b/media/libeffects/config/include/media/EffectsConfig.h index 55b946f620..fa0415bbdc 100644 --- a/media/libeffects/config/include/media/EffectsConfig.h +++ b/media/libeffects/config/include/media/EffectsConfig.h @@ -96,7 +96,7 @@ struct ParsingResult { /** Parsed config, nullptr if the xml lib could not load the file */ std::unique_ptr<Config> parsedConfig; size_t nbSkippedElement; //< Number of skipped invalid library, effect or processing chain - const char* configPath; //< Path to the loaded configuration + const std::string configPath; //< Path to the loaded configuration }; /** Parses the provided effect configuration. diff --git a/media/libeffects/config/src/EffectsConfig.cpp b/media/libeffects/config/src/EffectsConfig.cpp index d79501ff48..351b1ee8c8 100644 --- a/media/libeffects/config/src/EffectsConfig.cpp +++ b/media/libeffects/config/src/EffectsConfig.cpp @@ -250,14 +250,14 @@ bool parseStream(const XMLElement& xmlStream, Effects& effects, std::vector<Stre return true; } -/** Internal version of the public parse(const char* path) with precondition `path != nullptr`. */ -ParsingResult parseWithPath(const char* path) { +/** Internal version of the public parse(const char* path) where path always exist. */ +ParsingResult parseWithPath(std::string&& path) { XMLDocument doc; - doc.LoadFile(path); + doc.LoadFile(path.c_str()); if (doc.Error()) { - ALOGE("Failed to parse %s: Tinyxml2 error (%d): %s", path, + ALOGE("Failed to parse %s: Tinyxml2 error (%d): %s", path.c_str(), doc.ErrorID(), doc.ErrorStr()); - return {nullptr, 0, path}; + return {nullptr, 0, std::move(path)}; } auto config = std::make_unique<Config>(); @@ -295,7 +295,7 @@ ParsingResult parseWithPath(const char* path) { } } } - return {std::move(config), nbSkippedElements, path}; + return {std::move(config), nbSkippedElements, std::move(path)}; } }; // namespace @@ -310,14 +310,14 @@ ParsingResult parse(const char* path) { if (access(defaultPath.c_str(), R_OK) != 0) { continue; } - auto result = parseWithPath(defaultPath.c_str()); + auto result = parseWithPath(std::move(defaultPath)); if (result.parsedConfig != nullptr) { return result; } } ALOGE("Could not parse effect configuration in any of the default locations."); - return {nullptr, 0, nullptr}; + return {nullptr, 0, ""}; } } // namespace effectsConfig diff --git a/media/libeffects/factory/EffectsXmlConfigLoader.cpp b/media/libeffects/factory/EffectsXmlConfigLoader.cpp index 7a7d431d99..052a88b585 100644 --- a/media/libeffects/factory/EffectsXmlConfigLoader.cpp +++ b/media/libeffects/factory/EffectsXmlConfigLoader.cpp @@ -327,7 +327,8 @@ extern "C" ssize_t EffectLoadXmlEffectConfig(const char* path) &gSkippedEffects, &gSubEffectList); ALOGE_IF(result.nbSkippedElement != 0, "%zu errors during loading of configuration: %s", - result.nbSkippedElement, result.configPath ?: "No config file found"); + result.nbSkippedElement, + result.configPath.empty() ? "No config file found" : result.configPath.c_str()); return result.nbSkippedElement; } diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp index 04c269228a..53d266a51b 100644 --- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp +++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp @@ -1198,13 +1198,7 @@ void LvmEffect_free(EffectContext *pContext){ for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){ if (MemTab.Region[i].Size != 0){ if (MemTab.Region[i].pBaseAddress != NULL){ - ALOGV("\tLvmEffect_free - START freeing %" PRIu32 " bytes for region %u at %p\n", - MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress); - free(MemTab.Region[i].pBaseAddress); - - ALOGV("\tLvmEffect_free - END freeing %" PRIu32 " bytes for region %u at %p\n", - MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress); }else{ ALOGV("\tLVM_ERROR : LvmEffect_free - trying to free with NULL pointer %" PRIu32 " bytes for region %u at %p ERROR\n", diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp index e1c03f9eb8..686ec4c976 100644 --- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp +++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp @@ -612,13 +612,7 @@ void Reverb_free(ReverbContext *pContext){ for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){ if (MemTab.Region[i].Size != 0){ if (MemTab.Region[i].pBaseAddress != NULL){ - ALOGV("\tfree() - START freeing %" PRIu32 " bytes for region %u at %p\n", - MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress); - free(MemTab.Region[i].pBaseAddress); - - ALOGV("\tfree() - END freeing %" PRIu32 " bytes for region %u at %p\n", - MemTab.Region[i].Size, i, MemTab.Region[i].pBaseAddress); }else{ ALOGV("\tLVM_ERROR : free() - trying to free with NULL pointer %" PRIu32 " bytes " "for region %u at %p ERROR\n", diff --git a/media/libeffects/preprocessing/PreProcessing.cpp b/media/libeffects/preprocessing/PreProcessing.cpp index f2844edfc3..b914f4bd24 100644 --- a/media/libeffects/preprocessing/PreProcessing.cpp +++ b/media/libeffects/preprocessing/PreProcessing.cpp @@ -889,7 +889,7 @@ error: delete session->procFrame; session->procFrame = NULL; delete session->apm; - session->apm = NULL; + session->apm = NULL; // NOLINT(clang-analyzer-cplusplus.NewDelete) } return status; } diff --git a/media/libmedia/Android.bp b/media/libmedia/Android.bp index 1a1d6b3f12..1b3a1bea8f 100644 --- a/media/libmedia/Android.bp +++ b/media/libmedia/Android.bp @@ -41,6 +41,7 @@ cc_library_shared { vndk: { enabled: true, }, + double_loadable: true, srcs: [ "aidl/android/IGraphicBufferSource.aidl", diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp index aade69a093..e0f5a40092 100644 --- a/media/libmedia/MediaProfiles.cpp +++ b/media/libmedia/MediaProfiles.cpp @@ -546,8 +546,8 @@ void MediaProfiles::checkAndAddRequiredProfilesIfNecessary() { if (info->mHasRefProfile) { - CamcorderProfile *profile = - new CamcorderProfile( + std::unique_ptr<CamcorderProfile> profile = + std::make_unique<CamcorderProfile>( *mCamcorderProfiles[info->mRefProfileIndex]); // Overwrite the quality @@ -581,7 +581,7 @@ void MediaProfiles::checkAndAddRequiredProfilesIfNecessary() { mCamcorderProfiles[info->mRefProfileIndex]->mQuality, profile->mQuality, cameraId); - mCamcorderProfiles.add(profile); + mCamcorderProfiles.add(profile.release()); } } } diff --git a/media/libmedia/exports.lds b/media/libmedia/exports.lds index b09fbce81e..904a7f72e5 100644 --- a/media/libmedia/exports.lds +++ b/media/libmedia/exports.lds @@ -3,5 +3,5 @@ *; local: _ZN7android13MidiIoWrapper*; - _ZTVN7android13MidiIoWrapperE; + _ZTVN7android13MidiIoWrapperE*; }; diff --git a/media/libmediaplayer2/nuplayer2/Android.bp b/media/libmediaplayer2/nuplayer2/Android.bp index c40b36141f..1634f35409 100644 --- a/media/libmediaplayer2/nuplayer2/Android.bp +++ b/media/libmediaplayer2/nuplayer2/Android.bp @@ -58,8 +58,6 @@ cc_library_static { name: "libstagefright_nuplayer2", - tags: ["eng"], - sanitize: { cfi: true, diag: { diff --git a/media/libmediaplayerservice/nuplayer/Android.bp b/media/libmediaplayerservice/nuplayer/Android.bp index 645bb7a90a..a4da5648db 100644 --- a/media/libmediaplayerservice/nuplayer/Android.bp +++ b/media/libmediaplayerservice/nuplayer/Android.bp @@ -54,8 +54,6 @@ cc_library_static { name: "libstagefright_nuplayer", - tags: ["eng"], - sanitize: { cfi: true, diag: { diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp index 3a28bbd9f4..57a01980fb 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerRenderer.cpp @@ -358,8 +358,12 @@ status_t NuPlayer::Renderer::getCurrentPosition(int64_t *mediaUs) { // AudioSink has rendered some frames. int64_t nowUs = ALooper::GetNowUs(); - int64_t nowMediaUs = mAudioSink->getPlayedOutDurationUs(nowUs) - + mAudioFirstAnchorTimeMediaUs; + int64_t playedOutDurationUs = mAudioSink->getPlayedOutDurationUs(nowUs); + if (playedOutDurationUs == 0) { + *mediaUs = mAudioFirstAnchorTimeMediaUs; + return OK; + } + int64_t nowMediaUs = playedOutDurationUs + mAudioFirstAnchorTimeMediaUs; mMediaClock->updateAnchor(nowMediaUs, nowUs, -1); } diff --git a/media/libmediaplayerservice/tests/Android.bp b/media/libmediaplayerservice/tests/Android.bp index e936bdd015..e86b68a735 100644 --- a/media/libmediaplayerservice/tests/Android.bp +++ b/media/libmediaplayerservice/tests/Android.bp @@ -2,8 +2,6 @@ cc_test { name: "DrmSessionManager_test", - tags: ["tests"], - srcs: ["DrmSessionManager_test.cpp"], shared_libs: [ diff --git a/media/libstagefright/codecs/m4v_h263/dec/src/pvdec_api.cpp b/media/libstagefright/codecs/m4v_h263/dec/src/pvdec_api.cpp index 8d5d0712b3..75ca8467f2 100644 --- a/media/libstagefright/codecs/m4v_h263/dec/src/pvdec_api.cpp +++ b/media/libstagefright/codecs/m4v_h263/dec/src/pvdec_api.cpp @@ -107,6 +107,7 @@ OSCL_EXPORT_REF Bool PVInitVideoDecoder(VideoDecControls *decCtrl, uint8 *volbuf #else if ((size_t)nLayers > SIZE_MAX / sizeof(Vol *)) { status = PV_FALSE; + oscl_free(video); goto fail; } @@ -115,7 +116,8 @@ OSCL_EXPORT_REF Bool PVInitVideoDecoder(VideoDecControls *decCtrl, uint8 *volbuf if (video->vol == NULL) status = PV_FALSE; video->memoryUsage += nLayers * sizeof(Vol *); - + /* be sure not to leak any previous state */ + PVCleanUpVideoDecoder(decCtrl); /* we need to setup this pointer for the application to */ /* pass it around. */ decCtrl->videoDecoderData = (void *) video; diff --git a/media/libstagefright/exports.lds b/media/libstagefright/exports.lds index 59dfc492f7..aabc233f90 100644 --- a/media/libstagefright/exports.lds +++ b/media/libstagefright/exports.lds @@ -9,51 +9,51 @@ _ZN7android16SoftwareRenderer*; ABGRToARGB; ABGRToI420; - ABGRToUVRow_Any_NEON; + ABGRToUVRow_Any_NEON*; ABGRToUVRow_C; - ABGRToUVRow_NEON; - ABGRToYRow_Any_NEON; + ABGRToUVRow_NEON*; + ABGRToYRow_Any_NEON*; ABGRToYRow_C; - ABGRToYRow_NEON; + ABGRToYRow_NEON*; Android420ToI420; ARGB1555ToARGB; - ARGB1555ToARGBRow_Any_NEON; + ARGB1555ToARGBRow_Any_NEON*; ARGB1555ToARGBRow_C; - ARGB1555ToARGBRow_NEON; + ARGB1555ToARGBRow_NEON*; ARGB1555ToI420; - ARGB1555ToUVRow_Any_NEON; + ARGB1555ToUVRow_Any_NEON*; ARGB1555ToUVRow_C; - ARGB1555ToUVRow_NEON; - ARGB1555ToYRow_Any_NEON; + ARGB1555ToUVRow_NEON*; + ARGB1555ToYRow_Any_NEON*; ARGB1555ToYRow_C; - ARGB1555ToYRow_NEON; + ARGB1555ToYRow_NEON*; ARGB4444ToARGB; - ARGB4444ToARGBRow_Any_NEON; + ARGB4444ToARGBRow_Any_NEON*; ARGB4444ToARGBRow_C; - ARGB4444ToARGBRow_NEON; + ARGB4444ToARGBRow_NEON*; ARGB4444ToI420; - ARGB4444ToUVRow_Any_NEON; + ARGB4444ToUVRow_Any_NEON*; ARGB4444ToUVRow_C; - ARGB4444ToUVRow_NEON; - ARGB4444ToYRow_Any_NEON; + ARGB4444ToUVRow_NEON*; + ARGB4444ToYRow_Any_NEON*; ARGB4444ToYRow_C; - ARGB4444ToYRow_NEON; + ARGB4444ToYRow_NEON*; ARGBAdd; - ARGBAddRow_Any_NEON; + ARGBAddRow_Any_NEON*; ARGBAddRow_C; - ARGBAddRow_NEON; + ARGBAddRow_NEON*; ARGBAffineRow_C; ARGBAttenuate; - ARGBAttenuateRow_Any_NEON; + ARGBAttenuateRow_Any_NEON*; ARGBAttenuateRow_C; - ARGBAttenuateRow_NEON; + ARGBAttenuateRow_NEON*; ARGBBlend; ARGBBlendRow_C; - ARGBBlendRow_NEON; + ARGBBlendRow_NEON*; ARGBBlur; ARGBColorMatrix; ARGBColorMatrixRow_C; - ARGBColorMatrixRow_NEON; + ARGBColorMatrixRow_NEON*; ARGBColorTable; ARGBColorTableRow_C; ARGBComputeCumulativeSum; @@ -63,97 +63,97 @@ ARGBCopyYToAlpha; ARGBCopyYToAlphaRow_C; ARGBExtractAlpha; - ARGBExtractAlphaRow_Any_NEON; + ARGBExtractAlphaRow_Any_NEON*; ARGBExtractAlphaRow_C; - ARGBExtractAlphaRow_NEON; + ARGBExtractAlphaRow_NEON*; ARGBGray; ARGBGrayRow_C; - ARGBGrayRow_NEON; + ARGBGrayRow_NEON*; ARGBGrayTo; ARGBInterpolate; ARGBLumaColorTable; ARGBLumaColorTableRow_C; ARGBMirror; - ARGBMirrorRow_Any_NEON; + ARGBMirrorRow_Any_NEON*; ARGBMirrorRow_C; - ARGBMirrorRow_NEON; + ARGBMirrorRow_NEON*; ARGBMultiply; - ARGBMultiplyRow_Any_NEON; + ARGBMultiplyRow_Any_NEON*; ARGBMultiplyRow_C; - ARGBMultiplyRow_NEON; + ARGBMultiplyRow_NEON*; ARGBPolynomial; ARGBPolynomialRow_C; ARGBQuantize; ARGBQuantizeRow_C; - ARGBQuantizeRow_NEON; + ARGBQuantizeRow_NEON*; ARGBRect; ARGBSepia; ARGBSepiaRow_C; - ARGBSepiaRow_NEON; - ARGBSetRow_Any_NEON; + ARGBSepiaRow_NEON*; + ARGBSetRow_Any_NEON*; ARGBSetRow_C; - ARGBSetRow_NEON; + ARGBSetRow_NEON*; ARGBShade; ARGBShadeRow_C; - ARGBShadeRow_NEON; + ARGBShadeRow_NEON*; ARGBShuffle; - ARGBShuffleRow_Any_NEON; + ARGBShuffleRow_Any_NEON*; ARGBShuffleRow_C; - ARGBShuffleRow_NEON; + ARGBShuffleRow_NEON*; ARGBSobel; ARGBSobelToPlane; ARGBSobelXY; ARGBSubtract; - ARGBSubtractRow_Any_NEON; + ARGBSubtractRow_Any_NEON*; ARGBSubtractRow_C; - ARGBSubtractRow_NEON; + ARGBSubtractRow_NEON*; ARGBToABGR; - ARGBToARGB1555Row_Any_NEON; + ARGBToARGB1555Row_Any_NEON*; ARGBToARGB1555Row_C; - ARGBToARGB1555Row_NEON; - ARGBToARGB4444Row_Any_NEON; + ARGBToARGB1555Row_NEON*; + ARGBToARGB4444Row_Any_NEON*; ARGBToARGB4444Row_C; - ARGBToARGB4444Row_NEON; + ARGBToARGB4444Row_NEON*; ARGBToBGRA; ARGBToI420; - ARGBToRAWRow_Any_NEON; + ARGBToRAWRow_Any_NEON*; ARGBToRAWRow_C; - ARGBToRAWRow_NEON; - ARGBToRGB24Row_Any_NEON; + ARGBToRAWRow_NEON*; + ARGBToRGB24Row_Any_NEON*; ARGBToRGB24Row_C; - ARGBToRGB24Row_NEON; - ARGBToRGB565DitherRow_Any_NEON; + ARGBToRGB24Row_NEON*; + ARGBToRGB565DitherRow_Any_NEON*; ARGBToRGB565DitherRow_C; - ARGBToRGB565DitherRow_NEON; - ARGBToRGB565Row_Any_NEON; + ARGBToRGB565DitherRow_NEON*; + ARGBToRGB565Row_Any_NEON*; ARGBToRGB565Row_C; - ARGBToRGB565Row_NEON; - ARGBToUV444Row_Any_NEON; + ARGBToRGB565Row_NEON*; + ARGBToUV444Row_Any_NEON*; ARGBToUV444Row_C; - ARGBToUV444Row_NEON; - ARGBToUVJRow_Any_NEON; + ARGBToUV444Row_NEON*; + ARGBToUVJRow_Any_NEON*; ARGBToUVJRow_C; - ARGBToUVJRow_NEON; - ARGBToUVRow_Any_NEON; + ARGBToUVJRow_NEON*; + ARGBToUVRow_Any_NEON*; ARGBToUVRow_C; - ARGBToUVRow_NEON; - ARGBToYJRow_Any_NEON; + ARGBToUVRow_NEON*; + ARGBToYJRow_Any_NEON*; ARGBToYJRow_C; - ARGBToYJRow_NEON; - ARGBToYRow_Any_NEON; + ARGBToYJRow_NEON*; + ARGBToYRow_Any_NEON*; ARGBToYRow_C; - ARGBToYRow_NEON; + ARGBToYRow_NEON*; ARGBUnattenuate; ARGBUnattenuateRow_C; - ArmCpuCaps; + ArmCpuCaps*; BGRAToARGB; BGRAToI420; - BGRAToUVRow_Any_NEON; + BGRAToUVRow_Any_NEON*; BGRAToUVRow_C; - BGRAToUVRow_NEON; - BGRAToYRow_Any_NEON; + BGRAToUVRow_NEON*; + BGRAToYRow_Any_NEON*; BGRAToYRow_C; - BGRAToYRow_NEON; + BGRAToYRow_NEON*; BlendPlane; BlendPlaneRow_C; CanonicalFourCC; @@ -162,11 +162,11 @@ CopyPlane; CopyPlane_16; CopyRow_16_C; - CopyRow_Any_NEON; + CopyRow_Any_NEON*; CopyRow_C; - CopyRow_NEON; - CpuId; - cpu_info_; + CopyRow_NEON*; + CpuId*; + cpu_info_*; CumulativeSumToAverageRow_C; FixedDiv1_C; FixedDiv_C; @@ -176,18 +176,18 @@ H420ToARGB; H422ToABGR; H422ToARGB; - HalfFloat1Row_Any_NEON; - HalfFloat1Row_NEON; + HalfFloat1Row_Any_NEON*; + HalfFloat1Row_NEON*; HalfFloatPlane; - HalfFloatRow_Any_NEON; + HalfFloatRow_Any_NEON*; HalfFloatRow_C; - HalfFloatRow_NEON; + HalfFloatRow_NEON*; I400Copy; I400Mirror; I400ToARGB; - I400ToARGBRow_Any_NEON; + I400ToARGBRow_Any_NEON*; I400ToARGBRow_C; - I400ToARGBRow_NEON; + I400ToARGBRow_NEON*; I400ToI400; I400ToI420; I420AlphaToABGR; @@ -216,59 +216,59 @@ I420ToRGBA; I420ToUYVY; I420ToYUY2; - I422AlphaToARGBRow_Any_NEON; + I422AlphaToARGBRow_Any_NEON*; I422AlphaToARGBRow_C; - I422AlphaToARGBRow_NEON; + I422AlphaToARGBRow_NEON*; I422Copy; I422ToABGR; I422ToARGB; - I422ToARGB1555Row_Any_NEON; + I422ToARGB1555Row_Any_NEON*; I422ToARGB1555Row_C; - I422ToARGB1555Row_NEON; - I422ToARGB4444Row_Any_NEON; + I422ToARGB1555Row_NEON*; + I422ToARGB4444Row_Any_NEON*; I422ToARGB4444Row_C; - I422ToARGB4444Row_NEON; - I422ToARGBRow_Any_NEON; + I422ToARGB4444Row_NEON*; + I422ToARGBRow_Any_NEON*; I422ToARGBRow_C; - I422ToARGBRow_NEON; + I422ToARGBRow_NEON*; I422ToBGRA; I422ToI420; - I422ToRGB24Row_Any_NEON; + I422ToRGB24Row_Any_NEON*; I422ToRGB24Row_C; - I422ToRGB24Row_NEON; + I422ToRGB24Row_NEON*; I422ToRGB565; - I422ToRGB565Row_Any_NEON; + I422ToRGB565Row_Any_NEON*; I422ToRGB565Row_C; - I422ToRGB565Row_NEON; + I422ToRGB565Row_NEON*; I422ToRGBA; - I422ToRGBARow_Any_NEON; + I422ToRGBARow_Any_NEON*; I422ToRGBARow_C; - I422ToRGBARow_NEON; + I422ToRGBARow_NEON*; I422ToUYVY; - I422ToUYVYRow_Any_NEON; + I422ToUYVYRow_Any_NEON*; I422ToUYVYRow_C; - I422ToUYVYRow_NEON; + I422ToUYVYRow_NEON*; I422ToYUY2; - I422ToYUY2Row_Any_NEON; + I422ToYUY2Row_Any_NEON*; I422ToYUY2Row_C; - I422ToYUY2Row_NEON; + I422ToYUY2Row_NEON*; I444Copy; I444ToABGR; I444ToARGB; - I444ToARGBRow_Any_NEON; + I444ToARGBRow_Any_NEON*; I444ToARGBRow_C; - I444ToARGBRow_NEON; + I444ToARGBRow_NEON*; I444ToI420; - InitCpuFlags; + InitCpuFlags*; InterpolatePlane; InterpolateRow_16_C; - InterpolateRow_Any_NEON; + InterpolateRow_Any_NEON*; InterpolateRow_C; - InterpolateRow_NEON; + InterpolateRow_NEON*; J400ToARGB; - J400ToARGBRow_Any_NEON; + J400ToARGBRow_Any_NEON*; J400ToARGBRow_C; - J400ToARGBRow_NEON; + J400ToARGBRow_NEON*; J420ToABGR; J420ToARGB; J422ToABGR; @@ -282,107 +282,107 @@ kYvuJPEGConstants; M420ToARGB; M420ToI420; - MaskCpuFlags; + MaskCpuFlags*; MergeUVPlane; - MergeUVRow_Any_NEON; + MergeUVRow_Any_NEON*; MergeUVRow_C; - MergeUVRow_NEON; - MipsCpuCaps; + MergeUVRow_NEON*; + MipsCpuCaps*; MirrorPlane; - MirrorRow_Any_NEON; + MirrorRow_Any_NEON*; MirrorRow_C; - MirrorRow_NEON; + MirrorRow_NEON*; MirrorUVRow_C; - MirrorUVRow_NEON; - NV12ToARGBRow_Any_NEON; + MirrorUVRow_NEON*; + NV12ToARGBRow_Any_NEON*; NV12ToARGBRow_C; - NV12ToARGBRow_NEON; + NV12ToARGBRow_NEON*; NV12ToI420; NV12ToRGB565; - NV12ToRGB565Row_Any_NEON; + NV12ToRGB565Row_Any_NEON*; NV12ToRGB565Row_C; - NV12ToRGB565Row_NEON; + NV12ToRGB565Row_NEON*; NV21ToARGB; - NV21ToARGBRow_Any_NEON; + NV21ToARGBRow_Any_NEON*; NV21ToARGBRow_C; - NV21ToARGBRow_NEON; + NV21ToARGBRow_NEON*; NV21ToI420; RAWToARGB; - RAWToARGBRow_Any_NEON; + RAWToARGBRow_Any_NEON*; RAWToARGBRow_C; - RAWToARGBRow_NEON; + RAWToARGBRow_NEON*; RAWToI420; RAWToRGB24; - RAWToRGB24Row_Any_NEON; + RAWToRGB24Row_Any_NEON*; RAWToRGB24Row_C; - RAWToRGB24Row_NEON; - RAWToUVRow_Any_NEON; + RAWToRGB24Row_NEON*; + RAWToUVRow_Any_NEON*; RAWToUVRow_C; - RAWToUVRow_NEON; - RAWToYRow_Any_NEON; + RAWToUVRow_NEON*; + RAWToYRow_Any_NEON*; RAWToYRow_C; - RAWToYRow_NEON; + RAWToYRow_NEON*; RGB24ToARGB; - RGB24ToARGBRow_Any_NEON; + RGB24ToARGBRow_Any_NEON*; RGB24ToARGBRow_C; - RGB24ToARGBRow_NEON; + RGB24ToARGBRow_NEON*; RGB24ToI420; - RGB24ToUVRow_Any_NEON; + RGB24ToUVRow_Any_NEON*; RGB24ToUVRow_C; - RGB24ToUVRow_NEON; - RGB24ToYRow_Any_NEON; + RGB24ToUVRow_NEON*; + RGB24ToYRow_Any_NEON*; RGB24ToYRow_C; - RGB24ToYRow_NEON; + RGB24ToYRow_NEON*; RGB565ToARGB; - RGB565ToARGBRow_Any_NEON; + RGB565ToARGBRow_Any_NEON*; RGB565ToARGBRow_C; - RGB565ToARGBRow_NEON; + RGB565ToARGBRow_NEON*; RGB565ToI420; - RGB565ToUVRow_Any_NEON; + RGB565ToUVRow_Any_NEON*; RGB565ToUVRow_C; - RGB565ToUVRow_NEON; - RGB565ToYRow_Any_NEON; + RGB565ToUVRow_NEON*; + RGB565ToYRow_Any_NEON*; RGB565ToYRow_C; - RGB565ToYRow_NEON; + RGB565ToYRow_NEON*; RGBAToARGB; RGBAToI420; - RGBAToUVRow_Any_NEON; + RGBAToUVRow_Any_NEON*; RGBAToUVRow_C; - RGBAToUVRow_NEON; - RGBAToYRow_Any_NEON; + RGBAToUVRow_NEON*; + RGBAToYRow_Any_NEON*; RGBAToYRow_C; - RGBAToYRow_NEON; + RGBAToYRow_NEON*; RGBColorMatrix; RGBColorTable; RGBColorTableRow_C; Scale; ScaleAddRow_16_C; ScaleAddRow_C; - ScaleAddRows_NEON; + ScaleAddRows_NEON*; ScaleARGBCols64_C; - ScaleARGBCols_Any_NEON; + ScaleARGBCols_Any_NEON*; ScaleARGBCols_C; - ScaleARGBCols_NEON; + ScaleARGBCols_NEON*; ScaleARGBColsUp2_C; ScaleARGBFilterCols64_C; - ScaleARGBFilterCols_Any_NEON; + ScaleARGBFilterCols_Any_NEON*; ScaleARGBFilterCols_C; - ScaleARGBFilterCols_NEON; - ScaleARGBRowDown2_Any_NEON; - ScaleARGBRowDown2Box_Any_NEON; + ScaleARGBFilterCols_NEON*; + ScaleARGBRowDown2_Any_NEON*; + ScaleARGBRowDown2Box_Any_NEON*; ScaleARGBRowDown2Box_C; - ScaleARGBRowDown2Box_NEON; + ScaleARGBRowDown2Box_NEON*; ScaleARGBRowDown2_C; - ScaleARGBRowDown2Linear_Any_NEON; + ScaleARGBRowDown2Linear_Any_NEON*; ScaleARGBRowDown2Linear_C; - ScaleARGBRowDown2Linear_NEON; - ScaleARGBRowDown2_NEON; - ScaleARGBRowDownEven_Any_NEON; - ScaleARGBRowDownEvenBox_Any_NEON; + ScaleARGBRowDown2Linear_NEON*; + ScaleARGBRowDown2_NEON*; + ScaleARGBRowDownEven_Any_NEON*; + ScaleARGBRowDownEvenBox_Any_NEON*; ScaleARGBRowDownEvenBox_C; - ScaleARGBRowDownEvenBox_NEON; + ScaleARGBRowDownEvenBox_NEON*; ScaleARGBRowDownEven_C; - ScaleARGBRowDownEven_NEON; + ScaleARGBRowDownEven_NEON*; ScaleCols_16_C; ScaleCols_C; ScaleColsUp2_16_C; @@ -390,11 +390,11 @@ ScaleFilterCols_16_C; ScaleFilterCols64_16_C; ScaleFilterCols64_C; - ScaleFilterCols_Any_NEON; + ScaleFilterCols_Any_NEON*; ScaleFilterCols_C; - ScaleFilterCols_NEON; + ScaleFilterCols_NEON*; ScaleFilterReduce; - ScaleFilterRows_NEON; + ScaleFilterRows_NEON*; ScaleOffset; ScalePlane; ScalePlane_16; @@ -405,104 +405,104 @@ ScalePlaneVertical; ScalePlaneVertical_16; ScaleRowDown2_16_C; - ScaleRowDown2_Any_NEON; + ScaleRowDown2_Any_NEON*; ScaleRowDown2Box_16_C; - ScaleRowDown2Box_Any_NEON; + ScaleRowDown2Box_Any_NEON*; ScaleRowDown2Box_C; - ScaleRowDown2Box_NEON; + ScaleRowDown2Box_NEON*; ScaleRowDown2Box_Odd_C; - ScaleRowDown2Box_Odd_NEON; + ScaleRowDown2Box_Odd_NEON*; ScaleRowDown2_C; ScaleRowDown2Linear_16_C; - ScaleRowDown2Linear_Any_NEON; + ScaleRowDown2Linear_Any_NEON*; ScaleRowDown2Linear_C; - ScaleRowDown2Linear_NEON; - ScaleRowDown2_NEON; + ScaleRowDown2Linear_NEON*; + ScaleRowDown2_NEON*; ScaleRowDown34_0_Box_16_C; - ScaleRowDown34_0_Box_Any_NEON; + ScaleRowDown34_0_Box_Any_NEON*; ScaleRowDown34_0_Box_C; - ScaleRowDown34_0_Box_NEON; + ScaleRowDown34_0_Box_NEON*; ScaleRowDown34_16_C; ScaleRowDown34_1_Box_16_C; - ScaleRowDown34_1_Box_Any_NEON; + ScaleRowDown34_1_Box_Any_NEON*; ScaleRowDown34_1_Box_C; - ScaleRowDown34_1_Box_NEON; - ScaleRowDown34_Any_NEON; + ScaleRowDown34_1_Box_NEON*; + ScaleRowDown34_Any_NEON*; ScaleRowDown34_C; - ScaleRowDown34_NEON; + ScaleRowDown34_NEON*; ScaleRowDown38_16_C; ScaleRowDown38_2_Box_16_C; - ScaleRowDown38_2_Box_Any_NEON; + ScaleRowDown38_2_Box_Any_NEON*; ScaleRowDown38_2_Box_C; - ScaleRowDown38_2_Box_NEON; + ScaleRowDown38_2_Box_NEON*; ScaleRowDown38_3_Box_16_C; - ScaleRowDown38_3_Box_Any_NEON; + ScaleRowDown38_3_Box_Any_NEON*; ScaleRowDown38_3_Box_C; - ScaleRowDown38_3_Box_NEON; - ScaleRowDown38_Any_NEON; + ScaleRowDown38_3_Box_NEON*; + ScaleRowDown38_Any_NEON*; ScaleRowDown38_C; - ScaleRowDown38_NEON; + ScaleRowDown38_NEON*; ScaleRowDown4_16_C; - ScaleRowDown4_Any_NEON; + ScaleRowDown4_Any_NEON*; ScaleRowDown4Box_16_C; - ScaleRowDown4Box_Any_NEON; + ScaleRowDown4Box_Any_NEON*; ScaleRowDown4Box_C; - ScaleRowDown4Box_NEON; + ScaleRowDown4Box_NEON*; ScaleRowDown4_C; - ScaleRowDown4_NEON; + ScaleRowDown4_NEON*; ScaleSlope; SetPlane; - SetRow_Any_NEON; + SetRow_Any_NEON*; SetRow_C; - SetRow_NEON; - SobelRow_Any_NEON; + SetRow_NEON*; + SobelRow_Any_NEON*; SobelRow_C; - SobelRow_NEON; - SobelToPlaneRow_Any_NEON; + SobelRow_NEON*; + SobelToPlaneRow_Any_NEON*; SobelToPlaneRow_C; - SobelToPlaneRow_NEON; + SobelToPlaneRow_NEON*; SobelXRow_C; - SobelXRow_NEON; - SobelXYRow_Any_NEON; + SobelXRow_NEON*; + SobelXYRow_Any_NEON*; SobelXYRow_C; - SobelXYRow_NEON; + SobelXYRow_NEON*; SobelYRow_C; - SobelYRow_NEON; + SobelYRow_NEON*; SplitUVPlane; - SplitUVRow_Any_NEON; + SplitUVRow_Any_NEON*; SplitUVRow_C; - SplitUVRow_NEON; + SplitUVRow_NEON*; UYVYToARGB; - UYVYToARGBRow_Any_NEON; + UYVYToARGBRow_Any_NEON*; UYVYToARGBRow_C; - UYVYToARGBRow_NEON; + UYVYToARGBRow_NEON*; UYVYToI420; UYVYToI422; UYVYToNV12; - UYVYToUV422Row_Any_NEON; + UYVYToUV422Row_Any_NEON*; UYVYToUV422Row_C; - UYVYToUV422Row_NEON; - UYVYToUVRow_Any_NEON; + UYVYToUV422Row_NEON*; + UYVYToUVRow_Any_NEON*; UYVYToUVRow_C; - UYVYToUVRow_NEON; - UYVYToYRow_Any_NEON; + UYVYToUVRow_NEON*; + UYVYToYRow_Any_NEON*; UYVYToYRow_C; - UYVYToYRow_NEON; + UYVYToYRow_NEON*; YUY2ToARGB; - YUY2ToARGBRow_Any_NEON; + YUY2ToARGBRow_Any_NEON*; YUY2ToARGBRow_C; - YUY2ToARGBRow_NEON; + YUY2ToARGBRow_NEON*; YUY2ToI420; YUY2ToI422; YUY2ToNV12; - YUY2ToUV422Row_Any_NEON; + YUY2ToUV422Row_Any_NEON*; YUY2ToUV422Row_C; - YUY2ToUV422Row_NEON; - YUY2ToUVRow_Any_NEON; + YUY2ToUV422Row_NEON*; + YUY2ToUVRow_Any_NEON*; YUY2ToUVRow_C; - YUY2ToUVRow_NEON; + YUY2ToUVRow_NEON*; YUY2ToY; - YUY2ToYRow_Any_NEON; + YUY2ToYRow_Any_NEON*; YUY2ToYRow_C; - YUY2ToYRow_NEON; + YUY2ToYRow_NEON*; }; diff --git a/media/libstagefright/foundation/AString.cpp b/media/libstagefright/foundation/AString.cpp index 04fac19486..c6ef75fca1 100644 --- a/media/libstagefright/foundation/AString.cpp +++ b/media/libstagefright/foundation/AString.cpp @@ -31,7 +31,7 @@ namespace android { // static -const char *AString::kEmptyString = ""; +constexpr const char *AString::kEmptyString; AString::AString() : mData((char *)kEmptyString), diff --git a/media/libstagefright/foundation/Android.bp b/media/libstagefright/foundation/Android.bp index f663542bfc..6b384c0182 100644 --- a/media/libstagefright/foundation/Android.bp +++ b/media/libstagefright/foundation/Android.bp @@ -10,6 +10,7 @@ cc_library { vndk: { enabled: true, }, + double_loadable: true, include_dirs: [ "frameworks/av/include", "frameworks/native/include", diff --git a/media/libstagefright/foundation/include/media/stagefright/foundation/AString.h b/media/libstagefright/foundation/include/media/stagefright/foundation/AString.h index ff086b3128..0f6299c91a 100644 --- a/media/libstagefright/foundation/include/media/stagefright/foundation/AString.h +++ b/media/libstagefright/foundation/include/media/stagefright/foundation/AString.h @@ -93,7 +93,7 @@ struct AString { status_t writeToParcel(Parcel *parcel) const; private: - static const char *kEmptyString; + constexpr static const char *kEmptyString = ""; char *mData; size_t mSize; diff --git a/media/libstagefright/http/HTTPHelper.cpp b/media/libstagefright/http/HTTPHelper.cpp index 77845e2096..b895f03b9a 100644 --- a/media/libstagefright/http/HTTPHelper.cpp +++ b/media/libstagefright/http/HTTPHelper.cpp @@ -42,11 +42,11 @@ sp<IMediaHTTPService> CreateHTTPServiceInCurrentJavaContext() { env, env->FindClass("android/media/MediaHTTPService")); CHECK(clazz.get() != NULL); - jmethodID constructID = env->GetMethodID(clazz.get(), "<init>", "()V"); + jmethodID constructID = env->GetMethodID(clazz.get(), "<init>", "(Ljava/util/List;)V"); CHECK(constructID != NULL); ScopedLocalRef<jobject> httpServiceObj( - env, env->NewObject(clazz.get(), constructID)); + env, env->NewObject(clazz.get(), constructID, NULL)); sp<IMediaHTTPService> httpService; if (httpServiceObj.get() != NULL) { diff --git a/media/mtp/PosixAsyncIO.cpp b/media/mtp/PosixAsyncIO.cpp index e67c568315..72c07ccf49 100644 --- a/media/mtp/PosixAsyncIO.cpp +++ b/media/mtp/PosixAsyncIO.cpp @@ -15,42 +15,109 @@ */ #include <android-base/logging.h> -#include <condition_variable> #include <memory> -#include <mutex> +#include <pthread.h> #include <queue> +#include <thread> #include <unistd.h> #include "PosixAsyncIO.h" namespace { -void read_func(struct aiocb *aiocbp) { - aiocbp->ret = TEMP_FAILURE_RETRY(pread(aiocbp->aio_fildes, - aiocbp->aio_buf, aiocbp->aio_nbytes, aiocbp->aio_offset)); - if (aiocbp->ret == -1) aiocbp->error = errno; +std::thread gWorkerThread; +std::deque<struct aiocb*> gWorkQueue; +bool gSuspended = true; +int gAiocbRefcount = 0; +std::mutex gLock; +std::condition_variable gWait; + +void work_func(void *) { + pthread_setname_np(pthread_self(), "AsyncIO work"); + while (true) { + struct aiocb *aiocbp; + { + std::unique_lock<std::mutex> lk(gLock); + gWait.wait(lk, []{return gWorkQueue.size() > 0 || gSuspended;}); + if (gSuspended) + return; + aiocbp = gWorkQueue.back(); + gWorkQueue.pop_back(); + } + CHECK(aiocbp->queued); + int ret; + if (aiocbp->read) { + ret = TEMP_FAILURE_RETRY(pread(aiocbp->aio_fildes, + aiocbp->aio_buf, aiocbp->aio_nbytes, aiocbp->aio_offset)); + } else { + ret = TEMP_FAILURE_RETRY(pwrite(aiocbp->aio_fildes, + aiocbp->aio_buf, aiocbp->aio_nbytes, aiocbp->aio_offset)); + } + { + std::unique_lock<std::mutex> lk(aiocbp->lock); + aiocbp->ret = ret; + if (aiocbp->ret == -1) { + aiocbp->error = errno; + } + aiocbp->queued = false; + } + aiocbp->cv.notify_all(); + } } -void write_func(struct aiocb *aiocbp) { - aiocbp->ret = TEMP_FAILURE_RETRY(pwrite(aiocbp->aio_fildes, - aiocbp->aio_buf, aiocbp->aio_nbytes, aiocbp->aio_offset)); - if (aiocbp->ret == -1) aiocbp->error = errno; +int aio_add(struct aiocb *aiocbp) { + CHECK(!aiocbp->queued); + aiocbp->queued = true; + { + std::unique_lock<std::mutex> lk(gLock); + gWorkQueue.push_front(aiocbp); + } + gWait.notify_one(); + return 0; } } // end anonymous namespace +aiocb::aiocb() { + this->ret = 0; + this->queued = false; + { + std::unique_lock<std::mutex> lk(gLock); + if (gAiocbRefcount == 0) { + CHECK(gWorkQueue.size() == 0); + CHECK(gSuspended); + gSuspended = false; + gWorkerThread = std::thread(work_func, nullptr); + } + gAiocbRefcount++; + } +} + aiocb::~aiocb() { - CHECK(!thread.joinable()); + CHECK(!this->queued); + { + std::unique_lock<std::mutex> lk(gLock); + CHECK(!gSuspended); + if (gAiocbRefcount == 1) { + CHECK(gWorkQueue.size() == 0); + gSuspended = true; + lk.unlock(); + gWait.notify_one(); + gWorkerThread.join(); + lk.lock(); + } + gAiocbRefcount--; + } } int aio_read(struct aiocb *aiocbp) { - aiocbp->thread = std::thread(read_func, aiocbp); - return 0; + aiocbp->read = true; + return aio_add(aiocbp); } int aio_write(struct aiocb *aiocbp) { - aiocbp->thread = std::thread(write_func, aiocbp); - return 0; + aiocbp->read = false; + return aio_add(aiocbp); } int aio_error(const struct aiocb *aiocbp) { @@ -64,7 +131,10 @@ ssize_t aio_return(struct aiocb *aiocbp) { int aio_suspend(struct aiocb *aiocbp[], int n, const struct timespec *) { for (int i = 0; i < n; i++) { - aiocbp[i]->thread.join(); + { + std::unique_lock<std::mutex> lk(aiocbp[i]->lock); + aiocbp[i]->cv.wait(lk, [aiocbp, i]{return !aiocbp[i]->queued;}); + } } return 0; } diff --git a/media/mtp/PosixAsyncIO.h b/media/mtp/PosixAsyncIO.h index 590aaefdc1..2bb57357b4 100644 --- a/media/mtp/PosixAsyncIO.h +++ b/media/mtp/PosixAsyncIO.h @@ -17,10 +17,11 @@ #ifndef _POSIXASYNCIO_H #define _POSIXASYNCIO_H +#include <condition_variable> +#include <mutex> #include <sys/cdefs.h> #include <sys/types.h> #include <time.h> -#include <thread> #include <unistd.h> /** @@ -35,10 +36,15 @@ struct aiocb { size_t aio_nbytes; // Used internally - std::thread thread; + bool read; + bool queued; ssize_t ret; int error; + std::mutex lock; + std::condition_variable cv; + + aiocb(); ~aiocb(); }; diff --git a/media/ndk/include/media/NdkImage.h b/media/ndk/include/media/NdkImage.h index 19df760ab3..f936118776 100644 --- a/media/ndk/include/media/NdkImage.h +++ b/media/ndk/include/media/NdkImage.h @@ -36,13 +36,12 @@ #ifndef _NDK_IMAGE_H #define _NDK_IMAGE_H +#include <stdint.h> #include <sys/cdefs.h> #include "NdkMediaError.h" -#if __ANDROID_API__ >= 26 #include <android/hardware_buffer.h> -#endif /* __ANDROID_API__ >= 26 */ __BEGIN_DECLS @@ -529,7 +528,7 @@ typedef struct AImageCropRect { * * @param image The {@link AImage} to be deleted. */ -void AImage_delete(AImage* image); +void AImage_delete(AImage* image) __INTRODUCED_IN(24); /** * Query the width of the input {@link AImage}. @@ -543,7 +542,7 @@ void AImage_delete(AImage* image); * <li>{@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this * image has been deleted.</li></ul> */ -media_status_t AImage_getWidth(const AImage* image, /*out*/int32_t* width); +media_status_t AImage_getWidth(const AImage* image, /*out*/int32_t* width) __INTRODUCED_IN(24); /** * Query the height of the input {@link AImage}. @@ -557,7 +556,7 @@ media_status_t AImage_getWidth(const AImage* image, /*out*/int32_t* width); * <li>{@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this * image has been deleted.</li></ul> */ -media_status_t AImage_getHeight(const AImage* image, /*out*/int32_t* height); +media_status_t AImage_getHeight(const AImage* image, /*out*/int32_t* height) __INTRODUCED_IN(24); /** * Query the format of the input {@link AImage}. @@ -573,7 +572,7 @@ media_status_t AImage_getHeight(const AImage* image, /*out*/int32_t* height); * <li>{@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this * image has been deleted.</li></ul> */ -media_status_t AImage_getFormat(const AImage* image, /*out*/int32_t* format); +media_status_t AImage_getFormat(const AImage* image, /*out*/int32_t* format) __INTRODUCED_IN(24); /** * Query the cropped rectangle of the input {@link AImage}. @@ -590,7 +589,7 @@ media_status_t AImage_getFormat(const AImage* image, /*out*/int32_t* format); * <li>{@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this * image has been deleted.</li></ul> */ -media_status_t AImage_getCropRect(const AImage* image, /*out*/AImageCropRect* rect); +media_status_t AImage_getCropRect(const AImage* image, /*out*/AImageCropRect* rect) __INTRODUCED_IN(24); /** * Query the timestamp of the input {@link AImage}. @@ -614,7 +613,7 @@ media_status_t AImage_getCropRect(const AImage* image, /*out*/AImageCropRect* re * <li>{@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this * image has been deleted.</li></ul> */ -media_status_t AImage_getTimestamp(const AImage* image, /*out*/int64_t* timestampNs); +media_status_t AImage_getTimestamp(const AImage* image, /*out*/int64_t* timestampNs) __INTRODUCED_IN(24); /** * Query the number of planes of the input {@link AImage}. @@ -632,7 +631,7 @@ media_status_t AImage_getTimestamp(const AImage* image, /*out*/int64_t* timestam * <li>{@link AMEDIA_ERROR_INVALID_OBJECT} if the {@link AImageReader} generated this * image has been deleted.</li></ul> */ -media_status_t AImage_getNumberOfPlanes(const AImage* image, /*out*/int32_t* numPlanes); +media_status_t AImage_getNumberOfPlanes(const AImage* image, /*out*/int32_t* numPlanes) __INTRODUCED_IN(24); /** * Query the pixel stride of the input {@link AImage}. @@ -660,7 +659,7 @@ media_status_t AImage_getNumberOfPlanes(const AImage* image, /*out*/int32_t* num * for CPU access.</li></ul> */ media_status_t AImage_getPlanePixelStride( - const AImage* image, int planeIdx, /*out*/int32_t* pixelStride); + const AImage* image, int planeIdx, /*out*/int32_t* pixelStride) __INTRODUCED_IN(24); /** * Query the row stride of the input {@link AImage}. @@ -687,7 +686,7 @@ media_status_t AImage_getPlanePixelStride( * for CPU access.</li></ul> */ media_status_t AImage_getPlaneRowStride( - const AImage* image, int planeIdx, /*out*/int32_t* rowStride); + const AImage* image, int planeIdx, /*out*/int32_t* rowStride) __INTRODUCED_IN(24); /** * Get the data pointer of the input image for direct application access. @@ -712,7 +711,7 @@ media_status_t AImage_getPlaneRowStride( */ media_status_t AImage_getPlaneData( const AImage* image, int planeIdx, - /*out*/uint8_t** data, /*out*/int* dataLength); + /*out*/uint8_t** data, /*out*/int* dataLength) __INTRODUCED_IN(24); #endif /* __ANDROID_API__ >= 24 */ @@ -732,7 +731,7 @@ media_status_t AImage_getPlaneData( * * @see sync.h */ -void AImage_deleteAsync(AImage* image, int releaseFenceFd); +void AImage_deleteAsync(AImage* image, int releaseFenceFd) __INTRODUCED_IN(26); /** * Get the hardware buffer handle of the input image intended for GPU and/or hardware access. @@ -760,7 +759,7 @@ void AImage_deleteAsync(AImage* image, int releaseFenceFd); * * @see AImageReader_ImageCallback */ -media_status_t AImage_getHardwareBuffer(const AImage* image, /*out*/AHardwareBuffer** buffer); +media_status_t AImage_getHardwareBuffer(const AImage* image, /*out*/AHardwareBuffer** buffer) __INTRODUCED_IN(26); #endif /* __ANDROID_API__ >= 26 */ diff --git a/media/ndk/include/media/NdkImageReader.h b/media/ndk/include/media/NdkImageReader.h index 571410bf4d..68de17687e 100644 --- a/media/ndk/include/media/NdkImageReader.h +++ b/media/ndk/include/media/NdkImageReader.h @@ -88,7 +88,7 @@ typedef struct AImageReader AImageReader; */ media_status_t AImageReader_new( int32_t width, int32_t height, int32_t format, int32_t maxImages, - /*out*/AImageReader** reader); + /*out*/AImageReader** reader) __INTRODUCED_IN(24); /** * Delete an {@link AImageReader} and return all images generated by this reader to system. @@ -100,7 +100,7 @@ media_status_t AImageReader_new( * * @param reader The image reader to be deleted. */ -void AImageReader_delete(AImageReader* reader); +void AImageReader_delete(AImageReader* reader) __INTRODUCED_IN(24); /** * Get a {@link ANativeWindow} that can be used to produce {@link AImage} for this image reader. @@ -114,7 +114,7 @@ void AImageReader_delete(AImageReader* reader); * <li>{@link AMEDIA_OK} if the method call succeeds.</li> * <li>{@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or window is NULL.</li></ul> */ -media_status_t AImageReader_getWindow(AImageReader* reader, /*out*/ANativeWindow** window); +media_status_t AImageReader_getWindow(AImageReader* reader, /*out*/ANativeWindow** window) __INTRODUCED_IN(24); /** * Query the default width of the {@link AImage} generated by this reader, in pixels. @@ -130,7 +130,7 @@ media_status_t AImageReader_getWindow(AImageReader* reader, /*out*/ANativeWindow * <li>{@link AMEDIA_OK} if the method call succeeds.</li> * <li>{@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or width is NULL.</li></ul> */ -media_status_t AImageReader_getWidth(const AImageReader* reader, /*out*/int32_t* width); +media_status_t AImageReader_getWidth(const AImageReader* reader, /*out*/int32_t* width) __INTRODUCED_IN(24); /** * Query the default height of the {@link AImage} generated by this reader, in pixels. @@ -146,7 +146,7 @@ media_status_t AImageReader_getWidth(const AImageReader* reader, /*out*/int32_t* * <li>{@link AMEDIA_OK} if the method call succeeds.</li> * <li>{@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or height is NULL.</li></ul> */ -media_status_t AImageReader_getHeight(const AImageReader* reader, /*out*/int32_t* height); +media_status_t AImageReader_getHeight(const AImageReader* reader, /*out*/int32_t* height) __INTRODUCED_IN(24); /** * Query the format of the {@link AImage} generated by this reader. @@ -159,7 +159,7 @@ media_status_t AImageReader_getHeight(const AImageReader* reader, /*out*/int32_t * <li>{@link AMEDIA_OK} if the method call succeeds.</li> * <li>{@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or format is NULL.</li></ul> */ -media_status_t AImageReader_getFormat(const AImageReader* reader, /*out*/int32_t* format); +media_status_t AImageReader_getFormat(const AImageReader* reader, /*out*/int32_t* format) __INTRODUCED_IN(24); /** * Query the maximum number of concurrently acquired {@link AImage}s of this reader. @@ -172,7 +172,7 @@ media_status_t AImageReader_getFormat(const AImageReader* reader, /*out*/int32_t * <li>{@link AMEDIA_OK} if the method call succeeds.</li> * <li>{@link AMEDIA_ERROR_INVALID_PARAMETER} if reader or maxImages is NULL.</li></ul> */ -media_status_t AImageReader_getMaxImages(const AImageReader* reader, /*out*/int32_t* maxImages); +media_status_t AImageReader_getMaxImages(const AImageReader* reader, /*out*/int32_t* maxImages) __INTRODUCED_IN(24); /** * Acquire the next {@link AImage} from the image reader's queue. @@ -208,7 +208,7 @@ media_status_t AImageReader_getMaxImages(const AImageReader* reader, /*out*/int3 * * @see AImageReader_acquireLatestImage */ -media_status_t AImageReader_acquireNextImage(AImageReader* reader, /*out*/AImage** image); +media_status_t AImageReader_acquireNextImage(AImageReader* reader, /*out*/AImage** image) __INTRODUCED_IN(24); /** @@ -252,7 +252,7 @@ media_status_t AImageReader_acquireNextImage(AImageReader* reader, /*out*/AImage * * @see AImageReader_acquireNextImage */ -media_status_t AImageReader_acquireLatestImage(AImageReader* reader, /*out*/AImage** image); +media_status_t AImageReader_acquireLatestImage(AImageReader* reader, /*out*/AImage** image) __INTRODUCED_IN(24); /** @@ -296,7 +296,7 @@ typedef struct AImageReader_ImageListener { * <li>{@link AMEDIA_ERROR_INVALID_PARAMETER} if reader is NULL.</li></ul> */ media_status_t AImageReader_setImageListener( - AImageReader* reader, AImageReader_ImageListener* listener); + AImageReader* reader, AImageReader_ImageListener* listener) __INTRODUCED_IN(24); #endif /* __ANDROID_API__ >= 24 */ @@ -365,7 +365,7 @@ media_status_t AImageReader_setImageListener( */ media_status_t AImageReader_newWithUsage( int32_t width, int32_t height, int32_t format, uint64_t usage, int32_t maxImages, - /*out*/ AImageReader** reader); + /*out*/ AImageReader** reader) __INTRODUCED_IN(26); /** * Acquire the next {@link AImage} from the image reader's queue asynchronously. @@ -384,7 +384,7 @@ media_status_t AImageReader_newWithUsage( * @see sync_get_fence_info */ media_status_t AImageReader_acquireNextImageAsync( - AImageReader* reader, /*out*/AImage** image, /*out*/int* acquireFenceFd); + AImageReader* reader, /*out*/AImage** image, /*out*/int* acquireFenceFd) __INTRODUCED_IN(26); /** * Acquire the latest {@link AImage} from the image reader's queue asynchronously, dropping older @@ -404,7 +404,7 @@ media_status_t AImageReader_acquireNextImageAsync( * @see sync_get_fence_info */ media_status_t AImageReader_acquireLatestImageAsync( - AImageReader* reader, /*out*/AImage** image, /*out*/int* acquireFenceFd); + 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. * @@ -459,7 +459,7 @@ typedef struct AImageReader_BufferRemovedListener { * @see AImage_getHardwareBuffer */ media_status_t AImageReader_setBufferRemovedListener( - AImageReader* reader, AImageReader_BufferRemovedListener* listener); + AImageReader* reader, AImageReader_BufferRemovedListener* listener) __INTRODUCED_IN(26); #endif /* __ANDROID_API__ >= 26 */ diff --git a/media/ndk/include/media/NdkMediaCodec.h b/media/ndk/include/media/NdkMediaCodec.h index f4a51d084c..9dc120df29 100644 --- a/media/ndk/include/media/NdkMediaCodec.h +++ b/media/ndk/include/media/NdkMediaCodec.h @@ -14,6 +14,15 @@ * limitations under the License. */ +/** + * @addtogroup Media + * @{ + */ + +/** + * @file NdkMediaCodec.h + */ + /* * This file defines an NDK API. * Do not remove methods. @@ -119,23 +128,23 @@ struct AMediaCodecOnAsyncNotifyCallback { * When configuring, you will need to specify whether to use the codec as an * encoder or decoder. */ -AMediaCodec* AMediaCodec_createCodecByName(const char *name); +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. */ -AMediaCodec* AMediaCodec_createDecoderByType(const char *mime_type); +AMediaCodec* AMediaCodec_createDecoderByType(const char *mime_type) __INTRODUCED_IN(21); /** * Create encoder by name. */ -AMediaCodec* AMediaCodec_createEncoderByType(const char *mime_type); +AMediaCodec* AMediaCodec_createEncoderByType(const char *mime_type) __INTRODUCED_IN(21); /** * delete the codec and free its resources */ -media_status_t AMediaCodec_delete(AMediaCodec*); +media_status_t AMediaCodec_delete(AMediaCodec*) __INTRODUCED_IN(21); /** * Configure the codec. For decoding you would typically get the format from an extractor. @@ -145,43 +154,43 @@ media_status_t AMediaCodec_configure( const AMediaFormat* format, ANativeWindow* surface, AMediaCrypto *crypto, - uint32_t flags); + uint32_t flags) __INTRODUCED_IN(21); /** * Start the codec. A codec must be configured before it can be started, and must be started * before buffers can be sent to it. */ -media_status_t AMediaCodec_start(AMediaCodec*); +media_status_t AMediaCodec_start(AMediaCodec*) __INTRODUCED_IN(21); /** * Stop the codec. */ -media_status_t AMediaCodec_stop(AMediaCodec*); +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. */ -media_status_t AMediaCodec_flush(AMediaCodec*); +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. */ -uint8_t* AMediaCodec_getInputBuffer(AMediaCodec*, size_t idx, size_t *out_size); +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. */ -uint8_t* AMediaCodec_getOutputBuffer(AMediaCodec*, size_t idx, size_t *out_size); +uint8_t* AMediaCodec_getOutputBuffer(AMediaCodec*, size_t idx, size_t *out_size) __INTRODUCED_IN(21); /** * 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. */ -ssize_t AMediaCodec_dequeueInputBuffer(AMediaCodec*, int64_t timeoutUs); +ssize_t AMediaCodec_dequeueInputBuffer(AMediaCodec*, int64_t timeoutUs) __INTRODUCED_IN(21); /* * __USE_FILE_OFFSET64 changes the type of off_t in LP32, which changes the ABI @@ -212,7 +221,7 @@ static_assert(sizeof(_off_t_compat) == sizeof(long), */ media_status_t AMediaCodec_queueInputBuffer(AMediaCodec*, size_t idx, _off_t_compat offset, size_t size, - uint64_t time, uint32_t flags); + uint64_t time, uint32_t flags) __INTRODUCED_IN(21); /** * Send the specified buffer to the codec for processing. @@ -220,7 +229,7 @@ media_status_t AMediaCodec_queueInputBuffer(AMediaCodec*, size_t idx, media_status_t AMediaCodec_queueSecureInputBuffer(AMediaCodec*, size_t idx, _off_t_compat offset, AMediaCodecCryptoInfo*, - uint64_t time, uint32_t flags); + uint64_t time, uint32_t flags) __INTRODUCED_IN(21); #undef _off_t_compat @@ -228,21 +237,21 @@ media_status_t AMediaCodec_queueSecureInputBuffer(AMediaCodec*, size_t idx, * Get the index of the next available buffer of processed data. */ ssize_t AMediaCodec_dequeueOutputBuffer(AMediaCodec*, AMediaCodecBufferInfo *info, - int64_t timeoutUs); -AMediaFormat* AMediaCodec_getOutputFormat(AMediaCodec*); + int64_t timeoutUs) __INTRODUCED_IN(21); +AMediaFormat* AMediaCodec_getOutputFormat(AMediaCodec*) __INTRODUCED_IN(21); /** * Get format of the buffer. The specified buffer index must have been previously obtained from * dequeueOutputBuffer. */ -AMediaFormat* AMediaCodec_getBufferFormat(AMediaCodec*, size_t index); +AMediaFormat* AMediaCodec_getBufferFormat(AMediaCodec*, size_t index) __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. */ -media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool render); +media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool render) __INTRODUCED_IN(21); /** * Dynamically sets the output surface of a codec. @@ -254,7 +263,7 @@ media_status_t AMediaCodec_releaseOutputBuffer(AMediaCodec*, size_t idx, bool re * * For more details, see the Java documentation for MediaCodec.setOutputSurface. */ -media_status_t AMediaCodec_setOutputSurface(AMediaCodec*, ANativeWindow* surface); +media_status_t AMediaCodec_setOutputSurface(AMediaCodec*, ANativeWindow* surface) __INTRODUCED_IN(21); /** * If you are done with a buffer, use this call to update its surface timestamp @@ -265,7 +274,7 @@ media_status_t AMediaCodec_setOutputSurface(AMediaCodec*, ANativeWindow* surface * For more details, see the Java documentation for MediaCodec.releaseOutputBuffer. */ media_status_t AMediaCodec_releaseOutputBufferAtTime( - AMediaCodec *mData, size_t idx, int64_t timestampNs); + AMediaCodec *mData, size_t idx, int64_t timestampNs) __INTRODUCED_IN(21); #if __ANDROID_API__ >= 26 @@ -281,7 +290,7 @@ media_status_t AMediaCodec_releaseOutputBufferAtTime( * For more details, see the Java documentation for MediaCodec.createInputSurface. */ media_status_t AMediaCodec_createInputSurface( - AMediaCodec *mData, ANativeWindow **surface); + AMediaCodec *mData, ANativeWindow **surface) __INTRODUCED_IN(26); /** * Creates a persistent Surface that can be used as the input to encoder @@ -297,7 +306,7 @@ media_status_t AMediaCodec_createInputSurface( * For more details, see the Java documentation for MediaCodec.createPersistentInputSurface. */ media_status_t AMediaCodec_createPersistentInputSurface( - ANativeWindow **surface); + ANativeWindow **surface) __INTRODUCED_IN(26); /** * Set a persistent-surface that can be used as the input to encoder, in place of input buffers @@ -310,7 +319,7 @@ media_status_t AMediaCodec_createPersistentInputSurface( * For more details, see the Java documentation for MediaCodec.setInputSurface. */ media_status_t AMediaCodec_setInputSurface( - AMediaCodec *mData, ANativeWindow *surface); + AMediaCodec *mData, ANativeWindow *surface) __INTRODUCED_IN(26); /** * Signal additional parameters to the codec instance. @@ -321,7 +330,7 @@ media_status_t AMediaCodec_setInputSurface( * NOTE: Some of these parameter changes may silently fail to apply. */ media_status_t AMediaCodec_setParameters( - AMediaCodec *mData, const AMediaFormat* params); + AMediaCodec *mData, const AMediaFormat* params) __INTRODUCED_IN(26); /** * Signals end-of-stream on input. Equivalent to submitting an empty buffer with @@ -337,7 +346,7 @@ media_status_t AMediaCodec_setParameters( * * For more details, see the Java documentation for MediaCodec.signalEndOfInputStream. */ -media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData); +media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData) __INTRODUCED_IN(26); #endif /* __ANDROID_API__ >= 26 */ @@ -348,12 +357,12 @@ media_status_t AMediaCodec_signalEndOfInputStream(AMediaCodec *mData); * or createEncoderByType, what component is chosen is not known beforehand. * Caller shall call AMediaCodec_releaseName to free the returned pointer. */ -media_status_t AMediaCodec_getName(AMediaCodec*, char** out_name); +media_status_t AMediaCodec_getName(AMediaCodec*, char** out_name) __INTRODUCED_IN(28); /** * Free the memory pointed by name which is returned by AMediaCodec_getName. */ -void AMediaCodec_releaseName(AMediaCodec*, char* name); +void AMediaCodec_releaseName(AMediaCodec*, char* name) __INTRODUCED_IN(28); /** * Set an asynchronous callback for actionable AMediaCodec events. @@ -377,32 +386,32 @@ void AMediaCodec_releaseName(AMediaCodec*, char* name); media_status_t AMediaCodec_setAsyncNotifyCallback( AMediaCodec*, AMediaCodecOnAsyncNotifyCallback callback, - void *userdata); + void *userdata) __INTRODUCED_IN(28); /** * Release the crypto if applicable. */ -media_status_t AMediaCodec_releaseCrypto(AMediaCodec*); +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. */ -AMediaFormat* AMediaCodec_getInputFormat(AMediaCodec*); +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. */ -bool AMediaCodecActionCode_isRecoverable(int32_t actionCode); +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. */ -bool AMediaCodecActionCode_isTransient(int32_t actionCode); +bool AMediaCodecActionCode_isTransient(int32_t actionCode) __INTRODUCED_IN(28); #endif /* __ANDROID_API__ >= 28 */ @@ -438,54 +447,56 @@ AMediaCodecCryptoInfo *AMediaCodecCryptoInfo_new( uint8_t iv[16], cryptoinfo_mode_t mode, size_t *clearbytes, - size_t *encryptedbytes); + size_t *encryptedbytes) __INTRODUCED_IN(21); /** * delete an AMediaCodecCryptoInfo created previously with AMediaCodecCryptoInfo_new, or * obtained from AMediaExtractor */ -media_status_t AMediaCodecCryptoInfo_delete(AMediaCodecCryptoInfo*); +media_status_t AMediaCodecCryptoInfo_delete(AMediaCodecCryptoInfo*) __INTRODUCED_IN(21); /** * Set the crypto pattern on an AMediaCryptoInfo object */ void AMediaCodecCryptoInfo_setPattern( AMediaCodecCryptoInfo *info, - cryptoinfo_pattern_t *pattern); + cryptoinfo_pattern_t *pattern) __INTRODUCED_IN(21); /** * The number of subsamples that make up the buffer's contents. */ -size_t AMediaCodecCryptoInfo_getNumSubSamples(AMediaCodecCryptoInfo*); +size_t AMediaCodecCryptoInfo_getNumSubSamples(AMediaCodecCryptoInfo*) __INTRODUCED_IN(21); /** * A 16-byte opaque key */ -media_status_t AMediaCodecCryptoInfo_getKey(AMediaCodecCryptoInfo*, uint8_t *dst); +media_status_t AMediaCodecCryptoInfo_getKey(AMediaCodecCryptoInfo*, uint8_t *dst) __INTRODUCED_IN(21); /** * A 16-byte initialization vector */ -media_status_t AMediaCodecCryptoInfo_getIV(AMediaCodecCryptoInfo*, uint8_t *dst); +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. */ -cryptoinfo_mode_t AMediaCodecCryptoInfo_getMode(AMediaCodecCryptoInfo*); +cryptoinfo_mode_t AMediaCodecCryptoInfo_getMode(AMediaCodecCryptoInfo*) __INTRODUCED_IN(21); /** * The number of leading unencrypted bytes in each subsample. */ -media_status_t AMediaCodecCryptoInfo_getClearBytes(AMediaCodecCryptoInfo*, size_t *dst); +media_status_t AMediaCodecCryptoInfo_getClearBytes(AMediaCodecCryptoInfo*, size_t *dst) __INTRODUCED_IN(21); /** * The number of trailing encrypted bytes in each subsample. */ -media_status_t AMediaCodecCryptoInfo_getEncryptedBytes(AMediaCodecCryptoInfo*, size_t *dst); +media_status_t AMediaCodecCryptoInfo_getEncryptedBytes(AMediaCodecCryptoInfo*, size_t *dst) __INTRODUCED_IN(21); #endif /* __ANDROID_API__ >= 21 */ __END_DECLS #endif //_NDK_MEDIA_CODEC_H + +/** @} */ diff --git a/media/ndk/include/media/NdkMediaCrypto.h b/media/ndk/include/media/NdkMediaCrypto.h index d31dbdc4da..bcdf9a004d 100644 --- a/media/ndk/include/media/NdkMediaCrypto.h +++ b/media/ndk/include/media/NdkMediaCrypto.h @@ -14,6 +14,14 @@ * limitations under the License. */ +/** + * @addtogroup Media + * @{ + */ + +/** + * @file NdkMediaCrypto.h + */ /* * This file defines an NDK API. @@ -41,16 +49,18 @@ typedef uint8_t AMediaUUID[16]; #if __ANDROID_API__ >= 21 -bool AMediaCrypto_isCryptoSchemeSupported(const AMediaUUID uuid); +bool AMediaCrypto_isCryptoSchemeSupported(const AMediaUUID uuid) __INTRODUCED_IN(21); -bool AMediaCrypto_requiresSecureDecoderComponent(const char *mime); +bool AMediaCrypto_requiresSecureDecoderComponent(const char *mime) __INTRODUCED_IN(21); -AMediaCrypto* AMediaCrypto_new(const AMediaUUID uuid, const void *initData, size_t initDataSize); +AMediaCrypto* AMediaCrypto_new(const AMediaUUID uuid, const void *initData, size_t initDataSize) __INTRODUCED_IN(21); -void AMediaCrypto_delete(AMediaCrypto* crypto); +void AMediaCrypto_delete(AMediaCrypto* crypto) __INTRODUCED_IN(21); #endif /* __ANDROID_API__ >= 21 */ __END_DECLS #endif // _NDK_MEDIA_CRYPTO_H + +/** @} */ diff --git a/media/ndk/include/media/NdkMediaDataSource.h b/media/ndk/include/media/NdkMediaDataSource.h index 9e2e351aec..ea5ba0c43b 100644 --- a/media/ndk/include/media/NdkMediaDataSource.h +++ b/media/ndk/include/media/NdkMediaDataSource.h @@ -84,19 +84,19 @@ typedef void (*AMediaDataSourceClose)(void *userdata); * Create new media data source. Returns NULL if memory allocation * for the new data source object fails. */ -AMediaDataSource* AMediaDataSource_new(); +AMediaDataSource* AMediaDataSource_new() __INTRODUCED_IN(28); /** * Delete a previously created media data source. */ -void AMediaDataSource_delete(AMediaDataSource*); +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. */ void AMediaDataSource_setUserdata( - AMediaDataSource*, void *userdata); + AMediaDataSource*, void *userdata) __INTRODUCED_IN(28); /** * Set a custom callback for supplying random access media data to the @@ -111,7 +111,7 @@ void AMediaDataSource_setUserdata( */ void AMediaDataSource_setReadAt( AMediaDataSource*, - AMediaDataSourceReadAt); + AMediaDataSourceReadAt) __INTRODUCED_IN(28); /** * Set a custom callback for supplying the size of the data source to the @@ -122,7 +122,7 @@ void AMediaDataSource_setReadAt( */ void AMediaDataSource_setGetSize( AMediaDataSource*, - AMediaDataSourceGetSize); + AMediaDataSourceGetSize) __INTRODUCED_IN(28); /** * Set a custom callback to receive signal from the NDK media framework @@ -133,7 +133,7 @@ void AMediaDataSource_setGetSize( */ void AMediaDataSource_setClose( AMediaDataSource*, - AMediaDataSourceClose); + AMediaDataSourceClose) __INTRODUCED_IN(28); #endif /*__ANDROID_API__ >= 28 */ diff --git a/media/ndk/include/media/NdkMediaDrm.h b/media/ndk/include/media/NdkMediaDrm.h index 9e9f4c35d3..020968173b 100644 --- a/media/ndk/include/media/NdkMediaDrm.h +++ b/media/ndk/include/media/NdkMediaDrm.h @@ -14,6 +14,15 @@ * limitations under the License. */ +/** + * @addtogroup Media + * @{ + */ + +/** + * @file NdkMediaDrm.h + */ + /* * This file defines an NDK API. * Do not remove methods. @@ -88,25 +97,27 @@ typedef void (*AMediaDrmEventListener)(AMediaDrm *, const AMediaDrmSessionId *se * 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. */ -bool AMediaDrm_isCryptoSchemeSupported(const uint8_t *uuid, const char *mimeType); +bool AMediaDrm_isCryptoSchemeSupported(const uint8_t *uuid, + const char *mimeType) __INTRODUCED_IN(21); /** * Create a MediaDrm instance from a UUID * uuid identifies the universal unique ID of the crypto scheme. uuid must be 16 bytes. */ -AMediaDrm* AMediaDrm_createByUUID(const uint8_t *uuid); +AMediaDrm* AMediaDrm_createByUUID(const uint8_t *uuid) __INTRODUCED_IN(21); /** * Release a MediaDrm object */ -void AMediaDrm_release(AMediaDrm *); +void AMediaDrm_release(AMediaDrm *) __INTRODUCED_IN(21); /** * Register a callback to be invoked when an event occurs * * listener is the callback that will be invoked on event */ -media_status_t AMediaDrm_setOnEventListener(AMediaDrm *, AMediaDrmEventListener listener); +media_status_t AMediaDrm_setOnEventListener(AMediaDrm *, + AMediaDrmEventListener listener) __INTRODUCED_IN(21); /** * Open a new session with the MediaDrm object. A session ID is returned. @@ -114,13 +125,15 @@ media_status_t AMediaDrm_setOnEventListener(AMediaDrm *, AMediaDrmEventListener * returns MEDIADRM_NOT_PROVISIONED_ERROR if provisioning is needed * returns MEDIADRM_RESOURCE_BUSY_ERROR if required resources are in use */ -media_status_t AMediaDrm_openSession(AMediaDrm *, AMediaDrmSessionId *sessionId); +media_status_t AMediaDrm_openSession(AMediaDrm *, + AMediaDrmSessionId *sessionId) __INTRODUCED_IN(21); /** * Close a session on the MediaDrm object that was previously opened * with AMediaDrm_openSession. */ -media_status_t AMediaDrm_closeSession(AMediaDrm *, const AMediaDrmSessionId *sessionId); +media_status_t AMediaDrm_closeSession(AMediaDrm *, + const AMediaDrmSessionId *sessionId) __INTRODUCED_IN(21); typedef enum AMediaDrmKeyType { /** @@ -199,7 +212,7 @@ typedef struct AMediaDrmKeyValuePair { 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, - const uint8_t **keyRequest, size_t *keyRequestSize); + const uint8_t **keyRequest, size_t *keyRequestSize) __INTRODUCED_IN(21); /** * A key response is received from the license server by the app, then it is @@ -219,7 +232,8 @@ media_status_t AMediaDrm_getKeyRequest(AMediaDrm *, const AMediaDrmScope *scope, */ media_status_t AMediaDrm_provideKeyResponse(AMediaDrm *, const AMediaDrmScope *scope, - const uint8_t *response, size_t responseSize, AMediaDrmKeySetId *keySetId); + const uint8_t *response, size_t responseSize, + AMediaDrmKeySetId *keySetId) __INTRODUCED_IN(21); /** * Restore persisted offline keys into a new session. keySetId identifies the @@ -229,14 +243,15 @@ media_status_t AMediaDrm_provideKeyResponse(AMediaDrm *, const AMediaDrmScope *s * keySetId identifies the saved key set to restore */ media_status_t AMediaDrm_restoreKeys(AMediaDrm *, const AMediaDrmSessionId *sessionId, - const AMediaDrmKeySetId *keySetId); + const AMediaDrmKeySetId *keySetId) __INTRODUCED_IN(21); /** * Remove the current keys from a session. * * keySetId identifies keys to remove */ -media_status_t AMediaDrm_removeKeys(AMediaDrm *, const AMediaDrmSessionId *keySetId); +media_status_t AMediaDrm_removeKeys(AMediaDrm *, + const AMediaDrmSessionId *keySetId) __INTRODUCED_IN(21); /** * Request an informative description of the key status for the session. The status is @@ -252,7 +267,7 @@ media_status_t AMediaDrm_removeKeys(AMediaDrm *, const AMediaDrmSessionId *keySe * and numPairs will be set to the number of pairs available. */ media_status_t AMediaDrm_queryKeyStatus(AMediaDrm *, const AMediaDrmSessionId *sessionId, - AMediaDrmKeyValue *keyValuePairs, size_t *numPairs); + AMediaDrmKeyValue *keyValuePairs, size_t *numPairs) __INTRODUCED_IN(21); /** @@ -271,7 +286,7 @@ media_status_t AMediaDrm_queryKeyStatus(AMediaDrm *, const AMediaDrmSessionId *s * the next call to getProvisionRequest. */ media_status_t AMediaDrm_getProvisionRequest(AMediaDrm *, const uint8_t **provisionRequest, - size_t *provisionRequestSize, const char **serverUrl); + size_t *provisionRequestSize, const char **serverUrl) __INTRODUCED_IN(21); /** @@ -286,7 +301,7 @@ media_status_t AMediaDrm_getProvisionRequest(AMediaDrm *, const uint8_t **provis * server rejected the request */ media_status_t AMediaDrm_provideProvisionResponse(AMediaDrm *, - const uint8_t *response, size_t responseSize); + const uint8_t *response, size_t responseSize) __INTRODUCED_IN(21); /** @@ -311,7 +326,7 @@ media_status_t AMediaDrm_provideProvisionResponse(AMediaDrm *, * number required. */ media_status_t AMediaDrm_getSecureStops(AMediaDrm *, - AMediaDrmSecureStop *secureStops, size_t *numSecureStops); + AMediaDrmSecureStop *secureStops, size_t *numSecureStops) __INTRODUCED_IN(21); /** * Process the SecureStop server response message ssRelease. After authenticating @@ -320,7 +335,7 @@ media_status_t AMediaDrm_getSecureStops(AMediaDrm *, * ssRelease is the server response indicating which secure stops to release */ media_status_t AMediaDrm_releaseSecureStops(AMediaDrm *, - const AMediaDrmSecureStop *ssRelease); + const AMediaDrmSecureStop *ssRelease) __INTRODUCED_IN(21); /** * String property name: identifies the maker of the DRM engine plugin @@ -353,7 +368,7 @@ media_status_t AMediaDrm_releaseSecureStops(AMediaDrm *, * will remain valid until the next call to AMediaDrm_getPropertyString. */ media_status_t AMediaDrm_getPropertyString(AMediaDrm *, const char *propertyName, - const char **propertyValue); + const char **propertyValue) __INTRODUCED_IN(21); /** * Byte array property name: the device unique identifier is established during @@ -368,19 +383,19 @@ media_status_t AMediaDrm_getPropertyString(AMediaDrm *, const char *propertyName * will remain valid until the next call to AMediaDrm_getPropertyByteArray. */ media_status_t AMediaDrm_getPropertyByteArray(AMediaDrm *, const char *propertyName, - AMediaDrmByteArray *propertyValue); + AMediaDrmByteArray *propertyValue) __INTRODUCED_IN(21); /** * Set a DRM engine plugin String property value. */ media_status_t AMediaDrm_setPropertyString(AMediaDrm *, const char *propertyName, - const char *value); + const char *value) __INTRODUCED_IN(21); /** * Set a DRM engine plugin byte array property value. */ media_status_t AMediaDrm_setPropertyByteArray(AMediaDrm *, const char *propertyName, - const uint8_t *value, size_t valueSize); + const uint8_t *value, size_t valueSize) __INTRODUCED_IN(21); /** * In addition to supporting decryption of DASH Common Encrypted Media, the @@ -409,7 +424,7 @@ media_status_t AMediaDrm_setPropertyByteArray(AMediaDrm *, const char *propertyN */ media_status_t AMediaDrm_encrypt(AMediaDrm *, const AMediaDrmSessionId *sessionId, const char *cipherAlgorithm, uint8_t *keyId, uint8_t *iv, - const uint8_t *input, uint8_t *output, size_t dataSize); + const uint8_t *input, uint8_t *output, size_t dataSize) __INTRODUCED_IN(21); /* * Decrypt the data referenced by input of length dataSize using algorithm specified @@ -420,7 +435,7 @@ media_status_t AMediaDrm_encrypt(AMediaDrm *, const AMediaDrmSessionId *sessionI */ media_status_t AMediaDrm_decrypt(AMediaDrm *, const AMediaDrmSessionId *sessionId, const char *cipherAlgorithm, uint8_t *keyId, uint8_t *iv, - const uint8_t *input, uint8_t *output, size_t dataSize); + const uint8_t *input, uint8_t *output, size_t dataSize) __INTRODUCED_IN(21); /* * Generate a signature using the specified macAlgorithm over the message data @@ -433,7 +448,7 @@ media_status_t AMediaDrm_decrypt(AMediaDrm *, const AMediaDrmSessionId *sessionI */ media_status_t AMediaDrm_sign(AMediaDrm *, const AMediaDrmSessionId *sessionId, const char *macAlgorithm, uint8_t *keyId, uint8_t *message, size_t messageSize, - uint8_t *signature, size_t *signatureSize); + uint8_t *signature, size_t *signatureSize) __INTRODUCED_IN(21); /* * Perform a signature verification using the specified macAlgorithm over the message @@ -444,10 +459,12 @@ media_status_t AMediaDrm_sign(AMediaDrm *, const AMediaDrmSessionId *sessionId, */ media_status_t AMediaDrm_verify(AMediaDrm *, const AMediaDrmSessionId *sessionId, const char *macAlgorithm, uint8_t *keyId, const uint8_t *message, size_t messageSize, - const uint8_t *signature, size_t signatureSize); + const uint8_t *signature, size_t signatureSize) __INTRODUCED_IN(21); #endif /* __ANDROID_API__ >= 21 */ __END_DECLS #endif //_NDK_MEDIA_DRM_H + +/** @} */ diff --git a/media/ndk/include/media/NdkMediaError.h b/media/ndk/include/media/NdkMediaError.h index 13aacc9aa3..75f46059fb 100644 --- a/media/ndk/include/media/NdkMediaError.h +++ b/media/ndk/include/media/NdkMediaError.h @@ -14,6 +14,14 @@ * limitations under the License. */ +/** + * @addtogroup Media + * @{ + */ + +/** + * @file NdkMediaError.h + */ /* * This file defines an NDK API. @@ -79,3 +87,5 @@ typedef enum { __END_DECLS #endif // _NDK_MEDIA_ERROR_H + +/** @} */ diff --git a/media/ndk/include/media/NdkMediaExtractor.h b/media/ndk/include/media/NdkMediaExtractor.h index f7b9cfda6b..6a1796f977 100644 --- a/media/ndk/include/media/NdkMediaExtractor.h +++ b/media/ndk/include/media/NdkMediaExtractor.h @@ -14,6 +14,14 @@ * limitations under the License. */ +/** + * @addtogroup Media + * @{ + */ + +/** + * @file NdkMediaExtractor.h + */ /* * This file defines an NDK API. @@ -46,23 +54,24 @@ typedef struct AMediaExtractor AMediaExtractor; /** * Create new media extractor */ -AMediaExtractor* AMediaExtractor_new(); +AMediaExtractor* AMediaExtractor_new() __INTRODUCED_IN(21); /** * Delete a previously created media extractor */ -media_status_t AMediaExtractor_delete(AMediaExtractor*); +media_status_t AMediaExtractor_delete(AMediaExtractor*) __INTRODUCED_IN(21); /** * Set the file descriptor from which the extractor will read. */ media_status_t AMediaExtractor_setDataSourceFd(AMediaExtractor*, int fd, off64_t offset, - off64_t length); + off64_t length) __INTRODUCED_IN(21); /** * Set the URI from which the extractor will read. */ -media_status_t AMediaExtractor_setDataSource(AMediaExtractor*, const char *location); +media_status_t AMediaExtractor_setDataSource(AMediaExtractor*, + const char *location) __INTRODUCED_IN(21); // TODO support headers #if __ANDROID_API__ >= 28 @@ -70,19 +79,20 @@ media_status_t AMediaExtractor_setDataSource(AMediaExtractor*, const char *locat /** * Set the custom data source implementation from which the extractor will read. */ -media_status_t AMediaExtractor_setDataSourceCustom(AMediaExtractor*, AMediaDataSource *src); +media_status_t AMediaExtractor_setDataSourceCustom(AMediaExtractor*, + AMediaDataSource *src) __INTRODUCED_IN(28); #endif /* __ANDROID_API__ >= 28 */ /** * Return the number of tracks in the previously specified media file */ -size_t AMediaExtractor_getTrackCount(AMediaExtractor*); +size_t AMediaExtractor_getTrackCount(AMediaExtractor*) __INTRODUCED_IN(21); /** * Return the format of the specified track. The caller must free the returned format */ -AMediaFormat* AMediaExtractor_getTrackFormat(AMediaExtractor*, size_t idx); +AMediaFormat* AMediaExtractor_getTrackFormat(AMediaExtractor*, size_t idx) __INTRODUCED_IN(21); /** * Select the specified track. Subsequent calls to readSampleData, getSampleTrackIndex and @@ -90,41 +100,42 @@ AMediaFormat* AMediaExtractor_getTrackFormat(AMediaExtractor*, size_t idx); * Selecting the same track multiple times has no effect, the track is * only selected once. */ -media_status_t AMediaExtractor_selectTrack(AMediaExtractor*, size_t idx); +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.. */ -media_status_t AMediaExtractor_unselectTrack(AMediaExtractor*, size_t idx); +media_status_t AMediaExtractor_unselectTrack(AMediaExtractor*, size_t idx) __INTRODUCED_IN(21); /** * Read the current sample. */ -ssize_t AMediaExtractor_readSampleData(AMediaExtractor*, uint8_t *buffer, size_t capacity); +ssize_t AMediaExtractor_readSampleData(AMediaExtractor*, + uint8_t *buffer, size_t capacity) __INTRODUCED_IN(21); /** * Read the current sample's flags. */ -uint32_t AMediaExtractor_getSampleFlags(AMediaExtractor*); // see definitions below +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) */ -int AMediaExtractor_getSampleTrackIndex(AMediaExtractor*); +int AMediaExtractor_getSampleTrackIndex(AMediaExtractor*) __INTRODUCED_IN(21); /** * Returns the current sample's presentation time in microseconds. * or -1 if no more samples are available. */ -int64_t AMediaExtractor_getSampleTime(AMediaExtractor*); +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). */ -bool AMediaExtractor_advance(AMediaExtractor*); +bool AMediaExtractor_advance(AMediaExtractor*) __INTRODUCED_IN(21); typedef enum { AMEDIAEXTRACTOR_SEEK_PREVIOUS_SYNC, @@ -135,7 +146,8 @@ typedef enum { /** * */ -media_status_t AMediaExtractor_seekTo(AMediaExtractor*, int64_t seekPosUs, SeekMode mode); +media_status_t AMediaExtractor_seekTo(AMediaExtractor*, + int64_t seekPosUs, SeekMode mode) __INTRODUCED_IN(21); /** * mapping of crypto scheme uuid to the scheme specific data for that scheme @@ -157,10 +169,10 @@ typedef struct PsshInfo { /** * Get the PSSH info if present. */ -PsshInfo* AMediaExtractor_getPsshInfo(AMediaExtractor*); +PsshInfo* AMediaExtractor_getPsshInfo(AMediaExtractor*) __INTRODUCED_IN(21); -AMediaCodecCryptoInfo *AMediaExtractor_getSampleCryptoInfo(AMediaExtractor *); +AMediaCodecCryptoInfo *AMediaExtractor_getSampleCryptoInfo(AMediaExtractor *) __INTRODUCED_IN(21); enum { AMEDIAEXTRACTOR_SAMPLE_FLAG_SYNC = 1, @@ -176,7 +188,7 @@ 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. */ -AMediaFormat* AMediaExtractor_getFileFormat(AMediaExtractor*); +AMediaFormat* AMediaExtractor_getFileFormat(AMediaExtractor*) __INTRODUCED_IN(28); /** * Returns the size of the current sample in bytes, or -1 when no samples are @@ -188,7 +200,7 @@ AMediaFormat* AMediaExtractor_getFileFormat(AMediaExtractor*); * AMediaExtractor_readSampleData(ex, buf, sampleSize); * */ -ssize_t AMediaExtractor_getSampleSize(AMediaExtractor*); +ssize_t AMediaExtractor_getSampleSize(AMediaExtractor*) __INTRODUCED_IN(28); /** * Returns the duration of cached media samples downloaded from a network data source @@ -201,7 +213,7 @@ ssize_t AMediaExtractor_getSampleSize(AMediaExtractor*); * cached duration cannot be calculated (bitrate, duration, and file size information * not available). */ -int64_t AMediaExtractor_getCachedDuration(AMediaExtractor *); +int64_t AMediaExtractor_getCachedDuration(AMediaExtractor *) __INTRODUCED_IN(28); /** * Read the current sample's metadata format into |fmt|. Examples of sample metadata are @@ -212,7 +224,8 @@ int64_t AMediaExtractor_getCachedDuration(AMediaExtractor *); * 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_*. */ -media_status_t AMediaExtractor_getSampleFormat(AMediaExtractor *ex, AMediaFormat *fmt); +media_status_t AMediaExtractor_getSampleFormat(AMediaExtractor *ex, + AMediaFormat *fmt) __INTRODUCED_IN(28); #endif /* __ANDROID_API__ >= 28 */ @@ -221,3 +234,5 @@ media_status_t AMediaExtractor_getSampleFormat(AMediaExtractor *ex, AMediaFormat __END_DECLS #endif // _NDK_MEDIA_EXTRACTOR_H + +/** @} */ diff --git a/media/ndk/include/media/NdkMediaFormat.h b/media/ndk/include/media/NdkMediaFormat.h index 687054e017..5f7804d8a8 100644 --- a/media/ndk/include/media/NdkMediaFormat.h +++ b/media/ndk/include/media/NdkMediaFormat.h @@ -14,6 +14,15 @@ * limitations under the License. */ +/** + * @addtogroup Media + * @{ + */ + +/** + * @file NdkMediaFormat.h + */ + /* * This file defines an NDK API. * Do not remove methods. @@ -39,128 +48,130 @@ typedef struct AMediaFormat AMediaFormat; #if __ANDROID_API__ >= 21 -AMediaFormat *AMediaFormat_new(); -media_status_t AMediaFormat_delete(AMediaFormat*); +AMediaFormat *AMediaFormat_new() __INTRODUCED_IN(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. */ -const char* AMediaFormat_toString(AMediaFormat*); +const char* AMediaFormat_toString(AMediaFormat*) __INTRODUCED_IN(21); -bool AMediaFormat_getInt32(AMediaFormat*, const char *name, int32_t *out); -bool AMediaFormat_getInt64(AMediaFormat*, const char *name, int64_t *out); -bool AMediaFormat_getFloat(AMediaFormat*, const char *name, float *out); -bool AMediaFormat_getSize(AMediaFormat*, const char *name, size_t *out); +bool AMediaFormat_getInt32(AMediaFormat*, const char *name, int32_t *out) __INTRODUCED_IN(21); +bool AMediaFormat_getInt64(AMediaFormat*, const char *name, int64_t *out) __INTRODUCED_IN(21); +bool AMediaFormat_getFloat(AMediaFormat*, const char *name, float *out) __INTRODUCED_IN(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. */ -bool AMediaFormat_getBuffer(AMediaFormat*, const char *name, void** data, size_t *size); +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. */ -bool AMediaFormat_getString(AMediaFormat*, const char *name, const char **out); +bool AMediaFormat_getString(AMediaFormat*, const char *name, const char **out) __INTRODUCED_IN(21); -void AMediaFormat_setInt32(AMediaFormat*, const char* name, int32_t value); -void AMediaFormat_setInt64(AMediaFormat*, const char* name, int64_t value); -void AMediaFormat_setFloat(AMediaFormat*, const char* name, float value); +void AMediaFormat_setInt32(AMediaFormat*, const char* name, int32_t value) __INTRODUCED_IN(21); +void AMediaFormat_setInt64(AMediaFormat*, const char* name, int64_t value) __INTRODUCED_IN(21); +void AMediaFormat_setFloat(AMediaFormat*, const char* name, float value) __INTRODUCED_IN(21); /** * The provided string is copied into the format. */ -void AMediaFormat_setString(AMediaFormat*, const char* name, const char* value); +void AMediaFormat_setString(AMediaFormat*, const char* name, const char* value) __INTRODUCED_IN(21); /** * The provided data is copied into the format. */ -void AMediaFormat_setBuffer(AMediaFormat*, const char* name, void* data, size_t size); +void AMediaFormat_setBuffer(AMediaFormat*, const char* name, void* data, size_t size) __INTRODUCED_IN(21); /** * XXX should these be ints/enums that we look up in a table as needed? */ -extern const char* AMEDIAFORMAT_KEY_AAC_DRC_ATTENUATION_FACTOR; -extern const char* AMEDIAFORMAT_KEY_AAC_DRC_BOOST_FACTOR; -extern const char* AMEDIAFORMAT_KEY_AAC_DRC_HEAVY_COMPRESSION; -extern const char* AMEDIAFORMAT_KEY_AAC_DRC_TARGET_REFERENCE_LEVEL; -extern const char* AMEDIAFORMAT_KEY_AAC_ENCODED_TARGET_LEVEL; -extern const char* AMEDIAFORMAT_KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT; -extern const char* AMEDIAFORMAT_KEY_AAC_PROFILE; -extern const char* AMEDIAFORMAT_KEY_AAC_SBR_MODE; -extern const char* AMEDIAFORMAT_KEY_AUDIO_SESSION_ID; -extern const char* AMEDIAFORMAT_KEY_BITRATE_MODE; -extern const char* AMEDIAFORMAT_KEY_BIT_RATE; -extern const char* AMEDIAFORMAT_KEY_CAPTURE_RATE; -extern const char* AMEDIAFORMAT_KEY_CHANNEL_COUNT; -extern const char* AMEDIAFORMAT_KEY_CHANNEL_MASK; -extern const char* AMEDIAFORMAT_KEY_COLOR_FORMAT; -extern const char* AMEDIAFORMAT_KEY_COLOR_RANGE; -extern const char* AMEDIAFORMAT_KEY_COLOR_STANDARD; -extern const char* AMEDIAFORMAT_KEY_COLOR_TRANSFER; -extern const char* AMEDIAFORMAT_KEY_COMPLEXITY; -extern const char* AMEDIAFORMAT_KEY_CSD; -extern const char* AMEDIAFORMAT_KEY_CSD_0; -extern const char* AMEDIAFORMAT_KEY_CSD_1; -extern const char* AMEDIAFORMAT_KEY_CSD_2; -extern const char* AMEDIAFORMAT_KEY_DISPLAY_CROP; -extern const char* AMEDIAFORMAT_KEY_DISPLAY_HEIGHT; -extern const char* AMEDIAFORMAT_KEY_DISPLAY_WIDTH; -extern const char* AMEDIAFORMAT_KEY_DURATION; -extern const char* AMEDIAFORMAT_KEY_FLAC_COMPRESSION_LEVEL; -extern const char* AMEDIAFORMAT_KEY_FRAME_RATE; -extern const char* AMEDIAFORMAT_KEY_GRID_COLUMNS; -extern const char* AMEDIAFORMAT_KEY_GRID_ROWS; -extern const char* AMEDIAFORMAT_KEY_HDR_STATIC_INFO; -extern const char* AMEDIAFORMAT_KEY_HEIGHT; -extern const char* AMEDIAFORMAT_KEY_INTRA_REFRESH_PERIOD; -extern const char* AMEDIAFORMAT_KEY_IS_ADTS; -extern const char* AMEDIAFORMAT_KEY_IS_AUTOSELECT; -extern const char* AMEDIAFORMAT_KEY_IS_DEFAULT; -extern const char* AMEDIAFORMAT_KEY_IS_FORCED_SUBTITLE; -extern const char* AMEDIAFORMAT_KEY_I_FRAME_INTERVAL; -extern const char* AMEDIAFORMAT_KEY_LANGUAGE; -extern const char* AMEDIAFORMAT_KEY_LATENCY; -extern const char* AMEDIAFORMAT_KEY_LEVEL; -extern const char* AMEDIAFORMAT_KEY_MAX_HEIGHT; -extern const char* AMEDIAFORMAT_KEY_MAX_INPUT_SIZE; -extern const char* AMEDIAFORMAT_KEY_MAX_WIDTH; -extern const char* AMEDIAFORMAT_KEY_MIME; -extern const char* AMEDIAFORMAT_KEY_MPEG_USER_DATA; -extern const char* AMEDIAFORMAT_KEY_OPERATING_RATE; -extern const char* AMEDIAFORMAT_KEY_PCM_ENCODING; -extern const char* AMEDIAFORMAT_KEY_PRIORITY; -extern const char* AMEDIAFORMAT_KEY_PROFILE; -extern const char* AMEDIAFORMAT_KEY_PUSH_BLANK_BUFFERS_ON_STOP; -extern const char* AMEDIAFORMAT_KEY_REPEAT_PREVIOUS_FRAME_AFTER; -extern const char* AMEDIAFORMAT_KEY_ROTATION; -extern const char* AMEDIAFORMAT_KEY_SAMPLE_RATE; -extern const char* AMEDIAFORMAT_KEY_SEI; -extern const char* AMEDIAFORMAT_KEY_SLICE_HEIGHT; -extern const char* AMEDIAFORMAT_KEY_STRIDE; -extern const char* AMEDIAFORMAT_KEY_TEMPORAL_LAYER_ID; -extern const char* AMEDIAFORMAT_KEY_TEMPORAL_LAYERING; -extern const char* AMEDIAFORMAT_KEY_TILE_HEIGHT; -extern const char* AMEDIAFORMAT_KEY_TILE_WIDTH; -extern const char* AMEDIAFORMAT_KEY_TIME_US; -extern const char* AMEDIAFORMAT_KEY_TRACK_ID; -extern const char* AMEDIAFORMAT_KEY_TRACK_INDEX; -extern const char* AMEDIAFORMAT_KEY_WIDTH; +extern const char* AMEDIAFORMAT_KEY_AAC_DRC_ATTENUATION_FACTOR __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_AAC_DRC_BOOST_FACTOR __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_AAC_DRC_HEAVY_COMPRESSION __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_AAC_DRC_TARGET_REFERENCE_LEVEL __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_AAC_ENCODED_TARGET_LEVEL __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_AAC_PROFILE __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_AAC_SBR_MODE __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_AUDIO_SESSION_ID __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_BITRATE_MODE __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_BIT_RATE __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_CAPTURE_RATE __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_CHANNEL_COUNT __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_CHANNEL_MASK __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_COLOR_FORMAT __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_COLOR_RANGE __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_COLOR_STANDARD __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_COLOR_TRANSFER __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_COMPLEXITY __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_CSD __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_CSD_0 __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_CSD_1 __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_CSD_2 __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_DISPLAY_CROP __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_DISPLAY_HEIGHT __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_DISPLAY_WIDTH __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_DURATION __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_FLAC_COMPRESSION_LEVEL __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_FRAME_RATE __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_GRID_COLUMNS __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_GRID_ROWS __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_HDR_STATIC_INFO __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_HEIGHT __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_INTRA_REFRESH_PERIOD __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_IS_ADTS __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_IS_AUTOSELECT __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_IS_DEFAULT __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_IS_FORCED_SUBTITLE __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_I_FRAME_INTERVAL __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_LANGUAGE __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_LATENCY __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_LEVEL __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_MAX_HEIGHT __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_MAX_INPUT_SIZE __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_MAX_WIDTH __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_MIME __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_MPEG_USER_DATA __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_OPERATING_RATE __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_PCM_ENCODING __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_PRIORITY __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_PROFILE __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_PUSH_BLANK_BUFFERS_ON_STOP __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_REPEAT_PREVIOUS_FRAME_AFTER __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_ROTATION __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_SAMPLE_RATE __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_SEI __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_SLICE_HEIGHT __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_STRIDE __INTRODUCED_IN(21); +extern const char* AMEDIAFORMAT_KEY_TEMPORAL_LAYER_ID __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_TEMPORAL_LAYERING __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_TILE_HEIGHT __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_TILE_WIDTH __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_TIME_US __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_TRACK_ID __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_TRACK_INDEX __INTRODUCED_IN(28); +extern const char* AMEDIAFORMAT_KEY_WIDTH __INTRODUCED_IN(21); #endif /* __ANDROID_API__ >= 21 */ #if __ANDROID_API__ >= 28 -bool AMediaFormat_getDouble(AMediaFormat*, const char *name, double *out); +bool AMediaFormat_getDouble(AMediaFormat*, const char *name, double *out) __INTRODUCED_IN(28); bool AMediaFormat_getRect(AMediaFormat*, const char *name, - int32_t *left, int32_t *top, int32_t *right, int32_t *bottom); + int32_t *left, int32_t *top, int32_t *right, int32_t *bottom) __INTRODUCED_IN(28); -void AMediaFormat_setDouble(AMediaFormat*, const char* name, double value); -void AMediaFormat_setSize(AMediaFormat*, const char* name, size_t value); +void AMediaFormat_setDouble(AMediaFormat*, const char* name, double value) __INTRODUCED_IN(28); +void AMediaFormat_setSize(AMediaFormat*, const char* name, size_t value) __INTRODUCED_IN(28); void AMediaFormat_setRect(AMediaFormat*, const char* name, - int32_t left, int32_t top, int32_t right, int32_t bottom); + int32_t left, int32_t top, int32_t right, int32_t bottom) __INTRODUCED_IN(28); #endif /* __ANDROID_API__ >= 28 */ __END_DECLS #endif // _NDK_MEDIA_FORMAT_H + +/** @} */ diff --git a/media/ndk/include/media/NdkMediaMuxer.h b/media/ndk/include/media/NdkMediaMuxer.h index 1ecd1ca1f7..7393867c41 100644 --- a/media/ndk/include/media/NdkMediaMuxer.h +++ b/media/ndk/include/media/NdkMediaMuxer.h @@ -14,6 +14,14 @@ * limitations under the License. */ +/** + * @addtogroup Media + * @{ + */ + +/** + * @file NdkMediaMuxer.h + */ /* * This file defines an NDK API. @@ -50,12 +58,12 @@ typedef enum { /** * Create new media muxer */ -AMediaMuxer* AMediaMuxer_new(int fd, OutputFormat format); +AMediaMuxer* AMediaMuxer_new(int fd, OutputFormat format) __INTRODUCED_IN(21); /** * Delete a previously created media muxer */ -media_status_t AMediaMuxer_delete(AMediaMuxer*); +media_status_t AMediaMuxer_delete(AMediaMuxer*) __INTRODUCED_IN(21); /** * Set and store the geodata (latitude and longitude) in the output file. @@ -68,7 +76,8 @@ media_status_t AMediaMuxer_delete(AMediaMuxer*); * Latitude must be in the range [-90, 90]. * Longitude must be in the range [-180, 180]. */ -media_status_t AMediaMuxer_setLocation(AMediaMuxer*, float latitude, float longitude); +media_status_t AMediaMuxer_setLocation(AMediaMuxer*, + float latitude, float longitude) __INTRODUCED_IN(21); /** * Sets the orientation hint for output video playback. @@ -82,26 +91,26 @@ media_status_t AMediaMuxer_setLocation(AMediaMuxer*, float latitude, float longi * The angle is specified in degrees, clockwise. * The supported angles are 0, 90, 180, and 270 degrees. */ -media_status_t AMediaMuxer_setOrientationHint(AMediaMuxer*, int degrees); +media_status_t AMediaMuxer_setOrientationHint(AMediaMuxer*, int degrees) __INTRODUCED_IN(21); /** * 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. */ -ssize_t AMediaMuxer_addTrack(AMediaMuxer*, const AMediaFormat* format); +ssize_t AMediaMuxer_addTrack(AMediaMuxer*, const AMediaFormat* format) __INTRODUCED_IN(21); /** * Start the muxer. Should be called after AMediaMuxer_addTrack and * before AMediaMuxer_writeSampleData. */ -media_status_t AMediaMuxer_start(AMediaMuxer*); +media_status_t AMediaMuxer_start(AMediaMuxer*) __INTRODUCED_IN(21); /** * Stops the muxer. * Once the muxer stops, it can not be restarted. */ -media_status_t AMediaMuxer_stop(AMediaMuxer*); +media_status_t AMediaMuxer_stop(AMediaMuxer*) __INTRODUCED_IN(21); /** * Writes an encoded sample into the muxer. @@ -111,10 +120,13 @@ media_status_t AMediaMuxer_stop(AMediaMuxer*); * by the encoder.) */ media_status_t AMediaMuxer_writeSampleData(AMediaMuxer *muxer, - size_t trackIdx, const uint8_t *data, const AMediaCodecBufferInfo *info); + size_t trackIdx, const uint8_t *data, + const AMediaCodecBufferInfo *info) __INTRODUCED_IN(21); #endif /* __ANDROID_API__ >= 21 */ __END_DECLS #endif // _NDK_MEDIA_MUXER_H + +/** @} */ diff --git a/media/ndk/libmediandk.map.txt b/media/ndk/libmediandk.map.txt index fb566947fb..d828d6a2cb 100644 --- a/media/ndk/libmediandk.map.txt +++ b/media/ndk/libmediandk.map.txt @@ -32,55 +32,66 @@ LIBMEDIANDK { AMEDIAFORMAT_KEY_AAC_DRC_TARGET_REFERENCE_LEVEL; # var introduced=28 AMEDIAFORMAT_KEY_AAC_ENCODED_TARGET_LEVEL; # var introduced=28 AMEDIAFORMAT_KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT; # var introduced=28 - AMEDIAFORMAT_KEY_AAC_PROFILE; # var + AMEDIAFORMAT_KEY_AAC_PROFILE; # var introduced=21 AMEDIAFORMAT_KEY_AAC_SBR_MODE; # var introduced=28 AMEDIAFORMAT_KEY_AUDIO_SESSION_ID; # var introduced=28 AMEDIAFORMAT_KEY_BITRATE_MODE; # var introduced=28 - AMEDIAFORMAT_KEY_BIT_RATE; # var + AMEDIAFORMAT_KEY_BIT_RATE; # var introduced=21 AMEDIAFORMAT_KEY_CAPTURE_RATE; # var introduced=28 - AMEDIAFORMAT_KEY_CHANNEL_COUNT; # var - AMEDIAFORMAT_KEY_CHANNEL_MASK; # var - AMEDIAFORMAT_KEY_COLOR_FORMAT; # var + AMEDIAFORMAT_KEY_CHANNEL_COUNT; # var introduced=21 + AMEDIAFORMAT_KEY_CHANNEL_MASK; # var introduced=21 + AMEDIAFORMAT_KEY_COLOR_FORMAT; # var introduced=21 AMEDIAFORMAT_KEY_COLOR_RANGE; # var introduced=28 AMEDIAFORMAT_KEY_COLOR_STANDARD; # var introduced=28 AMEDIAFORMAT_KEY_COLOR_TRANSFER; # var introduced=28 AMEDIAFORMAT_KEY_COMPLEXITY; # var introduced=28 + AMEDIAFORMAT_KEY_CSD; # var introduced=28 + AMEDIAFORMAT_KEY_CSD_0; # var introduced=28 + AMEDIAFORMAT_KEY_CSD_1; # var introduced=28 + AMEDIAFORMAT_KEY_CSD_2; # var introduced=28 AMEDIAFORMAT_KEY_DISPLAY_CROP; # var introduced=28 - AMEDIAFORMAT_KEY_DURATION; # var - AMEDIAFORMAT_KEY_FLAC_COMPRESSION_LEVEL; # var - AMEDIAFORMAT_KEY_FRAME_RATE; # var + AMEDIAFORMAT_KEY_DISPLAY_HEIGHT; # var introduced=28 + AMEDIAFORMAT_KEY_DISPLAY_WIDTH; # var introduced=28 + AMEDIAFORMAT_KEY_DURATION; # var introduced=21 + AMEDIAFORMAT_KEY_FLAC_COMPRESSION_LEVEL; # var introduced=21 + AMEDIAFORMAT_KEY_FRAME_RATE; # var introduced=21 AMEDIAFORMAT_KEY_GRID_COLUMNS; # var introduced=28 AMEDIAFORMAT_KEY_GRID_ROWS; # var introduced=28 AMEDIAFORMAT_KEY_HDR_STATIC_INFO; # var introduced=28 - AMEDIAFORMAT_KEY_HEIGHT; # var + AMEDIAFORMAT_KEY_HEIGHT; # var introduced=21 AMEDIAFORMAT_KEY_INTRA_REFRESH_PERIOD; # var introduced=28 - AMEDIAFORMAT_KEY_IS_ADTS; # var - AMEDIAFORMAT_KEY_IS_AUTOSELECT; # var - AMEDIAFORMAT_KEY_IS_DEFAULT; # var - AMEDIAFORMAT_KEY_IS_FORCED_SUBTITLE; # var - AMEDIAFORMAT_KEY_I_FRAME_INTERVAL; # var - AMEDIAFORMAT_KEY_LANGUAGE; # var + AMEDIAFORMAT_KEY_IS_ADTS; # var introduced=21 + AMEDIAFORMAT_KEY_IS_AUTOSELECT; # var introduced=21 + AMEDIAFORMAT_KEY_IS_DEFAULT; # var introduced=21 + AMEDIAFORMAT_KEY_IS_FORCED_SUBTITLE; # var introduced=21 + AMEDIAFORMAT_KEY_I_FRAME_INTERVAL; # var introduced=21 + AMEDIAFORMAT_KEY_LANGUAGE; # var introduced=21 AMEDIAFORMAT_KEY_LATENCY; # var introduced=28 AMEDIAFORMAT_KEY_LEVEL; # var introduced=28 - AMEDIAFORMAT_KEY_MAX_HEIGHT; # var - AMEDIAFORMAT_KEY_MAX_INPUT_SIZE; # var - AMEDIAFORMAT_KEY_MAX_WIDTH; # var - AMEDIAFORMAT_KEY_MIME; # var + AMEDIAFORMAT_KEY_MAX_HEIGHT; # var introduced=21 + AMEDIAFORMAT_KEY_MAX_INPUT_SIZE; # var introduced=21 + AMEDIAFORMAT_KEY_MAX_WIDTH; # var introduced=21 + AMEDIAFORMAT_KEY_MIME; # var introduced=21 + AMEDIAFORMAT_KEY_MPEG_USER_DATA; # var introduced=28 AMEDIAFORMAT_KEY_OPERATING_RATE; # var introduced=28 AMEDIAFORMAT_KEY_PCM_ENCODING; # var introduced=28 AMEDIAFORMAT_KEY_PRIORITY; # var introduced=28 AMEDIAFORMAT_KEY_PROFILE; # var introduced=28 - AMEDIAFORMAT_KEY_PUSH_BLANK_BUFFERS_ON_STOP; # var - AMEDIAFORMAT_KEY_REPEAT_PREVIOUS_FRAME_AFTER; # var + AMEDIAFORMAT_KEY_PUSH_BLANK_BUFFERS_ON_STOP; # var introduced=21 + AMEDIAFORMAT_KEY_REPEAT_PREVIOUS_FRAME_AFTER; # var introduced=21 AMEDIAFORMAT_KEY_ROTATION; # var introduced=28 - AMEDIAFORMAT_KEY_SAMPLE_RATE; # var + AMEDIAFORMAT_KEY_SAMPLE_RATE; # var introduced=21 + AMEDIAFORMAT_KEY_SEI; # var introduced=28 AMEDIAFORMAT_KEY_SLICE_HEIGHT; # var introduced=28 - AMEDIAFORMAT_KEY_STRIDE; # var + AMEDIAFORMAT_KEY_STRIDE; # var introduced=21 + AMEDIAFORMAT_KEY_TEMPORAL_LAYER_ID; # var introduced=28 AMEDIAFORMAT_KEY_TEMPORAL_LAYERING; # var introduced=28 AMEDIAFORMAT_KEY_TILE_HEIGHT; # var introduced=28 AMEDIAFORMAT_KEY_TILE_WIDTH; # var introduced=28 + AMEDIAFORMAT_KEY_TIME_US; # var introduced=28 + AMEDIAFORMAT_KEY_TRACK_INDEX; # var introduced=28 AMEDIAFORMAT_KEY_TRACK_ID; # var introduced=28 - AMEDIAFORMAT_KEY_WIDTH; # var + AMEDIAFORMAT_KEY_WIDTH; # var introduced=21 AMediaCodecActionCode_isRecoverable; # introduced=28 AMediaCodecActionCode_isTransient; # introduced=28 AMediaCodecCryptoInfo_delete; diff --git a/services/audiopolicy/enginedefault/src/Engine.cpp b/services/audiopolicy/enginedefault/src/Engine.cpp index 3e13e50a44..267996c916 100644 --- a/services/audiopolicy/enginedefault/src/Engine.cpp +++ b/services/audiopolicy/enginedefault/src/Engine.cpp @@ -726,6 +726,9 @@ audio_devices_t Engine::getDeviceForInputSource(audio_source_t inputSource) cons device = AUDIO_DEVICE_IN_BACK_MIC; } else if (availableDeviceTypes & AUDIO_DEVICE_IN_BUILTIN_MIC) { device = AUDIO_DEVICE_IN_BUILTIN_MIC; + } else if (availableDeviceTypes & AUDIO_DEVICE_IN_USB_DEVICE) { + // This is specifically for a device without built-in mic + device = AUDIO_DEVICE_IN_USB_DEVICE; } break; case AUDIO_SOURCE_VOICE_DOWNLINK: diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp index 9d618b0f6c..0d6cfda5d5 100644 --- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp +++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp @@ -1333,6 +1333,11 @@ status_t AudioPolicyManager::startSource(const sp<AudioOutputDescriptor>& output setStrategyMute(STRATEGY_SONIFICATION, true, outputDesc); } + if (stream == AUDIO_STREAM_ENFORCED_AUDIBLE && + mEngine->getForceUse(AUDIO_POLICY_FORCE_FOR_SYSTEM) == AUDIO_POLICY_FORCE_SYSTEM_ENFORCED) { + setStrategyMute(STRATEGY_SONIFICATION, true, outputDesc); + } + return NO_ERROR; } diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp index d59b313289..c8b3c2ff29 100644 --- a/services/camera/libcameraservice/api1/Camera2Client.cpp +++ b/services/camera/libcameraservice/api1/Camera2Client.cpp @@ -780,33 +780,35 @@ status_t Camera2Client::startPreviewL(Parameters ¶ms, bool restart) { int lastJpegStreamId = mJpegProcessor->getStreamId(); // If jpeg stream will slow down preview, make sure we remove it before starting preview if (params.slowJpegMode) { - // Pause preview if we are streaming - int32_t activeRequestId = mStreamingProcessor->getActiveRequestId(); - if (activeRequestId != 0) { - res = mStreamingProcessor->togglePauseStream(/*pause*/true); - if (res != OK) { - ALOGE("%s: Camera %d: Can't pause streaming: %s (%d)", - __FUNCTION__, mCameraId, strerror(-res), res); - } - res = mDevice->waitUntilDrained(); - if (res != OK) { - ALOGE("%s: Camera %d: Waiting to stop streaming failed: %s (%d)", - __FUNCTION__, mCameraId, strerror(-res), res); + if (lastJpegStreamId != NO_STREAM) { + // Pause preview if we are streaming + int32_t activeRequestId = mStreamingProcessor->getActiveRequestId(); + if (activeRequestId != 0) { + res = mStreamingProcessor->togglePauseStream(/*pause*/true); + if (res != OK) { + ALOGE("%s: Camera %d: Can't pause streaming: %s (%d)", + __FUNCTION__, mCameraId, strerror(-res), res); + } + res = mDevice->waitUntilDrained(); + if (res != OK) { + ALOGE("%s: Camera %d: Waiting to stop streaming failed: %s (%d)", + __FUNCTION__, mCameraId, strerror(-res), res); + } } - } - - res = mJpegProcessor->deleteStream(); - if (res != OK) { - ALOGE("%s: Camera %d: delete Jpeg stream failed: %s (%d)", - __FUNCTION__, mCameraId, strerror(-res), res); - } + res = mJpegProcessor->deleteStream(); - if (activeRequestId != 0) { - res = mStreamingProcessor->togglePauseStream(/*pause*/false); if (res != OK) { - ALOGE("%s: Camera %d: Can't unpause streaming: %s (%d)", - __FUNCTION__, mCameraId, strerror(-res), res); + ALOGE("%s: Camera %d: delete Jpeg stream failed: %s (%d)", + __FUNCTION__, mCameraId, strerror(-res), res); + } + + if (activeRequestId != 0) { + res = mStreamingProcessor->togglePauseStream(/*pause*/false); + if (res != OK) { + ALOGE("%s: Camera %d: Can't unpause streaming: %s (%d)", + __FUNCTION__, mCameraId, strerror(-res), res); + } } } } else { diff --git a/services/camera/libcameraservice/common/CameraProviderManager.cpp b/services/camera/libcameraservice/common/CameraProviderManager.cpp index 43f1a91fd2..0ce4318e7f 100644 --- a/services/camera/libcameraservice/common/CameraProviderManager.cpp +++ b/services/camera/libcameraservice/common/CameraProviderManager.cpp @@ -631,7 +631,12 @@ status_t CameraProviderManager::ProviderInfo::addDevice(const std::string& name, mUniqueCameraIds.insert(id); if (isAPI1Compatible) { - mUniqueAPI1CompatibleCameraIds.push_back(id); + // addDevice can be called more than once for the same camera id if HAL + // supports openLegacy. + if (std::find(mUniqueAPI1CompatibleCameraIds.begin(), mUniqueAPI1CompatibleCameraIds.end(), + id) == mUniqueAPI1CompatibleCameraIds.end()) { + mUniqueAPI1CompatibleCameraIds.push_back(id); + } } if (parsedId != nullptr) { diff --git a/services/mediaanalytics/Android.mk b/services/mediaanalytics/Android.mk index 2eeb7fa386..5b20e61479 100644 --- a/services/mediaanalytics/Android.mk +++ b/services/mediaanalytics/Android.mk @@ -34,8 +34,7 @@ LOCAL_C_INCLUDES := \ $(TOP)/frameworks/av/include/camera \ $(TOP)/frameworks/native/include/media/openmax \ $(TOP)/frameworks/native/include/media/hardware \ - $(TOP)/external/tremolo/Tremolo \ - libcore/include + $(TOP)/external/tremolo/Tremolo LOCAL_MODULE:= mediametrics diff --git a/services/mediacodec/Android.mk b/services/mediacodec/Android.mk index 8631c3998b..db5f0fff88 100644 --- a/services/mediacodec/Android.mk +++ b/services/mediacodec/Android.mk @@ -27,9 +27,8 @@ _software_codecs := \ include $(CLEAR_VARS) # seccomp is not required for coverage build. ifneq ($(NATIVE_COVERAGE),true) -LOCAL_REQUIRED_MODULES := crash_dump.policy -LOCAL_REQUIRED_MODULES_arm := mediacodec.policy -LOCAL_REQUIRED_MODULES_x86 := mediacodec.policy +LOCAL_REQUIRED_MODULES_arm := crash_dump.policy mediacodec.policy +LOCAL_REQUIRED_MODULES_x86 := crash_dump.policy mediacodec.policy endif LOCAL_SRC_FILES := main_codecservice.cpp LOCAL_SHARED_LIBRARIES := \ diff --git a/services/mediaextractor/Android.mk b/services/mediaextractor/Android.mk index 7c6527f13d..37d6cc9c94 100644 --- a/services/mediaextractor/Android.mk +++ b/services/mediaextractor/Android.mk @@ -15,10 +15,9 @@ include $(BUILD_SHARED_LIBRARY) # service executable include $(CLEAR_VARS) # seccomp filters are defined for the following architectures: -LOCAL_REQUIRED_MODULES := crash_dump.policy -LOCAL_REQUIRED_MODULES_arm := mediaextractor.policy -LOCAL_REQUIRED_MODULES_arm64 := mediaextractor.policy -LOCAL_REQUIRED_MODULES_x86 := mediaextractor.policy +LOCAL_REQUIRED_MODULES_arm := crash_dump.policy mediaextractor.policy +LOCAL_REQUIRED_MODULES_arm64 := crash_dump.policy mediaextractor.policy +LOCAL_REQUIRED_MODULES_x86 := crash_dump.policy mediaextractor.policy # extractor libraries LOCAL_REQUIRED_MODULES += \ |
