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