openharmony 鸿蒙 capi-native-avmetadata-h

2026-08-25 浏览 (1)

native_avmetadata.h

Overview

The file declares the definitions of playback control metadata.

File to include: <multimedia/av_session/native_avmetadata.h>

Library: libohavsession.so

System capability: SystemCapability.Multimedia.AVSession.Core

Since: 13

Related module: OHAVSession

Summary

Structs

Nametypedef KeywordDescription
OH_AVMetadataBuilderStructOH_AVMetadataBuilderDefines a struct for the session metadata builder. The builder is used to construct session metadata.
OH_AVMetadataStructOH_AVMetadataDefines a struct for the session metadata. It is an AVMetadata instance set for a media asset.

Enums

Nametypedef KeywordDescription
AVMetadata_ResultAVMetadata_ResultEnumerates the error codes related to metadata operations.
AVMetadata_SkipIntervalsAVMetadata_SkipIntervalsEnumerates the fast-forward or rewind intervals supported by the media session.
AVMetadata_DisplayTagAVMetadata_DisplayTagEnumerates the display tags of the media asset. The display tag is a special type identifier of the media audio source.

Functions

NameDescription
AVMetadata_Result OH_AVMetadataBuilder_Create(OH_AVMetadataBuilder** builder)Creates a metadata builder.
AVMetadata_Result OH_AVMetadataBuilder_Destroy(OH_AVMetadataBuilder* builder)Destroys a metadata builder.
AVMetadata_Result OH_AVMetadataBuilder_SetAssetId(OH_AVMetadataBuilder* builder, const char* assetId)Sets the ID of the media asset.
AVMetadata_Result OH_AVMetadataBuilder_SetTitle(OH_AVMetadataBuilder* builder, const char* title)Sets a title for the media asset.
AVMetadata_Result OH_AVMetadataBuilder_SetArtist(OH_AVMetadataBuilder* builder, const char* artist)Sets an artist for the media asset.
AVMetadata_Result OH_AVMetadataBuilder_SetAuthor(OH_AVMetadataBuilder* builder, const char* author)Sets an author for the media asset.
AVMetadata_Result OH_AVMetadataBuilder_SetAlbum(OH_AVMetadataBuilder* builder, const char* album)Sets an album name for the media asset.
AVMetadata_Result OH_AVMetadataBuilder_SetWriter(OH_AVMetadataBuilder* builder, const char* writer)Sets a writer for the media asset.
AVMetadata_Result OH_AVMetadataBuilder_SetComposer(OH_AVMetadataBuilder* builder, const char* composer)Sets a composer for the media asset.
AVMetadata_Result OH_AVMetadataBuilder_SetDuration(OH_AVMetadataBuilder* builder, int64_t duration)Sets the playback duration for the media asset.
AVMetadata_Result OH_AVMetadataBuilder_SetMediaImageUri(OH_AVMetadataBuilder* builder, const char* mediaImageUri)Sets an image for the media asset.
AVMetadata_Result OH_AVMetadataBuilder_SetSubtitle(OH_AVMetadataBuilder* builder, const char* subtitle)Sets a subtitle for the media asset.
AVMetadata_Result OH_AVMetadataBuilder_SetDescription(OH_AVMetadataBuilder* builder, const char* description)Sets a description for the media asset.
AVMetadata_Result OH_AVMetadataBuilder_SetLyric(OH_AVMetadataBuilder* builder, const char* lyric)Sets lyrics for the media asset.
AVMetadata_Result OH_AVMetadataBuilder_SetSkipIntervals(OH_AVMetadataBuilder* builder, AVMetadata_SkipIntervals intervals)Sets the skip intervals for the media asset.
AVMetadata_Result OH_AVMetadataBuilder_SetDisplayTags(OH_AVMetadataBuilder* builder, int32_t tags)Sets display tags for the media asset.
AVMetadata_Result OH_AVMetadataBuilder_GenerateAVMetadata(OH_AVMetadataBuilder* builder, OH_AVMetadata** avMetadata)Generates an OH_AVMetadata object.
AVMetadata_Result OH_AVMetadata_Destroy(OH_AVMetadata* avMetadata)Releases an OH_AVMetadata object.

