• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# AVCapability
2
3
4## Overview
5
6The **AVCapability** module provides functions for querying the codec capability.
7
8\@syscap SystemCapability.Multimedia.Media.CodecBase
9
10**Since**
11
1210
13
14
15## Summary
16
17
18### Files
19
20| Name| Description|
21| -------- | -------- |
22| [native_avcapability.h](native__avcapability_8h.md) | Declares the native APIs used to query the codec capability.<br>**File to include**: <multimedia/player_framework/native_avcapability.h><br>**Library**: libnative_media_codecbase.so|
23
24
25### Structs
26
27| Name| Description|
28| -------- | -------- |
29| [OH_AVRange](_o_h___a_v_range.md) | Defines the value range, which contains the minimum value and maximum value.|
30
31
32### Types
33
34| Name| Description|
35| -------- | -------- |
36| [OH_BitrateMode](#oh_bitratemode) | Defines an enum that enumerates the bit rate modes of an encoder.|
37| [OH_AVRange](#oh_avrange) | Defines a struct for the value range, which contains the minimum value and maximum value.|
38| [OH_AVCodecCategory](#oh_avcodeccategory) | Defines an enum that enumerates the codec categories.|
39
40
41### Enums
42
43| Name| Description|
44| -------- | -------- |
45| [OH_BitrateMode](#oh_bitratemode) { **BITRATE_MODE_CBR** = 0, **BITRATE_MODE_VBR** = 1, **BITRATE_MODE_CQ** = 2 } | Enumerates the bit rate modes of an encoder.|
46| [OH_AVCodecCategory](#oh_avcodeccategory) { **HARDWARE** = 0, **SOFTWARE** } | Enumerates the codec categories.|
47
48
49### Functions
50
51| Name| Description|
52| -------- | -------- |
53| \*[OH_AVCodec_GetCapability](#oh_avcodec_getcapability) (const char \*mime, bool isEncoder) | Obtains the codec capability recommended by the system.|
54| \*[OH_AVCodec_GetCapabilityByCategory](#oh_avcodec_getcapabilitybycategory) (const char \*mime, bool isEncoder, [OH_AVCodecCategory](#oh_avcodeccategory) category) | Obtains the codec capability by category, which can be a hardware codec or software codec.|
55| [OH_AVCapability_IsHardware](#oh_avcapability_ishardware) (OH_AVCapability \*capability) | Checks whether a codec capability instance describes a hardware codec.|
56| \*[OH_AVCapability_GetName](#oh_avcapability_getname) (OH_AVCapability \*capability) | Obtains the codec name.|
57| [OH_AVCapability_GetMaxSupportedInstances](#oh_avcapability_getmaxsupportedinstances) (OH_AVCapability \*capability) | Obtains the maximum number of codec instances supported by a codec.|
58| [OH_AVCapability_GetEncoderBitrateRange](#oh_avcapability_getencoderbitraterange) (OH_AVCapability \*capability, [OH_AVRange](_o_h___a_v_range.md) \*bitrateRange) | Obtains the bit rate range supported by an encoder.|
59| [OH_AVCapability_IsEncoderBitrateModeSupported](#oh_avcapability_isencoderbitratemodesupported) (OH_AVCapability \*capability, [OH_BitrateMode](#oh_bitratemode) bitrateMode) | Checks whether an encoder supports a specific bit rate mode.|
60| [OH_AVCapability_GetEncoderQualityRange](#oh_avcapability_getencoderqualityrange) (OH_AVCapability \*capability, [OH_AVRange](_o_h___a_v_range.md) \*qualityRange) | Obtains the quality range supported by an encoder.|
61| [OH_AVCapability_GetEncoderComplexityRange](#oh_avcapability_getencodercomplexityrange) (OH_AVCapability \*capability, [OH_AVRange](_o_h___a_v_range.md) \*complexityRange) | Obtains the complexity range supported by an encoder.|
62| [OH_AVCapability_GetAudioSupportedSampleRates](#oh_avcapability_getaudiosupportedsamplerates) (OH_AVCapability \*capability, const int32_t \*\*sampleRates, uint32_t \*sampleRateNum) | Obtains the sampling rates supported by an audio codec.|
63| [OH_AVCapability_GetAudioChannelCountRange](#oh_avcapability_getaudiochannelcountrange) (OH_AVCapability \*capability, [OH_AVRange](_o_h___a_v_range.md) \*channelCountRange) | Obtains the count range of audio channels supported by an audio codec.|
64| [OH_AVCapability_GetVideoWidthAlignment](#oh_avcapability_getvideowidthalignment) (OH_AVCapability \*capability, int32_t \*widthAlignment) | Obtains the video width alignment supported by a video codec.|
65| [OH_AVCapability_GetVideoHeightAlignment](#oh_avcapability_getvideoheightalignment) (OH_AVCapability \*capability, int32_t \*heightAlignment) | Obtains the video height alignment supported by a video codec.|
66| [OH_AVCapability_GetVideoWidthRangeForHeight](#oh_avcapability_getvideowidthrangeforheight) (OH_AVCapability \*capability, int32_t height, [OH_AVRange](_o_h___a_v_range.md) \*widthRange) | Obtains the video width range supported by a video codec based on a given height.|
67| [OH_AVCapability_GetVideoHeightRangeForWidth](#oh_avcapability_getvideoheightrangeforwidth) (OH_AVCapability \*capability, int32_t width, [OH_AVRange](_o_h___a_v_range.md) \*heightRange) | Obtains the video height range supported by a video codec based on a given width.|
68| [OH_AVCapability_GetVideoWidthRange](#oh_avcapability_getvideowidthrange) (OH_AVCapability \*capability, [OH_AVRange](_o_h___a_v_range.md) \*widthRange) | Obtains the video width range supported by a video codec.|
69| [OH_AVCapability_GetVideoHeightRange](#oh_avcapability_getvideoheightrange) (OH_AVCapability \*capability, [OH_AVRange](_o_h___a_v_range.md) \*heightRange) | Obtains the video height range supported by a video codec.|
70| [OH_AVCapability_IsVideoSizeSupported](#oh_avcapability_isvideosizesupported) (OH_AVCapability \*capability, int32_t width, int32_t height) | Checks whether a video codec supports a specific video size.|
71| [OH_AVCapability_GetVideoFrameRateRange](#oh_avcapability_getvideoframeraterange) (OH_AVCapability \*capability, [OH_AVRange](_o_h___a_v_range.md) \*frameRateRange) | Obtains the video frame rate range supported by a video codec.|
72| [OH_AVCapability_GetVideoFrameRateRangeForSize](#oh_avcapability_getvideoframeraterangeforsize) (OH_AVCapability \*capability, int32_t width, int32_t height, [OH_AVRange](_o_h___a_v_range.md) \*frameRateRange) | Obtains the video frame rate range supported by a video codec based on a given video size.|
73| [OH_AVCapability_AreVideoSizeAndFrameRateSupported](#oh_avcapability_arevideosizeandframeratesupported) (OH_AVCapability \*capability, int32_t width, int32_t height, int32_t frameRate) | Checks whether a video codec supports the combination of a video size and frame rate.|
74| [OH_AVCapability_GetVideoSupportedPixelFormats](#oh_avcapability_getvideosupportedpixelformats) (OH_AVCapability \*capability, const int32_t \*\*pixelFormats, uint32_t \*pixelFormatNum) | Obtains the video pixel formats supported by a video codec.|
75| [OH_AVCapability_GetSupportedProfiles](#oh_avcapability_getsupportedprofiles) (OH_AVCapability \*capability, const int32_t \*\*profiles, uint32_t \*profileNum) | Obtains the profiles supported by a codec.|
76| [OH_AVCapability_GetSupportedLevelsForProfile](#oh_avcapability_getsupportedlevelsforprofile) (OH_AVCapability \*capability, int32_t profile, const int32_t \*\*levels, uint32_t \*levelNum) | Obtains the codec levels supported by a profile.|
77| [OH_AVCapability_AreProfileAndLevelSupported](#oh_avcapability_areprofileandlevelsupported) (OH_AVCapability \*capability, int32_t profile, int32_t level) | Checks whether a codec supports the combination of a profile and level.|
78
79
80### Variables
81
82| Name| Description|
83| -------- | -------- |
84| **OH_AVRange::minVal** | Defines the minimum value.|
85| **OH_AVRange::maxVal** | Defines the maximum value.|
86
87
88## Type Description
89
90
91### OH_AVCodecCategory
92
93
94```
95typedef enum OH_AVCodecCategory OH_AVCodecCategory
96```
97
98**Description**
99
100Defines an enum that enumerates the codec categories.
101
102\@syscap SystemCapability.Multimedia.Media.CodecBase
103
104**Since**
105
10610
107
108
109### OH_AVRange
110
111
112```
113typedef struct OH_AVRange OH_AVRange
114```
115
116**Description**
117
118Defines a struct for the value range, which contains the minimum value and maximum value.
119
120\@syscap SystemCapability.Multimedia.Media.CodecBase
121
122**Since**
123
12410
125
126
127### OH_BitrateMode
128
129
130```
131typedef enum OH_BitrateMode OH_BitrateMode
132```
133
134**Description**
135
136Defines an enum that enumerates the bit rate modes of an encoder.
137
138\@syscap SystemCapability.Multimedia.Media.CodecBase
139
140**Since**
141
14210
143
144
145## Enum Description
146
147
148### OH_AVCodecCategory
149
150
151```
152enum OH_AVCodecCategory
153```
154
155**Description**
156
157Defines an enum that enumerates the codec categories.
158
159\@syscap SystemCapability.Multimedia.Media.CodecBase
160
161**Since**
162
16310
164
165| Value| Description|
166| -------- | -------- |
167| HARDWARE | Hardware codec.|
168| SOFTWARE | Software codec.|
169
170
171### OH_BitrateMode
172
173
174```
175enum OH_BitrateMode
176```
177
178**Description**
179
180Defines an enum that enumerates the bit rate modes of an encoder.
181
182\@syscap SystemCapability.Multimedia.Media.CodecBase
183
184**Since**
185
18610
187
188| Value| Description|
189| -------- | -------- |
190| BITRATE_MODE_CBR | Constant bit rate.|
191| BITRATE_MODE_VBR | Variable bit rate.|
192| BITRATE_MODE_CQ | Constant quality.|
193
194
195## Function Description
196
197
198### OH_AVCapability_AreProfileAndLevelSupported()
199
200
201```
202bool OH_AVCapability_AreProfileAndLevelSupported (OH_AVCapability *capability, int32_t profile, int32_t level)
203```
204
205**Description**
206
207Checks whether a codec supports the combination of a profile and level.
208
209\@syscap SystemCapability.Multimedia.Media.CodecBase
210
211**Parameters**
212
213| Name| Description|
214| -------- | -------- |
215| capability | Pointer to the codec capability.|
216| profile | Profile of the codec.|
217| level | Level of the codec.|
218
219**Returns**
220
221Returns **true** if the combination of the profile and level is supported; returns **false** otherwise.
222
223**Since**
224
22510
226
227
228### OH_AVCapability_AreVideoSizeAndFrameRateSupported()
229
230
231```
232bool OH_AVCapability_AreVideoSizeAndFrameRateSupported (OH_AVCapability *capability, int32_t width, int32_t height, int32_t frameRate)
233```
234
235**Description**
236
237Checks whether a video codec supports the combination of a video size and frame rate.
238
239\@syscap SystemCapability.Multimedia.Media.CodecBase
240
241**Parameters**
242
243| Name| Description|
244| -------- | -------- |
245| capability | Pointer to the video codec capability. A pointer to the audio codec capability cannot be filled in.|
246| width | Number of horizontal video pixels.|
247| height | Number of vertical video pixels.|
248| frameRate | Number of frames per second.|
249
250**Returns**
251
252Returns **true** if the combination of the video size and frame rate is supported; returns **false** otherwise.
253
254**Since**
255
25610
257
258
259### OH_AVCapability_GetAudioChannelCountRange()
260
261
262```
263OH_AVErrCode OH_AVCapability_GetAudioChannelCountRange (OH_AVCapability *capability, OH_AVRange *channelCountRange)
264```
265
266**Description**
267
268Obtains the count range of audio channels supported by an audio codec.
269
270\@syscap SystemCapability.Multimedia.Media.CodecBase
271
272**Parameters**
273
274| Name| Description|
275| -------- | -------- |
276| capability | Pointer to the audio codec capability. A pointer to the video codec capability cannot be filled in.|
277| channelCountRange | Output parameter. Pointer to the count range of audio channels supported.|
278
279**Returns**
280
281Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
282
283**Since**
284
28510
286
287
288### OH_AVCapability_GetAudioSupportedSampleRates()
289
290
291```
292OH_AVErrCode OH_AVCapability_GetAudioSupportedSampleRates (OH_AVCapability *capability, const int32_t **sampleRates, uint32_t *sampleRateNum)
293```
294
295**Description**
296
297Obtains the sampling rates supported by an audio codec.
298
299\@syscap SystemCapability.Multimedia.Media.CodecBase
300
301**Parameters**
302
303| Name| Description|
304| -------- | -------- |
305| capability | Pointer to the audio codec capability. A pointer to the video codec capability cannot be filled in.|
306| sampleRates | Output parameter. Double pointer to the sampling rate array.|
307| sampleRateNum | Output parameter. Pointer to the number of elements in the array.|
308
309**Returns**
310
311Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
312
313**Since**
314
31510
316
317
318### OH_AVCapability_GetEncoderBitrateRange()
319
320
321```
322OH_AVErrCode OH_AVCapability_GetEncoderBitrateRange (OH_AVCapability *capability, OH_AVRange *bitrateRange)
323```
324
325**Description**
326
327Obtains the bit rate range supported by an encoder.
328
329\@syscap SystemCapability.Multimedia.Media.CodecBase
330
331**Parameters**
332
333| Name| Description|
334| -------- | -------- |
335| capability | Pointer to the encoder capability. A pointer to the decoder capability cannot be filled in.|
336| bitrateRange | Output parameter. Pointer to the bit rate range supported.|
337
338**Returns**
339
340Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
341
342**Since**
343
34410
345
346
347### OH_AVCapability_GetEncoderComplexityRange()
348
349
350```
351OH_AVErrCode OH_AVCapability_GetEncoderComplexityRange (OH_AVCapability *capability, OH_AVRange *complexityRange)
352```
353
354**Description**
355
356Obtains the complexity range supported by an encoder.
357
358\@syscap SystemCapability.Multimedia.Media.CodecBase
359
360**Parameters**
361
362| Name| Description|
363| -------- | -------- |
364| capability | Pointer to the encoder capability. A pointer to the decoder capability cannot be filled in.|
365| complexityRange | Output parameter. Pointer to the complexity range supported.|
366
367**Returns**
368
369Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
370
371**Since**
372
37310
374
375
376### OH_AVCapability_GetEncoderQualityRange()
377
378
379```
380OH_AVErrCode OH_AVCapability_GetEncoderQualityRange (OH_AVCapability *capability, OH_AVRange *qualityRange)
381```
382
383**Description**
384
385Obtains the quality range supported by an encoder.
386
387\@syscap SystemCapability.Multimedia.Media.CodecBase
388
389**Parameters**
390
391| Name| Description|
392| -------- | -------- |
393| capability | Pointer to the encoder capability. A pointer to the decoder capability cannot be filled in.|
394| qualityRange | Output parameter. Pointer to the quality range supported.|
395
396**Returns**
397
398Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
399
400**Since**
401
40210
403
404
405### OH_AVCapability_GetMaxSupportedInstances()
406
407
408```
409int32_t OH_AVCapability_GetMaxSupportedInstances (OH_AVCapability *capability)
410```
411
412**Description**
413
414Obtains the maximum number of codec instances supported by a codec.
415
416\@syscap SystemCapability.Multimedia.Media.CodecBase
417
418**Parameters**
419
420| Name| Description|
421| -------- | -------- |
422| capability | Pointer to the codec capability.|
423
424**Returns**
425
426Returns the maximum number of codec instances supported.
427
428**Since**
429
43010
431
432
433### OH_AVCapability_GetName()
434
435
436```
437const char* OH_AVCapability_GetName (OH_AVCapability *capability)
438```
439
440**Description**
441
442Obtains the codec name.
443
444\@syscap SystemCapability.Multimedia.Media.CodecBase
445
446**Parameters**
447
448| Name| Description|
449| -------- | -------- |
450| capability | Pointer to the codec capability.|
451
452**Returns**
453
454Returns the codec name string.
455
456**Since**
457
45810
459
460
461### OH_AVCapability_GetSupportedLevelsForProfile()
462
463
464```
465OH_AVErrCode OH_AVCapability_GetSupportedLevelsForProfile (OH_AVCapability *capability, int32_t profile, const int32_t **levels, uint32_t *levelNum)
466```
467
468**Description**
469
470Obtains the codec levels supported by a profile.
471
472\@syscap SystemCapability.Multimedia.Media.CodecBase
473
474**Parameters**
475
476| Name| Description|
477| -------- | -------- |
478| capability | Pointer to the codec capability.|
479| profile | Profile of the codec.|
480| levels | Output parameter. Double pointer to the codec level array.|
481| levelNum | Output parameter. Pointer to the number of elements in the array.|
482
483**Returns**
484
485Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
486
487**Since**
488
48910
490
491
492### OH_AVCapability_GetSupportedProfiles()
493
494
495```
496OH_AVErrCode OH_AVCapability_GetSupportedProfiles (OH_AVCapability *capability, const int32_t **profiles, uint32_t *profileNum)
497```
498
499**Description**
500
501Obtains the profiles supported by a codec.
502
503\@syscap SystemCapability.Multimedia.Media.CodecBase
504
505**Parameters**
506
507| Name| Description|
508| -------- | -------- |
509| capability | Pointer to the codec capability.|
510| profiles | Output parameter. Double pointer to the profile array.|
511| profileNum | Output parameter. Pointer to the number of elements in the array.|
512
513**Returns**
514
515Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
516
517**Since**
518
51910
520
521
522### OH_AVCapability_GetVideoFrameRateRange()
523
524
525```
526OH_AVErrCode OH_AVCapability_GetVideoFrameRateRange (OH_AVCapability *capability, OH_AVRange *frameRateRange)
527```
528
529**Description**
530
531Obtains the video frame rate range supported by a video codec.
532
533\@syscap SystemCapability.Multimedia.Media.CodecBase
534
535**Parameters**
536
537| Name| Description|
538| -------- | -------- |
539| capability | Pointer to the video codec capability. A pointer to the audio codec capability cannot be filled in.|
540| frameRateRange | Output parameter. Pointer to the video frame rate range supported.|
541
542**Returns**
543
544Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
545
546**Since**
547
54810
549
550
551### OH_AVCapability_GetVideoFrameRateRangeForSize()
552
553
554```
555OH_AVErrCode OH_AVCapability_GetVideoFrameRateRangeForSize (OH_AVCapability *capability, int32_t width, int32_t height, OH_AVRange *frameRateRange)
556```
557
558**Description**
559
560Obtains the video frame rate range supported by a video codec based on a given video size.
561
562\@syscap SystemCapability.Multimedia.Media.CodecBase
563
564**Parameters**
565
566| Name| Description|
567| -------- | -------- |
568| capability | Pointer to the video codec capability. A pointer to the audio codec capability cannot be filled in.|
569| width | Number of horizontal video pixels.|
570| height | Number of vertical video pixels.|
571| frameRateRange | Output parameter. Pointer to the video frame rate range supported.|
572
573**Returns**
574
575Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
576
577**Since**
578
57910
580
581
582### OH_AVCapability_GetVideoHeightAlignment()
583
584
585```
586OH_AVErrCode OH_AVCapability_GetVideoHeightAlignment (OH_AVCapability *capability, int32_t *heightAlignment)
587```
588
589**Description**
590
591Obtains the video height alignment supported by a video codec.
592
593\@syscap SystemCapability.Multimedia.Media.CodecBase
594
595**Parameters**
596
597| Name| Description|
598| -------- | -------- |
599| capability | Pointer to the video codec capability. A pointer to the audio codec capability cannot be filled in.|
600| heightAlignment | Output parameter. Pointer to the video height alignment supported.|
601
602**Returns**
603
604Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
605
606**Since**
607
60810
609
610
611### OH_AVCapability_GetVideoHeightRange()
612
613
614```
615OH_AVErrCode OH_AVCapability_GetVideoHeightRange (OH_AVCapability *capability, OH_AVRange *heightRange)
616```
617
618**Description**
619
620Obtains the video height range supported by a video codec.
621
622\@syscap SystemCapability.Multimedia.Media.CodecBase
623
624**Parameters**
625
626| Name| Description|
627| -------- | -------- |
628| capability | Pointer to the video codec capability. A pointer to the audio codec capability cannot be filled in.|
629| heightRange | Output parameter. Pointer to the video height range supported.|
630
631**Returns**
632
633Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
634
635**Since**
636
63710
638
639
640### OH_AVCapability_GetVideoHeightRangeForWidth()
641
642
643```
644OH_AVErrCode OH_AVCapability_GetVideoHeightRangeForWidth (OH_AVCapability *capability, int32_t width, OH_AVRange *heightRange)
645```
646
647**Description**
648
649Obtains the video height range supported by a video codec based on a given width.
650
651\@syscap SystemCapability.Multimedia.Media.CodecBase
652
653**Parameters**
654
655| Name| Description|
656| -------- | -------- |
657| capability | Pointer to the video codec capability. A pointer to the audio codec capability cannot be filled in.|
658| width | Number of horizontal video pixels.|
659| heightRange | Output parameter. Pointer to the video height range supported.|
660
661**Returns**
662
663Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
664
665**Since**
666
66710
668
669
670### OH_AVCapability_GetVideoSupportedPixelFormats()
671
672
673```
674OH_AVErrCode OH_AVCapability_GetVideoSupportedPixelFormats (OH_AVCapability *capability, const int32_t **pixelFormats, uint32_t *pixelFormatNum)
675```
676
677**Description**
678
679Obtains the video pixel formats supported by a video codec.
680
681\@syscap SystemCapability.Multimedia.Media.CodecBase
682
683**Parameters**
684
685| Name| Description|
686| -------- | -------- |
687| capability | Pointer to the video codec capability. A pointer to the audio codec capability cannot be filled in.|
688| pixelFormats | Output parameter. Double pointer to the video pixel format array.|
689| pixelFormatNum | Output parameter. Pointer to the number of elements in the array.|
690
691**Returns**
692
693Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
694
695**Since**
696
69710
698
699
700### OH_AVCapability_GetVideoWidthAlignment()
701
702
703```
704OH_AVErrCode OH_AVCapability_GetVideoWidthAlignment (OH_AVCapability *capability, int32_t *widthAlignment)
705```
706
707**Description**
708
709Obtains the video width alignment supported by a video codec.
710
711\@syscap SystemCapability.Multimedia.Media.CodecBase
712
713**Parameters**
714
715| Name| Description|
716| -------- | -------- |
717| capability | Pointer to the video codec capability. A pointer to the audio codec capability cannot be filled in.|
718| widthAlignment | Output parameter. Pointer to the video width alignment supported.|
719
720**Returns**
721
722Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
723
724**Since**
725
72610
727
728
729### OH_AVCapability_GetVideoWidthRange()
730
731
732```
733OH_AVErrCode OH_AVCapability_GetVideoWidthRange (OH_AVCapability *capability, OH_AVRange *widthRange)
734```
735
736**Description**
737
738Obtains the video width range supported by a video codec.
739
740\@syscap SystemCapability.Multimedia.Media.CodecBase
741
742**Parameters**
743
744| Name| Description|
745| -------- | -------- |
746| capability | Pointer to the video codec capability. A pointer to the audio codec capability cannot be filled in.|
747| widthRange | Output parameter. Pointer to the video width range supported.|
748
749**Returns**
750
751Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
752
753**Since**
754
75510
756
757
758### OH_AVCapability_GetVideoWidthRangeForHeight()
759
760
761```
762OH_AVErrCode OH_AVCapability_GetVideoWidthRangeForHeight (OH_AVCapability *capability, int32_t height, OH_AVRange *widthRange)
763```
764
765**Description**
766
767Obtains the video width range supported by a video codec based on a given height.
768
769\@syscap SystemCapability.Multimedia.Media.CodecBase
770
771**Parameters**
772
773| Name| Description|
774| -------- | -------- |
775| capability | Pointer to the video codec capability. A pointer to the audio codec capability cannot be filled in.|
776| height | Number of vertical video pixels.|
777| widthRange | Output parameter. Pointer to the video width range supported.|
778
779**Returns**
780
781Returns **AV_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVErrCode](_core.md#oh_averrcode) otherwise.
782
783**Since**
784
78510
786
787
788### OH_AVCapability_IsEncoderBitrateModeSupported()
789
790
791```
792bool OH_AVCapability_IsEncoderBitrateModeSupported (OH_AVCapability *capability, OH_BitrateMode bitrateMode)
793```
794
795**Description**
796
797Checks whether an encoder supports a specific bit rate mode.
798
799\@syscap SystemCapability.Multimedia.Media.CodecBase
800
801**Parameters**
802
803| Name| Description|
804| -------- | -------- |
805| capability | Pointer to the encoder capability. A pointer to the decoder capability cannot be filled in.|
806| bitrateMode | Bit rate mode.|
807
808**Returns**
809
810Returns **true** if the bit rate mode is supported; returns **false** otherwise.
811
812**Since**
813
81410
815
816
817### OH_AVCapability_IsHardware()
818
819
820```
821bool OH_AVCapability_IsHardware (OH_AVCapability *capability)
822```
823
824**Description**
825
826Checks whether a codec capability instance describes a hardware codec.
827
828\@syscap SystemCapability.Multimedia.Media.CodecBase
829
830**Parameters**
831
832| Name| Description|
833| -------- | -------- |
834| capability | Pointer to the codec capability.|
835
836**Returns**
837
838Returns **true** if the codec capability instance describes a hardware codec; returns **false**.
839
840**Since**
841
84210
843
844
845### OH_AVCapability_IsVideoSizeSupported()
846
847
848```
849bool OH_AVCapability_IsVideoSizeSupported (OH_AVCapability *capability, int32_t width, int32_t height)
850```
851
852**Description**
853
854Checks whether a video codec supports a specific video size.
855
856\@syscap SystemCapability.Multimedia.Media.CodecBase
857
858**Parameters**
859
860| Name| Description|
861| -------- | -------- |
862| capability | Pointer to the video codec capability. A pointer to the audio codec capability cannot be filled in.|
863| width | Number of horizontal video pixels.|
864| height | Number of vertical video pixels.|
865
866**Returns**
867
868Returns **true** if the video size is supported; returns **false** otherwise.
869
870**Since**
871
87210
873
874
875### OH_AVCodec_GetCapability()
876
877
878```
879OH_AVCapability* OH_AVCodec_GetCapability (const char *mime, bool isEncoder)
880```
881
882**Description**
883
884Obtains the codec capability recommended by the system.
885
886\@syscap SystemCapability.Multimedia.Media.CodecBase
887
888**Parameters**
889
890| Name| Description|
891| -------- | -------- |
892| mime | Pointer to a string that describes the MIME type. For details, see [AVCODEC_MIMETYPE](_codec_base.md#variables).|
893| isEncoder | Whether the instance is an encoder. The value **true** means an encoder and **false** means a decoder.|
894
895**Returns**
896
897Returns a pointer to the codec capability instance if an existing codec matches; returns NULL otherwise.
898
899**Since**
900
90110
902
903
904### OH_AVCodec_GetCapabilityByCategory()
905
906
907```
908OH_AVCapability* OH_AVCodec_GetCapabilityByCategory (const char *mime, bool isEncoder, OH_AVCodecCategory category)
909```
910
911**Description**
912
913Obtains the codec capability by category,
914
915which can be a hardware codec or software codec.
916
917\@syscap SystemCapability.Multimedia.Media.CodecBase
918
919**Parameters**
920
921| Name| Description|
922| -------- | -------- |
923| mime | Pointer to a string that describes the MIME type. For details, see [AVCODEC_MIMETYPE](_codec_base.md#variables).|
924| isEncoder | Whether the instance is an encoder. The value **true** means an encoder and **false** means a decoder.|
925| category | Codec category.|
926
927**Returns**
928
929Returns a pointer to the codec capability instance if an existing codec matches; returns NULL otherwise.
930
931**Since**
932
93310
934