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 /**
18  * @addtogroup Media
19  * @{
20  */
21 
22 /**
23  * @file NdkMediaCodecInfo.h
24  */
25 
26 /*
27  * This file defines an NDK API.
28  * Do not remove methods.
29  * Do not change method signatures.
30  * Do not change the value of constants.
31  * Do not change the size of any of the classes defined in here.
32  * Do not reference types that are not part of the NDK.
33  * Do not #include files that aren't part of the NDK.
34  */
35 
36 #ifndef _NDK_MEDIA_CODEC_INFO_H
37 #define _NDK_MEDIA_CODEC_INFO_H
38 
39 #include "NdkMediaError.h"
40 #include "NdkMediaFormat.h"
41 
42 __BEGIN_DECLS
43 
44 struct ACodecAudioCapabilities;
45 typedef struct ACodecAudioCapabilities ACodecAudioCapabilities;
46 struct ACodecPerformancePoint;
47 typedef struct ACodecPerformancePoint ACodecPerformancePoint;
48 struct ACodecVideoCapabilities;
49 typedef struct ACodecVideoCapabilities ACodecVideoCapabilities;
50 struct ACodecEncoderCapabilities;
51 typedef struct ACodecEncoderCapabilities ACodecEncoderCapabilities;
52 struct AMediaCodecInfo;
53 typedef struct AMediaCodecInfo AMediaCodecInfo;
54 
55 /**
56  * A uitlity structure describing the range of two integer values.
57  */
58 typedef struct AIntRange {
59     int32_t mLower;
60     int32_t mUpper;
61 } AIntRange;
62 
63 /**
64  * A uitlity structure describing the range of two double values.
65  */
66 typedef struct ADoubleRange {
67     double mLower;
68     double mUpper;
69 } ADoubleRange;
70 
71 // AMediaCodecInfo
72 
73 /**
74  * Get the canonical name of a codec.
75  *
76  * \return      The char pointer to the canonical name.
77  *              It is owned by the framework. No lifetime management needed for users.
78  *
79  * Return NULL if @param info is invalid.
80  */
81 const char* AMediaCodecInfo_getCanonicalName(const AMediaCodecInfo *info) __INTRODUCED_IN(36);
82 
83 /**
84  * Query if the codec is an encoder.
85  */
86 bool AMediaCodecInfo_isEncoder(const AMediaCodecInfo *info) __INTRODUCED_IN(36);
87 
88 /**
89  * Query if the codec is provided by the Android platform (false) or the device manufacturer (true).
90  */
91 bool AMediaCodecInfo_isVendor(const AMediaCodecInfo *info) __INTRODUCED_IN(36);
92 
93 /**
94  * The type of codecs.
95  */
96 typedef enum AMediaCodecType : int32_t {
97     /**
98      * Not a codec type. Used for indicating an invalid operation occurred.
99      */
100     INVALID_CODEC_INFO = 0,
101 
102     /**
103      * Software codec.
104      *
105      * Software-only codecs are more secure as they run in a tighter security sandbox.
106      * On the other hand, software-only codecs do not provide any performance guarantees.
107      */
108     SOFTWARE_ONLY = 1,
109 
110     /**
111      * Hardware accelerated codec.
112      *
113      * Hardware codecs generally have higher performance or lower power consumption than
114      * software codecs, but since they are specific to each device,
115      * the actual performance details can vary.
116      */
117     HARDWARE_ACCELERATED = 2,
118 
119     /**
120      * Software codec but have device access.
121      * Mainly referring to software codecs provided by vendors.
122      */
123     SOFTWARE_WITH_DEVICE_ACCESS = 3,
124 } AMediaCodecType;
125 
126 /**
127  * Query if the codec is SOFTWARE_ONLY, HARDWARE_ACCELERATED or SOFTWARE_WITH_DEVICE_ACCESS.
128  *
129  * Return INVALID_CODEC_INFO if @param info is invalid.
130  */
131 AMediaCodecType AMediaCodecInfo_getMediaCodecInfoType(
132         const AMediaCodecInfo *info) __INTRODUCED_IN(36);
133 
134 /**
135  * Get the supported media type of the codec.
136  *
137  * \return  The char pointer to the media type.
138  *          It is owned by the framework with infinite lifetime.
139  *
140  * Return NULL if @param info is invalid.
141  */
142 const char* AMediaCodecInfo_getMediaType(const AMediaCodecInfo *info) __INTRODUCED_IN(36);
143 
144 /**
145  * Returns the max number of the supported concurrent codec instances.
146  *
147  * This is a hint for an upper bound. Applications should not expect to successfully
148  * operate more instances than the returned value, but the actual number of
149  * concurrently operable instances may be less as it depends on the available
150  * resources at time of use.
151  *
152  * Return -1 if @param info is invalid.
153  */
154 int32_t AMediaCodecInfo_getMaxSupportedInstances(const AMediaCodecInfo *info) __INTRODUCED_IN(36);
155 
156 /**
157  * Query codec feature capabilities.
158  *
159  * These features are supported to be used by the codec.  These
160  * include optional features that can be turned on, as well as
161  * features that are always on.
162  *
163  * Return 1 if the feature is supported;
164  * Return 0 if the feature is unsupported;
165  * Return -1 if @param featureName is invalid.
166  */
167 int32_t AMediaCodecInfo_isFeatureSupported(const AMediaCodecInfo *info,
168         const char *featureName) __INTRODUCED_IN(36);
169 
170 /**
171  * Query codec feature requirements.
172  *
173  * These features are required to be used by the codec, and as such,
174  * they are always turned on.
175  *
176  * Return 1 if the feature is required;
177  * Return 0 if the feature is not required;
178  * Return -1 if @param featureName is invalid.
179  */
180 int32_t AMediaCodecInfo_isFeatureRequired(const AMediaCodecInfo *info,
181         const char *featureName) __INTRODUCED_IN(36);
182 
183 /**
184  * Query whether codec supports a given @param format.
185  *
186  * Return 1 if the format is supported;
187  * Return 0 if the format is unsupported;
188  * Return -1 if @param format is invalid.
189  */
190 int32_t AMediaCodecInfo_isFormatSupported(const AMediaCodecInfo *info,
191         const AMediaFormat *format) __INTRODUCED_IN(36);
192 
193 /**
194  * Get the ACodecAudioCapabilities from the given AMediaCodecInfo.
195  *
196  * @param outAudioCaps        The pointer to the output ACodecAudioCapabilities.
197  *                            It is owned by the framework and has an infinite lifetime.
198  *
199  * Return AMEDIA_OK if successfully got the ACodecAudioCapabilities.
200  * Return AMEDIA_ERROR_UNSUPPORTED if the codec is not an audio codec.
201  * Return AMEDIA_ERROR_INVALID_PARAMETER if @param info is invalid.
202  */
203 media_status_t AMediaCodecInfo_getAudioCapabilities(const AMediaCodecInfo *info,
204         const ACodecAudioCapabilities **outAudioCaps) __INTRODUCED_IN(36);
205 
206 /**
207  * Get the ACodecVideoCapabilities from the given AMediaCodecInfo.
208  *
209  * @param outVideoCaps        The pointer to the output ACodecVideoCapabilities.
210  *                            It is owned by the framework and has an infinite lifetime.
211  *
212  * Return AMEDIA_OK if successfully got the ACodecVideoCapabilities.
213  * Return AMEDIA_ERROR_UNSUPPORTED if the codec is not a video codec.
214  * Return AMEDIA_ERROR_INVALID_PARAMETER if @param info is invalid.
215  */
216 media_status_t AMediaCodecInfo_getVideoCapabilities(const AMediaCodecInfo *info,
217         const ACodecVideoCapabilities **outVideoCaps) __INTRODUCED_IN(36);
218 
219 /**
220  * Get the ACodecEncoderCapabilities from the given AMediaCodecInfo.
221  *
222  * @param outEncoderCaps        The pointer to the output ACodecEncoderCapabilities.
223  *                              It is owned by the framework and has an infinite lifetime.
224  *
225  * Return AMEDIA_OK if successfully got the ACodecEncoderCapabilities.
226  * Return AMEDIA_ERROR_UNSUPPORTED if the codec is not an encoder.
227  * Return AMEDIA_ERROR_INVALID_PARAMETER if @param info is invalid.
228  */
229 media_status_t AMediaCodecInfo_getEncoderCapabilities(const AMediaCodecInfo *info,
230         const ACodecEncoderCapabilities **outEncoderCaps) __INTRODUCED_IN(36);
231 
232 // ACodecAudioCapabilities
233 
234 /**
235  * Get the range of supported bitrates in bits/second.
236  *
237  * @param outRange  The pointer to the range of supported bitrates.
238  *                  Users are responsible for allocating a valid AIntRange structure and
239  *                  managing the lifetime of it.
240  *
241  * Return AMEDIA_OK if got bitrates successfully.
242  * Return AMEDIA_ERROR_INVALID_PARAMETER if any of @param audioCaps and @param outRange is invalid.
243  */
244 media_status_t ACodecAudioCapabilities_getBitrateRange(const ACodecAudioCapabilities *audioCaps,
245         AIntRange *outRange) __INTRODUCED_IN(36);
246 
247 /**
248  * Get the array of supported sample rates
249  *
250  * The array is sorted in ascending order.
251  *
252  * @param outArrayPtr   The pointer to the output sample rates array.
253  *                      The array is owned by the framework and has an infinite lifetime.
254  * @param outCount      The size of the output array.
255  *
256  * Return AMEDIA_OK if the codec supports only discrete values.
257  * Otherwise, it returns AMEDIA_ERROR_UNSUPPORTED.
258  * Return AMEDIA_ERROR_INVALID_PARAMETER if any of @param audioCaps, @param outArrayPtr
259  * and @param outCount is invalid.
260  */
261 media_status_t ACodecAudioCapabilities_getSupportedSampleRates(
262         const ACodecAudioCapabilities *audioCaps, const int **outArrayPtr,
263         size_t *outCount) __INTRODUCED_IN(36);
264 
265 /**
266  * Get the array of supported sample rate ranges.
267  *
268  * The array is sorted in ascending order, and the ranges are distinct (non-intersecting).
269  *
270  * @param outArrayPtr   The pointer to the out sample rate ranges array.
271  *                      The array is owned by the framework and has an infinite lifetime.
272  * @param outCount      The size of the out array.
273  *
274  * Return AMEDIA_OK if got the sample rate ranges successfully.
275  * Return AMEDIA_ERROR_INVALID_PARAMETER if any of @param audioCaps, @param outArrayPtr
276  * and @param outCount is invalid.
277  */
278 media_status_t ACodecAudioCapabilities_getSupportedSampleRateRanges(
279         const ACodecAudioCapabilities *audioCaps,
280         const AIntRange **outArrayPtr, size_t *outCount) __INTRODUCED_IN(36);
281 
282 /**
283  * Return the maximum number of input channels supported.
284  *
285  * Return -1 if @param audioCaps is invalid.
286  */
287 int32_t ACodecAudioCapabilities_getMaxInputChannelCount(
288         const ACodecAudioCapabilities *audioCaps) __INTRODUCED_IN(36);
289 
290 /**
291  * Returns the minimum number of input channels supported.
292  * This is often 1, but does vary for certain mime types.
293  *
294  * Return -1 if @param audioCaps is invalid.
295  */
296 int32_t ACodecAudioCapabilities_getMinInputChannelCount(
297         const ACodecAudioCapabilities *audioCaps) __INTRODUCED_IN(36);
298 
299 /**
300  * Get an array of ranges representing the number of input channels supported.
301  * The codec supports any number of input channels within this range.
302  * For many codecs, this will be a single range [1..N], for some N.
303  *
304  * The array is sorted in ascending order, and the ranges are distinct (non-intersecting).
305  *
306  * @param outArrayPtr   The pointer to the output array of input-channels ranges.
307  *                      The array is owned by the framework and has an infinite lifetime.
308  * @param outCount      The size of the output array.
309  *
310  * Return AMEDIA_OK if got the input channel array successfully.
311  * Return AMEDIA_ERROR_INVALID_PARAMETER if @param audioCaps is invalid.
312  */
313 media_status_t ACodecAudioCapabilities_getInputChannelCountRanges(
314         const ACodecAudioCapabilities *audioCaps,
315         const AIntRange **outArrayPtr, size_t *outCount) __INTRODUCED_IN(36);
316 
317 /**
318  * Query whether the sample rate is supported by the codec.
319  *
320  * Return 1 if the sample rate is supported.
321  * Return 0 if the sample rate is unsupported
322  * Return -1 if @param audioCaps is invalid.
323  */
324 int32_t ACodecAudioCapabilities_isSampleRateSupported(const ACodecAudioCapabilities *audioCaps,
325         int32_t sampleRate) __INTRODUCED_IN(36);
326 
327 // ACodecPerformancePoint
328 
329 /**
330  * Create a performance point for a given frame size and frame rate.
331  *
332  * Performance points are defined by number of pixels, pixel rate and frame rate.
333  *
334  * Users are responsible for calling
335  * ACodecPerformancePoint_delete(ACodecPerformancePoint *performancePoint) after use.
336  *
337  * @param width width of the frame in pixels
338  * @param height height of the frame in pixels
339  * @param frameRate frame rate in frames per second
340  */
341 ACodecPerformancePoint* ACodecPerformancePoint_create(int32_t width, int32_t height,
342         int32_t frameRate) __INTRODUCED_IN(36);
343 
344 /**
345  * Delete a created performance point.
346  *
347  * Return AMEDIA_OK if it is successfully deleted.
348  * Return AMEDIA_ERROR_INVALID_PARAMETER if @param performancePoint is invalid.
349  */
350 media_status_t ACodecPerformancePoint_delete(
351         ACodecPerformancePoint *performancePoint) __INTRODUCED_IN(36);
352 
353 /**
354  * Checks whether the performance point covers a media format.
355  *
356  * @param format Stream format considered.
357  * Return true if the performance point covers the format.
358  */
359 bool ACodecPerformancePoint_coversFormat(const ACodecPerformancePoint *performancePoint,
360         const AMediaFormat *format) __INTRODUCED_IN(36);
361 
362 /**
363  * Checks whether a performance point covers another performance point.
364  *
365  * Use this method to determine if a performance point advertised by a codec covers the
366  * performance point required. This method can also be used for loose ordering as this
367  * method is transitive.
368  *
369  * A Performance point represents an upper bound. This means that
370  * it covers all performance points with fewer pixels, pixel rate and frame rate.
371  *
372  * Return true if @param one covers @param another.
373  */
374 bool ACodecPerformancePoint_covers(const ACodecPerformancePoint *one,
375         const ACodecPerformancePoint *another) __INTRODUCED_IN(36);
376 
377 /**
378  * Checks whether two performance points are equal.
379  */
380 bool ACodecPerformancePoint_equals(const ACodecPerformancePoint *one,
381         const ACodecPerformancePoint *another) __INTRODUCED_IN(36);
382 
383 // ACodecVideoCapabilities
384 
385 /**
386  * Get the range of supported bitrates in bits/second.
387  *
388  * @param outRange  The pointer to the range of output bitrates.
389  *                  Users are responsible for allocating a valid AIntRange structure and
390  *                  managing the lifetime of it.
391  *
392  * Return AMEDIA_OK if got the supported bitrates successfully.
393  * Return AMEDIA_ERROR_INVALID_PARAMETER if any of @param videoCaps and @param outRange is invalid.
394  */
395 media_status_t ACodecVideoCapabilities_getBitrateRange(const ACodecVideoCapabilities *videoCaps,
396         AIntRange *outRange) __INTRODUCED_IN(36);
397 
398 /**
399  * Get the range of supported video widths.
400  *
401  * @param outRange  The pointer to the range of output supported widths.
402  *                  Users are responsible for allocating a valid AIntRange structure and
403  *                  managing the lifetime of it.
404  *
405  * Return AMEDIA_OK if got the supported video widths successfully.
406  * Return AMEDIA_ERROR_INVALID_PARAMETER if any of @param videoCaps and @param outRange is invalid.
407  */
408 media_status_t ACodecVideoCapabilities_getSupportedWidths(const ACodecVideoCapabilities *videoCaps,
409         AIntRange *outRange) __INTRODUCED_IN(36);
410 
411 /**
412  * Get the range of supported video heights.
413  *
414  * @param outRange  The pointer to the range of output supported heights.
415  *                  Users are responsible for allocating a valid AIntRange structure and
416  *                  managing the lifetime of it.
417  *
418  * Return AMEDIA_OK if got the supported video heights successfully.
419  * Return AMEDIA_ERROR_INVALID_PARAMETER if any of @param videoCaps and @param outRange is invalid.
420  */
421 media_status_t ACodecVideoCapabilities_getSupportedHeights(const ACodecVideoCapabilities *videoCaps,
422         AIntRange *outRange) __INTRODUCED_IN(36);
423 
424 /**
425  * Return the alignment requirement for video width (in pixels).
426  *
427  * This is a power-of-2 value that video width must be a multiple of.
428  *
429  * Return -1 if @param videoCaps is invalid.
430  */
431 int32_t ACodecVideoCapabilities_getWidthAlignment(
432         const ACodecVideoCapabilities *videoCaps) __INTRODUCED_IN(36);
433 
434 /**
435  * Return the alignment requirement for video height (in pixels).
436  *
437  * This is a power-of-2 value that video height must be a multiple of.
438  *
439  * Return -1 if @param videoCaps is invalid.
440  */
441 int32_t ACodecVideoCapabilities_getHeightAlignment(
442         const ACodecVideoCapabilities *videoCaps) __INTRODUCED_IN(36);
443 
444 /**
445  * Get the range of supported frame rates.
446  *
447  * This is not a performance indicator. Rather, it expresses the limits specified in the coding
448  * standard, based on the complexities of encoding material for later playback at a certain
449  * frame rate, or the decoding of such material in non-realtime.
450  *
451  * @param outRange  The pointer to the range of output supported frame rates.
452  *                  Users are responsible for allocating a valid AIntRange structure and
453  *                  managing the lifetime of it.
454  *
455  * \return AMEDIA_OK if got the frame rate range successfully.
456  * \return AMEDIA_ERROR_INVALID_PARAMETER if any of @param videoCaps and @param outRange is invalid.
457  */
458 media_status_t ACodecVideoCapabilities_getSupportedFrameRates(
459         const ACodecVideoCapabilities *videoCaps, AIntRange *outRange) __INTRODUCED_IN(36);
460 
461 /**
462  * Get the range of supported video widths for a video height.
463  *
464  * @param outRange      The pointer to the range of supported widths.
465  *                      Users are responsible for allocating a valid AIntRange structure and
466  *                      managing the lifetime of it.
467  *
468  * Return AMEDIA_OK if got the supported video width range successfully.
469  * Return AMEDIA_ERROR_UNSUPPORTED if the height query is not supported.
470  * Return AMEDIA_ERROR_INVALID_PARAMETER if any of @param videoCaps and @param outRange is invalid.
471  */
472 media_status_t ACodecVideoCapabilities_getSupportedWidthsFor(
473         const ACodecVideoCapabilities *videoCaps, int32_t height,
474         AIntRange *outRange) __INTRODUCED_IN(36);
475 
476 /**
477  * Get the range of supported video heights for a video width.
478  *
479  * @param outRange      The pointer to the range of supported heights.
480  *                      Users are responsible for allocating a valid AIntRange structure and
481  *                      managing the lifetime of it.
482  *
483  * Return AMEDIA_OK if got the supported video height range successfully.
484  * Return AMEDIA_ERROR_UNSUPPORTED if the width query is not supported.
485  * Return AMEDIA_ERROR_INVALID_PARAMETER if any of @param videoCaps and @param outRange is invalid.
486  */
487 media_status_t ACodecVideoCapabilities_getSupportedHeightsFor(
488         const ACodecVideoCapabilities *videoCaps, int32_t width,
489         AIntRange *outRange) __INTRODUCED_IN(36);
490 
491 /**
492  * Get the range of supported video frame rates for a video size.
493  *
494  * This is not a performance indicator.  Rather, it expresses the limits specified in the coding
495  * standard, based on the complexities of encoding material of a given size for later playback at
496  * a certain frame rate, or the decoding of such material in non-realtime.
497  *
498  * @param outRange      The pointer to the range of frame rates.
499  *                      Users are responsible for allocating a valid ADoubleRange structure and
500  *                      managing the lifetime of it.
501  *
502  * Return AMEDIA_OK if got the supported video frame rates successfully.
503  * Return AMEDIA_ERROR_UNSUPPORTED if the size query is not supported.
504  * Return AMEDIA_ERROR_INVALID_PARAMETER if any of @param videoCaps and @param outRange is invalid.
505  */
506 media_status_t ACodecVideoCapabilities_getSupportedFrameRatesFor(
507         const ACodecVideoCapabilities *videoCaps, int32_t width, int32_t height,
508         ADoubleRange *outRange) __INTRODUCED_IN(36);
509 
510 /**
511  * Get the range of achievable video frame rates for a video size.
512  *
513  * This is based on manufacturer's performance measurements for this device and codec.
514  * The measurements may not be available for all codecs or devices.
515  *
516  * @param outRange      The pointer to the range of frame rates.
517   *                     Users are responsible for allocating a valid ADoubleRange structure and
518  *                      managing the lifetime of it.
519  *
520  * Return AMEDIA_OK if got the achievable video frame rates successfully.
521  * Return AMEDIA_ERROR_UNSUPPORTED if the codec did not publish any measurement data.
522  * Return AMEDIA_ERROR_INVALID_PARAMETER if any of @param videoCaps and @param outRange is invalid.
523  */
524 media_status_t ACodecVideoCapabilities_getAchievableFrameRatesFor(
525         const ACodecVideoCapabilities *videoCaps, int32_t width, int32_t height,
526         ADoubleRange *outRange) __INTRODUCED_IN(36);
527 
528 /**
529  * Get the supported performance points.
530  *
531  * @param outPerformancePointArray      The pointer to the output performance points array.
532  *                                      The array is owned by the framework and has an infinite
533  *                                      lifetime.
534  * @param outCount                      The size of the output array.
535  *
536  * Return AMEDIA_OK if successfully got the performance points.
537  * Return AMEDIA_ERROR_INVALID_PARAMETER if @param videoCaps is invalid.
538  */
539 media_status_t ACodecVideoCapabilities_getSupportedPerformancePoints(
540         const ACodecVideoCapabilities *videoCaps,
541         const ACodecPerformancePoint **outPerformancePointArray,
542         size_t *outCount) __INTRODUCED_IN(36);
543 
544 /**
545  * Return whether a given video size and frameRate combination is supported.
546  *
547  * Return 1 if the size and rate are supported.
548  * Return 0 if they are not supported.
549  * Return -1 if @param videoCaps is invalid.
550  */
551 int32_t ACodecVideoCapabilities_areSizeAndRateSupported(const ACodecVideoCapabilities *videoCaps,
552         int32_t width, int32_t height, double frameRate) __INTRODUCED_IN(36);
553 
554 /**
555  * Return whether a given video size is supported.
556  *
557  * Return 1 if the size is supported.
558  * Return 0 if the size is not supported.
559  * Return -1 if @param videoCaps is invalid.
560  */
561 int32_t ACodecVideoCapabilities_isSizeSupported(const ACodecVideoCapabilities *videoCaps,
562         int32_t width, int32_t height) __INTRODUCED_IN(36);
563 
564 // ACodecEncoderCapabilities
565 
566 /**
567  * Get the supported range of quality values.
568  *
569  * Quality is implementation-specific. As a general rule, a higher quality
570  * setting results in a better image quality and a lower compression ratio.
571  *
572  * @param outRange      The pointer to the range of quality values.
573  *                      Users are responsible for allocating a valid AIntRange structure and
574  *                      managing the lifetime of it.
575  *
576  * Return AMEDIA_OK if successfully got the quality range.
577  * Return AMEDIA_ERROR_INVALID_PARAMETER if any of @param videoCaps and @param outRange is invalid.
578  */
579 media_status_t ACodecEncoderCapabilities_getQualityRange(
580         const ACodecEncoderCapabilities *encoderCaps,
581         AIntRange *outRange) __INTRODUCED_IN(36);
582 
583 /**
584  * Get the supported range of encoder complexity values.
585  *
586  * Some codecs may support multiple complexity levels, where higher complexity values use more
587  * encoder tools (e.g. perform more intensive calculations) to improve the quality or the
588  * compression ratio. Use a lower value to save power and/or time.
589  *
590  * @param outRange      The pointer to the range of encoder complexity values.
591  *                      Users are responsible for allocating a valid AIntRange structure and
592  *                      managing the lifetime of it.
593  *
594  * Return AMEDIA_OK if successfully got the complexity range.
595  * Return AMEDIA_ERROR_INVALID_PARAMETER if any of @param videoCaps and @param outRange is invalid.
596  */
597 media_status_t ACodecEncoderCapabilities_getComplexityRange(
598         const ACodecEncoderCapabilities *encoderCaps,
599         AIntRange *outRange) __INTRODUCED_IN(36);
600 
601 /**
602  * Encoder bitrate modes.
603  */
604 typedef enum ABiterateMode : int32_t {
605     BITRATE_MODE_CQ = 0,
606     BITRATE_MODE_VBR = 1,
607     BITRATE_MODE_CBR = 2,
608     BITRATE_MODE_CBR_FD = 3
609 } ABiterateMode;
610 
611 /**
612  * Query whether a bitrate mode is supported.
613  *
614  * Return 1 if the bitrate mode is supported.
615  * Return 0 if the bitrate mode is unsupported.
616  * Return -1 if @param encoderCaps is invalid.
617  */
618 int32_t ACodecEncoderCapabilities_isBitrateModeSupported(
619         const ACodecEncoderCapabilities *encoderCaps, ABiterateMode mode) __INTRODUCED_IN(36);
620 
621 __END_DECLS
622 
623 #endif //_NDK_MEDIA_CODEC_INFO_H
624 
625 /** @} */