1 /*
2 * Copyright (C) 2024 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 //#define LOG_NDEBUG 0
18 #define LOG_TAG "NdkMediaCodecInfo"
19
20 #include "NdkMediaCodecInfoPriv.h"
21
22 #include <media/NdkMediaFormatPriv.h>
23
24 using namespace android;
25
26 extern "C" {
27
28 // AMediaCodecInfo
29
30 EXPORT
AMediaCodecInfo_getCanonicalName(const AMediaCodecInfo * info)31 const char* AMediaCodecInfo_getCanonicalName(const AMediaCodecInfo *info) {
32 if (info == nullptr || info->mInfo == nullptr) {
33 return nullptr;
34 }
35
36 return info->mInfo->getCodecName();
37 }
38
39 EXPORT
AMediaCodecInfo_getKind(const AMediaCodecInfo * info)40 AMediaCodecKind AMediaCodecInfo_getKind(const AMediaCodecInfo* info) {
41 if (info == nullptr) {
42 return AMediaCodecKind_INVALID;
43 }
44
45 return info->mInfo->isEncoder() ? AMediaCodecKind_ENCODER : AMediaCodecKind_DECODER;
46 }
47
48 EXPORT
AMediaCodecInfo_isVendor(const AMediaCodecInfo * info)49 int32_t AMediaCodecInfo_isVendor(const AMediaCodecInfo *info) {
50 if (info == nullptr) {
51 return -1;
52 }
53
54 int32_t attributes = info->mInfo->getAttributes();
55 return (attributes & android::MediaCodecInfo::kFlagIsVendor) ? 1 : 0;
56 }
57
58 EXPORT
AMediaCodecInfo_getMediaCodecInfoType(const AMediaCodecInfo * info)59 AMediaCodecType AMediaCodecInfo_getMediaCodecInfoType(const AMediaCodecInfo *info) {
60 if (info == nullptr || info->mInfo == nullptr) {
61 return AMediaCodecType_INVALID_CODEC_INFO;
62 }
63
64 int32_t attributes = info->mInfo->getAttributes();
65
66 if (attributes & android::MediaCodecInfo::kFlagIsSoftwareOnly) {
67 return AMediaCodecType_SOFTWARE_ONLY;
68 }
69 if (attributes & android::MediaCodecInfo::kFlagIsHardwareAccelerated) {
70 return AMediaCodecType_HARDWARE_ACCELERATED;
71 }
72 return AMediaCodecType_SOFTWARE_WITH_DEVICE_ACCESS;
73 }
74
75 EXPORT
AMediaCodecInfo_getMediaType(const AMediaCodecInfo * info)76 const char* AMediaCodecInfo_getMediaType(const AMediaCodecInfo *info) {
77 if (info == nullptr || info->mInfo == nullptr) {
78 return nullptr;
79 }
80
81 return info->mMediaType.c_str();
82 }
83
84 EXPORT
AMediaCodecInfo_getMaxSupportedInstances(const AMediaCodecInfo * info)85 int32_t AMediaCodecInfo_getMaxSupportedInstances(const AMediaCodecInfo *info) {
86 if (info == nullptr) {
87 return -1;
88 }
89
90 return info->mCodecCaps->getMaxSupportedInstances();
91 }
92
93 EXPORT
AMediaCodecInfo_isFeatureSupported(const AMediaCodecInfo * info,const char * featureName)94 int32_t AMediaCodecInfo_isFeatureSupported(const AMediaCodecInfo *info, const char *featureName) {
95 if (info == nullptr || featureName == nullptr) {
96 return -1;
97 }
98 return info->mCodecCaps->isFeatureSupported(std::string(featureName));
99 }
100
101 EXPORT
AMediaCodecInfo_isFeatureRequired(const AMediaCodecInfo * info,const char * featureName)102 int32_t AMediaCodecInfo_isFeatureRequired(const AMediaCodecInfo *info, const char *featureName) {
103 if (info == nullptr || featureName == nullptr) {
104 return -1;
105 }
106 return info->mCodecCaps->isFeatureRequired(std::string(featureName));
107 }
108
109 EXPORT
AMediaCodecInfo_isFormatSupported(const AMediaCodecInfo * info,const AMediaFormat * format)110 int32_t AMediaCodecInfo_isFormatSupported(const AMediaCodecInfo *info, const AMediaFormat *format) {
111 if (info == nullptr || format == nullptr) {
112 return -1;
113 }
114
115 sp<AMessage> nativeFormat;
116 AMediaFormat_getFormat(format, &nativeFormat);
117
118 return info->mCodecCaps->isFormatSupported(nativeFormat);
119 }
120
121 EXPORT
AMediaCodecInfo_getAudioCapabilities(const AMediaCodecInfo * info,const ACodecAudioCapabilities ** outAudioCaps)122 media_status_t AMediaCodecInfo_getAudioCapabilities(const AMediaCodecInfo *info,
123 const ACodecAudioCapabilities **outAudioCaps) {
124 if (info == nullptr || info->mInfo == nullptr || outAudioCaps == nullptr) {
125 return AMEDIA_ERROR_INVALID_PARAMETER;
126 }
127
128 *outAudioCaps = info->mAAudioCaps.get();
129
130 if ((*outAudioCaps) == nullptr) {
131 return AMEDIA_ERROR_UNSUPPORTED;
132 }
133
134 return AMEDIA_OK;
135 }
136
137 EXPORT
AMediaCodecInfo_getVideoCapabilities(const AMediaCodecInfo * info,const ACodecVideoCapabilities ** outVideoCaps)138 media_status_t AMediaCodecInfo_getVideoCapabilities(const AMediaCodecInfo *info,
139 const ACodecVideoCapabilities **outVideoCaps) {
140 if (info == nullptr || info->mInfo == nullptr || outVideoCaps == nullptr) {
141 return AMEDIA_ERROR_INVALID_PARAMETER;
142 }
143
144 *outVideoCaps = info->mAVideoCaps.get();
145
146 if ((*outVideoCaps) == nullptr) {
147 return AMEDIA_ERROR_UNSUPPORTED;
148 }
149
150 return AMEDIA_OK;
151 }
152
153 EXPORT
AMediaCodecInfo_getEncoderCapabilities(const AMediaCodecInfo * info,const ACodecEncoderCapabilities ** outEncoderCaps)154 media_status_t AMediaCodecInfo_getEncoderCapabilities(const AMediaCodecInfo *info,
155 const ACodecEncoderCapabilities **outEncoderCaps) {
156 if (info == nullptr || info->mInfo == nullptr || outEncoderCaps == nullptr) {
157 return AMEDIA_ERROR_INVALID_PARAMETER;
158 }
159
160 *outEncoderCaps = info->mAEncoderCaps.get();
161
162 if ((*outEncoderCaps) == nullptr) {
163 return AMEDIA_ERROR_UNSUPPORTED;
164 }
165
166 return AMEDIA_OK;
167 }
168
169 // ACodecAudioCapabilities
170
171 EXPORT
ACodecAudioCapabilities_getBitrateRange(const ACodecAudioCapabilities * audioCaps,AIntRange * outRange)172 media_status_t ACodecAudioCapabilities_getBitrateRange(const ACodecAudioCapabilities *audioCaps,
173 AIntRange *outRange) {
174 if (audioCaps == nullptr || outRange == nullptr) {
175 return AMEDIA_ERROR_INVALID_PARAMETER;
176 }
177
178 const Range<int32_t>& bitrateRange = audioCaps->mAudioCaps->getBitrateRange();
179 outRange->mLower = bitrateRange.lower();
180 outRange->mUpper = bitrateRange.upper();
181
182 return AMEDIA_OK;
183 }
184
185 EXPORT
ACodecAudioCapabilities_getSupportedSampleRates(const ACodecAudioCapabilities * audioCaps,const int ** outArrayPtr,size_t * outCount)186 media_status_t ACodecAudioCapabilities_getSupportedSampleRates(
187 const ACodecAudioCapabilities *audioCaps, const int **outArrayPtr, size_t *outCount) {
188 if (audioCaps == nullptr || outArrayPtr == nullptr || outCount == nullptr) {
189 return AMEDIA_ERROR_INVALID_PARAMETER;
190 }
191
192 if (audioCaps->mSampleRates.empty()) {
193 return AMEDIA_ERROR_UNSUPPORTED;
194 }
195
196 *outArrayPtr = audioCaps->mSampleRates.data();
197 *outCount = audioCaps->mSampleRates.size();
198
199 return AMEDIA_OK;
200 }
201
202 EXPORT
ACodecAudioCapabilities_getSupportedSampleRateRanges(const ACodecAudioCapabilities * audioCaps,const AIntRange ** outArrayPtr,size_t * outCount)203 media_status_t ACodecAudioCapabilities_getSupportedSampleRateRanges(
204 const ACodecAudioCapabilities *audioCaps, const AIntRange **outArrayPtr, size_t *outCount) {
205 if (audioCaps == nullptr || outArrayPtr == nullptr || outCount == nullptr) {
206 return AMEDIA_ERROR_INVALID_PARAMETER;
207 }
208
209 *outArrayPtr = audioCaps->mSampleRateRanges.data();
210 *outCount = audioCaps->mSampleRateRanges.size();
211
212 return AMEDIA_OK;
213 }
214
215 EXPORT
ACodecAudioCapabilities_getMaxInputChannelCount(const ACodecAudioCapabilities * audioCaps)216 int32_t ACodecAudioCapabilities_getMaxInputChannelCount(const ACodecAudioCapabilities *audioCaps) {
217 if (audioCaps == nullptr) {
218 return -1;
219 }
220 return audioCaps->mAudioCaps->getMaxInputChannelCount();
221 }
222
223 EXPORT
ACodecAudioCapabilities_getMinInputChannelCount(const ACodecAudioCapabilities * audioCaps)224 int32_t ACodecAudioCapabilities_getMinInputChannelCount(const ACodecAudioCapabilities *audioCaps) {
225 if (audioCaps == nullptr) {
226 return -1;
227 }
228 return audioCaps->mAudioCaps->getMinInputChannelCount();
229 }
230
231 EXPORT
ACodecAudioCapabilities_getInputChannelCountRanges(const ACodecAudioCapabilities * audioCaps,const AIntRange ** outArrayPtr,size_t * outCount)232 media_status_t ACodecAudioCapabilities_getInputChannelCountRanges(
233 const ACodecAudioCapabilities *audioCaps, const AIntRange **outArrayPtr, size_t *outCount) {
234 if (audioCaps == nullptr || outArrayPtr == nullptr || outCount == nullptr) {
235 return AMEDIA_ERROR_INVALID_PARAMETER;
236 }
237
238 *outArrayPtr = audioCaps->mInputChannelCountRanges.data();
239 *outCount = audioCaps->mInputChannelCountRanges.size();
240
241 return AMEDIA_OK;
242 }
243
244 EXPORT
ACodecAudioCapabilities_isSampleRateSupported(const ACodecAudioCapabilities * audioCaps,int32_t sampleRate)245 int32_t ACodecAudioCapabilities_isSampleRateSupported(const ACodecAudioCapabilities *audioCaps,
246 int32_t sampleRate) {
247 if (audioCaps == nullptr) {
248 return -1;
249 }
250 return audioCaps->mAudioCaps->isSampleRateSupported(sampleRate);
251 }
252
253 // ACodecPerformancePoint
254
255 EXPORT
ACodecPerformancePoint_create(int32_t width,int32_t height,int32_t frameRate)256 ACodecPerformancePoint* ACodecPerformancePoint_create(int32_t width, int32_t height,
257 int32_t frameRate) {
258 return new ACodecPerformancePoint(
259 std::make_shared<VideoCapabilities::PerformancePoint>(width, height, frameRate));
260 }
261
262 EXPORT
ACodecPerformancePoint_destroy(ACodecPerformancePoint * performancePoint)263 void ACodecPerformancePoint_destroy(ACodecPerformancePoint *performancePoint) {
264 delete performancePoint;
265 }
266
267 EXPORT
ACodecPerformancePoint_coversFormat(const ACodecPerformancePoint * performancePoint,const AMediaFormat * format)268 int32_t ACodecPerformancePoint_coversFormat(const ACodecPerformancePoint *performancePoint,
269 const AMediaFormat *format) {
270 if (performancePoint == nullptr || format == nullptr) {
271 return -1;
272 }
273
274 sp<AMessage> nativeFormat;
275 AMediaFormat_getFormat(format, &nativeFormat);
276
277 return performancePoint->mPerformancePoint->covers(nativeFormat);
278 }
279
280 EXPORT
ACodecPerformancePoint_covers(const ACodecPerformancePoint * one,const ACodecPerformancePoint * another)281 int32_t ACodecPerformancePoint_covers(const ACodecPerformancePoint *one,
282 const ACodecPerformancePoint *another) {
283 if (one == nullptr || another == nullptr) {
284 return -1;
285 }
286
287 return one->mPerformancePoint->covers(*(another->mPerformancePoint));
288 }
289
290 EXPORT
ACodecPerformancePoint_equals(const ACodecPerformancePoint * one,const ACodecPerformancePoint * another)291 int32_t ACodecPerformancePoint_equals(const ACodecPerformancePoint *one,
292 const ACodecPerformancePoint *another) {
293 if (one == nullptr || another == nullptr) {
294 return -1;
295 }
296
297 return one->mPerformancePoint->equals(*(another->mPerformancePoint));
298 }
299
300 // ACodecVideoCapabilities
301
302 EXPORT
ACodecVideoCapabilities_getBitrateRange(const ACodecVideoCapabilities * videoCaps,AIntRange * outRange)303 media_status_t ACodecVideoCapabilities_getBitrateRange(const ACodecVideoCapabilities *videoCaps,
304 AIntRange *outRange) {
305 if (videoCaps == nullptr || outRange == nullptr) {
306 return AMEDIA_ERROR_INVALID_PARAMETER;
307 }
308
309 const Range<int32_t>& bitrateRange = videoCaps->mVideoCaps->getBitrateRange();
310 outRange->mLower = bitrateRange.lower();
311 outRange->mUpper = bitrateRange.upper();
312
313 return AMEDIA_OK;
314 }
315
316 EXPORT
ACodecVideoCapabilities_getSupportedWidths(const ACodecVideoCapabilities * videoCaps,AIntRange * outRange)317 media_status_t ACodecVideoCapabilities_getSupportedWidths(const ACodecVideoCapabilities *videoCaps,
318 AIntRange *outRange) {
319 if (videoCaps == nullptr || outRange == nullptr) {
320 return AMEDIA_ERROR_INVALID_PARAMETER;
321 }
322
323 const Range<int32_t>& supportedWidths = videoCaps->mVideoCaps->getSupportedWidths();
324 outRange->mLower = supportedWidths.lower();
325 outRange->mUpper = supportedWidths.upper();
326
327 return AMEDIA_OK;
328 }
329
330 EXPORT
ACodecVideoCapabilities_getSupportedHeights(const ACodecVideoCapabilities * videoCaps,AIntRange * outRange)331 media_status_t ACodecVideoCapabilities_getSupportedHeights(const ACodecVideoCapabilities *videoCaps,
332 AIntRange *outRange) {
333 if (videoCaps == nullptr || outRange == nullptr) {
334 return AMEDIA_ERROR_INVALID_PARAMETER;
335 }
336
337 const Range<int32_t>& supportedHeights = videoCaps->mVideoCaps->getSupportedHeights();
338 outRange->mLower = supportedHeights.lower();
339 outRange->mUpper = supportedHeights.upper();
340
341 return AMEDIA_OK;
342 }
343
344 EXPORT
ACodecVideoCapabilities_getWidthAlignment(const ACodecVideoCapabilities * videoCaps)345 int32_t ACodecVideoCapabilities_getWidthAlignment(const ACodecVideoCapabilities *videoCaps) {
346 if (videoCaps == nullptr) {
347 return -1;
348 }
349 return videoCaps->mVideoCaps->getWidthAlignment();
350 }
351
352 EXPORT
ACodecVideoCapabilities_getHeightAlignment(const ACodecVideoCapabilities * videoCaps)353 int32_t ACodecVideoCapabilities_getHeightAlignment(const ACodecVideoCapabilities *videoCaps) {
354 if (videoCaps == nullptr) {
355 return -1;
356 }
357 return videoCaps->mVideoCaps->getHeightAlignment();
358 }
359
360 EXPORT
ACodecVideoCapabilities_getSupportedFrameRates(const ACodecVideoCapabilities * videoCaps,AIntRange * outRange)361 media_status_t ACodecVideoCapabilities_getSupportedFrameRates(
362 const ACodecVideoCapabilities *videoCaps, AIntRange *outRange) {
363 if (videoCaps == nullptr || outRange == nullptr) {
364 return AMEDIA_ERROR_INVALID_PARAMETER;
365 }
366
367 const Range<int32_t>& frameRateRange = videoCaps->mVideoCaps->getSupportedFrameRates();
368 outRange->mLower = frameRateRange.lower();
369 outRange->mUpper = frameRateRange.upper();
370
371 return AMEDIA_OK;
372 }
373
374 EXPORT
ACodecVideoCapabilities_getSupportedWidthsFor(const ACodecVideoCapabilities * videoCaps,int32_t height,AIntRange * outRange)375 media_status_t ACodecVideoCapabilities_getSupportedWidthsFor(
376 const ACodecVideoCapabilities *videoCaps, int32_t height, AIntRange *outRange) {
377 if (videoCaps == nullptr || outRange == nullptr) {
378 return AMEDIA_ERROR_INVALID_PARAMETER;
379 }
380
381 std::optional<Range<int32_t>> widthRange = videoCaps->mVideoCaps->getSupportedWidthsFor(height);
382 if (!widthRange) {
383 return AMEDIA_ERROR_UNSUPPORTED;
384 }
385
386 outRange->mLower = widthRange.value().lower();
387 outRange->mUpper = widthRange.value().upper();
388
389 return AMEDIA_OK;
390 }
391
392 EXPORT
ACodecVideoCapabilities_getSupportedHeightsFor(const ACodecVideoCapabilities * videoCaps,int32_t width,AIntRange * outRange)393 media_status_t ACodecVideoCapabilities_getSupportedHeightsFor(
394 const ACodecVideoCapabilities *videoCaps, int32_t width, AIntRange *outRange) {
395 if (videoCaps == nullptr || outRange == nullptr) {
396 return AMEDIA_ERROR_INVALID_PARAMETER;
397 }
398
399 std::optional<Range<int32_t>> heightRange
400 = videoCaps->mVideoCaps->getSupportedHeightsFor(width);
401 if (!heightRange) {
402 return AMEDIA_ERROR_UNSUPPORTED;
403 }
404
405 outRange->mLower = heightRange.value().lower();
406 outRange->mUpper = heightRange.value().upper();
407
408 return AMEDIA_OK;
409 }
410
411 EXPORT
ACodecVideoCapabilities_getSupportedFrameRatesFor(const ACodecVideoCapabilities * videoCaps,int32_t width,int32_t height,ADoubleRange * outRange)412 media_status_t ACodecVideoCapabilities_getSupportedFrameRatesFor(
413 const ACodecVideoCapabilities *videoCaps, int32_t width, int32_t height,
414 ADoubleRange *outRange) {
415 if (videoCaps == nullptr || outRange == nullptr) {
416 return AMEDIA_ERROR_INVALID_PARAMETER;
417 }
418
419 std::optional<Range<double>> frameRates
420 = videoCaps->mVideoCaps->getSupportedFrameRatesFor(width, height);
421 if (!frameRates) {
422 return AMEDIA_ERROR_UNSUPPORTED;
423 }
424
425 outRange->mLower = frameRates.value().lower();
426 outRange->mUpper = frameRates.value().upper();
427
428 return AMEDIA_OK;
429 }
430
431 EXPORT
ACodecVideoCapabilities_getAchievableFrameRatesFor(const ACodecVideoCapabilities * videoCaps,int32_t width,int32_t height,ADoubleRange * outRange)432 media_status_t ACodecVideoCapabilities_getAchievableFrameRatesFor(
433 const ACodecVideoCapabilities *videoCaps, int32_t width, int32_t height,
434 ADoubleRange *outRange) {
435 if (videoCaps == nullptr || outRange == nullptr) {
436 return AMEDIA_ERROR_INVALID_PARAMETER;
437 }
438
439 std::optional<Range<double>> frameRates
440 = videoCaps->mVideoCaps->getAchievableFrameRatesFor(width, height);
441 if (!frameRates) {
442 return AMEDIA_ERROR_UNSUPPORTED;
443 }
444
445 outRange->mLower = frameRates.value().lower();
446 outRange->mUpper = frameRates.value().upper();
447
448 return AMEDIA_OK;
449 }
450
451 EXPORT
ACodecVideoCapabilities_getNextSupportedPerformancePoint(const ACodecVideoCapabilities * _Nonnull videoCaps,const ACodecPerformancePoint * _Nullable * _Nonnull outPerformancePoint)452 media_status_t ACodecVideoCapabilities_getNextSupportedPerformancePoint(
453 const ACodecVideoCapabilities* _Nonnull videoCaps,
454 const ACodecPerformancePoint* _Nullable * _Nonnull outPerformancePoint) {
455 if (videoCaps == nullptr || outPerformancePoint == nullptr) {
456 return AMEDIA_ERROR_INVALID_PARAMETER;
457 }
458
459 bool found = *outPerformancePoint == nullptr;
460 for (const ACodecPerformancePoint& pp : videoCaps->mPerformancePoints) {
461 if (found) {
462 *outPerformancePoint = &pp;
463 return AMEDIA_OK;
464 }
465 if (*outPerformancePoint == &pp) {
466 found = true;
467 }
468 }
469 *outPerformancePoint = nullptr;
470 return AMEDIA_ERROR_UNSUPPORTED;
471 }
472
473 EXPORT
ACodecVideoCapabilities_areSizeAndRateSupported(const ACodecVideoCapabilities * videoCaps,int32_t width,int32_t height,double frameRate)474 int32_t ACodecVideoCapabilities_areSizeAndRateSupported(const ACodecVideoCapabilities *videoCaps,
475 int32_t width, int32_t height, double frameRate) {
476 if (videoCaps == nullptr) {
477 return -1;
478 }
479 return videoCaps->mVideoCaps->areSizeAndRateSupported(width, height, frameRate);
480 }
481
482 EXPORT
ACodecVideoCapabilities_isSizeSupported(const ACodecVideoCapabilities * videoCaps,int32_t width,int32_t height)483 int32_t ACodecVideoCapabilities_isSizeSupported(const ACodecVideoCapabilities *videoCaps,
484 int32_t width, int32_t height) {
485 if (videoCaps == nullptr) {
486 return -1;
487 }
488 return videoCaps->mVideoCaps->isSizeSupported(width, height);
489 }
490
491 // ACodecEncoderCapabilities
492
493 EXPORT
ACodecEncoderCapabilities_getQualityRange(const ACodecEncoderCapabilities * encoderCaps,AIntRange * outRange)494 media_status_t ACodecEncoderCapabilities_getQualityRange(
495 const ACodecEncoderCapabilities *encoderCaps, AIntRange *outRange) {
496 if (encoderCaps == nullptr || outRange == nullptr) {
497 return AMEDIA_ERROR_INVALID_PARAMETER;
498 }
499
500 const Range<int32_t>& qualityRange = encoderCaps->mEncoderCaps->getQualityRange();
501 outRange->mLower = qualityRange.lower();
502 outRange->mUpper = qualityRange.upper();
503
504 return AMEDIA_OK;
505 }
506
507 EXPORT
ACodecEncoderCapabilities_getComplexityRange(const ACodecEncoderCapabilities * encoderCaps,AIntRange * outRange)508 media_status_t ACodecEncoderCapabilities_getComplexityRange(
509 const ACodecEncoderCapabilities *encoderCaps, AIntRange *outRange) {
510 if (encoderCaps == nullptr || outRange == nullptr) {
511 return AMEDIA_ERROR_INVALID_PARAMETER;
512 }
513
514 const Range<int32_t>& complexityRange = encoderCaps->mEncoderCaps->getComplexityRange();
515 outRange->mLower = complexityRange.lower();
516 outRange->mUpper = complexityRange.upper();
517
518 return AMEDIA_OK;
519 }
520
ACodecEncoderCapabilities_isBitrateModeSupported(const ACodecEncoderCapabilities * encoderCaps,ABitrateMode mode)521 int32_t ACodecEncoderCapabilities_isBitrateModeSupported(
522 const ACodecEncoderCapabilities *encoderCaps, ABitrateMode mode) {
523 if (encoderCaps == nullptr) {
524 return -1;
525 }
526 return encoderCaps->mEncoderCaps->isBitrateModeSupported(mode);
527 }
528
529 // Feature Names
530
531 extern const char* AMediaCodecInfo_FEATURE_AdaptivePlayback = "adaptive-playback";
532 extern const char* AMediaCodecInfo_FEATURE_SecurePlayback = "secure-playback";
533 extern const char* AMediaCodecInfo_FEATURE_TunneledPlayback = "tunneled-playback";
534 extern const char* AMediaCodecInfo_FEATURE_DynamicTimestamp = "dynamic-timestamp";
535 extern const char* AMediaCodecInfo_FEATURE_FrameParsing = "frame-parsing";
536 extern const char* AMediaCodecInfo_FEATURE_MultipleFrames = "multiple-frames";
537 extern const char* AMediaCodecInfo_FEATURE_PartialFrame = "partial-frame";
538 extern const char* AMediaCodecInfo_FEATURE_IntraRefresh = "intra-refresh";
539 extern const char* AMediaCodecInfo_FEATURE_LowLatency = "low-latency";
540 extern const char* AMediaCodecInfo_FEATURE_QpBounds = "qp-bounds";
541 extern const char* AMediaCodecInfo_FEATURE_EncodingStatistics = "encoding-statistics";
542 extern const char* AMediaCodecInfo_FEATURE_HdrEditing = "hdr-editing";
543 extern const char* AMediaCodecInfo_FEATURE_HlgEditing = "hlg-editing";
544 extern const char* AMediaCodecInfo_FEATURE_DynamicColorAspects = "dynamic-color-aspects";
545 extern const char* AMediaCodecInfo_FEATURE_Roi = "region-of-interest";
546 extern const char* AMediaCodecInfo_FEATURE_DetachedSurface = "detached-surface";
547
548 }