Enums

AVMetadata_Result

enum AVMetadata_Result

Description

Enumerates the error codes related to metadata operations.

Since: 13

Enum ItemDescription
AVMETADATA_SUCCESS = 0Operation successful.
AVMETADATA_ERROR_INVALID_PARAM = 1Incorrect parameter.
AVMETADATA_ERROR_NO_MEMORY = 2Insufficient memory.

AVMetadata_SkipIntervals

enum AVMetadata_SkipIntervals

Description

Enumerates the fast-forward or rewind intervals supported by the media session.

Since: 13

Enum ItemDescription
SECONDS_10 = 10The time is 10 seconds.
SECONDS_15 = 15The time is 15 seconds.
SECONDS_30 = 30The time is 30 seconds.

AVMetadata_DisplayTag

enum AVMetadata_DisplayTag

Description

Enumerates the display tags of the media asset. The display tag is a special type identifier of the media audio source.

Since: 13

Enum ItemDescription
AVSESSION_DISPLAYTAG_AUDIO_VIVID = 1AUDIO VIVID.

Function Description

OH_AVMetadataBuilder_Create()

AVMetadata_Result OH_AVMetadataBuilder_Create(OH_AVMetadataBuilder** builder)

Description

Creates a metadata builder.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder** builderDouble pointer to the builder created.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM: builder is nullptr.
AVMETADATA_ERROR_NO_MEMORY: There is no sufficient memory.

OH_AVMetadataBuilder_Destroy()

AVMetadata_Result OH_AVMetadataBuilder_Destroy(OH_AVMetadataBuilder* builder)

Description

Destroys a metadata builder.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM: builder is nullptr.

OH_AVMetadataBuilder_SetAssetId()

AVMetadata_Result OH_AVMetadataBuilder_SetAssetId(OH_AVMetadataBuilder* builder, const char* assetId)

Description

Sets the ID of the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
const char* assetIdPointer to the asset ID.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. assetId is nullptr.

OH_AVMetadataBuilder_SetTitle()

AVMetadata_Result OH_AVMetadataBuilder_SetTitle(OH_AVMetadataBuilder* builder, const char* title)

Description

Sets a title for the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
const char* titlePointer to the title.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. title is nullptr.

OH_AVMetadataBuilder_SetArtist()

AVMetadata_Result OH_AVMetadataBuilder_SetArtist(OH_AVMetadataBuilder* builder, const char* artist)

Description

Sets an artist for the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
const char* artistPointer to the artist.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. artist is nullptr.

OH_AVMetadataBuilder_SetAuthor()

AVMetadata_Result OH_AVMetadataBuilder_SetAuthor(OH_AVMetadataBuilder* builder, const char* author)

Description

Sets an author for the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
const char* authorPointer to the author.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. author is nullptr.

OH_AVMetadataBuilder_SetAlbum()

AVMetadata_Result OH_AVMetadataBuilder_SetAlbum(OH_AVMetadataBuilder* builder, const char* album)

Description

Sets an album name for the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
const char* albumPointer to the album name.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. album is nullptr.

OH_AVMetadataBuilder_SetWriter()

AVMetadata_Result OH_AVMetadataBuilder_SetWriter(OH_AVMetadataBuilder* builder, const char* writer)

Description

Sets a writer for the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
const char* writerPointer to the writer.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. writer is nullptr.

OH_AVMetadataBuilder_SetComposer()

AVMetadata_Result OH_AVMetadataBuilder_SetComposer(OH_AVMetadataBuilder* builder, const char* composer)

Description

Sets a composer for the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
const char* composerPointer to the composer.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. composer is nullptr.

