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

Name typedef Keyword Description
OH_AVMetadataBuilderStruct OH_AVMetadataBuilder Defines a struct for the session metadata builder. The builder is used to construct session metadata.
OH_AVMetadataStruct OH_AVMetadata Defines a struct for the session metadata. It is an AVMetadata instance set for a media asset.

Functions

Name Description
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_SetFilter(OH_AVMetadataBuilder* builder, uint32_t filter) Sets the supported protocols.
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.

Function Description

OH_AVMetadataBuilder_Create()

AVMetadata_Result OH_AVMetadataBuilder_Create(OH_AVMetadataBuilder** builder)

Description

Creates a metadata builder.

Since: 13

Parameters

Name Description
OH_AVMetadataBuilder** builder Double pointer to the builder created.

Returns

Type Description
AVMetadata_Result AVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM: builder is nullptr.
AVMETADATA_ERROR_NO_MEMORY: The memory is insufficient.

OH_AVMetadataBuilder_Destroy()

AVMetadata_Result OH_AVMetadataBuilder_Destroy(OH_AVMetadataBuilder* builder)

Description

Destroys a metadata builder.

Since: 13

Parameters

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.

Returns

Type Description
AVMetadata_Result AVMETADATA_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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
const char* assetId Pointer to the asset ID.

Returns

Type Description
AVMetadata_Result AVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. assetId is a null pointer.

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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
const char* title Pointer to the title.

Returns

Type Description
AVMetadata_Result AVMETADATA_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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
const char* artist Artist of the media asset.

Returns

Type Description
AVMetadata_Result AVMETADATA_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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
const char* author Pointer to the author.

Returns

Type Description
AVMetadata_Result AVMETADATA_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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
const char* album Pointer to the album name.

Returns

Type Description
AVMetadata_Result AVMETADATA_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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
const char* writer Pointer to the writer.

Returns

Type Description
AVMetadata_Result AVMETADATA_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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
const char* composer Pointer to the composer.

Returns

Type Description
AVMetadata_Result AVMETADATA_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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
int64_t duration Playback duration, in ms.

Returns

Type Description
AVMetadata_Result AVMETADATA_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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
const char* mediaImageUri Pointer to the URI of the image.

Returns

Type Description
AVMetadata_Result AVMETADATA_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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
const char* subtitle Pointer to the subtitle.

Returns

Type Description
AVMetadata_Result AVMETADATA_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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
const char* description Pointer to the description.

Returns

Type Description
AVMetadata_Result AVMETADATA_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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
const char* lyric Pointer to the lyrics in the LRC format.

Returns

Type Description
AVMetadata_Result AVMETADATA_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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
AVMetadata_SkipIntervals intervals Skip intervals.

Returns

Type Description
AVMetadata_Result AVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. intervals is a null pointer.

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

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
int32_t tags Tags of the media asset displayed on the playback control page.

Returns

Type Description
AVMetadata_Result AVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM: builder is nullptr.

OH_AVMetadataBuilder_SetFilter()

AVMetadata_Result OH_AVMetadataBuilder_SetFilter(OH_AVMetadataBuilder* builder, uint32_t filter)

Description

Sets the supported protocols.

Since: 23

Parameters

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
uint32_t filter Protocol supported by the session. If this parameter is not set, AVSession_ProtocolType.TYPE_CAST_PLUS_STREAM is used by default.

Returns

Type Description
AVMetadata_Result AVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM:
1. builder is nullptr.
2. The filter parameter is invalid.

OH_AVMetadataBuilder_GenerateAVMetadata()

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

Description

Generates an OH_AVMetadata object.

Since: 13

Parameters

Name Description
OH_AVMetadataBuilder* builder Pointer to an OH_AVMetadataBuilder instance.
OH_AVMetadata** avMetadata Double pointer to the OH_AVMetadata object created.

Returns

Type Description
AVMetadata_Result AVMETADATA_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

Name Description
OH_AVMetadata* avMetadata Pointer to an OH_AVMetadata object.

Returns

Type Description
AVMetadata_Result AVMETADATA_SUCCESS: The function is executed successfully.
AVMETADATA_ERROR_INVALID_PARAM: avMetadata is nullptr.