openharmony 鸿蒙 capi-avmetadata-extractor-h

2025-06-12 浏览 (1)

avmetadata_extractor.h

Overview

The avmetadata_extractor.h file declares the AVMetadataExtractor APIs. You can use the APIs to obtain metadata from media assets.

Library: libavmetadata_extractor.so

System capability: SystemCapability.Multimedia.Media.AVMetadataExtractor

Since: 18

Related module: AVMetadataExtractor

Summary

Structs

Nametypedef KeywordDescription
OH_AVMetadataExtractorOH_AVMetadataExtractorDescribes the OH_AVMetadataExtractor.

Functions

NameDescription
OH_AVMetadataExtractor* OH_AVMetadataExtractor_Create(void)Creates an OH_AVMetadataExtractor instance.
OH_AVErrCode OH_AVMetadataExtractor_SetFDSource(OH_AVMetadataExtractor* extractor,int32_t fd, int64_t offset, int64_t size)Sets a data source based on the media file descriptor.
OH_AVErrCode OH_AVMetadataExtractor_FetchMetadata(OH_AVMetadataExtractor* extractor, OH_AVFormat* avMetadata)Obtains metadata from a media asset. This function must be called after SetSource.
OH_AVErrCode OH_AVMetadataExtractor_FetchAlbumCover(OH_AVMetadataExtractor* extractor, OH_PixelmapNative** pixelMap)Obtains the cover of an audio album. This function must be called after SetSource.
OH_AVErrCode OH_AVMetadataExtractor_Release(OH_AVMetadataExtractor* extractor)Releases the resources used by the OH_AVMetadataExtractor instance and destroys the instance.

Function Description

OH_AVMetadataExtractor_Create()

OH_AVMetadataExtractor* OH_AVMetadataExtractor_Create(void)

Description

Creates an OH_AVMetadataExtractor instance.

System capability: SystemCapability.Multimedia.Media.AVMetadataExtractor

Since: 18

Return value

TypeDescription
OH_AVMetadataExtractor*Pointer to the OH_AVMetadataExtractor instance created if the operation is successful; a null pointer otherwise.
Possible cause of failures: HstEngineFactory::CreateAVMetadataHelperEngine fails to run.

OH_AVMetadataExtractor_SetFDSource()

OH_AVErrCode OH_AVMetadataExtractor_SetFDSource(OH_AVMetadataExtractor* extractor,int32_t fd, int64_t offset, int64_t size)

Description

Sets a data source based on the media file descriptor.

System capability: SystemCapability.Multimedia.Media.AVMetadataExtractor

Since: 18

Parameters

ParameterDescription
OH_AVMetadataExtractor* extractorPointer to the OH_AVMetadataExtractor instance.
int32_t fdFile descriptor of the media source.
int64_t offsetOffset of the media source in the file descriptor.
int64_t sizeSize of the media source.

Return value

TypeDescription
OH_AVErrCodeAV_ERR_OK: The operation is successful.
AV_ERR_INVALID_VAL: The input parameter extractor is a null pointer or a parameter is invalid.
AV_ERR_OPERATE_NOT_PERMIT: The operation is forbidden.
AV_ERR_NO_MEMORY: Internal memory allocation failed.

OH_AVMetadataExtractor_FetchMetadata()

OH_AVErrCode OH_AVMetadataExtractor_FetchMetadata(OH_AVMetadataExtractor* extractor, OH_AVFormat* avMetadata)

Description

Obtains metadata from a media asset.

This function must be called after OH_AVMetadataExtractor_SetFDSource.

System capability: SystemCapability.Multimedia.Media.AVMetadataExtractor

Since: 18

Parameters

ParameterDescription
OH_AVMetadataExtractor* extractorPointer to the OH_AVMetadataExtractor instance.
OH_AVFormat* avMetadataPointer to the OH_AVFormat instance, which contains the obtained metadata.

Return value

TypeDescription
OH_AVErrCodeAV_ERR_OK: The operation is successful.
AV_ERR_INVALID_VAL: The input parameter extractor is a null pointer or a parameter is invalid.
AV_ERR_OPERATE_NOT_PERMIT: The operation is forbidden.
AV_ERR_UNSUPPORTED_FORMAT: The format is not supported.
AV_ERR_NO_MEMORY: Internal memory allocation failed.

OH_AVMetadataExtractor_FetchAlbumCover()

OH_AVErrCode OH_AVMetadataExtractor_FetchAlbumCover(OH_AVMetadataExtractor* extractor, OH_PixelmapNative** pixelMap)

Description

Obtains the cover of an audio album.

This function must be called after OH_AVMetadataExtractor_SetFDSource.

System capability: SystemCapability.Multimedia.Media.AVMetadataExtractor

Since: 18

Parameters

ParameterDescription
OH_AVMetadataExtractor* extractorPointer to the OH_AVMetadataExtractor instance.
OH_PixelmapNative** pixelMapDouble pointer to the album cover obtained.

Return value

TypeDescription
OH_AVErrCodeAV_ERR_OK: The operation is successful.
AV_ERR_INVALID_VAL: The input parameter extractor is a null pointer or a parameter is invalid.
AV_ERR_OPERATE_NOT_PERMIT: The operation is forbidden.
AV_ERR_UNSUPPORTED_FORMAT: The format is not supported.
AV_ERR_NO_MEMORY: Internal memory allocation failed.

OH_AVMetadataExtractor_Release()

OH_AVErrCode OH_AVMetadataExtractor_Release(OH_AVMetadataExtractor* extractor)

Description

Releases the resources used by the OH_AVMetadataExtractor instance and destroys the instance.

System capability: SystemCapability.Multimedia.Media.AVMetadataExtractor

Since: 18

Parameters

ParameterDescription
OH_AVMetadataExtractor* extractorPointer to the OH_AVMetadataExtractor instance.

Return value

TypeDescription
OH_AVErrCodeAV_ERR_OK: The operation is successful.
AV_ERR_INVALID_VAL: The input parameter extractor is a null pointer or a parameter is invalid.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Media Kit

harmony 鸿蒙AVImageGenerator

harmony 鸿蒙AVMetadataExtractor

harmony 鸿蒙AVPlayer

harmony 鸿蒙AVPlayerCallback

harmony 鸿蒙AVRecorder

harmony 鸿蒙AVScreenCapture

harmony 鸿蒙OH_AVRecorder_Config

harmony 鸿蒙OH_AVRecorder_EncoderInfo

harmony 鸿蒙OH_AVRecorder_Location

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/FzslVg