1 /* 2 * Copyright (C) 2020 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef _NDK_MEDIA_CODEC_PLATFORM_H 18 #define _NDK_MEDIA_CODEC_PLATFORM_H 19 20 #include <stdint.h> 21 #include <sys/cdefs.h> 22 23 #include <media/NdkMediaCodec.h> 24 25 __BEGIN_DECLS 26 27 /** 28 * Special uid and pid values used with AMediaCodec_createCodecByNameForClient, 29 * AMediaCodec_createDecoderByTypeForClient and AMediaCodec_createEncoderByTypeForClient. 30 * 31 * Introduced in API 31. 32 */ 33 enum { 34 /** 35 * Uid value to indicate using calling uid. 36 */ 37 AMEDIACODEC_CALLING_UID = -1, 38 /** 39 * Pid value to indicate using calling pid. 40 */ 41 AMEDIACODEC_CALLING_PID = -1, 42 }; 43 44 /** 45 * Create codec by name on behalf of a client. 46 * 47 * The usage is similar to AMediaCodec_createCodecByName(), except that the codec instance 48 * will be attributed to the client of {uid, pid}, instead of the caller. 49 * 50 * Only certain privileged users are allowed to specify {uid, pid} that's different from the 51 * caller's. Without the privilege, this API will behave the same as 52 * AMediaCodec_createCodecByName(). 53 * 54 * Available since API level 31. 55 */ 56 AMediaCodec* AMediaCodec_createCodecByNameForClient(const char *name, 57 pid_t pid, 58 uid_t uid) __INTRODUCED_IN(31); 59 60 /** 61 * Create codec by mime type on behalf of a client. 62 * 63 * The usage is similar to AMediaCodec_createDecoderByType(), except that the codec instance 64 * will be attributed to the client of {uid, pid}, instead of the caller. 65 * 66 * Only certain privileged users are allowed to specify {uid, pid} that's different from the 67 * caller's. Without the privilege, this API will behave the same as 68 * AMediaCodec_createDecoderByType(). 69 * 70 * Available since API level 31. 71 */ 72 AMediaCodec* AMediaCodec_createDecoderByTypeForClient(const char *mime_type, 73 pid_t pid, 74 uid_t uid) __INTRODUCED_IN(31); 75 76 /** 77 * Create encoder by name on behalf of a client. 78 * 79 * The usage is similar to AMediaCodec_createEncoderByType(), except that the codec instance 80 * will be attributed to the client of {uid, pid}, instead of the caller. 81 * 82 * Only certain privileged users are allowed to specify {uid, pid} that's different from the 83 * caller's. Without the privilege, this API will behave the same as 84 * AMediaCodec_createEncoderByType(). 85 * 86 * Available since API level 31. 87 */ 88 AMediaCodec* AMediaCodec_createEncoderByTypeForClient(const char *mime_type, 89 pid_t pid, 90 uid_t uid) __INTRODUCED_IN(31); 91 92 __END_DECLS 93 94 #endif //_NDK_MEDIA_CODEC_PLATFORM_H 95 96 /** @} */ 97