From 5bf3814132fb853f8b533df5ec50b97fa2eedc86 Mon Sep 17 00:00:00 2001 From: Chen Guodong Date: Thu, 8 Aug 2024 10:34:35 +0800 Subject: [PATCH 1/3] Move avplayer ndk subtitle and track related constants to api13 Signed-off-by: Chen Guodong --- multimedia/player_framework/avplayer_base.h | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/multimedia/player_framework/avplayer_base.h b/multimedia/player_framework/avplayer_base.h index 903a52f72..5dcc9126b 100644 --- a/multimedia/player_framework/avplayer_base.h +++ b/multimedia/player_framework/avplayer_base.h @@ -172,6 +172,41 @@ typedef enum AVPlayerOnInfoType { AV_INFO_TYPE_AUDIO_OUTPUT_DEVICE_CHANGE = 17, } AVPlayerOnInfoType; +/** + * @brief Key to get subtitle text, value type is char array. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 13 + */ +extern const char* OH_PLAYER_SUBTITLE_TEXT; + +/** + * @brief Key to get subtitle pts, value type is int32_t. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 13 + */ +extern const char* OH_PLAYER_SUBTITLE_PTS; + +/** + * @brief Key to get subtitle duration, value type is int32_t. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 13 + */ +extern const char* OH_PLAYER_SUBTITLE_DURATION; + +/** + * @brief Key to get track count, value type is uint32_t. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 13 + */ +extern const char* OH_PLAYER_TRACK_COUNT; + +/** + * @brief Key to get track info array, value type is OH_AVFormat pointer array. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @since 13 + */ +extern const char* OH_PLAYER_TRACK_INFO_ARRAY; + /** * @brief Called when a player message or alarm is received. * @syscap SystemCapability.Multimedia.Media.AVPlayer -- Gitee From 2f8bca711973eb3f41ba64274dc1f1c76138e751 Mon Sep 17 00:00:00 2001 From: Chen Guodong Date: Thu, 8 Aug 2024 11:08:27 +0800 Subject: [PATCH 2/3] Add set media muted interface. Signed-off-by: Chen Guodong --- multimedia/player_framework/avplayer.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/multimedia/player_framework/avplayer.h b/multimedia/player_framework/avplayer.h index ab0d17cd3..ccbb52a86 100644 --- a/multimedia/player_framework/avplayer.h +++ b/multimedia/player_framework/avplayer.h @@ -563,6 +563,20 @@ OH_AVErrCode OH_AVPlayer_GetMediaKeySystemInfo(OH_AVPlayer *player, DRM_MediaKey OH_AVErrCode OH_AVPlayer_SetDecryptionConfig(OH_AVPlayer *player, MediaKeySession *mediaKeySession, bool secureVideoPath); +/** + * @brief mute or unmute specified media. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param mediaType Indicates the target media type. see @OH_AVCodec.OH_MediaType + * @param isMuted The switch to set mute or unmute + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input player is nullptr or media don't contain specified mediaType. + * {@link AV_ERR_UNSUPPORT} if the specified mediaType not supported. + * @since 13 +*/ +OH_AVErrCode OH_AVPlayer_SetMediaMuted(OH_AVPlayer *player, OH_MediaType mediaType, bool isMuted); + #ifdef __cplusplus } #endif -- Gitee From 92906807af92e0ca974a25eb2eb71d5cc267222a Mon Sep 17 00:00:00 2001 From: Chen Guodong Date: Thu, 15 Aug 2024 16:23:16 +0800 Subject: [PATCH 3/3] Move AddSubtitle interface to api 13. Signed-off-by: Chen Guodong --- multimedia/player_framework/avplayer.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/multimedia/player_framework/avplayer.h b/multimedia/player_framework/avplayer.h index ccbb52a86..b5d354b9f 100644 --- a/multimedia/player_framework/avplayer.h +++ b/multimedia/player_framework/avplayer.h @@ -577,6 +577,32 @@ OH_AVErrCode OH_AVPlayer_SetDecryptionConfig(OH_AVPlayer *player, MediaKeySessio */ OH_AVErrCode OH_AVPlayer_SetMediaMuted(OH_AVPlayer *player, OH_MediaType mediaType, bool isMuted); +/** + * @brief Add the subtitle source for the player. The corresponding source can be http url. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param url Indicates the playback source. + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input player is nullptr, url is null or player setUrlSource failed. + * @since 13 + */ +OH_AVErrCode OH_AVPlayer_AddSubtitleFromUrl(H_AVPlayer *player, const char *url); + +/** + * @brief Add the subtitle file descriptor source for the player. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @param player Pointer to an OH_AVPlayer instance + * @param fd Indicates the file descriptor of subtitle source. + * @param offset Indicates the offset of subtitle source in file descriptor. + * @param size Indicates the size of subtitle source. + * @return Function result code. + * {@link AV_ERR_OK} if the execution is successful. + * {@link AV_ERR_INVALID_VAL} if input player is nullptr or player setFdSource failed. + * @since 13 + */ +OH_AVErrCode OH_AVPlayer_AddSubtitleFromFd(H_AVPlayer *player, int32_t fd, int64_t offset, int64_t size); + #ifdef __cplusplus } #endif -- Gitee