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