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