OH_AVMetadataBuilder_SetDuration()

AVMetadata_Result OH_AVMetadataBuilder_SetDuration(OH_AVMetadataBuilder* builder, int64_t duration)

Description

Sets the playback duration for the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
int64_t durationPlayback duration, in ms.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM: builder is nullptr.

OH_AVMetadataBuilder_SetMediaImageUri()

AVMetadata_Result OH_AVMetadataBuilder_SetMediaImageUri(OH_AVMetadataBuilder* builder, const char* mediaImageUri)

Description

Sets an image for the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
const char* mediaImageUriPointer to the URI of the image.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. mediaImageUri is nullptr.

OH_AVMetadataBuilder_SetSubtitle()

AVMetadata_Result OH_AVMetadataBuilder_SetSubtitle(OH_AVMetadataBuilder* builder, const char* subtitle)

Description

Sets a subtitle for the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
const char* subtitlePointer to the subtitle.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. subtitle is nullptr.

OH_AVMetadataBuilder_SetDescription()

AVMetadata_Result OH_AVMetadataBuilder_SetDescription(OH_AVMetadataBuilder* builder, const char* description)

Description

Sets a description for the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
const char* descriptionPointer to the description.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. description is nullptr.

OH_AVMetadataBuilder_SetLyric()

AVMetadata_Result OH_AVMetadataBuilder_SetLyric(OH_AVMetadataBuilder* builder, const char* lyric)

Description

Sets lyrics for the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
const char* lyricPointer to the lyrics in the LRC format.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. lyric is nullptr.

OH_AVMetadataBuilder_SetSkipIntervals()

AVMetadata_Result OH_AVMetadataBuilder_SetSkipIntervals(OH_AVMetadataBuilder* builder,AVMetadata_SkipIntervals intervals)

Description

Sets the skip intervals for the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
AVMetadata_SkipIntervals intervalsSkip intervals.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. intervals is invalid.

OH_AVMetadataBuilder_SetDisplayTags()

AVMetadata_Result OH_AVMetadataBuilder_SetDisplayTags(OH_AVMetadataBuilder* builder, int32_t tags)

Description

Sets display tags for the media asset.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
int32_t tagsTags of the media asset displayed on the playback control page.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM: builder is nullptr.

OH_AVMetadataBuilder_GenerateAVMetadata()

AVMetadata_Result OH_AVMetadataBuilder_GenerateAVMetadata(OH_AVMetadataBuilder* builder,OH_AVMetadata** avMetadata)

Description

Generates an OH_AVMetadata object.

Since: 13

Parameters

NameDescription
OH_AVMetadataBuilder* builderPointer to an OH_AVMetadataBuilder instance.
OH_AVMetadata** avMetadataDouble pointer to the OH_AVMetadata object created.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_NO_MEMORY: The memory is insufficient.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. avMetadata is nullptr.

OH_AVMetadata_Destroy()

AVMetadata_Result OH_AVMetadata_Destroy(OH_AVMetadata* avMetadata)

Description

Releases an OH_AVMetadata object.

Since: 13

Parameters

NameDescription
OH_AVMetadata* avMetadataPointer to an OH_AVMetadata object.

Returns

TypeDescription
AVMetadata_ResultAVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM: avMetadata is nullptr.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-avsession

openharmony 鸿蒙 arkts-apis-avsession-e

openharmony 鸿蒙 capi-native-avsession-h

openharmony 鸿蒙 errorcode-avsession

openharmony 鸿蒙 js-apis-inner-application-MediaControlExtensionContext-sys

openharmony 鸿蒙 arkts-apis-avsession-AVSession

openharmony 鸿蒙 ohos-multimedia-avcastpicker

openharmony 鸿蒙 arkts-apis-avsession-AVCastController

openharmony 鸿蒙 arkts-apis-avsession-AVCastPickerHelper

openharmony 鸿蒙 arkts-apis-avsession-t

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