diff --git a/packages/video_player_avplay/tizen/inc/plusplayer/plusplayer_wrapper.h b/packages/video_player_avplay/tizen/inc/plusplayer/plusplayer_wrapper.h deleted file mode 100644 index 061a852ad..000000000 --- a/packages/video_player_avplay/tizen/inc/plusplayer/plusplayer_wrapper.h +++ /dev/null @@ -1,665 +0,0 @@ -// Copyright 2022 Samsung Electronics Co., Ltd. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef FLUTTER_PLUGIN_PLUSPLAYER_WRAPPER_H -#define FLUTTER_PLUGIN_PLUSPLAYER_WRAPPER_H - -#include -#include -#include - -#include -#include -#include -#include -#include - -#define PLUS_PLAYER_EXPORT __attribute__((visibility("default"))) -#define PLUSPLAYER_ERROR_CLASS TIZEN_ERROR_PLAYER | 0x20 -/* This is for custom defined player error. */ -#define PLUSPLAYER_CUSTOM_ERROR_CLASS TIZEN_ERROR_PLAYER | 0x1000 - -namespace plusplayer { - -/** - * @brief Enumeration for supported subtitle attributes - */ -enum SubtitleAttrType { - kSubAttrRegionXPos = 0, - kSubAttrRegionYPos, - kSubAttrRegionWidth, - kSubAttrRegionHeight, - kSubAttrWindowXPadding, - kSubAttrWindowYPadding, - kSubAttrWindowLeftMargin, - kSubAttrWindowRightMargin, - kSubAttrWindowTopMargin, - kSubAttrWindowBottomMargin, - kSubAttrWindowBgColor, - kSubAttrWindowOpacity, - kSubAttrWindowShowBg, - kSubAttrFontFamily, - kSubAttrFontSize, - kSubAttrFontWeight, - kSubAttrFontStyle, - kSubAttrFontColor, - kSubAttrFontBgColor, - kSubAttrFontOpacity, - kSubAttrFontBgOpacity, - kSubAttrFontTextOutlineColor, - kSubAttrFontTextOutlineThickness, - kSubAttrFontTextOutlineBlurRadius, - kSubAttrFontVerticalAlign, - kSubAttrFontHorizontalAlign, - kSubAttrRawSubtitle, - kSubAttrWebvttCueLine, - kSubAttrWebvttCueLineNum, - kSubAttrWebvttCueLineAlign, - kSubAttrWebvttCueAlign, - kSubAttrWebvttCueSize, - kSubAttrWebvttCuePosition, - kSubAttrWebvttCuePositionAlign, - kSubAttrWebvttCueVertical, - kSubAttrTimestamp, - kSubAttrExtsubIndex, - kSubAttrTypeNone -}; - -/** - * @brief Enumeration for player supported subtitle types - */ -enum class SubtitleType { - kText, /**< subtitle type text */ - kPicture, /**< subtitle type picture */ - kTTMLRender, /**< subtitle type ttml */ - kInvalid /**< unsupported subtitle type */ -}; - -/** - * @brief structure definition of subtitle attribute - */ -struct SubtitleAttribute { - /** - * @brief parameterized constructor of SubtitleAttr - * @param [in] _type : type of subtitle attribute. Please see - * @SubtitleAttrType - * @param [in] _start_time : start time of subtitle visibility - * @param [in] _stop_time : end type of subtitle visibility - * @param [in] _value : subtitle attribute value - * @param [in] _extsub_index : subtitle index in case of external. - * @pre None - * @post None - * @exception None - * @return N/A - */ - explicit SubtitleAttribute(const SubtitleAttrType _type, - const uint32_t _start_time, - const uint32_t _stop_time, const void* _value, - const int _extsub_index) - : type(_type), - start_time(_start_time), - stop_time(_stop_time), - value(_value), - extsub_index(_extsub_index) {} - const SubtitleAttrType type = - kSubAttrTypeNone; /**< Type of subtitle attribute. */ - const uint32_t start_time = - std::numeric_limits::max(); /**< start time of subtitle - visibility */ - const uint32_t stop_time = - std::numeric_limits::max(); /**< end time of subtitle visibility - */ - const void* value; /**< subtitle value */ - const int extsub_index = -1; /**< subtitle index */ -}; -using SubtitleAttributeList = std::list; -using SubtitleAttributeListPtr = std::unique_ptr; - -enum class DisplayType { kNone, kOverlay, kEvas, kMixer, kOverlaySyncUI }; - -enum class DisplayMode { - kLetterBox, - kOriginSize, - kFullScreen, - kCroppedFull, - kOriginOrLetter, - kDstRoi, - kAutoAspectRatio, - kDstRoiAutoAspectRatio, - kMax -}; - -enum TrackType { - kTrackTypeAudio = 0, - kTrackTypeVideo, - kTrackTypeSubtitle, - kTrackTypeMax -}; - -enum PlayerType { - kDefault, - kDASH, -}; - -enum class DisplayRotation { kNone, kRotate90, kRotate180, kRotate270 }; - -enum class State { - kNone, /**< Player is created, but not opened */ - kIdle, /**< Player is opened, but not prepared or player is stopped */ - kTypeFinderReady, /**< TypeFinder prepared */ - kTrackSourceReady, /**< TrackSource prepared */ - kReady, /**< Player is ready to play(start) */ - kPlaying, /**< Player is playing media */ - kPaused /**< Player is paused while playing media */ -}; - -struct Geometry { - /** - * @brief start X position of Display window. [Default = 0] - */ - int x = 0; - /** - * @brief start Y position of Display window. [Default = 0] - */ - int y = 0; - /** - * @brief Width of Display window. [Default = 1920] - */ - int w = 1920; - /** - * @brief Height of Display window. [Default = 1080] - */ - int h = 1080; -}; - -struct PlayerMemento { - uint64_t playing_time = 0; /**< Playing time of current player */ - State state = State::kNone; /**< Player status of current player */ - DisplayMode display_mode = - DisplayMode::kMax; /**< Display mode of current player */ - DisplayType display_type = - DisplayType::kNone; /**< Display type of current player */ - Geometry display_area; /**< Display area of current player */ - std::map - buffer_config; /**< Buffer config of current player */ - bool is_live = false; /**< Live status of current player */ - double current_playback_rate = 1.0; /**< Playback rate of current player */ - int aspect_radio_num = 0; /**< Aspect radio num of current player */ - int aspect_radio_den = 0; /**< Aspect radio den of current player */ -}; - -enum class ErrorType { - kNone = TIZEN_ERROR_NONE, /**< Successful */ - kOutOfMemory = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ - kInvalidParameter = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ - kNoSuchFile = TIZEN_ERROR_NO_SUCH_FILE, /**< No such file or directory */ - kInvalidOperation = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */ - kFileNoSpaceOnDevice = - TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE, /**< No space left on the device */ - kFeatureNotSupportedOnDevice = - TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */ - kSeekFailed = PLUSPLAYER_ERROR_CLASS | 0x01, /**< Seek operation failure */ - kInvalidState = PLUSPLAYER_ERROR_CLASS | 0x02, /**< Invalid state */ - kNotSupportedFile = - PLUSPLAYER_ERROR_CLASS | 0x03, /**< File format not supported */ - kInvalidUri = PLUSPLAYER_ERROR_CLASS | 0x04, /**< Invalid URI */ - kSoundPolicy = PLUSPLAYER_ERROR_CLASS | 0x05, /**< Sound policy error */ - kConnectionFailed = - PLUSPLAYER_ERROR_CLASS | 0x06, /**< Streaming connection failed */ - kVideoCaptureFailed = - PLUSPLAYER_ERROR_CLASS | 0x07, /**< Video capture failed */ - kDrmExpired = PLUSPLAYER_ERROR_CLASS | 0x08, /**< Expired license */ - kDrmNoLicense = PLUSPLAYER_ERROR_CLASS | 0x09, /**< No license */ - kDrmFutureUse = PLUSPLAYER_ERROR_CLASS | 0x0a, /**< License for future use */ - kDrmNotPermitted = PLUSPLAYER_ERROR_CLASS | 0x0b, /**< Format not permitted */ - kResourceLimit = PLUSPLAYER_ERROR_CLASS | 0x0c, /**< Resource limit */ - kPermissionDenied = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ - kServiceDisconnected = - PLUSPLAYER_ERROR_CLASS | 0x0d, /**< Socket connection lost (Since 3.0) */ - kBufferSpace = - TIZEN_ERROR_BUFFER_SPACE, /**< No buffer space available (Since 3.0)*/ - kNotSupportedAudioCodec = - PLUSPLAYER_ERROR_CLASS | - 0x0e, // < Not supported audio codec but video can be played (Since 4.0) - kNotSupportedVideoCodec = - PLUSPLAYER_ERROR_CLASS | - 0x0f, //< Not supported video codec but audio can be played (Since 4.0) - kNotSupportedSubtitle = - PLUSPLAYER_ERROR_CLASS | - 0x10, /**< Not supported subtitle format (Since 4.0) */ - - // TODO(euna7.ko) Can be removed. refer to - // http://168.219.243.246:8090/pages/viewpage.action?pageId=27269511 - kDrmInfo = - PLUSPLAYER_CUSTOM_ERROR_CLASS | 0x05, /**< playready drm error info */ - kNotSupportedFormat = PLUSPLAYER_CUSTOM_ERROR_CLASS | 0x08, - kStreamingPlayer = PLUSPLAYER_CUSTOM_ERROR_CLASS | 0x09, - kDtcpFsk = PLUSPLAYER_CUSTOM_ERROR_CLASS | 0x0a, - kPreLoadingTimeOut = PLUSPLAYER_CUSTOM_ERROR_CLASS | - 0x0b, /**< can't finish preloading in time*/ - kNetworkError = - PLUSPLAYER_CUSTOM_ERROR_CLASS | 0x0c, /**< for network error */ - kChannelSurfingFailed = - PLUSPLAYER_CUSTOM_ERROR_CLASS | 0x0d, /**< for channel surfing error */ - - kUnknown -}; - -enum class StreamingMessageType { - kNone = 0, - // kResolutionChanged, - // kAdEnd, - // kAdStart, - // kRenderDone, - kBitrateChange, - // kFragmentInfo, - kSparseTrackDetect, - // kStreamingEvent, - // kDrmChallengeData, - kDrmInitData, - // kHttpErrorCode, - // kDrmRenewSessionData, - kStreamEventType, - kStreamEventData, - kStreamSyncFlush, - kStreamMrsUrlChanged, - kDrmKeyRotation, - kFragmentDownloadInfo, - kDvrLiveLag, - kSparseTrackData, - kConnectionRetry, - kConfigLowLatency, - kCurlErrorDebugInfo, - kParDarChange, - kDashMPDAnchor, - kDashRemoveStream, - kMediaSyncCSSCII, - kDashLiveToVod -}; - -enum class SourceType { - kNone, - kBase, - kHttp, - kHls, - kDash, - kSmooth, - kFile, - kMem, - kExternalSubtitle, - kNotFound, - kMax -}; - -enum class ContentFormat { - kNone, - kMP4Mov, - kMpegts, - k3GpMov, - kAudioMpeg, - kAudioMpegAac, - kMkv, - kAvi, - kVideoAsf, - kAppXid3, - kAudioOgg, - kAudioFlac, - kFlv, - kVideoMpeg, - kUnknown -}; - -enum class DecodedVideoFrameBufferType { - kNone, - kCopy, - kReference, - kScale, - kManualCopy, -}; -enum class RscType { kVideoRenderer }; - -struct MessageParam { - std::string data; - int size = 0; - int code = 0; // Error or warning code -}; -struct PlayerAppInfo { - std::string id; /**< App id */ - std::string version; /**< App version */ - std::string type; /**< App type. ex)"MSE", "HTML5", etc.. */ -}; - -const int kInvalidTrackIndex = -1; - -struct Track { - int index = kInvalidTrackIndex; - int id = 0; - std::string mimetype; - std::string streamtype; - std::string container_type; - TrackType type = kTrackTypeMax; - std::shared_ptr codec_data; - unsigned int codec_tag = 0; - int codec_data_len = 0; - int width = 0; - int height = 0; - int maxwidth = 0; - int maxheight = 0; - int framerate_num = 0; - int framerate_den = 0; - int sample_rate = 0; - int sample_format = 0; - int channels = 0; - int version = 0; - int layer = 0; - int bits_per_sample = 0; - int block_align = 0; - int bitrate = 0; - int endianness = 1234; // little endian : 1234 others big endian - bool is_signed = false; - bool active = false; - bool use_swdecoder = false; - std::string language_code; - std::string subtitle_format; - Track() {} - Track(int _index, int _id, std::string _mimetype, std::string _streamtype, - std::string _container_type, TrackType _type, - std::shared_ptr _codec_data, unsigned int _codec_tag, - int _codec_data_len, int _width, int _height, int _maxwidth, - int _maxheight, int _framerate_num, int _framerate_den, - int _sample_rate, int _sample_format, int _channels, int _version, - int _layer, int _bits_per_sample, int _block_align, int _bitrate, - int _endianness, bool _is_signed, bool _active, bool _use_swdecoder, - std::string _language_code, std::string _subtitle_format) - : index(_index), - id(_id), - mimetype(_mimetype), - streamtype(_streamtype), - container_type(_container_type), - type(_type), - codec_data(_codec_data), - codec_tag(_codec_tag), - codec_data_len(_codec_data_len), - width(_width), - height(_height), - maxwidth(_maxwidth), - maxheight(_maxheight), - framerate_num(_framerate_num), - framerate_den(_framerate_den), - sample_rate(_sample_rate), - sample_format(_sample_format), - channels(_channels), - version(_version), - layer(_layer), - bits_per_sample(_bits_per_sample), - block_align(_block_align), - bitrate(_bitrate), - endianness(_endianness), - is_signed(_is_signed), - active(_active), - use_swdecoder(_use_swdecoder), - language_code(_language_code), - subtitle_format(_subtitle_format) {} -}; - -namespace drm { -using LicenseAcquiredCb = void*; -using UserData = void*; -using DrmHandle = int; - -enum class Type { - kNone = 0, - kPlayready, - kMarlin, - kVerimatrix, - kWidevineClassic, - kSecuremedia, - kSdrm, - kWidevineCdm = 8, - kMax -}; - -struct Property { - Type type = Type::kNone; // Drm type - DrmHandle handle = 0; // Drm handle - bool external_decryption = false; // External Decryption Mode - LicenseAcquiredCb license_acquired_cb = - nullptr; // The cb will be invoked when license was acquired. - UserData license_acquired_userdata = - nullptr; // The userdata will be sent by license_acquired_cb -}; -} // namespace drm - -} // namespace plusplayer - -#if defined(__cplusplus) -extern "C" { -#endif - -typedef void (*OnPlayerPrepared)(bool ret, void* user_data); -typedef void (*OnPlayerSeekCompleted)(void* user_data); -typedef void (*OnPlayerResourceConflicted)(void* user_data); -typedef void (*OnPlayerBuffering)(int percent, void* user_data); -typedef void (*OnPlayerCompleted)(void* user_data); -typedef void (*OnPlayerPlaying)(void* user_data); -typedef void (*OnPlayerError)(const plusplayer::ErrorType& error_code, - void* user_data); -typedef void (*OnPlayerErrorMessage)(const plusplayer::ErrorType& error_code, - const char* error_msg, void* user_data); -typedef void (*OnPlayerAdaptiveStreamingControl)( - const plusplayer::StreamingMessageType& type, - const plusplayer::MessageParam& msg, void* user_data); -typedef void (*OnPlayerDrmInitData)(int* drmhandle, unsigned int len, - unsigned char* psshdata, - plusplayer::TrackType type, - void* user_data); -typedef void (*OnPlayerClosedCaptionData)(std::unique_ptr data, - const int size, void* user_data); -typedef void (*OnPlayerCueEvent)(const char* CueData, void* userdata); -typedef void (*OnPlayerDateRangeEvent)(const char* DateRangeData, - void* user_data); -typedef void (*OnPlayerStopReachEvent)(bool StopReach, void* user_data); -typedef void (*OnPlayerCueOutContEvent)(const char* CueOutContData, - void* user_data); -typedef void (*OnPlayerChangeSourceDone)(bool ret, void* user_data); -typedef void (*OnPlayerStateChangedToPlaying)(void* user_data); -typedef void (*OnPlayerDrmType)(plusplayer::drm::Type drmtype, void* user_data); -typedef void (*OnPlayerSubtitleData)( - char* data, const int size, const plusplayer::SubtitleType& type, - const uint64_t duration, plusplayer::SubtitleAttributeListPtr attr_list, - void* user_data); -typedef void (*OnPlayerADEventFromDash)(const char* ADData, void* user_data); - -struct PlusplayerListener { - OnPlayerPrepared prepared_callback{nullptr}; - OnPlayerSeekCompleted seek_completed_callback{nullptr}; - OnPlayerResourceConflicted resource_conflicted_callback{nullptr}; - OnPlayerBuffering buffering_callback{nullptr}; - OnPlayerCompleted completed_callback{nullptr}; - OnPlayerPlaying playing_callback{nullptr}; - OnPlayerError error_callback{nullptr}; - OnPlayerErrorMessage error_message_callback{nullptr}; - OnPlayerAdaptiveStreamingControl adaptive_streaming_control_callback{nullptr}; - OnPlayerDrmInitData drm_init_data_callback{nullptr}; - OnPlayerClosedCaptionData closed_caption_data_callback{nullptr}; - OnPlayerCueEvent cue_event_callback{nullptr}; - OnPlayerDateRangeEvent data_range_event_callback{nullptr}; - OnPlayerStopReachEvent stop_reach_event_callback{nullptr}; - OnPlayerCueOutContEvent cue_out_cont_event_callback{nullptr}; - OnPlayerChangeSourceDone change_source_done_callback{nullptr}; - OnPlayerStateChangedToPlaying state_changed_to_playing_callback{nullptr}; - OnPlayerDrmType drm_type_callback{nullptr}; - OnPlayerSubtitleData subtitle_data_callback{nullptr}; - OnPlayerADEventFromDash ad_event_callback{nullptr}; -}; - -struct Plusplayer; -typedef struct Plusplayer* PlusplayerRef; - -PLUS_PLAYER_EXPORT PlusplayerRef CreatePlayer(plusplayer::PlayerType type); - -PLUS_PLAYER_EXPORT bool Activate(PlusplayerRef player, - const plusplayer::TrackType type); - -PLUS_PLAYER_EXPORT bool Deactivate(PlusplayerRef player, - const plusplayer::TrackType type); - -PLUS_PLAYER_EXPORT bool SetVolume(PlusplayerRef player, int volume); - -PLUS_PLAYER_EXPORT bool Open(PlusplayerRef player, const std::string& uri); - -PLUS_PLAYER_EXPORT void SetAppId(PlusplayerRef player, - const std::string& app_id); - -PLUS_PLAYER_EXPORT void SetPrebufferMode(PlusplayerRef player, - bool is_prebuffer_mode); - -PLUS_PLAYER_EXPORT void SetAppInfo(PlusplayerRef player, - const plusplayer::PlayerAppInfo& app_info); - -PLUS_PLAYER_EXPORT bool StopSource(PlusplayerRef player); - -PLUS_PLAYER_EXPORT bool ChangeSource( - PlusplayerRef player, const std::string& uri, - const plusplayer::SourceType source_type, - const plusplayer::ContentFormat format_type, - const uint64_t time_milliseconds, const bool is_seamless); - -PLUS_PLAYER_EXPORT bool Prepare(PlusplayerRef player); - -PLUS_PLAYER_EXPORT bool PrepareAsync(PlusplayerRef player); - -PLUS_PLAYER_EXPORT bool Start(PlusplayerRef player); - -PLUS_PLAYER_EXPORT bool Stop(PlusplayerRef player); - -PLUS_PLAYER_EXPORT void SetDrm(PlusplayerRef player, - const plusplayer::drm::Property& property); - -PLUS_PLAYER_EXPORT bool Pause(PlusplayerRef player); - -PLUS_PLAYER_EXPORT bool Resume(PlusplayerRef player); - -PLUS_PLAYER_EXPORT bool Close(PlusplayerRef player); - -PLUS_PLAYER_EXPORT bool Seek(PlusplayerRef player, - const uint64_t time_millisecond); - -PLUS_PLAYER_EXPORT void SetStopPosition(PlusplayerRef player, - const uint64_t time_millisecond); - -PLUS_PLAYER_EXPORT bool Suspend(PlusplayerRef player); - -PLUS_PLAYER_EXPORT bool Restore(PlusplayerRef player, plusplayer::State state); - -PLUS_PLAYER_EXPORT bool GetMemento(PlusplayerRef player, - plusplayer::PlayerMemento* memento); - -PLUS_PLAYER_EXPORT bool SetDisplay(PlusplayerRef player, - const plusplayer::DisplayType& type, - const uint32_t serface_id, const int x, - const int y, const int w, const int h); - -PLUS_PLAYER_EXPORT bool SetDisplayMode(PlusplayerRef player, - const plusplayer::DisplayMode& mode); - -PLUS_PLAYER_EXPORT bool SetDisplayRoi(PlusplayerRef player, - const plusplayer::Geometry& roi); - -PLUS_PLAYER_EXPORT bool SetDisplayRotate( - PlusplayerRef player, const plusplayer::DisplayRotation& rotate); - -PLUS_PLAYER_EXPORT bool GetDisplayRotate(PlusplayerRef player, - plusplayer::DisplayRotation* rotate); - -PLUS_PLAYER_EXPORT bool GetDisplayRotationSupport(PlusplayerRef player, - bool& can_rotate); - -PLUS_PLAYER_EXPORT bool IsRotatableDevice(PlusplayerRef player); - -PLUS_PLAYER_EXPORT bool SetDisplayVisible(PlusplayerRef player, - bool is_visible); - -PLUS_PLAYER_EXPORT bool SetAudioMute(PlusplayerRef player, bool is_mute); - -PLUS_PLAYER_EXPORT bool SetBufferConfig( - PlusplayerRef player, const std::pair& config); - -PLUS_PLAYER_EXPORT plusplayer::State GetState(PlusplayerRef player); - -PLUS_PLAYER_EXPORT std::string GetTrackLanguageCode(PlusplayerRef player, - plusplayer::TrackType type, - int index); - -PLUS_PLAYER_EXPORT int GetTrackCount(PlusplayerRef player, - plusplayer::TrackType type); - -PLUS_PLAYER_EXPORT std::vector GetTrackInfo( - PlusplayerRef player); - -PLUS_PLAYER_EXPORT std::vector GetActiveTrackInfo( - PlusplayerRef player); - -PLUS_PLAYER_EXPORT bool GetDuration(PlusplayerRef player, - int64_t* duration_in_milliseconds); - -PLUS_PLAYER_EXPORT bool GetPlayingTime(PlusplayerRef player, - uint64_t* time_in_milliseconds); - -PLUS_PLAYER_EXPORT bool SetSilentSubtitle(PlusplayerRef player, bool onoff); - -PLUS_PLAYER_EXPORT bool SetPlaybackRate(PlusplayerRef player, - const double speed); - -PLUS_PLAYER_EXPORT bool SetPlaybackRateBySeek(PlusplayerRef player, - const double rate); - -PLUS_PLAYER_EXPORT void DestroyPlayer(PlusplayerRef player); - -PLUS_PLAYER_EXPORT void DrmLicenseAcquiredDone(PlusplayerRef player, - plusplayer::TrackType type); - -PLUS_PLAYER_EXPORT void SetStreamingProperty(PlusplayerRef player, - const std::string& type, - const std::string& value); - -PLUS_PLAYER_EXPORT std::string GetStreamingProperty(PlusplayerRef player, - const std::string& type); - -PLUS_PLAYER_EXPORT bool SelectTrack(PlusplayerRef player, - plusplayer::TrackType type, int index); - -PLUS_PLAYER_EXPORT bool SetSubtitlePath(PlusplayerRef player, - const std::string& path); - -PLUS_PLAYER_EXPORT bool SetPreferredLanguage( - PlusplayerRef player, plusplayer::TrackType type, - const std::string& primary_language, const std::string& secondary_language, - const std::string& tertiary_language); - -PLUS_PLAYER_EXPORT void SetVideoFrameBufferType( - PlusplayerRef player, const plusplayer::DecodedVideoFrameBufferType type); - -PLUS_PLAYER_EXPORT bool GetVirtualRscId(PlusplayerRef player, - const plusplayer::RscType type, - int* virtual_id); - -PLUS_PLAYER_EXPORT bool SetData(PlusplayerRef player, const std::string data); - -PLUS_PLAYER_EXPORT bool GetData(PlusplayerRef player, std::string& data); - -PLUS_PLAYER_EXPORT bool UpdateDashToken(PlusplayerRef player, - const std::string& token); - -PLUS_PLAYER_EXPORT void RegisterListener(PlusplayerRef player, - PlusplayerListener* listener, - void* user_data); - -PLUS_PLAYER_EXPORT void UnregisterListener(PlusplayerRef player); -}; -#if defined(__cplusplus) -// extern "C" -#endif - -#endif // FLUTTER_PLUGIN_PLUSPLAYER_WRAPPER_H diff --git a/packages/video_player_avplay/tizen/inc/plusplayer_capi/appinfo.h b/packages/video_player_avplay/tizen/inc/plusplayer_capi/appinfo.h new file mode 100644 index 000000000..9858c06f1 --- /dev/null +++ b/packages/video_player_avplay/tizen/inc/plusplayer_capi/appinfo.h @@ -0,0 +1,52 @@ +/** + * @file + * @brief AppInfo related enums + * @interfacetype Platform + * @privlevel None-privilege + * @privilege None + * @product TV, AV, B2B + * @version 8.0 + * @SDK_Support N + * @remark This is a group of C style display releted data structures + * and enums. + * @see The display related enum values and data structures will be + * converted by this managed C version types to avoid binary + * compatibility. + * + * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __PLUSPLAYER_PLUSPLAYER_CAPI_APPINFO_H__ +#define __PLUSPLAYER_PLUSPLAYER_CAPI_APPINFO_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Player app information. + */ +typedef struct { + char* id; /**< App id */ + char* version; /**< App version */ + char* type; /**< App type. ex)"MSE", "HTML5", etc.. */ + char* extra_data; /**< Extra field for future use */ +} plusplayer_app_info_s; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // __PLUSPLAYER_PLUSPLAYER_CAPI_APPINFO_H__ diff --git a/packages/video_player_avplay/tizen/inc/plusplayer_capi/attribute.h b/packages/video_player_avplay/tizen/inc/plusplayer_capi/attribute.h new file mode 100644 index 000000000..9f1f9fa88 --- /dev/null +++ b/packages/video_player_avplay/tizen/inc/plusplayer_capi/attribute.h @@ -0,0 +1,194 @@ +/** + * @file + * @brief Subtitle Attribute Enums and structures. + * @interfacetype Platform + * @privlevel None-privilege + * @privilege None + * @product TV, AV, B2B + * @version 8.0 + * @SDK_Support N + * @remark This is a group of C style Subtitle Attribute related enums + * and structures. + * @see Subtitle Attribute enum conversion and structures. + * + * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __PLUSPLAYER_PLUSPLAYER_CAPI_ATTRIBUTE_H__ +#define __PLUSPLAYER_PLUSPLAYER_CAPI_ATTRIBUTE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** + * @brief Enumeration for supported subtitle attributes + */ +typedef enum { + PLUSPLAYER_SUBTITLE_ATTR_TYPE_REGION_XPOS, /**< float type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_REGION_YPOS, /**< float type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_REGION_WIDTH, /**< float type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_REGION_HEIGHT, /**< float type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WINDOW_XPADDING, /**< float type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WINDOW_YPADDING, /**< float type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WINDOW_LEFT_MARGIN, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WINDOW_RIGHT_MARGIN, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WINDOW_TOP_MARGIN, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WINDOW_BOTTOM_MARGIN, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WINDOW_BG_COLOR, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WINDOW_OPACITY, /**< float type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WINDOW_SHOW_BG, /**< how to show window + background, uint type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_FONT_FAMILY, /**< char* type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_FONT_SIZE, /**< float type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_FONT_WEIGHT, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_FONT_STYLE, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_FONT_COLOR, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_FONT_BG_COLOR, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_FONT_OPACITY, /**< float type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_FONT_BG_OPACITY, /**< float type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_FONT_TEXT_OUTLINE_COLOR, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_FONT_TEXT_OUTLINE_THICKNESS, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_FONT_TEXT_OUTLINE_BLUR_RADIUS, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_FONT_VERTICAL_ALIGN, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_FONT_HORIZONTAL_ALIGN, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_RAW_SUBTITLE, /**< char* type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WEBVTT_CUE_LINE, /**< float type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WEBVTT_CUE_LINE_NUM, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WEBVTT_CUE_LINE_ALIGN, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WEBVTT_CUE_ALIGN, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WEBVTT_CUE_SIZE, /**< float type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WEBVTT_CUE_POSITION, /**< float type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WEBVTT_CUE_POSITION_ALIGN, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_WEBVTT_CUE_VERTICAL, /**< int type */ + PLUSPLAYER_SUBTITLE_ATTR_TYPE_TIMESTAMP, + PLUSPLAYER_SUBTITLE_ATTR_TYPE_EXTSUB_INDEX /**< File index of external + subtitle */ +} plusplayer_subtitle_attr_type_e; + +/** + * @brief Enumeration for player supported subtitle types + */ +typedef enum { + PLUSPLAYER_SUBTITLE_TYPE_TEXT, /**< subtitle type text */ + PLUSPLAYER_SUBTITLE_TYPE_PICTURE, /**< subtitle type picture */ + PLUSPLAYER_SUBTITLE_TYPE_TTML, /**< subtitle type ttml */ +} plusplayer_subtitle_type_e; + +/** + * @brief Enumeration for player supported subtitle attribute data types + */ +typedef enum { + PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_BOOL, /**< subtitle attribute data type + bool */ + PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_FLOAT, /**< subtitle attribute data type + * float + */ + PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_DOUBLE, /**< subtitle attribute data type + * double + */ + PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_STRING, /**< subtitle attribute data type + * string + */ + PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_INT, /**< subtitle attribute data type int + */ + PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_UINT, /**< subtitle attribute data type + uint */ + PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_INT64, /**< subtitle attribute data type + * int64 + */ + PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_UINT64 /**< subtitle attribute data type + * uint64 + */ +} plusplayer_subtitle_attr_data_type_e; + +/** + * @brief structure definition of subtitle attribute + */ +typedef struct { + /** + * @brief Subtitle attribute. + */ + plusplayer_subtitle_attr_type_e attr; + + /** + * @brief Subtitle attribute data type. + */ + plusplayer_subtitle_attr_data_type_e dtype; + + /** + * @brief Start time. + */ + uint32_t start_time; + + /** + * @brief Stop time. + */ + uint32_t stop_time; + + /** + * @brief Subtitle attribute value. It can be float, int32, char*, + * unsigned int. + */ + union { + /** + * @brief Floating type subtitle attribute value. + */ + float float_value; + + /** + * @brief 32bit integer type subtitle atribute value. + */ + int32_t int32_value; + + /** + * @brief String type subtitle atribute value. + */ + const char* str_value; + + /** + * @brief Unsigned 32bit integer type subtitle attribute value. + */ + uint32_t uint32_value; + + /** + * @brief Unsigned 64bit integer type subtitle attribute value. + */ + uint64_t uint64_value; + + /** + * @brief 64bit integer type subtitle attribute value. + */ + int64_t int64_value; + + /** + * @brief Double type subtitle attribute value. + */ + double double_value; + } value; + + /** + * @brief Extra subtitle attribute index. + */ + int extsub_index; +} plusplayer_subtitle_attr_s; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // __PLUSPLAYER_PLUSPLAYER_CAPI_ATTRIBUTE_H__ \ No newline at end of file diff --git a/packages/video_player_avplay/tizen/inc/plusplayer_capi/display.h b/packages/video_player_avplay/tizen/inc/plusplayer_capi/display.h new file mode 100644 index 000000000..62e697a02 --- /dev/null +++ b/packages/video_player_avplay/tizen/inc/plusplayer_capi/display.h @@ -0,0 +1,108 @@ +/** + * @file + * @brief Display related enums + * @interfacetype Platform + * @privlevel None-privilege + * @privilege None + * @product TV, AV, B2B + * @version 8.0 + * @SDK_Support N + * @remark This is a group of C style display releted data structures + * and enums. + * @see The display related enum values and data structures will be + * converted by this managed C version types to avoid binary + * compatibility. + * + * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __PLUSPLAYER_PLUSPLAYER_CAPI_DISPLAY_H__ +#define __PLUSPLAYER_PLUSPLAYER_CAPI_DISPLAY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerations for controlling the still mode activation + */ +typedef enum { + PLUSPLAYER_STILL_MODE_NONE, /**< Still mode is not set */ + PLUSPLAYER_STILL_MODE_OFF, /**< Still mode is deactivated */ + PLUSPLAYER_STILL_MODE_ON /**< Still mode is activated */ +} plusplayer_still_mode_e; + +/** + * @brief Enumerations for the display mode + */ +typedef enum { + PLUSPLAYER_DISPLAY_MODE_LETTER_BOX, /**< Letterboxing mode */ + PLUSPLAYER_DISPLAY_MODE_ORIGIN_SIZE, /**< Original size */ + PLUSPLAYER_DISPLAY_MODE_FULL_SCREEN, /**< Full screen */ + PLUSPLAYER_DISPLAY_MODE_CROPPED_FULL, /**< Cropped full screen */ + PLUSPLAYER_DISPLAY_MODE_ORIGIN_OR_LETTER, /**< Origin or letterbox */ + PLUSPLAYER_DISPLAY_MODE_DST_ROI, /**< Destination ROI */ + PLUSPLAYER_DISPLAY_MODE_AUTO_ASPECT_RATIO, /**< Auto aspect ratio */ + PLUSPLAYER_DISPLAY_MODE_ROI_AUTO_ASPECT_RATIO /**< ROI auto aspect ratio */ +} plusplayer_display_mode_e; + +/** + * @brief Enumeration of display types + */ +typedef enum { + PLUSPLAYER_DISPLAY_TYPE_NONE, /**< No display type specified */ + PLUSPLAYER_DISPLAY_TYPE_OVERLAY, /**< Overlay display type */ + PLUSPLAYER_DISPLAY_TYPE_EVAS, /**< EVAS-based display */ + PLUSPLAYER_DISPLAY_TYPE_MIXER, /**< Mixer display type */ + PLUSPLAYER_DISPLAY_TYPE_OVERLAYSYNCUI /**< Overlay with synchronized UI */ +} plusplayer_display_type_e; + +/** + * @brief Enumeration for display rotation types + */ +typedef enum { + PLUSPLAYER_DISPLAY_ROTATION_TYPE_NONE, /**< No rotation applied */ + PLUSPLAYER_DISPLAY_ROTATION_TYPE_90, /**< Rotate 90 degrees clockwise */ + PLUSPLAYER_DISPLAY_ROTATION_TYPE_180, /**< Rotate 180 degrees */ + PLUSPLAYER_DISPLAY_ROTATION_TYPE_270 /**< Rotate 270 degrees clockwise */ +} plusplayer_display_rotation_type_e; + +/** + * @brief struct for geometry + */ +typedef struct { + /** + * @brief start X position of Display window. [Default = 0] + */ + int x; + /** + * @brief start Y position of Display window. [Default = 0] + */ + int y; + /** + * @brief Width of Display window. [Default = 1920] + */ + int width; + /** + * @brief Height of Display window. [Default = 1080] + */ + int height; +} plusplayer_geometry_s; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // __PLUSPLAYER_PLUSPLAYER_CAPI_DISPLAY_H__ diff --git a/packages/video_player_avplay/tizen/inc/plusplayer_capi/drm.h b/packages/video_player_avplay/tizen/inc/plusplayer_capi/drm.h new file mode 100644 index 000000000..fbbf3bc1d --- /dev/null +++ b/packages/video_player_avplay/tizen/inc/plusplayer_capi/drm.h @@ -0,0 +1,89 @@ +/** + * @file + * @brief Drm related enums + * @interfacetype Platform + * @privlevel None-privilege + * @privilege None + * @product TV, AV, B2B + * @version 8.0 + * @SDK_Support N + * @remark This is a group of C style drm related data structures and + * enums. + * @see Drm related event listeners, enum classes, etc.. are + * converted to this. + * + * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __PLUSPLAYER_PLUSPLAYER_CAPI_DRM_H__ +#define __PLUSPLAYER_PLUSPLAYER_CAPI_DRM_H__ + +#include +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumeration of DRM types + */ +typedef enum { + PLUSPLAYER_DRM_TYPE_NONE, /**< No DRM applied */ + PLUSPLAYER_DRM_TYPE_PLAYREADY, /**< Microsoft PlayReady DRM */ + PLUSPLAYER_DRM_TYPE_MARLIN, /**< Marlin DRM */ + PLUSPLAYER_DRM_TYPE_VERIMATRIX, /**< Verimatrix DRM */ + PLUSPLAYER_DRM_TYPE_WV_CLASSIC, /**< Widevine Classic (Legacy) */ + PLUSPLAYER_DRM_TYPE_SECUREMEDIA, /**< SecureMedia DRM */ + PLUSPLAYER_DRM_TYPE_SDRM, /**< Samsung DRM (SDRM) */ + PLUSPLAYER_DRM_TYPE_WIDEVINE_CDM /**< Widevine CDM (Client-Driven) */ +} plusplayer_drm_type_e; + +#ifdef DRM_MAPI_AARCH_64 +typedef unsigned long Plusplayer_DrmHandle; +#else +typedef int Plusplayer_DrmHandle; +#endif + +/** + * @brief Drm property structure + */ +typedef struct { + /** + * @description Drm type + */ + plusplayer_drm_type_e type; + + /** + * @description Drm session handle + */ + Plusplayer_DrmHandle handle; + + /** + * @description External Decryption Mode + */ + bool external_decryption; + + /** + * @description The cb will be invoked when license was acquired. + */ + void *license_acquired_cb; + + /** + * @description The userdata will be sent by license_acquired_cb + */ + void *license_acquired_userdata; +} plusplayer_drm_property_s; + +} // extern "C" +#endif // __PLUSPLAYER_PLUSPLAYER_CAPI_DRM_H__ diff --git a/packages/video_player_avplay/tizen/inc/plusplayer_capi/error.h b/packages/video_player_avplay/tizen/inc/plusplayer_capi/error.h new file mode 100644 index 000000000..088b78a47 --- /dev/null +++ b/packages/video_player_avplay/tizen/inc/plusplayer_capi/error.h @@ -0,0 +1,121 @@ +/** + * @file + * @brief Error related enums + * @interfacetype Platform + * @privlevel None-privilege + * @privilege None + * @product TV, AV, B2B + * @version 8.0 + * @SDK_Support N + * @remark This is a group of C style error related enum. + * @see All error enum values will be converted to this managed error + * types. + * + * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __PLUSPLAYER_PLUSPLAYER_CAPI_ERROR_H__ +#define __PLUSPLAYER_PLUSPLAYER_CAPI_ERROR_H__ + +#include "tizen.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define PLUSPLAYER_ERROR_CLASS_CAPI (TIZEN_ERROR_PLAYER | 0x20) + +/* This is for custom defined plusplayer error. */ +#define PLUSPLAYER_CUSTOM_ERROR_CLASS_CAPI (TIZEN_ERROR_PLAYER | 0x1000) + +/** + * @brief Enumerations for the error type + */ +typedef enum { + PLUSPLAYER_ERROR_TYPE_NONE = TIZEN_ERROR_NONE, /**< Successful */ + PLUSPLAYER_ERROR_TYPE_OUT_OF_MEMORY = + TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ + PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER = + TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + PLUSPLAYER_ERROR_TYPE_NO_SUCH_FILE = + TIZEN_ERROR_NO_SUCH_FILE, /**< No such file or directory */ + PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION = + TIZEN_ERROR_INVALID_OPERATION, /**< Invalid operation */ + PLUSPLAYER_ERROR_TYPE_FILE_NO_SPACE_ON_DEVICE = + TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE, /**< No space left on the device */ + PLUSPLAYER_ERROR_TYPE_FEATURE_NOT_SUPPORTED_ON_DEVICE = + TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */ + PLUSPLAYER_ERROR_TYPE_SEEK_FAILED = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x01, /**< Seek operation failure */ + PLUSPLAYER_ERROR_TYPE_INVALID_STATE = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x02, /**< Invalid state */ + PLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_FILE = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x03, /**< File format not supported */ + PLUSPLAYER_ERROR_TYPE_INVALID_URI = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x04, /**< Invalid URI */ + PLUSPLAYER_ERROR_TYPE_SOUND_POLICY = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x05, /**< Sound policy error */ + PLUSPLAYER_ERROR_TYPE_CONNECTION_FAILED = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x06, /**< Streaming connection failed */ + PLUSPLAYER_ERROR_TYPE_VIDEO_CAPTURE_FAILED = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x07, /**< Video capture failed */ + PLUSPLAYER_ERROR_TYPE_DRM_EXPIRED = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x08, /**< Expired license */ + PLUSPLAYER_ERROR_TYPE_DRM_NO_LICENSE = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x09, /**< No license */ + PLUSPLAYER_ERROR_TYPE_DRM_FUTURE_USE = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x0a, /**< License for future use */ + PLUSPLAYER_ERROR_TYPE_NOT_PERMITTED = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x0b, /**< Format not permitted */ + PLUSPLAYER_ERROR_TYPE_RESOURCE_LIMIT = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x0c, /**< Resource limit */ + PLUSPLAYER_ERROR_TYPE_PERMISSION_DENIED = + TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ + PLUSPLAYER_ERROR_TYPE_SERVICE_DISCONNECTED = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x0d, /**< Socket connection lost*/ + PLUSPLAYER_ERROR_TYPE_NO_BUFFER_SPACE = + TIZEN_ERROR_BUFFER_SPACE, /**< No buffer space available */ + PLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_AUDIO_CODEC = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x0e, /**< Not supported audio codec but + video can be played */ + PLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_VIDEO_CODEC = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x0f, /**< Not supported video codec but + video can be played */ + PLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_SUBTITLE = + PLUSPLAYER_ERROR_CLASS_CAPI | 0x10, /**< Not supported subtitle format */ + PLUSPLAYER_ERROR_TYPE_DRM_DECRYPTION_FAILED = + PLUSPLAYER_CUSTOM_ERROR_CLASS_CAPI | + 0x05, /**< playready drm error info */ + PLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_FORMAT = + PLUSPLAYER_CUSTOM_ERROR_CLASS_CAPI | 0x08, /**< format not supported */ + PLUSPLAYER_ERROR_TYPE_STREAMING_PLAYER = + PLUSPLAYER_CUSTOM_ERROR_CLASS_CAPI | 0x09, // confirm it later + PLUSPLAYER_ERROR_TYPE_DTCPFSK = PLUSPLAYER_CUSTOM_ERROR_CLASS_CAPI | 0x0a, + PLUSPLAYER_ERROR_TYPE_PRELOADING_TIMEOUT = + PLUSPLAYER_CUSTOM_ERROR_CLASS_CAPI | + 0x0b, /**< can't finish preloading in time*/ + PLUSPLAYER_ERROR_TYPE_NETWORK_ERROR = + PLUSPLAYER_CUSTOM_ERROR_CLASS_CAPI | 0x0c, /**< for network error*/ + PLUSPLAYER_ERROR_TYPE_NOT_CHANNEL_SURFING_ERROR = + PLUSPLAYER_CUSTOM_ERROR_CLASS_CAPI | + 0x0d, /**< for channel surfing error*/ + PLUSPLAYER_ERROR_TYPE_UNKNOWN +} plusplayer_error_type_e; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // __PLUSPLAYER_PLUSPLAYER_CAPI_ERROR_H__ diff --git a/packages/video_player_avplay/tizen/inc/plusplayer_capi/plusplayer_capi.h b/packages/video_player_avplay/tizen/inc/plusplayer_capi/plusplayer_capi.h new file mode 100644 index 000000000..3a75b5911 --- /dev/null +++ b/packages/video_player_avplay/tizen/inc/plusplayer_capi/plusplayer_capi.h @@ -0,0 +1,1892 @@ +/** + * @file plusplayer_capi.h + * @brief PlusPlayer api c version + * @interfacetype Platform + * @privlevel None-privilege + * @privilege None + * @product TV, AV, B2B + * @version 8.0 + * @SDK_Support N + * @remark This is plusplayer api header implemented as C style to + * avoid binary compatibility issues. + * + * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __PLUSPLAYER_PLUSPLAYER_CAPI_PLUSPLAYER_CAPI_H__ +#define __PLUSPLAYER_PLUSPLAYER_CAPI_PLUSPLAYER_CAPI_H__ + +#include "plusplayer_capi/appinfo.h" +#include "plusplayer_capi/attribute.h" +#include "plusplayer_capi/display.h" +#include "plusplayer_capi/drm.h" +#include "plusplayer_capi/error.h" +#include "plusplayer_capi/property.h" +#include "plusplayer_capi/state.h" +#include "plusplayer_capi/streaming_message.h" +#include "plusplayer_capi/track.h" +#include "plusplayer_capi/track_capi.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/** + * @brief Callback for error events + * @param error_type Type of error occurred + * @param user_data Application-specific user data + */ +typedef void (*plusplayer_error_cb)(plusplayer_error_type_e error_type, + void* user_data); + +/** + * @brief Callback for asynchronous preparation completion + * @param prepare_flag True if preparation succeeded, false otherwise + * @param user_data Application-specific user data + */ +typedef void (*plusplayer_prepare_async_done_cb)(bool prepare_flag, + void* user_data); + +/** + * @brief Callback for resource conflict events + * @param user_data Application-specific user data + */ +typedef void (*plusplayer_resource_conflicted_cb)(void* user_data); + +/** + * @brief Callback for end of stream event + * @param user_data Application-specific user data + */ +typedef void (*plusplayer_eos_cb)(void* user_data); + +/** + * @brief Callback for seek completion + * @param user_data Application-specific user data + */ +typedef void (*plusplayer_seek_done_cb)(void* user_data); + +/** + * @brief Callback for buffer status updates + * @param buffer_level Current buffer level percentage (0-100) + * @param user_data Application-specific user data + */ +typedef void (*plusplayer_buffer_status_cb)(int buffer_level, void*); + +/** + * @brief Callback for DRM initialization data reception + * @param handle DRM session handle + * @param data_size Size of the initialization data + * @param data Pointer to the initialization data buffer + * @param track_type Type of media track associated with the data + * @param user_data Application-specific user data + */ +typedef void (*plusplayer_drm_init_data_cb)(Plusplayer_DrmHandle* handle, + unsigned int data_size, + unsigned char* data, + plusplayer_track_type_e track_type, + void* user_data); + +/** + * @brief Callback for adaptive streaming control events + * @param message_type Type of streaming message/event + * @param param Pointer to message-specific parameters + * @param user_data Application-specific user data + */ +typedef void (*plusplayer_adaptive_streaming_control_event_cb)( + plusplayer_streaming_message_type_e message_type, + plusplayer_message_param_s* param, void* user_data); + +/** + * @brief Callback for error message details + * @param error_type Type of error occurred + * @param message Human-readable error message + * @param user_data Application-specific user data + */ +typedef void (*plusplayer_error_msg_cb)(plusplayer_error_type_e error_type, + const char* message, void* user_data); +/** + * @brief Callback function for Subtitle Data updated information + * @param type subtitle type (text or picture) + * @param duration_in_ms subtitle duration (ms) + * @param data Subtitle data + * @param size subtitle data length + * @param attr_list list of subtitle attribute + * @param attr_size length of subtitle attribute list + * @param user_data Application-specific user data + */ +typedef void (*plusplayer_subtitle_updated_cb)( + const plusplayer_subtitle_type_e type, const uint64_t duration_in_ms, + const char* data, const int size, plusplayer_subtitle_attr_s* attr_list, + int attr_size, void* userdata); + +/** + * @brief Callback for AD Event from DASH. + * @param ad_data Ad information c_str ends with '\0' + * @param user_data Application-specific user data + * @pre On callback registration, it will not be invoked before player + * prepare. + */ +typedef void (*plusplayer_ad_event_cb)(const char* ad_data, void* userdata); + +/** + * @brief Callback for track information. + * @param track Track handle. Caller can use this handle to get information. + * @param user_data Application-specific user data + * @return @c true to continue with the next iteration of the loop, + * otherwise @c false to break out of the loop + */ +typedef bool (*plusplayer_track_cb)(const plusplayer_track_h track, + void* userdata); + +/** + * @brief Handle for PlusPlayer CAPI + */ +typedef void* plusplayer_h; + +/** + * @brief Handle for PlusPlayer Track + */ +typedef void* plusplayer_track_h; + +/** + * @brief Create a plusplayer handle. + * @param [in] void + * @return return plusplayer handle pointer. + * @code + * plusplayer_h player = plusplayer_create(); + * // ... your codes ... + * plusplayer_destroy(player); + * @endcode + * @pre None + * @post The player state will be #PLUSPLAYER_STATE_NONE. + * @exception None + * @remark Caller must ensure all APIs are called from the same thread as + * this API is invoked. + */ +plusplayer_h plusplayer_create(void); + +/** + * @brief Open plusplayer handle. + * @param [in] handle : plusplayer handle + * @param [in] uri : content uri. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * // ... your codes ... + * plusplayer_close(player); + * plusplayer_destroy(player); + * @endcode + * @pre The player state must be #PLUSPLAYER_STATE_NONE. + * @post The player state will be #PLUSPLAYER_STATE_IDLE. + * @exception None + * @remark Caller must provide a valid HTTP(S) URI. Local file sources + * (e.g., file:///path) is not supported. + * @see plusplayer_close() \n + * plusplayer_prepare() + */ +int plusplayer_open(plusplayer_h handle, const char* uri); + +/** + * @brief Prepare the player for playback, synchronously. + * @param [in] handle : plusplayer handle + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation + * failed. + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * plusplayer_prepare(player); // SYNCHRONOUS operation + * // ... your codes ... + * @endcode + * @pre The player state must be #PLUSPLAYER_STATE_IDLE. + * @post The player state will be #PLUSPLAYER_STATE_READY + * or #PLUSPLAYER_STATE_TRACK_SOURCE_READY (only in case of prebuffer + * mode) + * @exception None + * @see plusplayer_open() + */ +int plusplayer_prepare(plusplayer_h handle); + +/** + * @brief Start media playback. + * @param [in] handle : plusplayer handle. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation + * failed. + * @code + * plusplayer_prepare(player); + * plusplayer_start(player); + * // ... your codes ... + * @endcode + * @pre The player state should be #PLUSPLAYER_STATE_READY. + * @post The player state will be #PLUSPLAYER_STATE_PLAYING. + * @exception None + * @see plusplayer_open() \n + * plusplayer_prepare() \n + * plusplayer_start() \n + * plusplayer_stop() \n + * plusplayer_close() + */ +int plusplayer_start(plusplayer_h handle); + +/** + * @brief Stop playing media content. + * @param [in] handle : plusplayer handle. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation + * failed. + * @code + * plusplayer_open(); + * plusplayer_prepare(player); + * // ... your codes ... + * plusplayer_stop(player); + * // ... your codes ... + * plusplayer_close(player); + * @endcode + * @pre The player state must be all of #plusplayer_state_e except + * #PLUSPLAYER_STATE_NONE. + * @post The player state will be #PLUSPLAYER_STATE_IDLE. + * @exception None + * @remark plusplayer_close() must be called once after player is stopped + * @see plusplayer_open() \n + * plusplayer_prepare() \n + * plusplayer_start() \n + * plusplayer_close() + */ +int plusplayer_stop(plusplayer_h handle); + +/** + * @brief Release all the player resources except callback functions. + * @param [in] handle : plusplayer handle. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #plusplayer_ERROR_TYPE_NONE Successful + * @retval #plusplayer_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #plusplayer_ERROR_TYPE_INVALID_OPERATION Internal operation + * failed. + * @pre The player state must be all of #plusplayer_state_e except + * #PLUSPLAYER_STATE_NONE. + * @post The player state will be #PLUSPLAYER_STATE_NONE. + * @exception None + * @see plusplayer_open() + */ +int plusplayer_close(plusplayer_h handle); + +/** + * @brief Release a player handle. + * @param [in] handle : plusplayer handle. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation + * failed. + * @code + * plusplayer_h player = plusplayer_create(); + * // ... your codes ... + * plusplayer_destroy(player); + * @endcode + * @pre The player state must be #PLUSPLAYER_STATE_NONE + * @post player handle will be removed. + * @exception None + * @see plusplayer_create() + */ +int plusplayer_destroy(plusplayer_h handle); + +/** + * @brief Get current state of player. + * @param [in] handle : plusplayer handle. + * @return current #plusplayer_state_e of player. + * @code + * plusplayer_h player = plusplayer_create(); + * // ... your codes ... + * plusplayer_state_e ret = plusplayer_get_state(player); + * // ... your codes ... + * plusplayer_destroy(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_NONE. + * @post The player state will be same as @pre. + * @exception None + */ +plusplayer_state_e plusplayer_get_state(plusplayer_h handle); + +/** + * @brief Set the video display type and window pointer. + * @param [in] handle : plusplayer handle. + * @param [in] type : display type. + * @param [in] window : the handle to display window. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation + * failed. + * @code + * plusplayer_open(player,uri); + * plusplayer_set_display(player,plusplayer_display_type_e_OVERLAY,window); + * // ... your codes ... + * plusplayer_close(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_IDLE. + * @post None + * @exception None + * @remark We are not supporting changing display. \n + * This API have to be called before calling + * plusplayer_prepare() or plusplayer_prepare_async() to reflect the + * display type. + * @see plusplayer_open() \n + * plusplayer_set_display_mode() \n + * plusplayer_set_display_roi() + */ +int plusplayer_set_display(plusplayer_h handle, plusplayer_display_type_e type, + void* window); + +/** + * @brief Set the video display type, surface id and display size. + * @param [in] handle : plusplayer handle. + * @param [in] type : display type. + * @param [in] surface_id : resource id of window. + * @param [in] roi : plusplayer_geometry_s. + * @return @c one of plusplayer_error_type_e values will be returned. + * @pre The player state must be at least #PLUSPLAYER_STATE_IDLE. + * @post None + * @exception None + * @see plusplayer_set_display_mode() \n + * plusplayer_set_display_roi() + */ +int plusplayer_set_display_subsurface(plusplayer_h handle, + plusplayer_display_type_e type, + uint32_t surface_id, + plusplayer_geometry_s roi); + +/** + * @brief Set a callback function to be invoked when player is prepared + * completed. + * @param [in] handle : plusplayer handle. + * @param [in] prepare_async_done_cb : the prepare async done callback + * function to register. + * @param [in] userdata : pointer to caller object of + * prepare_async_done_cb(). + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * refer to the sample code of plusplayer_prepare_async(); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_NONE. \n + * But recommended to be called in either #PLUSPLAYER_STATE_NONE or + * #PLUSPLAYER_STATE_IDLE. + * @post plusplayer_prepare_async_done_cb() will be invoked. + * @exception It is prohibited to call any player APIs within context of + * plusplayer_prepare_async_done_cb callback + * @remark plusplayer_prepare_async_done_cb() \n + * if prepare_async_done_cb is set to null, + * plusplayer_prepare_async_done_cb() will not be + * invoked anymore. + * @see plusplayer_prepare_async(). + */ +int plusplayer_set_prepare_async_done_cb( + plusplayer_h handle, plusplayer_prepare_async_done_cb prepare_async_done_cb, + void* userdata); + +/** + * @brief Set a callback function to be invoked when resource conflicted. + * @param [in] handle : plusplayer handle. + * @param [in] resource_conflicted_cb : the resource conflict callback + * function to be called. + * @param [in] userdata : pointer to caller object of + * resource_conflicted_cb(). + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * static void resource_conflicted_cb(void* userdata){ + * //Something you want to do when Resource Conflict occur + * } + * plusplayer_h player1 = plusplayer_create(); + * plusplayer_h player2 = plusplayer_create(); + * plusplayer_set_resource_conflicted_cb(player1, + * resource_conflicted_cb, NULL); + * // ... your codes ... + * plusplayer_prepare(player1); + * plusplayer_prepare(player2); + * // ... your codes ... + * plusplayer_close(player1); + * plusplayer_destroy(player1); + * plusplayer_close(player2); + * plusplayer_destroy(player2); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_NONE. \n + * But recommended to be called in either #PLUSPLAYER_STATE_NONE or + * #PLUSPLAYER_STATE_IDLE. + * @post plusplayer_resource_conflicted_cb() will be invoked. + * @exception It is prohibited to call any player APIs within context of + * plusplayer_resource_conflicted_cb callback + * @remark plusplayer_resource_conflicted_cb() \n + * if resource_conflicted_cb is set to null, + * plusplayer_resource_conflicted_cb() will not be + * invoked anymore. + */ +int plusplayer_set_resource_conflicted_cb( + plusplayer_h handle, + plusplayer_resource_conflicted_cb resource_conflicted_cb, void* userdata); + +/** + * @brief Set a callback function to be invoked when end of stream (EOS) is + * reached. + * @param [in] handle : plusplayer handle. + * @param [in] eos_cb : the EOS callback function to be called. + * @param [in] userdata : pointer to caller object of eos_cb(). + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * static void eos_cb(void* userdata){ + * //Something you want to do when EOS received + * } + * plusplayer_h player = plusplayer_create(); + * plusplayer_set_eos_cb(player, eos_cb, NULL); + * plusplayer_prepare(player); + * plusplayer_start(player); + * // ... your codes ... + * plusplayer_destroy(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_NONE. \n + * But recommended to be called in either #PLUSPLAYER_STATE_NONE or + * #PLUSPLAYER_STATE_IDLE. + * @post plusplayer_eos_cb() will be invoked. + * @exception It is prohibited to call any player APIs within context of + * plusplayer_eos_cb callback + * @remark plusplayer_eos_cb() + * if eos_cb is set to null, + * plusplayer_eos_cb() will not be + * invoked anymore. + */ +int plusplayer_set_eos_cb(plusplayer_h handle, plusplayer_eos_cb eos_cb, + void* userdata); + +/** + * @brief Set a callback function to be invoked for buffer status. + * @param [in] handle : plusplayer handle. + * @param [in] buffer_status_cb : the buffer status callback function to be + * called. + * @param [in] userdata : pointer to caller object of buffer_status_cb(). + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * static void buffer_status_cb(int percent, void* userdata){ + * //Something you want to do with buffer percent + * } + * plusplayer_h player = plusplayer_create(); + * plusplayer_set_buffer_status_cb(player, buffer_status_cb, NULL); + * plusplayer_prepare(player); + * // ... your codes ... + * plusplayer_destroy(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_NONE. \n + * But recommended to be called in either #PLUSPLAYER_STATE_NONE or + * #PLUSPLAYER_STATE_IDLE. + * @post plusplayer_buffer_status_cb() will be invoked. + * @exception It is prohibited to call any player APIs within context of + * plusplayer_buffer_status_cb callback + * @remark plusplayer_buffer_status_cb() \n + * if buffer_status_cb is set to null, + * plusplayer_buffer_status_cb() will not be + * invoked anymore. + */ +int plusplayer_set_buffer_status_cb( + plusplayer_h handle, plusplayer_buffer_status_cb buffer_status_cb, + void* userdata); + +/** + * @brief Sets a callback function to be invoked when an error occurs. + * @param [in] handle : plusplayer handle. + * @param [in] error_cb : the error callback function to register. + * @param [in] userdata : pointer to caller object of plusplayer_error_cb(). + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * static void error_cb(const plusplayer_error_type_e err_code, void* + * userdata) { + * //Something you want to do when error occur + * } + * plusplayer_h player = plusplayer_create(); + * plusplayer_set_error_cb(player, error_cb, NULL); + * // ... your codes ... + * plusplayer_destroy(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_NONE. \n + * But recommended to be called in either #PLUSPLAYER_STATE_NONE or + * #PLUSPLAYER_STATE_IDLE. + * @post plusplayer_error_cb() will be invoked. + * @exception It is prohibited to call any player APIs within context of + * plusplayer_error_cb callback + * @remark plusplayer_error_cb() \n + * if plusplayer_error_cb is set to null, + * plusplayer_error_cb() will not be + * invoked anymore. + */ +int plusplayer_set_error_cb(plusplayer_h handle, plusplayer_error_cb error_cb, + void* userdata); + +/** + * @brief Sets a callback function to be invoked when an error occurs. + * @param [in] handle : plusplayer handle. + * @param [in] error_msg_cb : the error callback function to register. + * @param [in] userdata : pointer to caller object of + * plusplayer_error_msg_cb(). + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * static void error_msg_cb(const plusplayer_error_type_e err_code, + * const char* error_msg, void* userdata) { + * //Something you want to do when error occur + * } + * plusplayer_h player = plusplayer_create(); + * plusplayer_set_error_msg_cb(player, error_msg_cb, NULL); + * // ... your codes ... + * plusplayer_destroy(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_NONE. \n + * But recommended to be called in either #PLUSPLAYER_STATE_NONE or + * #PLUSPLAYER_STATE_IDLE. + * @post plusplayer_error_msg_cb() will be invoked. + * @exception It is prohibited to call any player APIs within context of + * plusplayer_error_msg_cb callback + * @remark plusplayer_error_msg_cb() \n + * if plusplayer_error_msg_cb is set to null, + * plusplayer_error_msg_cb() will not be + * invoked anymore. + */ +int plusplayer_set_error_msg_cb(plusplayer_h handle, + plusplayer_error_msg_cb error_msg_cb, + void* userdata); + +/** + * @brief Set a callback function to be invoked when player seek is + * completed. + * @param [in] handle : plusplayer handle. + * @param [in] seek_done_cb : the seek done callback function to register. + * @param [in] userdata : pointer to caller object of + * plusplayer_seek_done_cb(). + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * refer to the sample code of plusplayer_seek(); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_NONE. \n + * But recommended to be called in either #PLUSPLAYER_STATE_NONE or + * #PLUSPLAYER_STATE_IDLE. + * @post plusplayer_seek_done_cb() will be invoked. + * @exception It is prohibited to call any player APIs within context of + * plusplayer_seek_done_cb callback + * @remark plusplayer_seek_done_cb() \n + * if seek_done_cb is set to null, + * plusplayer_seek_done_cb() will + * not be invoked anymore. + */ +int plusplayer_set_seek_done_cb(plusplayer_h handle, + plusplayer_seek_done_cb seek_done_cb, + void* userdata); + +/** + * @brief Set a callback function to be invoked when there is any subtitle + information to display. + * @param [in] handle : plusplayer handle. + * @param [in] subtitle_updated_cb : the subtitle data callback function to + register. + * @param [in] userdata : pointer to caller object of + * plusplayer_subtitle_updated_cb(). + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * static void subtitle_data_cb(const plusplayer_subtitle_type_e + type, const uint64_t duration_in_ms, const char* data, const int size, + plusplayer_subtitle_attr_s* attr_list, int attr_size, void* userdata) { + * //Something you want to do on when subtitle data is updated + * } + * plusplayer_h player = plusplayer_create(); + * plusplayer_set_subtitle_updated_cb(player, subtitle_data_cb, + NULL); + * // ... your codes ... + * plusplayer_destroy(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_NONE. \n + * But recommended to be called in either #PLUSPLAYER_STATE_NONE or + * #PLUSPLAYER_STATE_IDLE. + * @post plusplayer_subtitle_updated_cb() will be invoked. + * @exception It is prohibited to call any player APIs within context of + * plusplayer_subtitle_updated_cb callback + * @remark plusplayer_subtitle_updated_cb() \n + * if subtitle_updated_cb is set to null, + * plusplayer_subtitle_updated_cb() will + * not be invoked anymore. + */ +int plusplayer_set_subtitle_updated_cb( + plusplayer_h handle, plusplayer_subtitle_updated_cb subtitle_updated_cb, + void* userdata); + +/** + * @brief Sets a callback function to be invoked when dash ad event is + * parsed. + * @param [in] handle : plusplayer handle. + * @param [in] ad_event_cb : the error callback function to register. + * @param [in] userdata : pointer to caller object of plusplayer_error_cb(). + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * static void ad_event_cb(const char* ad_data, void* userdata) { + * //Something you want to do when dash scte:35 cue event is + * parsed + * } + * plusplayer_h player = plusplayer_create(); + * plusplayer_set_ad_event_cb(player, ad_event_cb, NULL); + * // ... your codes ... + * plusplayer_destroy(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_NONE. \n + * But recommended to be called in either #PLUSPLAYER_STATE_NONE or + * #PLUSPLAYER_STATE_IDLE. + * @post plusplayer_ad_event_cb() will be invoked. + * @exception It is prohibited to call any player APIs within context of + * plusplayer_ad_event_cb callback + * @remark callback function @c ad_event_cb will be invoked after player + * prepare, when dash scte:35 cue event is parsed. + * @remark plusplayer_ad_event_cb() \n + * if plusplayer_ad_event_cb is set to null, + * plusplayer_ad_event_cb() will not be + * invoked anymore. + */ +int plusplayer_set_ad_event_cb(plusplayer_h handle, + plusplayer_ad_event_cb ad_event_cb, + void* userdata); + +/** + * @brief Prepare the player for playback, asynchronously. + * @param [in] handle : plusplayer handle. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * static void prepare_done_cb(bool ret, void* userdata) { + * //Something you want to do when prepare done, but, we strongly + * //recommend DO NOT CALL PLAYER APIs in this callbck + * } + * plusplayer_h player = plusplayer_create(); + * plusplayer_set_prepare_async_done_cb(player, + * prepare_done_cb, NULL); + * plusplayer_open(player,uri); + * plusplayer_prepare_async(player); // ASYNC operation + * // ... your codes ... + * plusplayer_close(player); + * plusplayer_destroy(player); + * @endcode + * @pre The player state must be #PLUSPLAYER_STATE_IDLE. + * @post The player state will be #PLUSPLAYER_STATE_READY + * or #PLUSPLAYER_STATE_TRACK_SOURCE_READY (only in case of prebuffer + * mode) + * @exception None + * @remark plusplayer_prepare_async_done_cb() is invoked. + * @see plusplayer_open() \n + * plusplayer_stop() \n + * plusplayer_close() + */ +int plusplayer_prepare_async(plusplayer_h handle); + +/** + * @brief Pause playing media content. + * @param [in] handle : plusplayer handle. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * prepare player done + * // ... your codes ... + * plusplayer_pause(player); + * // ... your codes ... + * plusplayer_stop(player); + * @endcode + * @pre The player state must be one of #PLUSPLAYER_STATE_READY or + * #PLUSPLAYER_STATE_PAUSED or #PLUSPLAYER_STATE_PLAYING. + * @post The player state will be #PLUSPLAYER_STATE_PAUSE. + * @exception None + * @see plusplayer_start() \n + * plusplayer_resume() \n + * plusplayer_prepare_async() + */ +int plusplayer_pause(plusplayer_h handle); + +/** + * @brief Resume playing media content. + * @param [in] handle : plusplayer handle. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation + * failed + * @code + * prepare player done + * // ... your codes ... + * plusplayer_pause(player); + * // ... your codes ... + * plusplayer_resume(player); + * // ... your codes ... + * plusplayer_stop(player); + * @endcode + * @pre The player state must be one of #PLUSPLAYER_STATE_PAUSED or + * #PLUSPLAYER_STATE_PLAYING. + * @post The player state will be #PLUSPLAYER_STATE_PLAYING. + * @exception None + * @see plusplayer_start() \n + * plusplayer_pause() \n + * plusplayer_prepare() + */ +int plusplayer_resume(plusplayer_h handle); + +/** + * @brief Seek/Jump playback to position passed in parameter, + * asynchronously. + * @param [in] handle : plusplayer handle. + * @param [in] time : the absolute position(playingtime) of + * the stream in milliseconds + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @remark In case of non-seekable content, it will return @c + * PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION. \n If application ignore this error, + * player will keep playing without changing play position. + * @code + * static void seek_done_cb(void* userdata) { + * //Something you want to do when seek is completed + * } + * plusplayer_set_seek_done_cb(handle_, seek_done_cb, this); + * // ... your codes ... + * const uint64_t ms_to_seek = 0; + * plusplayer_seek(player,ms_to_seek); + * // ... your codes ... + * plusplayer_stop(player); + * @endcode + * @pre The player state must be one of #PLUSPLAYER_STATE_READY or + * #PLUSPLAYER_STATE_PAUSED or #PLUSPLAYER_STATE_PLAYING. + * In PLUSPLAYER_STATE_IDLE, this api can be called exceptionally + * between plusplayer_open() and plusplayer_prepare_async(). + * the start time of plyabak can be set explicitly when starting + * first playback. In this case, plusplayer_set_seek_done_cb is not + * called. + * @post None + * @exception None + * @remark plusplayer_set_seek_done_cb() will be invoked when seek operation + * is finished. + */ +int plusplayer_seek(plusplayer_h handle, uint64_t time); + +/** + * @brief Enable prebuffer mode. + * @param [in] handle : plusplayer handle. + * @param [in] prebuffer_mode : Boolean to set prebuffer mode + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * // ... your codes ... + * plusplayer_set_prebuffer_mode(player,true); + * uint64_t resume_time_ms = 5000; + * plusplayer_set_resume_time(player, resume_time_ms); + * // ... your codes ... + * plusplayer_prepare(player); + * plusplayer_state_e curr_state = plusplayer_get_state(player); // + * curr_state will be #PLUSPLAYER_STATE_TRACK_SOURCE_READY + * @endcode + * @pre The player state must be #PLUSPLAYER_STATE_IDLE + * @post The player state will be #PLUSPLAYER_STATE_IDLE. + * @exception None + * @see plusplayer_set_property() + */ +void plusplayer_set_prebuffer_mode(plusplayer_h handle, bool prebuffer_mode); + +/** + * @brief Sets application id to resource manager to allocate + * hardware resources like decoder. + * @param [in] handle : plusplayer handle. + * @param [in] app_id : app id + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * plusplayer_open(player,uri); + * plusplayer_set_app_id(player,app_id); + * // ... your codes ... + * plusplayer_stop(player); + * @endcode + * @pre The player state must be #PLUSPLAYER_STATE_IDLE. + * @post The player state will be same as @pre. + * @exception None + * @see plusplayer_start() \n + */ +int plusplayer_set_app_id(plusplayer_h handle, const char* app_id); + +/** + * @brief Suspend playing media content. Player can be suspended and it will + * be muted. \n The current playback status will be maintained internally \n App + * can call suspend() when the app is switching to background. + * @param [in] handle : plusplayer handle. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * prepare player done + * // ... your codes ... + * plusplayer_suspend(player); + * // ... your codes ... + * plusplayer_stop(player); + * @endcode + * @pre The player state must be one of #PLUSPLAYER_STATE_READY or + * #PLUSPLAYER_STATE_PAUSED or #PLUSPLAYER_STATE_PLAYING. + * @post In case of success the player state will be + * #PLUSPLAYER_STATE_PAUSED otherwise state will be not changed. + * @remark In case of power off/on, caller needs to close and open player + * again. + * @exception None + * @see plusplayer_start() \n + * plusplayer_pause() \n + * plusplayer_prepare() \n + * plusplayer_close() + */ +int plusplayer_suspend(plusplayer_h handle); + +/** + * @brief Restore the suspended player. + * @param [in] handle : plusplayer handle. + * @param [in] target_state : State of player after restore. \n + * Playback will be started if #PLUSPLAYER_STATE_PLAYING is set. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * prepare player done + * // ... your codes ... + * plusplayer_suspend(player); + * // ... your codes ... + * plusplayer_restore(player,PLUSPLAYER_STATE_PLAYING); + * plusplayer_stop(player); + * @endcode + * @pre The player must be suspended. + * @post The player state will be one of #PLUSPLAYER_STATE_PLAYING or + * #PLUSPLAYER_STATE_PAUSED or #PLUSPLAYER_STATE_READY + * @exception None + * @see plusplayer_suspend() \n + */ +int plusplayer_restore(plusplayer_h handle, plusplayer_state_e target_state); + +/** + * @brief Get the current playing time of the associated media. + * @param [in] handle : plusplayer handle. + * @param [out] cur_time_ms : current playing time default in milliseconds + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * prepare player done + * plusplayer_start(player); + * // ... your codes ... + * uint64_t cur_time_ms = 0; + * plusplayer_get_playing_time(player, &cur_time_ms); + * // ... your codes ... + * plusplayer_stop(player); + * @endcode + * @pre The player must be one of #PLUSPLAYER_STATE_PAUSE or + * #PLUSPLAYER_STATE_PLAYING. + * @post None + * @exception None + * @see plusplayer_prepare_async() + */ +int plusplayer_get_playing_time(plusplayer_h handle, uint64_t* cur_time_ms); + +/** + * @brief Set the video display mode. + * @param [in] handle : plusplayer handle. + * @param [in] mode : display mode. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * plusplayer_open(player,uri); + * plusplayer_set_display_mode(player,PLUSPLAYER_DISPLAY_MODE_DST_ROI); + * // ... your codes ... + * plusplayer_close(player); + * @endcode + * @pre The player state can be all of #plusplayer_state_e except + * #PLUSPLAYER_STATE_NONE. + * @post None + * @exception None + * @see plusplayer_open() \n + * plusplayer_set_display_mode() \n + * plusplayer_set_display_roi() + */ +int plusplayer_set_display_mode(plusplayer_h handle, + plusplayer_display_mode_e mode); + +/** + * @brief Set the ROI(Region Of Interest) area of display. + * @param [in] handle : plusplayer handle. + * @param [in] roi : plusplayer_geometry_s. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * plusplayer_open(player,uri); + * plusplayer_set_display(player,plusplayer_display_type_e_OVERLAY,window); + * plusplayer_set_display_mode(player,PLUSPLAYER_DISPLAY_MODE_DST_ROI); + * plusplayer_geometry_s roi; + * roi.x = 0; + * roi.y = 0; + * roi.w = 600; + * roi.h = 500; + * plusplayer_set_display_roi(player,roi); + * // ... your codes ... + * plusplayer_close(player); + * @endcode + * @pre The player state can be all of #plusplayer_state_e except + * #PLUSPLAYER_STATE_NONE. \n + * Before set display ROI, #PLUSPLAYER_DISPLAY_MODE_DST_ROI + * must be set with plusplayer_set_display_mode(). + * @post None + * @exception None + * @remark The minimum value of width and height are 1. + * @see plusplayer_open() \n + * plusplayer_set_display() \n + * plusplayer_set_display_mode() + */ +int plusplayer_set_display_roi(plusplayer_h handle, plusplayer_geometry_s roi); +/** + * @brief Set the rotate angle of the video display. + * @param [in] handle : plusplayer handle. + * @param [in] rotation : the rotate angle of the display. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * plusplayer_open(player,uri); + * plusplayer_set_display(player,plusplayer_display_type_e_OVERLAY,window); + * plusplayer_set_display_rotation(player_,plusplayer_display_rotation_type_e_90); + * // ... your codes ... + * plusplayer_close(player); + * @endcode + * @pre The player state can be all of #plusplayer_state_e except + * #PLUSPLAYER_STATE_NONE. + * @post The player state will be same as @pre. + * @remark The default value is 0. + * @exception None + * @see plusplayer_open() \n + * plusplayer_set_display() + */ +int plusplayer_set_display_rotation( + plusplayer_h handle, plusplayer_display_rotation_type_e rotation); + +/** + * @brief Set buffer config parameters to buffer media contents + * before starting playback. + * @param [in] handle : plusplayer handle. + * @param [in] config : config of buffer.\n + * config can be \n + * "total_buffer_size_in_byte" \n + * "total_buffer_size_in_time" \n + * "buffer_size_in_byte_for_play" \n + * "buffer_size_in_sec_for_play" \n + * "buffer_size_in_byte_for_resume" \n + * "buffer_size_in_sec_for_resume" \n + * "buffering_timeout_in_sec_for_play" + * @param [in] amount : data amount to be buffered. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @pre The player state can be all of #plusplayer_state_e except + * #State::PLUSPLAYER_STATE_NONE + * @post The player state will be same as @pre. + * @exception None + */ +int plusplayer_set_buffer_config(plusplayer_h handle, const char* config, + int amount); + +/** + * @brief Get the duration of the stream. + * @param [in] handle : plusplayer handle. + * @param [out] duration_ms : duration in milliseconds. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation + * failed. + * @pre The player state must be one of + * PLUSPLAYER_STATE_TRACK_SOURCE_READY, PLUSPLAYER_STATE_READY, + * PLUSPLAYER_STATE_PLAYING or PLUSPLAYER_STATE_PAUSED. + * @post The player state will be same as @pre. + * @exception None + */ +int plusplayer_get_duration(plusplayer_h handle, int64_t* duration_ms); + +/** + * @brief Set the media playback rate. This api is used to slow/fast + * playback speed. + * @param [in] handle : plusplayer handle. + * @param [in] playback_rate : media playback rate. + * @remark Supported playback rates include: -16.0, -8.0, -4.0, -2.0, 0.25, + * 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 4.0, 8.0, 16.0. + * @remark Positive parameter values play the media forwards, while negative + * values cause the media to play in reverse. + * @remark Playback speeds -16x and 16x are not supported for general HTTP + * and HTTPS streams. + * @remark For HLS streaming, trick play is available for content with + * EXT-X-I-FRAME-STREAM-INF tag, So content must have this in playlist. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_STATE Invalid state + * @code + * prepare player done + * // ... your codes ... + * plusplayer_set_playback_rate(player,1.5); + * // ... your codes ... + * plusplayer_stop(player); + * @endcode + * @pre The player state can be all of #plusplayer_state_e except + * #PLUSPLAYER_STATE_NONE or #PLUSPLAYER_STATE_IDLE. + * @post The player state will be same as @pre. + * @exception None + * @see plusplayer_prepare_async() + */ +int plusplayer_set_playback_rate(plusplayer_h handle, + const double playback_rate); + +/** + * @brief Deactivate Track. + * @param [in] handle : plusplayer handle. + * @param [in] track_type : track type enum. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * refer to the sample code of plusplayer_activate_track() + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_IDLE + * @post The player state will be same as @pre. + * @exception None + * @see plusplayer_activate_track + */ +int plusplayer_deactivate_track(plusplayer_h handle, + plusplayer_track_type_e track_type); + +/** + * @brief Activate Track. + * @param [in] handle : plusplayer handle. + * @param [in] track_type : track type enum. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * // Sample example for activate/deactivate track type. + * // play one player in normal + * plusplayer_h player1 = plusplayer_create(); + * plusplayer_open(player1,uri_1); + * plusplayer_prepare(player1); + * plusplayer_start(player1); + * + * // play one more player started in deactivate + * plusplayer_h player2 = plusplayer_create(); + * plusplayer_open(player2,uri_2); + * // ... your codes ... + * plusplayer_deactivate_track(player2, PLUSPLAYER_TRACK_TYPE_AUDIO); + * plusplayer_prepare(player2); + * plusplayer_start(player2); + * + * // if you want to play player2, deactivate player1 first + * // and then activate player2 + * plusplayer_deactivate_track(player1, PLUSPLAYER_TRACK_TYPE_AUDIO); + * plusplayer_activate_track(player2, PLUSPLAYER_TRACK_TYPE_AUDIO); + * // ... your codes ... + * plusplayer_close(player1); + * plusplayer_destroy(player1); + * plusplayer_close(player2); + * plusplayer_destroy(player2); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_IDLE. + * @post The player state will be same as @pre. + * plusplayer_activate_track(). + * @exception None + * @see plusplayer_deactivate_track + */ +int plusplayer_activate_track(plusplayer_h handle, + plusplayer_track_type_e track_type); + +/** + * @brief Set Property. + * @param [in] handle : plusplayer handle. + * @param [in] property : property type enum. + * @param [in] value : property value in string. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * // Example for setting resolution information for HLS/DASH + * streaming. + * + * plusplayer_open(player,uri); + * // ... your codes ... + * plusplayer_set_property(player, + * PLUSPLAYER_PROPERTY_ADAPTIVE_INFO, "FIXED_MAX_RESOLUTION=7680X4320"); + * // ... your codes ... + * plusplayer_prepare(player); + * + * + * // Example for setting adaptive bitrate information. + * + * plusplayer_open(player,uri); + * // ... your codes ... + * plusplayer_set_property(player, + * PLUSPLAYER_PROPERTY_ADAPTIVE_INFO, + * "BITRATES=5000~10000|STARTBITRATE=HIGHEST|SKIPBITRATE=LOWEST"); + * // ... your codes ... + * plusplayer_prepare(player); + * + * + * // Example for setting Max Bandwidth (Only valid for Dash + * Streaming). + * + * plusplayer_open(player, dash_uri); + * plusplayer_prepare(player); + * plusplayer_set_property(player, + * PLUSPLAYER_PROPERTY_MAX_BANDWIDTH, "100000"); + * // ... your codes ... + * plusplayer_start(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_IDLE + * @post The player state will be same as @pre. + * @remark Valid Properties to Set are [PLUSPLAYER_PROPERTY_ADAPTIVE_INFO, + * PLUSPLAYER_PROPERTY_LISTEN_SPARSE_TRACK, + * PLUSPLAYER_PROPERTY_CONFIG_LOW_LATENCY, + * PLUSPLAYER_PROPERTY_ATSC3_L1_SERVER_TIME, + * PLUSPLAYER_PROPERTY_AUDIO_DESCRIPTION, PLUSPLAYER_PROPERTY_PRESELECTION_TAG, + * PLUSPLAYER_PROPERTY_USE_MAIN_OUT_SHARE, PLUSPLAYER_PROPERTY_URL_AUTH_TOKEN, + * PLUSPLAYER_PROPERTY_USER_LOW_LATENCY, PLUSPLAYER_PROPERTY_OPEN_HTTP_HEADER, + * PLUSPLAYER_PROPERTY_MAX_BANDWIDTH, PLUSPLAYER_PROPERTY_MPEGH_METADATA, + * PLUSPLAYER_PROPERTY_OPEN_MANIFEST, PLUSPLAYER_PROPERTY_UNWANTED_RESOLUTION, + * PLUSPLAYER_PROPERTY_UNWANTED_FRAMERATE, + * PLUSPLAYER_PROPERTY_UPDATE_SAME_LANGUAGE_CODE] + * @exception None + */ +int plusplayer_set_property(plusplayer_h handle, plusplayer_property_e property, + const char* value); + +/** + * @brief Get Property. + * @param [in] handle : plusplayer handle. + * @param [in] property : get property type enum. + * @param [out] value : Value of @c property. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_STATE Invalid State + * @code + * // Example for getting string listing of available bit-rates for + * the currently-playing stream. + * + * plusplayer_prepare(player); + * char* value; + * plusplayer_get_property(player, + * PLUSPLAYER_PROPERTY_AVAILABLE_BITRATE, &value); + * // ... your codes ... + * plusplayer_start(player); + * // ... your codes ... + * free(value); + * @endcode + * @pre The player state must be #PLUSPLAYER_STATE_READY or + * #PLUSPLAYER_STATE_PLAYING or #PLUSPLAYER_STATE_PAUSED + * @post None + * @remark It is caller's responsibility to free @c value memory resources + * ONLY on api return success. + * @remark Valid Properties to Get are + * [PLUSPLAYER_PROPERTY_AVAILABLE_BITRATE, PLUSPLAYER_PROPERTY_PRESELECTION_TAG, + * PLUSPLAYER_PROPERTY_CURRENT_LATENCY, PLUSPLAYER_PROPERTY_IS_DVB_DASH, + * PLUSPLAYER_PROPERTY_LIVE_PLAYER_START, PLUSPLAYER_PROPERTY_HTTP_HEADER, + * PLUSPLAYER_PROPERTY_START_DATE, + * PLUSPLAYER_PROPERTY_MPEGH_METADATA, PLUSPLAYER_PROPERTY_DASH_STREAM_INFO, + * PLUSPLAYER_PROPERTY_AUDIO_STREAM_INFO, + * PLUSPLAYER_PROPERTY_SUBTITLE_STREAM_INFO, + * PLUSPLAYER_PROPERTY_VIDEO_STREAM_INFO] + * @exception None + */ +int plusplayer_get_property(plusplayer_h handle, plusplayer_property_e property, + char** value); + +/** + * @brief Get track count of a track type. + * @param [in] handle : plusplayer handle. + * @param [in] track_type : track type Audio, Video or Subtitle. + * @param [out] count : track count. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * plusplayer_prepare(player); + * // ... your codes ... + * int track_count = 0; + * plusplayer_get_track_count(player,PLUSPLAYER_TRACK_TYPE_AUDIO,&track_count); + * // ... your codes ... + * plusplayer_start(player); + * @endcode + * @pre The player can be one of PLUSPLAYER_STATE_TRACK_SOURCE_READY, + * PLUSPLAYER_STATE_READY, PLUSPLAYER_STATE_PLAYING or PLUSPLAYER_STATE_PAUSED + * @post The player state is same as before calling + * @exception None + */ +int plusplayer_get_track_count(plusplayer_h handle, + plusplayer_track_type_e track_type, int* count); + +/** + * @brief Select track to be played. + * @param [in] handle : plusplayer handle. + * @param [in] type : track type (only supports #PLUSPLAYER_TRACK_TYPE_AUDIO + * and #PLUSPLAYER_TRACK_TYPE_VIDEO) + * @param [in] index : index of track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * plusplayer_prepare(player); + * // ... your codes ... + * plusplayer_select_track(player_, PLUSPLAYER_TRACK_TYPE_AUDIO, 0); + * // ... your codes ... + * plusplayer_start(player); + * @endcode + * @pre The player can be one of PLUSPLAYER_STATE_READY, + * PLUSPLAYER_STATE_PLAYING or PLUSPLAYER_STATE_PAUSED + * @post The player state will be same as @pre. + * @exception None + */ +int plusplayer_select_track(plusplayer_h handle, plusplayer_track_type_e type, + int index); + +/** + * @brief Get language code of the selected track. + * @param [in] handle : plusplayer handle. + * @param [in] type : track type. + * @param [in] index : index of track. + * @return @c Pointer to heap allocated char array on success, @c NULL + * otherwise + * @retval String value of property type + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * plusplayer_prepare(player); + * // ... your codes ... + * auto lang_code = + * plusplayer_get_track_language_code(player_,PLUSPLAYER_TRACK_TYPE_AUDIO,1); + * // ... your codes ... + * plusplayer_start(player); + * free(lang_code); + * @endcode + * @pre The player can be one of PLUSPLAYER_STATE_READY, + * PLUSPLAYER_STATE_PLAYING or PLUSPLAYER_STATE_PAUSED + * @post The player state will be same as @pre. + * @remark It is caller's responsibility to free the returned pointer memory + * resources. + * @exception None + */ +const char* plusplayer_get_track_language_code(plusplayer_h handle, + plusplayer_track_type_e type, + int index); + +/** + * @brief Set Application Information like id, version and type to + * plusplayer. + * @param [in] handle : plusplayer handle. + * @param [in] app_info : plusplayer_app_info_s struct. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * std::string id , version , type. + * // ... your codes ... + * plusplayer_app_info_s app_info; + * app_info.id = id; + * app_info.version = version; + * app_info.type = type; + * plusplayer_set_app_info(player,app_info); + * // ... your codes ... + * plusplayer_start(player); + * @endcode + * @pre The player must be PLUSPLAYER_STATE_IDLE. + * @post The player state will be same as @pre. + * @exception None + */ +int plusplayer_set_app_info(plusplayer_h handle, + const plusplayer_app_info_s* app_info); + +/** + * @brief Set DRM Property. + * @param [in] handle : plusplayer handle. + * @param [in] drm_property : DRM Property + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * plusplayer_prepare(player); + * // ... your codes ... + * plusplayer_drm_property_s drm_property; + * plusplayer_set_drm(player,drm_property); + * // ... your codes ... + * plusplayer_start(player); + * @endcode + * @pre The player state can be #PLUSPLAYER_STATE_IDLE. + * @post The player state will be same as @pre + * @exception None + */ +int plusplayer_set_drm(plusplayer_h handle, + plusplayer_drm_property_s drm_property); + +/** + * @brief Set a callback function to be invoked when drm init data is set. + * @param [in] handle : plusplayer handle. + * @param [in] drm_init_data_callback : the drm init callback function to + * register. + * @param [in] userdata : pointer to caller object of + * plusplayer_set_drm_init_data_cb() + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @pre The player state must be at least #PLUSPLAYER_STATE_NONE. \n + * But recommended to be called in either #PLUSPLAYER_STATE_NONE or + * #PLUSPLAYER_STATE_IDLE. + * @post plusplayer_set_drm_init_data_cb() will be invoked. + * if drm_init_data_cb is set to null, + * plusplayer_set_drm_init_data_cb() will not be invoked anymore. + * @exception It is prohibited to call any player APIs within context of + * plusplayer_drm_init_data_cb callback + */ +int plusplayer_set_drm_init_data_cb( + plusplayer_h handle, plusplayer_drm_init_data_cb drm_init_data_callback, + void* userdata); + +/** + * @brief Set a callback function to be invoked when streamingengine + * invokes adaptive streaming control event. + * @param [in] handle : plusplayer handle. + * @param [in] adaptive_streaming_control_event_cb : the adative streaming + * event callback function to register. + * @param [in] userdata : pointer to caller object of + * plusplayer_set_drm_init_data_cb() + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @pre The player state must be at least #PLUSPLAYER_STATE_NONE. \n + * But recommended to be called in either #PLUSPLAYER_STATE_NONE or + * #PLUSPLAYER_STATE_IDLE. + * @post plusplayer_set_adaptive_streaming_control_event_cb() will be + * invoked. if adaptive_streaming_control_event_cb is set to null, + * adaptive_streaming_control_event_cb() will not be invoked anymore. + * @exception It is prohibited to call any player APIs within context of + * plusplayer_adaptive_streaming_control_event_cb callback + * @remark @c data inside plusplayer_message_param_s struct is allocated + * using malloc operator. It is caller's responsibility to free the returned + * pointer memory resources using @ free operator. + */ +int plusplayer_set_adaptive_streaming_control_event_cb( + plusplayer_h handle, + plusplayer_adaptive_streaming_control_event_cb + adaptive_streaming_control_event_cb, + void* userdata); + +/** + * @brief Notify to player DRM license is acquired for a specified track + * type. + * @param [in] handle : plusplayer handle. + * @param [in] track_type : @c for which track is that drm license was + * acquired. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @pre The player state must be one of + * #PLUSPLAYER_STATE_TRACK_SOURCE_READY or #PLUSPLAYER_STATE_READY, + * @post The player state will be same as @pre + * @exception None + */ +int plusplayer_drm_license_acquired_done(plusplayer_h handle, + plusplayer_track_type_e track_type); + +/** + * @brief Set External Subtitle Path. + * @param [in] handle : plusplayer handle. + * @param [in] uri : external subtitle path uri. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,content_uri); + * plusplayer_set_subtitle(player,subtitle_uri); + * // ... your codes ... + * plusplayer_prepare(player); + * plusplayer_start(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_IDLE + * @post The player state will be same as @pre + * @exception None + */ +int plusplayer_set_subtitle_path(plusplayer_h handle, const char* uri); + +/** + * @brief Set Video Stillmode. + * @param [in] handle : plusplayer handle. + * @param [in] stillmode : enum for stillmode. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * plusplayer_set_video_stillmode(player,PLUSPLAYER_STILL_MODE_ON); + * // ... your codes ... + * plusplayer_prepare(player); + * plusplayer_start(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_IDLE + * @post The player state will be same as @pre + * @exception None + */ +int plusplayer_set_video_stillmode(plusplayer_h handle, + plusplayer_still_mode_e stillmode); + +/** + * @brief Set Alternate Video Resource(Sub decoder and Sub Scaler). + * @param [in] handle : plusplayer handle. + * @param [in] rsc_type : set alternative video resource. + * (@c 0 [default] = set all video resources(decoder/scaler) to + * main resources, + * @c 1 = set all video resources(decoder/scaler) to sub + * resources, + * @c 2 = set only decoder to sub resource, + * @c 3 = set only scaler to sub resource) + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * plusplayer_set_alternate_video_resource(player,1); + * // ... your codes ... + * plusplayer_prepare(player); + * plusplayer_start(player); + * @endcode + * @pre The player state must be #PLUSPLAYER_STATE_IDLE + * @post The player state will be same as @pre + * @remark Using sub resource (either decoder or scaler) is subject to + * availability on platform. \n No error is returned if unable to set resource. + * @exception None + */ +int plusplayer_set_alternative_video_resource(plusplayer_h handle, + unsigned int rsc_type); + +/** + * @brief Get track info. + * @param [in] handle : plusplayer handle. + * @param [in] track_cb : plusplayer track callback function to register. + * @param [in] userdata : userdata of caller. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * bool printTrackInfo(const plusplayer_track_h track, void* userdata) { + * int index, id; + * const char* mimetype; + * plusplayer_get_track_index(track, &index); + * plusplayer_get_track_id(track, &id); + * plusplayer_get_track_mimetype(track, &mimetype); + * // ... your codes ... + * return true; + * } + * + * // ... your codes ... + * plusplayer_prepare(player_); + * plusplayer_get_foreach_track(player_, printTrackInfo, nullptr); + * + * @endcode + * @pre The player can be one of PLUSPLAYER_STATE_TRACK_SOURCE_READY, + * PLUSPLAYER_STATE_READY, PLUSPLAYER_STATE_PLAYING or PLUSPLAYER_STATE_PAUSED + * @post The player state is same as before calling + * @remark The caller will receive track information through track_cb. + * Further caller can use get api's for track info members. + * @exception None + * @see plusplayer_get_track_index() \n + * plusplayer_get_track_id() \n + * plusplayer_get_track_type() \n + * plusplayer_get_track_bitrate() + */ +int plusplayer_get_foreach_track(plusplayer_h handle, + plusplayer_track_cb track_cb, void* userdata); + +/** + * @brief Get Active track info. + * @param [in] handle : plusplayer handle. + * @param [in] track_cb : plusplayer track callback function to register. + * @param [in] userdata : userdata of caller. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * bool getTrackAudio(const plusplayer_track_h track, void* user_data) { + * plusplayer_track_h* found_track = + * (plusplayer_track_h*)user_data; + * plusplayer_track_type_e track_type; + * + * if (plusplayer_get_track_type(track, &track_type) != + * PLUSPLAYER_ERROR_TYPE_NONE) + * { + * return false; + * } + * if (track_type == PLUSPLAYER_TRACK_TYPE_AUDIO) { + * *found_track = track; + * return false; + * } + * return true; + * } + * + * bool GetActiveTrack(plusplayer_h player, const + * plusplayer_track_type_e type, plusplayer_track_h* active_track) { + * plusplayer_track_h found_track = nullptr; + * plusplayer_get_foreach_active_track(player, getTrackAudio, + * &found_track); + * if (found_track == nullptr) { + * return false; + * } + * *active_track = found_track; + * return true; + * } + * @endcode + * @pre The player can be one of PLUSPLAYER_STATE_TRACK_SOURCE_READY, + * PLUSPLAYER_STATE_READY, PLUSPLAYER_STATE_PLAYING or PLUSPLAYER_STATE_PAUSED + * @post The player state is same as before calling + * @remark The caller will receive track information through track_cb. + * Further caller can use get api's for track info members. + * @exception None + * @see plusplayer_get_track_index() \n + * plusplayer_get_track_id() \n + * plusplayer_get_track_type() \n + * plusplayer_get_track_bitrate() + */ +int plusplayer_get_foreach_active_track(plusplayer_h handle, + plusplayer_track_cb track_cb, + void* userdata); + +/** + * @brief Set HTTP Request Cookie. + * @param [in] handle : plusplayer handle. + * @param [in] cookie : String containing HTTP request cookie. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * plusplayer_set_cookie(player, ); + * // ... your codes ... + * plusplayer_prepare(player); + * plusplayer_start(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_IDLE + * @post The player state will be same as @pre + * @exception None + */ +int plusplayer_set_cookie(plusplayer_h handle, const char* cookie); + +/** + * @brief Set HTTP User Agent. + * @param [in] handle : plusplayer handle. + * @param [in] user_agent : String containing HTTP user agent. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * plusplayer_set_user_agent(player,user_agent); + * // ... your codes ... + * plusplayer_prepare(player); + * plusplayer_start(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_IDLE + * @post The player state will be same as @pre + * @exception None + */ +int plusplayer_set_user_agent(plusplayer_h handle, const char* user_agent); + +/** + * @brief Set resume time to start the content playback. + * @param [in] handle : plusplayer handle. + * @param [in] resume_time_ms : value to start the content playback at + * resume time. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * plusplayer_set_resume_time(player, resume_time_ms); + * // ... your codes ... + * plusplayer_prepare(player); + * plusplayer_start(player); + * @endcode + * @pre The player state must be at least #PLUSPLAYER_STATE_IDLE + * @post The player state will be same as @pre + * @remark For general non-adaptive streaming content, this api will return + * error @c PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION + * @exception None + */ +int plusplayer_set_resume_time(plusplayer_h handle, uint64_t resume_time_ms); + +/** + * @brief To check whether stream is live. + * @param [in] handle : plusplayer handle. + * @param [out] is_live : live streaming or not @c true = live streaming + * @c false = VOD + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_STATE Invalid state + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * plusplayer_prepare(player); + * // ... your codes ... + * plusplayer_is_live_streaming(player, &is_live); + * // ... your codes ... + * @endcode + * @pre The player state must be #PLUSPLAYER_STATE_READY or + * #PLUSPLAYER_STATE_PLAYING or #PLUSPLAYER_STATE_PAUSED + * @post The player state will be same as @pre + * @remark For general non-adaptive streaming content, this api will return + * error @c PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION + * @exception None + */ +int plusplayer_is_live_streaming(plusplayer_h handle, bool* is_live); + +/** + * @brief Get live stream duration of current DVR window. + * @param [in] handle : plusplayer handle. + * @param [out] start_time_ms : start time in milliseconds. + * @param [out] end_time_ms : end time in milliseconds. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_STATE Invalid state + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * plusplayer_prepare(player); + * // ... your codes ... + * plusplayer_get_dvr_seekable_range(player, &start_time_ms, + * &end_time_ms); + * // ... your codes ... + * @endcode + * @pre The player state must be #PLUSPLAYER_STATE_READY or + * #PLUSPLAYER_STATE_PLAYING or #PLUSPLAYER_STATE_PAUSED + * @post The player state will be same as @pre + * @remark Live streams do not have fixed duration. But server generally + * maintains a finite buffer (called DVR) of live encoded data, whose right edge + * @c end_time_ms indicates live point and @c start_time_ms indicates oldest + * segment buffered by the server. DVR is sliding rightward with time to keep + * with live point. + * @remark For general non-adaptive streaming content, this api will return + * error @c PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION + * @exception None + */ +int plusplayer_get_dvr_seekable_range(plusplayer_h handle, + uint64_t* start_time_ms, + uint64_t* end_time_ms); + +/** + * @brief Get the current streaming bandwidth. + * @param [in] handle : plusplayer handle. + * @param [out] curr_bandwidth_bps : value of current bandwidth in bits/s + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_STATE Invalid state + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * plusplayer_prepare(player); + * // ... your codes ... + * plusplayer_get_current_bandwidth(player, &curr_bandwidth_bps); + * // ... your codes ... + * @endcode + * @pre The player state must be #PLUSPLAYER_STATE_READY or + * #PLUSPLAYER_STATE_PLAYING or #PLUSPLAYER_STATE_PAUSED + * @post The player state will be same as @pre + * @remark For general non-adaptive streaming content, this api will return + * error @c PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION + * @exception None + */ +int plusplayer_get_current_bandwidth(plusplayer_h handle, + uint32_t* curr_bandwidth_bps); + +/** + * @brief Set the visibility of the video display. + * @param [in] handle : plusplayer handle. + * @param [in] is_visible : The visibility of the display + * @c true = visible, @c false = non-visible. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player,uri); + * // ... your codes ... + * plusplayer_set_display_visible(player, true); + * // ... your codes ... + * @endcode + * @pre The player state must be atleast #PLUSPLAYER_STATE_IDLE + * @post The player state will be same as @pre + * @exception None + */ +int plusplayer_set_display_visible(plusplayer_h handle, bool is_visible); + +/** + * @brief Set audio volume level. + * @param [in] handle : plusplayer handle. + * @param [in] volume : volume level in Range [0-100]. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type_e values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Internal operation failed + * @code + * plusplayer_h player = plusplayer_create(); + * plusplayer_open(player, uri); + * plusplayer_prepare(); + * // ... your codes ... + * plusplayer_set_volume(player, 50); + * // ... your codes ... + * @endcode + * @pre The player state must be atleast #PLUSPLAYER_STATE_NONE + * @post The player state will be same as @pre + * @exception None + */ +int plusplayer_set_volume(plusplayer_h handle, int volume); + +#ifdef __cplusplus +} +#endif + +#endif // __PLUSPLAYER_PLUSPLAYER_CAPI_PLUSPLAYER_CAPI_H__ diff --git a/packages/video_player_avplay/tizen/inc/plusplayer_capi/property.h b/packages/video_player_avplay/tizen/inc/plusplayer_capi/property.h new file mode 100644 index 000000000..ffaa0b08f --- /dev/null +++ b/packages/video_player_avplay/tizen/inc/plusplayer_capi/property.h @@ -0,0 +1,155 @@ +/** + * @file + * @brief Property enum. + * @interfacetype Platform + * @privlevel None-privilege + * @privilege None + * @product TV, AV, B2B + * @version 8.0 + * @SDK_Support N + * @remark This is a group of C style property related enum. + * @see Property enum conversion. + * + * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __PLUSPLAYER_PLUSPLAYER_CAPI_PROPERTY_H__ +#define __PLUSPLAYER_PLUSPLAYER_CAPI_PROPERTY_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerations for plusplayer property. + */ +typedef enum { + PLUSPLAYER_PROPERTY_ADAPTIVE_INFO, /**< String containing custom + attributes for adaptive streaming + playback. Effective only for + Adaptive Streaming Protocols.*/ + PLUSPLAYER_PROPERTY_LISTEN_SPARSE_TRACK, /**< Sparse track is a + lightweight timeline-synced + stream used for captions, + metadata, or events, delivered + alongside audio/video without + continuous samples. Value + contains String value of + Sparse name to listen. + Effective only for Smooth + Streaming content */ + PLUSPLAYER_PROPERTY_CONFIG_LOW_LATENCY, /**< String with low latency + setting. Effective for HLS, + DASH streaming */ + PLUSPLAYER_PROPERTY_ATSC3_L1_SERVER_TIME, /**< String value of int64_t + server time from ATSC like + broadcast tuner(for US/KR + products). Effective for + ATSC3.0 ICS LIVE DASH + streaming */ + PLUSPLAYER_PROPERTY_AUDIO_DESCRIPTION, /**< String ["ON","OFF"] to control + is download AD stream. Effective + only for DASH streaming. */ + PLUSPLAYER_PROPERTY_PRESELECTION_TAG, /**< String value of int , for + object based audio advance + experience. Effective only for + DASH streaming. */ + PLUSPLAYER_PROPERTY_USE_MAIN_OUT_SHARE, /**< String exist when need + advance audio HW resource + control. Effective only for + DASH streaming. */ + PLUSPLAYER_PROPERTY_URL_AUTH_TOKEN, /**< String http token for streaming + engine download. Effective only for DASH + streaming.*/ + PLUSPLAYER_PROPERTY_USER_LOW_LATENCY, /**< String ["ON","OFF"] to control + is force enable low latency live + logic. Effective only for DASH + streaming.*/ + PLUSPLAYER_PROPERTY_MAX_BANDWIDTH, /**< String value to limit ABR. + Effective only for DASH streaming.*/ + PLUSPLAYER_PROPERTY_OPEN_HTTP_HEADER, /**< String value ["TRUE", "FALSE"] + to control is force enable if can + get libcurl headers with + "PLUSPLAYER_PROPERTY_HTTP_HEADER" + property. Effective only for DASH + streaming. + */ + PLUSPLAYER_PROPERTY_AVAILABLE_BITRATE, /**< String listing the available + bit-rates for the + currently-playing stream. + Effective only for HLS, DASH, Smooth + Streaming. */ + PLUSPLAYER_PROPERTY_CURRENT_LATENCY, /**< String value of uint64_t live + latency (only for lowlatency logic + on). Effective only for DASH + streaming. */ + PLUSPLAYER_PROPERTY_IS_DVB_DASH, /**< String ["1","0"] , to show is DASH + DVB profile (for EU products). + Effective only for HBBTV DASH case. */ + PLUSPLAYER_PROPERTY_LIVE_PLAYER_START, /**< String value of int64_t to + show when live rejoin timepoint + is live_start of [live_start, + live_end] range. Effective only + for HBBTV DASH case.*/ + PLUSPLAYER_PROPERTY_START_DATE, /**< String value of int64_t to show + content of live MPD starting time. + Effective only for DASH streaming. */ + PLUSPLAYER_PROPERTY_MPEGH_METADATA, /**< String value of MPEG-H metadata. + Effective only for DASH streaming.*/ + PLUSPLAYER_PROPERTY_DASH_STREAM_INFO, /**< String value of dash MPD. Effective + only for DASH streaming.*/ + PLUSPLAYER_PROPERTY_HTTP_HEADER, /**< String value of Dash engine download + header. Effective only for DASH + streaming.*/ + PLUSPLAYER_PROPERTY_OPEN_MANIFEST, /** + +/** + * @brief Enumeration of streaming message types + */ +typedef enum { + PLUSPLAYER_STREAMING_MESSAGE_TYPE_NONE = 0, /** < None */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_BITRATECHANGE, /** < Bitrate change occurred + */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_SPARSETRACKDETECT, /** < Sparse track + detected */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_DRMINITDATA, /** < DRM initialization data + received */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_STREAMEVENTTYPE, /** < Stream event type + notification */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_STREAMEVENTDATA, /** < Stream event data + notification */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_STREAMSYNCFLUSH, /** < Stream + synchronization flush */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_STREAMMRSURLCHANGED, /** < MRSS URL changed + */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_DRMKEYROTATION, /** < DRM key rotation event + */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_FRAGMENTDOWNLOADINFO, /** < Fragment + download info */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_DVRLIVELAG, /** < DVR live lag info */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_SPARSETRACKDATA, /** < Sparse track data + received */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_CONNECTIONRETRY, /** < Connection retry + attempt */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_CONFIGLOWLATENCY, /** < Low latency config + update */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_CURLERRORDEBUGINFO, /** < CURL error debug + info */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_PARDARCHANGE, /** < Parda change event */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_DASHMPDANCHOR, /** < DASH MPD anchor update + */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_DASHREMOVESTREAM, /** < DASH stream removal + */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_MEDIASYNCCSSCII, /** < Media sync SS CII + data */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_DASHLIVETOVOD, /** < DASH live to VOD + transition */ + PLUSPLAYER_STREAMING_MESSAGE_TYPE_MANIFESTUPDATE /** DASH manifest content + update*/ +} plusplayer_streaming_message_type_e; + +/** + * @brief plusplayer_message_param_s structure type + */ +typedef struct { + /** + * @brief Message Data + */ + char* data; + /** + * @brief size/length of message data + */ + int size; + /** + * @brief Message Code if any + */ + int code; // Error or warning code +} plusplayer_message_param_s; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // __PLUSPLAYER_PLUSPLAYER_STREAMING_MESSAGE_H__ diff --git a/packages/video_player_avplay/tizen/inc/plusplayer_capi/track.h b/packages/video_player_avplay/tizen/inc/plusplayer_capi/track.h new file mode 100644 index 000000000..cec95c382 --- /dev/null +++ b/packages/video_player_avplay/tizen/inc/plusplayer_capi/track.h @@ -0,0 +1,50 @@ +/** + * @file + * @brief Track enum. + * @interfacetype Platform + * @privlevel None-privilege + * @privilege None + * @product TV, AV, B2B + * @version 8.0 + * @SDK_Support N + * @remark This is a group of C style Track related enums and + * structures. + * @see Track enum conversion and structures. + * + * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __PLUSPLAYER_PLUSPLAYER_CAPI_TRACK_H__ +#define __PLUSPLAYER_PLUSPLAYER_CAPI_TRACK_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +/** + * @brief Enumerations for plusplayer track type. + */ +typedef enum { + PLUSPLAYER_TRACK_TYPE_AUDIO = 0, /**< Track type Audio */ + PLUSPLAYER_TRACK_TYPE_VIDEO, /**< Track type Video */ + PLUSPLAYER_TRACK_TYPE_SUBTITLE /**< Track type Subtitle */ +} plusplayer_track_type_e; + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // __PLUSPLAYER_PLUSPLAYER_CAPI_TRACK_H__ diff --git a/packages/video_player_avplay/tizen/inc/plusplayer_capi/track_capi.h b/packages/video_player_avplay/tizen/inc/plusplayer_capi/track_capi.h new file mode 100644 index 000000000..7850e7808 --- /dev/null +++ b/packages/video_player_avplay/tizen/inc/plusplayer_capi/track_capi.h @@ -0,0 +1,696 @@ +/** + * @file track_capi.h + * @brief PlusPlayer Track apis c version + * @interfacetype Platform + * @privlevel None-privilege + * @privilege None + * @product TV, AV, B2B + * @version 8.0 + * @SDK_Support N + * @remark This is plusplayer track apis header implemented as C style + * to avoid binary compatibility issues. + * + * Copyright (c) 2025 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __PLUSPLAYER_PLUSPLAYER_CAPI_PLUSPLAYER_TRACK_CAPI_H__ +#define __PLUSPLAYER_PLUSPLAYER_CAPI_PLUSPLAYER_TRACK_CAPI_H__ + +#include "plusplayer_capi/track.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Handle for PlusPlayer Track + */ +typedef void* plusplayer_track_h; + +/** + * @brief Get the index of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_index : index of track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_index; + * plusplayer_get_track_index(track, &track_index); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_index(plusplayer_track_h track, int* track_index); + +/** + * @brief Get the ID of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_id : id of track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_id; + * plusplayer_get_track_id(track, &track_id); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_id(plusplayer_track_h track, int* track_id); + +/** + * @brief Get the MIME type of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_mimetype : mimetype of track. (e.g "video/x-h264", + * "audio/mpeg") + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * const char* track_mimetype; + * plusplayer_get_track_mimetype(track, &track_mimetype); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @remark Caller MUST NOT attempt to free track_mimetype resource. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_mimetype(plusplayer_track_h track, + const char** track_mimetype); + +/** + * @brief Get the stream type of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_streamtype : streamtype of track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * const char* track_streamtype; + * plusplayer_get_track_streamtype(track, &track_streamtype); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @remark Caller MUST NOT attempt to free track_streamtype resource. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_streamtype(plusplayer_track_h track, + const char** track_streamtype); + +/** + * @brief Get the media container type of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_containertype : container type of track. (e.g + * "tsdemux", "dash_mov") + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * const char* track_containertype; + * plusplayer_get_track_container_type(track, &track_containertype); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @remark Caller MUST NOT attempt to free track_containertype resource. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_container_type(plusplayer_track_h track, + const char** track_containertype); + +/** + * @brief Get the type of the track (audio/video/subtitle). + * @param [in] track : Handle to the track info. + * @param [out] track_type : type of the track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * plusplayer_track_type_e track_type; + * plusplayer_get_track_type(track, &track_type); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_type(plusplayer_track_h track, + plusplayer_track_type_e* track_type); + +/** + * @brief Get the codec data of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_codecdata : codec data of the track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION Data is invalid. + * @code + * plusplayer_track_h track = ...; + * const char* track_codecdata; + * plusplayer_get_track_codec_data(track, &track_codecdata); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @remark Caller MUST NOT attempt to free track_codecdata resource. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_codec_data(plusplayer_track_h track, + const char** track_codecdata); + +/** + * @brief Get the codec tag of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_codectag : codec tag of the track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * unsigned int track_codectag; + * plusplayer_get_track_codec_tag(track, &track_codectag); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_codec_tag(plusplayer_track_h track, + unsigned int* track_codectag); + +/** + * @brief Get the length of the codec data of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_codecdatalen : length of the codec data of the track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_codecdatalen; + * plusplayer_get_track_codec_data_len(track, &track_codecdatalen); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_codec_data_len(plusplayer_track_h track, + int* track_codecdatalen); + +/** + * @brief Get the width of video resolution. + * @param [in] track : Handle to the track info. + * @param [out] track_width : width of video track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_width; + * plusplayer_get_track_width(track, &track_width); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_width(plusplayer_track_h track, int* track_width); + +/** + * @brief Get the height of video resolution. + * @param [in] track : Handle to the track info. + * @param [out] track_height : height of video track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_height; + * plusplayer_get_track_height(track, &track_height); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_height(plusplayer_track_h track, int* track_height); + +/** + * @brief Get the maximum width of video in adaptive stream + * @param [in] track : Handle to the track info. + * @param [out] track_maxwidth : maximum width of video track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_maxwidth; + * plusplayer_get_track_maxwidth(track, &track_maxwidth); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_maxwidth(plusplayer_track_h track, + int* track_maxwidth); + +/** + * @brief Get the maximum height of video in adaptive stream. + * @param [in] track : Handle to the track info. + * @param [out] track_maxheight : maximum height of video track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_maxheight; + * plusplayer_get_track_maxheight(track, &track_maxheight); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_maxheight(plusplayer_track_h track, + int* track_maxheight); + +/** + * @brief Get the numerator of the frame rate of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_framerate_num : framerate numerator. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_framerate_num; + * plusplayer_get_track_framerate_num(track, &track_framerate_num); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_framerate_num(plusplayer_track_h track, + int* track_framerate_num); + +/** + * @brief Get the denominator of the frame rate of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_framerate_den : framerate denumerator. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_framerate_den; + * plusplayer_get_track_framerate_den(track, &track_framerate_den); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_framerate_den(plusplayer_track_h track, + int* track_framerate_den); + +/** + * @brief Get the sample rate for audio track. + * @param [in] track : Handle to the track info. + * @param [out] track_sample_rate : sample rate for audio track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_sample_rate; + * plusplayer_get_track_sample_rate(track, &track_sample_rate); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_sample_rate(plusplayer_track_h track, + int* track_sample_rate); + +/** + * @brief Get the sample format for audio track. + * @param [in] track : Handle to the track info. + * @param [out] track_sample_format : sample format for audio track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_sample_format; + * plusplayer_get_track_sample_format(track, &track_sample_format); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_sample_format(plusplayer_track_h track, + int* track_sample_format); + +/** + * @brief Get the number of channels of audio track. + * @param [in] track : Handle to the track info. + * @param [out] track_channels : number of channels of audio track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_channels; + * plusplayer_get_track_channels(track, &track_channels); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_channels(plusplayer_track_h track, + int* track_channels); + +/** + * @brief Get the mpeg version of audio codec. + * @param [in] track : Handle to the track info. + * @param [out] track_version : mpeg version of audio codec. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_version; + * plusplayer_get_track_version(track, &track_version); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_version(plusplayer_track_h track, int* track_version); + +/** + * @brief Get the mpeg layer of audio codec. + * @param [in] track : Handle to the track info. + * @param [out] track_layer : mpeg layer of audio codec. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_layer; + * plusplayer_get_track_layer(track, &track_layer); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_layer(plusplayer_track_h track, int* track_layer); + +/** + * @brief Get the bits per sample of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_bits_per_sample : bits per sample of the track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_bits_per_sample; + * plusplayer_get_track_bits_per_sample(track, + * &track_bits_per_sample); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_bits_per_sample(plusplayer_track_h track, + int* track_bits_per_sample); + +/** + * @brief Get the data block alignment of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_block_align : data block alignment. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_block_align; + * plusplayer_get_track_block_align(track, &track_block_align); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_block_align(plusplayer_track_h track, + int* track_block_align); + +/** + * @brief Get the data bitrate of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_bitrate : data bitrate of the track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_bitrate; + * plusplayer_get_track_bitrate(track, &track_bitrate); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_bitrate(plusplayer_track_h track, int* track_bitrate); + +/** + * @brief Get the endianness of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_endianness : endianness of the track. (e.g little + * endian : 1234) + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * int track_endianness; + * plusplayer_get_track_endianness(track, &track_endianness); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_endianness(plusplayer_track_h track, + int* track_endianness); + +/** + * @brief Check if this track is signed or not. + * @param [in] track : Handle to the track info. + * @param [out] track_is_signed : @c True if track is signed, @c False + * otherwise. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * bool track_is_signed; + * plusplayer_get_track_is_signed(track, &track_is_signed); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_is_signed(plusplayer_track_h track, + bool* track_is_signed); + +/** + * @brief Check if the track is active. + * @param [in] track : Handle to the track info. + * @param [out] track_active : @c True if track is active, @c False + * otherwise. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * bool track_active; + * plusplayer_get_track_active(track, &track_active); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_active(plusplayer_track_h track, bool* track_active); + +/** + * @brief Get the language code of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_lang_code : language code of track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * const char* track_lang_code; + * plusplayer_get_track_lang_code(track, &track_lang_code); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @remark Caller MUST NOT attempt to free track_lang_code resource. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_lang_code(plusplayer_track_h track, + const char** track_lang_code); + +/** + * @brief Get the subtitle format of the track. + * @param [in] track : Handle to the track info. + * @param [out] track_subtitle_format : subtitle format of track. + * @return @c PLUSPLAYER_ERROR_TYPE_NONE on success,otherwise @c one of + * plusplayer_error_type values will be returned. + * @retval #PLUSPLAYER_ERROR_TYPE_NONE Successful + * @retval #PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER Invalid parameter + * @code + * plusplayer_track_h track = ...; + * const char* track_subtitle_format; + * plusplayer_get_track_subtitle_format(track, + * &track_subtitle_format); + * // ... your codes ... + * @endcode + * @pre The track handle must be valid. + * @post The track info remains unchanged. + * @remark Caller MUST NOT attempt to free track_subtitle_format resource. + * @exception None + * @see plusplayer_get_foreach_track() \n + * plusplayer_get_foreach_active_track() + */ +int plusplayer_get_track_subtitle_format(plusplayer_track_h track, + const char** track_subtitle_format); + +#ifdef __cplusplus +} +#endif + +#endif // __PLUSPLAYER_PLUSPLAYER_CAPI_PLUSPLAYER_TRACK_CAPI_H__ \ No newline at end of file diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libavcodec_common.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libavcodec_common.so deleted file mode 100755 index c92145f88..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libavcodec_common.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libavformat_mmdash.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libavformat_mmdash.so deleted file mode 100755 index 398d5a252..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libavformat_mmdash.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libavformat_mmhls.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libavformat_mmhls.so deleted file mode 100755 index 777791d1f..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libavformat_mmhls.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libavformat_mmhttp.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libavformat_mmhttp.so deleted file mode 100755 index 1f7df29ec..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libavformat_mmhttp.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libavutil_common.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libavutil_common.so deleted file mode 100755 index c8b7a8f91..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libavutil_common.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libdash.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libdash.so deleted file mode 100755 index ae8bda216..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libdash.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libdashplusplayer_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libdashplusplayer_tvplus.so deleted file mode 100755 index b37a383b9..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libdashplusplayer_tvplus.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libgstdash.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libgstdash.so deleted file mode 100755 index 04bb4c42d..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libgstdash.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libgsthls.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libgsthls.so deleted file mode 100755 index 8d3283f26..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libgsthls.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libgsthttpdemux.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libgsthttpdemux.so deleted file mode 100755 index 0c3aaa612..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libgsthttpdemux.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libgstmmhttpsrc.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libgstmmhttpsrc.so deleted file mode 100755 index 9447c65b6..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libgstmmhttpsrc.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libgstsubtitle_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libgstsubtitle_tvplus.so deleted file mode 100755 index 125009fcb..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libgstsubtitle_tvplus.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libgstsubtitleparse_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libgstsubtitleparse_tvplus.so deleted file mode 100755 index 9599a8043..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libgstsubtitleparse_tvplus.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libhls.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libhls.so deleted file mode 100755 index 037962fa1..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libhls.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libplusplayer-wrapper.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libplusplayer-wrapper.so deleted file mode 100755 index 497ac1a7d..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libplusplayer-wrapper.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libplusplayer_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libplusplayer_tvplus.so deleted file mode 100755 index 2ea77d4e6..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libplusplayer_tvplus.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libplusplayercore_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libplusplayercore_tvplus.so deleted file mode 100755 index 6ba861faf..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libplusplayercore_tvplus.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libslive-jsoncpp.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libslive-jsoncpp.so deleted file mode 100755 index ec8618ff0..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libslive-jsoncpp.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/10.0/libtracksource_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/10.0/libtracksource_tvplus.so deleted file mode 100755 index 2b8cdc7c9..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/10.0/libtracksource_tvplus.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.0/libdash.so b/packages/video_player_avplay/tizen/lib/armel/6.0/libdash.so index 1bd2dfeab..ccbdb3b97 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.0/libdash.so and b/packages/video_player_avplay/tizen/lib/armel/6.0/libdash.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.0/libdashplusplayer_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/6.0/libdashplusplayer_tvplus.so index 00cc75287..bc684e4de 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.0/libdashplusplayer_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/6.0/libdashplusplayer_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.0/libgsthls.so b/packages/video_player_avplay/tizen/lib/armel/6.0/libgsthls.so index e7a84c2cf..ce4eea8f3 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.0/libgsthls.so and b/packages/video_player_avplay/tizen/lib/armel/6.0/libgsthls.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.0/libhls.so b/packages/video_player_avplay/tizen/lib/armel/6.0/libhls.so index e85b61ad1..8799726f1 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.0/libhls.so and b/packages/video_player_avplay/tizen/lib/armel/6.0/libhls.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.0/libplusplayer-wrapper.so b/packages/video_player_avplay/tizen/lib/armel/6.0/libplusplayer-wrapper.so deleted file mode 100755 index e7913cd03..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.0/libplusplayer-wrapper.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.0/libplusplayer_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/6.0/libplusplayer_tvplus.so index e79816279..3f127d8ca 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.0/libplusplayer_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/6.0/libplusplayer_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.0/libplusplayercore_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/6.0/libplusplayercore_tvplus.so index e01c079cb..7d641c454 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.0/libplusplayercore_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/6.0/libplusplayercore_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.0/libslive-jsoncpp.so b/packages/video_player_avplay/tizen/lib/armel/6.0/libslive-jsoncpp.so index 6511007b3..f9dc6361a 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.0/libslive-jsoncpp.so and b/packages/video_player_avplay/tizen/lib/armel/6.0/libslive-jsoncpp.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.0/libtracksource_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/6.0/libtracksource_tvplus.so index 275a03e3d..b86d1589c 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.0/libtracksource_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/6.0/libtracksource_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.5/libdash.so b/packages/video_player_avplay/tizen/lib/armel/6.5/libdash.so index 76702e3bb..6a6d659ad 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.5/libdash.so and b/packages/video_player_avplay/tizen/lib/armel/6.5/libdash.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.5/libdashplusplayer_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/6.5/libdashplusplayer_tvplus.so index f8c1b6ad3..03330f4c3 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.5/libdashplusplayer_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/6.5/libdashplusplayer_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.5/libgsthls.so b/packages/video_player_avplay/tizen/lib/armel/6.5/libgsthls.so index b4047b93a..3f41c2966 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.5/libgsthls.so and b/packages/video_player_avplay/tizen/lib/armel/6.5/libgsthls.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.5/libhls.so b/packages/video_player_avplay/tizen/lib/armel/6.5/libhls.so index e5998a002..c2490a32d 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.5/libhls.so and b/packages/video_player_avplay/tizen/lib/armel/6.5/libhls.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.5/libplusplayer-wrapper.so b/packages/video_player_avplay/tizen/lib/armel/6.5/libplusplayer-wrapper.so deleted file mode 100755 index 2b2b6e141..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.5/libplusplayer-wrapper.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.5/libplusplayer_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/6.5/libplusplayer_tvplus.so index db745f167..6af33096c 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.5/libplusplayer_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/6.5/libplusplayer_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.5/libplusplayercore_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/6.5/libplusplayercore_tvplus.so index 46c34e79d..d08af0253 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.5/libplusplayercore_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/6.5/libplusplayercore_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.5/libslive-jsoncpp.so b/packages/video_player_avplay/tizen/lib/armel/6.5/libslive-jsoncpp.so index 6511007b3..f9dc6361a 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.5/libslive-jsoncpp.so and b/packages/video_player_avplay/tizen/lib/armel/6.5/libslive-jsoncpp.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/6.5/libtracksource_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/6.5/libtracksource_tvplus.so index c80fd8991..0d0a4795c 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/6.5/libtracksource_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/6.5/libtracksource_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/7.0/libdash.so b/packages/video_player_avplay/tizen/lib/armel/7.0/libdash.so index 76702e3bb..6a6d659ad 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/7.0/libdash.so and b/packages/video_player_avplay/tizen/lib/armel/7.0/libdash.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/7.0/libdashplusplayer_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/7.0/libdashplusplayer_tvplus.so index f8c1b6ad3..03330f4c3 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/7.0/libdashplusplayer_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/7.0/libdashplusplayer_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/7.0/libgsthls.so b/packages/video_player_avplay/tizen/lib/armel/7.0/libgsthls.so index b4047b93a..3f41c2966 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/7.0/libgsthls.so and b/packages/video_player_avplay/tizen/lib/armel/7.0/libgsthls.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/7.0/libhls.so b/packages/video_player_avplay/tizen/lib/armel/7.0/libhls.so index e5998a002..c2490a32d 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/7.0/libhls.so and b/packages/video_player_avplay/tizen/lib/armel/7.0/libhls.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/7.0/libplusplayer-wrapper.so b/packages/video_player_avplay/tizen/lib/armel/7.0/libplusplayer-wrapper.so deleted file mode 100755 index 2b2b6e141..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/7.0/libplusplayer-wrapper.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/7.0/libplusplayer_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/7.0/libplusplayer_tvplus.so index db745f167..6af33096c 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/7.0/libplusplayer_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/7.0/libplusplayer_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/7.0/libplusplayercore_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/7.0/libplusplayercore_tvplus.so index 46c34e79d..d08af0253 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/7.0/libplusplayercore_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/7.0/libplusplayercore_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/7.0/libslive-jsoncpp.so b/packages/video_player_avplay/tizen/lib/armel/7.0/libslive-jsoncpp.so index 77e3cb98f..f9dc6361a 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/7.0/libslive-jsoncpp.so and b/packages/video_player_avplay/tizen/lib/armel/7.0/libslive-jsoncpp.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/7.0/libtracksource_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/7.0/libtracksource_tvplus.so index c80fd8991..0d0a4795c 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/7.0/libtracksource_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/7.0/libtracksource_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/8.0/libdash.so b/packages/video_player_avplay/tizen/lib/armel/8.0/libdash.so index 76702e3bb..6a6d659ad 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/8.0/libdash.so and b/packages/video_player_avplay/tizen/lib/armel/8.0/libdash.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/8.0/libdashplusplayer_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/8.0/libdashplusplayer_tvplus.so index f8c1b6ad3..03330f4c3 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/8.0/libdashplusplayer_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/8.0/libdashplusplayer_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/8.0/libgsthls.so b/packages/video_player_avplay/tizen/lib/armel/8.0/libgsthls.so index b4047b93a..3f41c2966 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/8.0/libgsthls.so and b/packages/video_player_avplay/tizen/lib/armel/8.0/libgsthls.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/8.0/libhls.so b/packages/video_player_avplay/tizen/lib/armel/8.0/libhls.so index e5998a002..c2490a32d 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/8.0/libhls.so and b/packages/video_player_avplay/tizen/lib/armel/8.0/libhls.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/8.0/libplusplayer-wrapper.so b/packages/video_player_avplay/tizen/lib/armel/8.0/libplusplayer-wrapper.so deleted file mode 100755 index 2b2b6e141..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/8.0/libplusplayer-wrapper.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/8.0/libplusplayer_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/8.0/libplusplayer_tvplus.so index db745f167..6af33096c 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/8.0/libplusplayer_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/8.0/libplusplayer_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/8.0/libplusplayercore_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/8.0/libplusplayercore_tvplus.so index 46c34e79d..d08af0253 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/8.0/libplusplayercore_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/8.0/libplusplayercore_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/8.0/libslive-jsoncpp.so b/packages/video_player_avplay/tizen/lib/armel/8.0/libslive-jsoncpp.so index 77e3cb98f..f9dc6361a 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/8.0/libslive-jsoncpp.so and b/packages/video_player_avplay/tizen/lib/armel/8.0/libslive-jsoncpp.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/8.0/libtracksource_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/8.0/libtracksource_tvplus.so index c80fd8991..0d0a4795c 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/8.0/libtracksource_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/8.0/libtracksource_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/9.0/libdash.so b/packages/video_player_avplay/tizen/lib/armel/9.0/libdash.so index 76702e3bb..6a6d659ad 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/9.0/libdash.so and b/packages/video_player_avplay/tizen/lib/armel/9.0/libdash.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/9.0/libdashplusplayer_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/9.0/libdashplusplayer_tvplus.so index f8c1b6ad3..03330f4c3 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/9.0/libdashplusplayer_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/9.0/libdashplusplayer_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/9.0/libgsthls.so b/packages/video_player_avplay/tizen/lib/armel/9.0/libgsthls.so index b4047b93a..3f41c2966 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/9.0/libgsthls.so and b/packages/video_player_avplay/tizen/lib/armel/9.0/libgsthls.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/9.0/libhls.so b/packages/video_player_avplay/tizen/lib/armel/9.0/libhls.so index e5998a002..c2490a32d 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/9.0/libhls.so and b/packages/video_player_avplay/tizen/lib/armel/9.0/libhls.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/9.0/libplusplayer-wrapper.so b/packages/video_player_avplay/tizen/lib/armel/9.0/libplusplayer-wrapper.so deleted file mode 100755 index 2b2b6e141..000000000 Binary files a/packages/video_player_avplay/tizen/lib/armel/9.0/libplusplayer-wrapper.so and /dev/null differ diff --git a/packages/video_player_avplay/tizen/lib/armel/9.0/libplusplayer_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/9.0/libplusplayer_tvplus.so index db745f167..6af33096c 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/9.0/libplusplayer_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/9.0/libplusplayer_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/9.0/libplusplayercore_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/9.0/libplusplayercore_tvplus.so index 46c34e79d..d08af0253 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/9.0/libplusplayercore_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/9.0/libplusplayercore_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/9.0/libslive-jsoncpp.so b/packages/video_player_avplay/tizen/lib/armel/9.0/libslive-jsoncpp.so index ec8618ff0..f9dc6361a 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/9.0/libslive-jsoncpp.so and b/packages/video_player_avplay/tizen/lib/armel/9.0/libslive-jsoncpp.so differ diff --git a/packages/video_player_avplay/tizen/lib/armel/9.0/libtracksource_tvplus.so b/packages/video_player_avplay/tizen/lib/armel/9.0/libtracksource_tvplus.so index c80fd8991..0d0a4795c 100755 Binary files a/packages/video_player_avplay/tizen/lib/armel/9.0/libtracksource_tvplus.so and b/packages/video_player_avplay/tizen/lib/armel/9.0/libtracksource_tvplus.so differ diff --git a/packages/video_player_avplay/tizen/project_def.prop b/packages/video_player_avplay/tizen/project_def.prop index d2e4125eb..bd58a34b5 100644 --- a/packages/video_player_avplay/tizen/project_def.prop +++ b/packages/video_player_avplay/tizen/project_def.prop @@ -6,7 +6,19 @@ type = sharedLib profile = common-5.5 # Source files -USER_SRCS += src/*.cc +USER_SRCS += \ + src/device_proxy.cc \ + src/drm_license_helper.cc \ + src/drm_manager_proxy.cc \ + src/drm_manager.cc \ + src/ecore_wl2_window_proxy.cc \ + src/media_player_proxy.cc \ + src/media_player.cc \ + src/messages.cc \ + src/plus_player_util.cc \ + src/video_player_tizen_plugin.cc \ + src/video_player.cc \ + src/plus_player.cc # User defines USER_DEFS = @@ -19,11 +31,24 @@ USER_CFLAGS_MISC = USER_CPPFLAGS_MISC = # User includes -USER_INC_DIRS = inc src inc/plusplayer +USER_INC_DIRS = inc src USER_INC_FILES = USER_CPP_INC_FILES = -# Linker options -USER_LIB_DIRS = lib/${BUILD_ARCH}/${API_VERSION} -USER_LFLAGS = -Wl,-rpath='$$ORIGIN' -USER_LIBS = stdc++ plusplayer-wrapper gstsubtitle_tvplus gstsubtitleparse_tvplus plusplayercore_tvplus tracksource_tvplus plusplayer_tvplus dashplusplayer_tvplus +ifeq ($(API_VERSION), 10.0) + USER_SRCS += \ + src/plusplayer_capi.cc + USER_LIBS = stdc++ +else + # Linker options + USER_LIB_DIRS = lib/${BUILD_ARCH}/${API_VERSION} + USER_LFLAGS = -Wl,-rpath='$$ORIGIN' + USER_LIBS = \ + stdc++ \ + gstsubtitle_tvplus \ + gstsubtitleparse_tvplus \ + plusplayercore_tvplus \ + tracksource_tvplus \ + plusplayer_tvplus \ + dashplusplayer_tvplus +endif diff --git a/packages/video_player_avplay/tizen/src/plus_player.cc b/packages/video_player_avplay/tizen/src/plus_player.cc index 42f125c76..8aba8ecb4 100644 --- a/packages/video_player_avplay/tizen/src/plus_player.cc +++ b/packages/video_player_avplay/tizen/src/plus_player.cc @@ -8,50 +8,30 @@ #include #include +#include +#include #include "log.h" +#include "plus_player_util.h" #include "rapidjson/document.h" #include "rapidjson/stringbuffer.h" #include "rapidjson/writer.h" namespace video_player_avplay_tizen { -static std::vector split(const std::string &s, char delim) { - std::stringstream ss(s); - std::string item; - std::vector tokens; - while (getline(ss, item, delim)) { - tokens.push_back(item); - } - return tokens; -} - -static plusplayer::TrackType ConvertTrackType(std::string track_type) { - if (track_type == "video") { - return plusplayer::TrackType::kTrackTypeVideo; - } - if (track_type == "audio") { - return plusplayer::TrackType::kTrackTypeAudio; - } - if (track_type == "text") { - return plusplayer::TrackType::kTrackTypeSubtitle; - } - return plusplayer::TrackType::kTrackTypeMax; -} - PlusPlayer::PlusPlayer(flutter::BinaryMessenger *messenger, FlutterDesktopViewRef flutter_view) : VideoPlayer(messenger, flutter_view) { - memento_ = std::make_unique(); + memento_ = std::make_unique(); device_proxy_ = std::make_unique(); } PlusPlayer::~PlusPlayer() { if (player_) { - Stop(player_); - Close(player_); - UnregisterListener(player_); - DestroyPlayer(player_); + plusplayer_stop(player_); + plusplayer_close(player_); + UnregisterListener(); + plusplayer_destroy(player_); player_ = nullptr; } @@ -60,69 +40,58 @@ PlusPlayer::~PlusPlayer() { } } +void PlusPlayer::UnregisterListener() { + plusplayer_set_buffer_status_cb(player_, nullptr, this); + plusplayer_set_adaptive_streaming_control_event_cb(player_, nullptr, this); + plusplayer_set_eos_cb(player_, nullptr, this); + plusplayer_set_drm_init_data_cb(player_, nullptr, this); + plusplayer_set_error_cb(player_, nullptr, this); + plusplayer_set_error_msg_cb(player_, nullptr, this); + plusplayer_set_prepare_async_done_cb(player_, nullptr, this); + plusplayer_set_seek_done_cb(player_, nullptr, this); + plusplayer_set_subtitle_updated_cb(player_, nullptr, this); + plusplayer_set_resource_conflicted_cb(player_, nullptr, this); + plusplayer_set_ad_event_cb(player_, nullptr, this); +} + void PlusPlayer::RegisterListener() { - listener_.buffering_callback = OnBufferStatus; - listener_.adaptive_streaming_control_callback = - OnAdaptiveStreamingControlEvent; - listener_.completed_callback = OnEos; - listener_.drm_init_data_callback = OnDrmInitData; - listener_.error_callback = OnError; - listener_.error_message_callback = OnErrorMsg; - listener_.prepared_callback = OnPrepareDone; - listener_.seek_completed_callback = OnSeekDone; - listener_.subtitle_data_callback = OnSubtitleData; - listener_.playing_callback = OnStateChangedToPlaying; - listener_.resource_conflicted_callback = OnResourceConflicted; - listener_.ad_event_callback = OnADEventFromDash; - ::RegisterListener(player_, &listener_, this); + plusplayer_set_buffer_status_cb(player_, OnBufferStatus, this); + plusplayer_set_adaptive_streaming_control_event_cb( + player_, OnAdaptiveStreamingControlEvent, this); + plusplayer_set_eos_cb(player_, OnEos, this); + plusplayer_set_drm_init_data_cb(player_, OnDrmInitData, this); + plusplayer_set_error_cb(player_, OnError, this); + plusplayer_set_error_msg_cb(player_, OnErrorMsg, this); + plusplayer_set_prepare_async_done_cb(player_, OnPrepareDone, this); + plusplayer_set_seek_done_cb(player_, OnSeekDone, this); + plusplayer_set_subtitle_updated_cb(player_, OnSubtitleData, this); + plusplayer_set_resource_conflicted_cb(player_, OnResourceConflicted, this); + plusplayer_set_ad_event_cb(player_, OnADEventFromDash, this); } int64_t PlusPlayer::Create(const std::string &uri, const CreateMessage &create_message) { LOG_INFO("[PlusPlayer] Create player."); - - std::string video_format; - - if (create_message.format_hint() && !create_message.format_hint()->empty()) { - video_format = *create_message.format_hint(); - } - - if (video_format == "dash") { - player_ = CreatePlayer(plusplayer::PlayerType::kDASH); - } else { - player_ = CreatePlayer(plusplayer::PlayerType::kDefault); - } + player_ = plusplayer_create(); if (!player_) { LOG_ERROR("[PlusPlayer] Fail to create player."); return -1; } - if (!Open(player_, uri)) { + if (plusplayer_open(player_, uri.c_str()) != PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Fail to open uri : %s.", uri.c_str()); return -1; } + url_ = uri; create_message_ = create_message; LOG_INFO("[PlusPlayer] Uri: %s", uri.c_str()); - if (create_message.streaming_property() != nullptr && - !create_message.streaming_property()->empty()) { - for (const auto &[key, value] : *create_message.streaming_property()) { - SetStreamingProperty(std::get(key), - std::get(value)); - } - } - - char *appId = nullptr; - int ret = app_manager_get_app_id(getpid(), &appId); - if (ret != APP_MANAGER_ERROR_NONE) { - LOG_ERROR("[PlusPlayer] Fail to get app id: %s.", get_error_message(ret)); + if (!SetAppId()) { + LOG_ERROR("[PlusPlayer] Fail to set app id"); return -1; } - SetAppId(player_, std::string(appId)); - free(appId); - RegisterListener(); int64_t drm_type = flutter_common::GetValue(create_message.drm_configs(), @@ -143,23 +112,9 @@ int64_t PlusPlayer::Create(const std::string &uri, SetDisplayRoi(0, 0, 1, 1); - bool is_prebuffer_mode = flutter_common::GetValue( - create_message.player_options(), "prebufferMode", false); - if (is_prebuffer_mode) { - SetPrebufferMode(player_, true); - is_prebuffer_mode_ = true; - } + PreSet(create_message); - int64_t start_position = flutter_common::GetValue( - create_message.player_options(), "startPosition", (int64_t)0); - if (start_position > 0) { - LOG_INFO("[PlusPlayer] Start position: %lld", start_position); - if (!Seek(player_, start_position)) { - LOG_INFO("[PlusPlayer] Fail to seek, it's a non-seekable content"); - } - } - - if (!PrepareAsync(player_)) { + if (plusplayer_prepare_async(player_) != PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to prepare."); return -1; } @@ -171,99 +126,171 @@ void PlusPlayer::Dispose() { ClearUpEventChannel(); } +void PlusPlayer::PreSet(const CreateMessage &create_message) { + if (create_message.streaming_property() != nullptr && + !create_message.streaming_property()->empty()) { + for (const auto &[key, value] : *create_message.streaming_property()) { + SetStreamingProperty(std::get(key), + std::get(value)); + } + + std::string user_agent = flutter_common::GetValue( + create_message.streaming_property(), "USER_AGENT", std::string()); + if (!user_agent.empty()) { + int ret = plusplayer_set_user_agent(player_, user_agent.c_str()); + if (ret != PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] plusplayer_set_user_agent failed: %s.", + user_agent.c_str()); + } + } + + std::string cookie = flutter_common::GetValue( + create_message.streaming_property(), "COOKIE", std::string()); + if (!cookie.empty()) { + int ret = plusplayer_set_cookie(player_, cookie.c_str()); + if (ret != PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] plusplayer_set_cookie failed: %s.", + cookie.c_str()); + } + } + + bool is_prebuffer_mode = flutter_common::GetValue( + create_message.player_options(), "prebufferMode", false); + if (is_prebuffer_mode) { + plusplayer_set_prebuffer_mode(player_, true); + is_prebuffer_mode_ = true; + } + + int64_t start_position = flutter_common::GetValue( + create_message.player_options(), "startPosition", (int64_t)0); + if (start_position > 0) { + LOG_INFO("[PlusPlayer] Start position: %lld", start_position); + if (plusplayer_seek(player_, start_position) != + PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_INFO("[PlusPlayer] Fail to seek, it's a non-seekable content"); + } + } + } +} + void PlusPlayer::SetDisplayRoi(int32_t x, int32_t y, int32_t width, int32_t height) { - plusplayer::Geometry roi; + plusplayer_geometry_s roi; roi.x = x; roi.y = y; - roi.w = width; - roi.h = height; - if (!::SetDisplayRoi(player_, roi)) { + roi.width = width; + roi.height = height; + if (plusplayer_set_display_roi(player_, roi) != PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to set display roi."); + return; } + current_display_roi_ = {x, y, width, height}; +} + +bool PlusPlayer::SetAppId() { + char *app_id; + int ret = app_manager_get_app_id(getpid(), &app_id); + if (ret != APP_MANAGER_ERROR_NONE) { + LOG_ERROR("[PlusPlayer] Fail to get app id: %s.", get_error_message(ret)); + return false; + } + + if (plusplayer_set_app_id(player_, app_id) != PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] Fail to set app id"); + free(app_id); + return false; + } + free(app_id); + return true; } bool PlusPlayer::Play() { LOG_INFO("[PlusPlayer] Player starting."); - plusplayer::State state = GetState(player_); - if (state < plusplayer::State::kTrackSourceReady) { + plusplayer_state_e state = plusplayer_get_state(player_); + if (state < PLUSPLAYER_STATE_TRACK_SOURCE_READY) { LOG_ERROR("[PlusPlayer] Player is not ready."); return false; } - if (state <= plusplayer::State::kReady) { - if (!Start(player_)) { + if (state <= PLUSPLAYER_STATE_READY) { + if (plusplayer_start(player_) != PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to start."); return false; } + SendIsPlayingState(true); return true; - } else if (state == plusplayer::State::kPaused) { - if (!Resume(player_)) { + } else if (state == PLUSPLAYER_STATE_PAUSED) { + if (plusplayer_resume(player_) != PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to resume."); return false; } + SendIsPlayingState(true); return true; } return false; } bool PlusPlayer::Activate() { - if (!::Activate(player_, plusplayer::kTrackTypeVideo)) { - LOG_ERROR("[PlusPlayer] Fail to activate video."); + if (plusplayer_activate_track(player_, PLUSPLAYER_TRACK_TYPE_AUDIO) != + PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] Fail to activate audio."); return false; } - if (!::Activate(player_, plusplayer::kTrackTypeAudio)) { - LOG_ERROR("[PlusPlayer] Fail to activate audio."); + if (plusplayer_activate_track(player_, PLUSPLAYER_TRACK_TYPE_VIDEO) != + PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] Fail to activate video."); return false; } - if (!::Activate(player_, plusplayer::kTrackTypeSubtitle)) { + if (plusplayer_activate_track(player_, PLUSPLAYER_TRACK_TYPE_SUBTITLE) != + PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Fail to activate subtitle."); + return false; } - return true; } bool PlusPlayer::Deactivate() { if (is_prebuffer_mode_) { - Stop(player_); + plusplayer_stop(player_); return true; } - - if (!::Deactivate(player_, plusplayer::kTrackTypeVideo)) { - LOG_ERROR("[PlusPlayer] Fail to deactivate video."); + if (plusplayer_deactivate_track(player_, PLUSPLAYER_TRACK_TYPE_AUDIO) != + PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] Fail to deactivate audio."); return false; } - if (!::Deactivate(player_, plusplayer::kTrackTypeAudio)) { - LOG_ERROR("[PlusPlayer] Fail to deactivate audio."); + if (plusplayer_deactivate_track(player_, PLUSPLAYER_TRACK_TYPE_VIDEO) != + PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] Fail to deactivate video."); return false; } - if (!::Deactivate(player_, plusplayer::kTrackTypeSubtitle)) { + if (plusplayer_deactivate_track(player_, PLUSPLAYER_TRACK_TYPE_SUBTITLE) != + PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Fail to deactivate subtitle."); + return false; } - return true; } bool PlusPlayer::Pause() { LOG_INFO("[PlusPlayer] Player pausing."); - plusplayer::State state = GetState(player_); - if (state < plusplayer::State::kReady) { + plusplayer_state_e state = plusplayer_get_state(player_); + if (state < PLUSPLAYER_STATE_READY) { LOG_ERROR("[PlusPlayer] Player is not ready."); return false; } - if (state != plusplayer::State::kPlaying) { + if (state != PLUSPLAYER_STATE_PLAYING) { LOG_INFO("[PlusPlayer] Player not playing."); return false; } - if (!::Pause(player_)) { + if (plusplayer_pause(player_) != PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to pause."); return false; } - SendIsPlayingState(false); return true; } @@ -274,14 +301,15 @@ bool PlusPlayer::SetLooping(bool is_looping) { } bool PlusPlayer::SetVolume(double volume) { - if (GetState(player_) < plusplayer::State::kPlaying) { + if (plusplayer_get_state(player_) < PLUSPLAYER_STATE_PLAYING) { LOG_ERROR("[PlusPlayer] Player is in invalid state"); return false; } // dart api volume range[0,1], plusplaer volume range[0,100] int new_volume = volume * 100; - LOG_INFO("[PlusPlayer] Volume: %d", new_volume); - if (!::SetVolume(player_, new_volume)) { + LOG_INFO("[PlusPlayerPlatform] Volume: %d", new_volume); + if (plusplayer_set_volume(player_, new_volume) != + PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Fail to set volume."); return false; } @@ -291,11 +319,12 @@ bool PlusPlayer::SetVolume(double volume) { bool PlusPlayer::SetPlaybackSpeed(double speed) { LOG_INFO("[PlusPlayer] Speed: %f", speed); - if (GetState(player_) <= plusplayer::State::kIdle) { + if (plusplayer_get_state(player_) <= PLUSPLAYER_STATE_IDLE) { LOG_ERROR("[PlusPlayer] Player is not prepared."); return false; } - if (!SetPlaybackRate(player_, speed)) { + if (plusplayer_set_playback_rate(player_, speed) != + PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to set playback rate."); return false; } @@ -305,7 +334,7 @@ bool PlusPlayer::SetPlaybackSpeed(double speed) { bool PlusPlayer::SeekTo(int64_t position, SeekCompletedCallback callback) { LOG_INFO("[PlusPlayer] Seek to position: %lld", position); - if (GetState(player_) < plusplayer::State::kReady) { + if (plusplayer_get_state(player_) < PLUSPLAYER_STATE_READY) { LOG_ERROR("[PlusPlayer] Player is not ready."); return false; } @@ -316,7 +345,7 @@ bool PlusPlayer::SeekTo(int64_t position, SeekCompletedCallback callback) { } on_seek_completed_ = std::move(callback); - if (!Seek(player_, position)) { + if (plusplayer_seek(player_, position) != PLUSPLAYER_ERROR_TYPE_NONE) { on_seek_completed_ = nullptr; LOG_ERROR("[PlusPlayer] Player fail to seek."); return false; @@ -327,10 +356,10 @@ bool PlusPlayer::SeekTo(int64_t position, SeekCompletedCallback callback) { int64_t PlusPlayer::GetPosition() { uint64_t position = 0; - plusplayer::State state = GetState(player_); - if (state == plusplayer::State::kPlaying || - state == plusplayer::State::kPaused) { - if (!GetPlayingTime(player_, &position)) { + plusplayer_state_e state = plusplayer_get_state(player_); + if (state == PLUSPLAYER_STATE_PLAYING || state == PLUSPLAYER_STATE_PAUSED) { + if (plusplayer_get_playing_time(player_, &position) != + PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to get the current playing time."); } } @@ -338,25 +367,24 @@ int64_t PlusPlayer::GetPosition() { } bool PlusPlayer::IsLive() { - plusplayer::PlayerMemento memento; - if (!GetMemento(player_, &memento)) { - LOG_ERROR("[PlusPlayer] Player fail to get memento."); + bool value = false; + if (plusplayer_is_live_streaming(player_, &value) != + PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] Player fail to get is live."); return false; } - - return memento.is_live; + return value; } std::pair PlusPlayer::GetLiveDuration() { - std::string live_duration_str = - ::GetStreamingProperty(player_, "GET_LIVE_DURATION"); - if (live_duration_str.empty()) { + uint64_t start = 0; + uint64_t end = 0; + if (plusplayer_get_dvr_seekable_range(player_, &start, &end) != + PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to get live duration."); return std::make_pair(0, 0); } - - std::vector time_vec = split(live_duration_str, '|'); - return std::make_pair(std::stoll(time_vec[0]), std::stoll(time_vec[1])); + return std::make_pair(start, end); } std::pair PlusPlayer::GetDuration() { @@ -364,7 +392,8 @@ std::pair PlusPlayer::GetDuration() { return GetLiveDuration(); } else { int64_t duration = 0; - if (!::GetDuration(player_, &duration)) { + if (plusplayer_get_duration(player_, &duration) != + PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to get the duration."); return std::make_pair(0, 0); } @@ -373,17 +402,37 @@ std::pair PlusPlayer::GetDuration() { } void PlusPlayer::GetVideoSize(int32_t *width, int32_t *height) { - if (GetState(player_) >= plusplayer::State::kTrackSourceReady) { + if (plusplayer_get_state(player_) >= PLUSPLAYER_STATE_TRACK_SOURCE_READY) { + struct UserData { + int32_t *w; + int32_t *h; + bool *found; + }; + UserData data{width, height, nullptr}; bool found = false; - std::vector tracks = ::GetActiveTrackInfo(player_); - for (auto track : tracks) { - if (track.type == plusplayer::TrackType::kTrackTypeVideo) { - *width = track.width; - *height = track.height; - found = true; - break; - } - } + data.found = &found; + + plusplayer_get_foreach_active_track( + player_, + [](plusplayer_track_h track_h, void *user_data) -> bool { + plusplayer_track_type_e type; + if (plusplayer_get_track_type(track_h, &type) != + PLUSPLAYER_ERROR_TYPE_NONE) { + return true; // continue iteration + } + if (type == PLUSPLAYER_TRACK_TYPE_VIDEO) { + int w = 0, h = 0; + plusplayer_get_track_width(track_h, &w); + plusplayer_get_track_height(track_h, &h); + UserData *d = static_cast(user_data); + *(d->w) = w; + *(d->h) = h; + *(d->found) = true; + return false; // stop iteration + } + return true; // continue iteration + }, + &data); if (!found) { LOG_ERROR("[PlusPlayer] Player fail to get video size."); } else { @@ -393,7 +442,7 @@ void PlusPlayer::GetVideoSize(int32_t *width, int32_t *height) { } bool PlusPlayer::IsReady() { - return plusplayer::State::kReady == GetState(player_); + return PLUSPLAYER_STATE_READY == plusplayer_get_state(player_); } bool PlusPlayer::SetDisplay() { @@ -410,99 +459,148 @@ bool PlusPlayer::SetDisplay() { LOG_ERROR("[PlusPlayer] Fail to get resource id."); return false; } - bool ret = ::SetDisplay(player_, plusplayer::DisplayType::kOverlay, - resource_id, x, y, width, height); - if (!ret) { + plusplayer_geometry_s roi{x, y, width, height}; + if (plusplayer_set_display_subsurface( + player_, PLUSPLAYER_DISPLAY_TYPE_OVERLAY, resource_id, roi) != + PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to set display."); return false; } - - ret = ::SetDisplayMode(player_, plusplayer::DisplayMode::kDstRoi); - if (!ret) { + if (plusplayer_set_display_mode( + player_, + plusplayer_display_mode_e::PLUSPLAYER_DISPLAY_MODE_DST_ROI) != + PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to set display mode."); return false; } - return true; } -flutter::EncodableValue PlusPlayer::ParseVideoTrack( - plusplayer::Track video_track) { +flutter::EncodableValue ParseVideoTrack(const plusplayer_track_h track) { flutter::EncodableMap video_track_result = {}; video_track_result.insert_or_assign(flutter::EncodableValue("trackType"), flutter::EncodableValue("video")); - video_track_result.insert_or_assign( - flutter::EncodableValue("trackId"), - flutter::EncodableValue(video_track.index)); - video_track_result.insert_or_assign( - flutter::EncodableValue("mimetype"), - flutter::EncodableValue(video_track.mimetype)); - video_track_result.insert_or_assign( - flutter::EncodableValue("width"), - flutter::EncodableValue(video_track.width)); - video_track_result.insert_or_assign( - flutter::EncodableValue("height"), - flutter::EncodableValue(video_track.height)); - video_track_result.insert_or_assign( - flutter::EncodableValue("bitrate"), - flutter::EncodableValue(video_track.bitrate)); + + int track_index = 0; + if (plusplayer_get_track_index(track, &track_index) == + PLUSPLAYER_ERROR_TYPE_NONE) { + video_track_result.insert_or_assign(flutter::EncodableValue("trackId"), + flutter::EncodableValue(track_index)); + } + + const char *mimetype; + if (plusplayer_get_track_mimetype(track, &mimetype) == + PLUSPLAYER_ERROR_TYPE_NONE) { + video_track_result.insert_or_assign( + flutter::EncodableValue("mimetype"), + flutter::EncodableValue(std::string(mimetype))); + } + + int width = 0; + plusplayer_get_track_width(track, &width); + video_track_result.insert_or_assign(flutter::EncodableValue("width"), + flutter::EncodableValue(width)); + + int height = 0; + plusplayer_get_track_height(track, &height); + video_track_result.insert_or_assign(flutter::EncodableValue("height"), + flutter::EncodableValue(height)); + + int bitrate = 0; + plusplayer_get_track_bitrate(track, &bitrate); + video_track_result.insert_or_assign(flutter::EncodableValue("bitrate"), + flutter::EncodableValue(bitrate)); + LOG_DEBUG( "[PlusPlayer] video track info : trackId : %d, mimetype : %s, width : " "%d, height : %d, birate : %d", - video_track.index, video_track.mimetype.c_str(), video_track.width, - video_track.height, video_track.bitrate); + track_index, mimetype, width, height, bitrate); return flutter::EncodableValue(video_track_result); } -flutter::EncodableValue PlusPlayer::ParseAudioTrack( - plusplayer::Track audio_track) { +flutter::EncodableValue ParseAudioTrack(const plusplayer_track_h track) { flutter::EncodableMap audio_track_result = {}; audio_track_result.insert_or_assign(flutter::EncodableValue("trackType"), flutter::EncodableValue("audio")); - audio_track_result.insert_or_assign( - flutter::EncodableValue("trackId"), - flutter::EncodableValue(audio_track.index)); - audio_track_result.insert_or_assign( - flutter::EncodableValue("mimetype"), - flutter::EncodableValue(audio_track.mimetype)); - audio_track_result.insert_or_assign( - flutter::EncodableValue("language"), - flutter::EncodableValue(audio_track.language_code)); - audio_track_result.insert_or_assign( - flutter::EncodableValue("channel"), - flutter::EncodableValue(audio_track.channels)); - audio_track_result.insert_or_assign( - flutter::EncodableValue("bitrate"), - flutter::EncodableValue(audio_track.bitrate)); + + int track_index = 0; + if (plusplayer_get_track_index(track, &track_index) == + PLUSPLAYER_ERROR_TYPE_NONE) { + audio_track_result.insert_or_assign(flutter::EncodableValue("trackId"), + flutter::EncodableValue(track_index)); + } + + const char *mimetype; + if (plusplayer_get_track_mimetype(track, &mimetype) == + PLUSPLAYER_ERROR_TYPE_NONE) { + audio_track_result.insert_or_assign( + flutter::EncodableValue("mimetype"), + flutter::EncodableValue(std::string(mimetype))); + } + + const char *language_code; + if (plusplayer_get_track_lang_code(track, &language_code) == + PLUSPLAYER_ERROR_TYPE_NONE) { + audio_track_result.insert_or_assign( + flutter::EncodableValue("language"), + flutter::EncodableValue(std::string(language_code))); + } + + int channel_count; + if (plusplayer_get_track_channels(track, &channel_count) == + PLUSPLAYER_ERROR_TYPE_NONE) { + audio_track_result.insert_or_assign(flutter::EncodableValue("channel"), + flutter::EncodableValue(channel_count)); + } + + int bitrate; + if (plusplayer_get_track_bitrate(track, &bitrate) == + PLUSPLAYER_ERROR_TYPE_NONE) { + audio_track_result.insert_or_assign(flutter::EncodableValue("bitrate"), + flutter::EncodableValue(bitrate)); + } + LOG_DEBUG( "[PlusPlayer] audio track info : trackId : %d, mimetype : %s, " - "language_code : " - "%s, channel : %d, bitrate : %d", - audio_track.index, audio_track.mimetype.c_str(), - audio_track.language_code.c_str(), audio_track.channels, - audio_track.bitrate); + "language_code : %s, channel : %d, bitrate : %d", + track_index, mimetype, language_code, channel_count, bitrate); + return flutter::EncodableValue(audio_track_result); } -flutter::EncodableValue PlusPlayer::ParseSubtitleTrack( - plusplayer::Track subtitle_track) { +flutter::EncodableValue ParseSubtitleTrack(const plusplayer_track_h track) { flutter::EncodableMap subtitle_track_result = {}; subtitle_track_result.insert_or_assign(flutter::EncodableValue("trackType"), flutter::EncodableValue("text")); - subtitle_track_result.insert_or_assign( - flutter::EncodableValue("trackId"), - flutter::EncodableValue(subtitle_track.index)); - subtitle_track_result.insert_or_assign( - flutter::EncodableValue("mimetype"), - flutter::EncodableValue(subtitle_track.mimetype)); - subtitle_track_result.insert_or_assign( - flutter::EncodableValue("language"), - flutter::EncodableValue(subtitle_track.language_code)); + + int track_index = 0; + if (plusplayer_get_track_index(track, &track_index) == + PLUSPLAYER_ERROR_TYPE_NONE) { + subtitle_track_result.insert_or_assign( + flutter::EncodableValue("trackId"), + flutter::EncodableValue(track_index)); + } + + const char *mimetype; + if (plusplayer_get_track_mimetype(track, &mimetype) == + PLUSPLAYER_ERROR_TYPE_NONE) { + subtitle_track_result.insert_or_assign( + flutter::EncodableValue("mimetype"), + flutter::EncodableValue(std::string(mimetype))); + } + + const char *language_code; + if (plusplayer_get_track_lang_code(track, &language_code) == + PLUSPLAYER_ERROR_TYPE_NONE) { + subtitle_track_result.insert_or_assign( + flutter::EncodableValue("language"), + flutter::EncodableValue(std::string(language_code))); + } + LOG_DEBUG( "[PlusPlayer] subtitle track info : trackId : %d, mimetype : %s, " "language_code : %s", - subtitle_track.index, subtitle_track.mimetype.c_str(), - subtitle_track.language_code.c_str()); + track_index, mimetype, language_code); return flutter::EncodableValue(subtitle_track_result); } @@ -512,49 +610,55 @@ flutter::EncodableList PlusPlayer::GetTrackInfo(std::string track_type) { return {}; } - plusplayer::State state = GetState(player_); - if (state < plusplayer::State::kTrackSourceReady) { + plusplayer_state_e state = plusplayer_get_state(player_); + if (state < PLUSPLAYER_STATE_TRACK_SOURCE_READY) { LOG_ERROR("[PlusPlayer] Player is in invalid state."); return {}; } - plusplayer::TrackType type = ConvertTrackType(track_type); + plusplayer_track_type_e type = ConvertTrackType(track_type); - int track_count = GetTrackCount(player_, type); - if (track_count <= 0) { + int track_count = 0; + if (plusplayer_get_track_count(player_, type, &track_count) != + PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] Fail to get track count"); return {}; } - const std::vector track_info = ::GetTrackInfo(player_); - if (track_info.empty()) { + if (track_count <= 0) { return {}; } + struct UserData { + flutter::EncodableList *track_selections; + plusplayer_track_type_e type; + }; + flutter::EncodableList trackSelections = {}; - if (type == plusplayer::TrackType::kTrackTypeVideo) { - LOG_INFO("[PlusPlayer] Video track count: %d", track_count); - for (const auto &track : track_info) { - if (track.type == plusplayer::kTrackTypeVideo) { - trackSelections.push_back(ParseVideoTrack(track)); - } - } - } else if (type == plusplayer::TrackType::kTrackTypeAudio) { - LOG_INFO("[PlusPlayer] Audio track count: %d", track_count); - for (const auto &track : track_info) { - if (track.type == plusplayer::kTrackTypeAudio) { - trackSelections.push_back(ParseAudioTrack(track)); - } - } - } else if (type == plusplayer::TrackType::kTrackTypeSubtitle) { - LOG_INFO("[PlusPlayer] Subtitle track count: %d", track_count); - for (const auto &track : track_info) { - if (track.type == plusplayer::kTrackTypeSubtitle) { - trackSelections.push_back( - flutter::EncodableValue(ParseSubtitleTrack(track))); - } - } + UserData data = {}; + data.track_selections = &trackSelections; + data.type = type; + if (plusplayer_get_foreach_track( + player_, + [](plusplayer_track_h track_h, void *user_data) -> bool { + UserData *data = static_cast(user_data); + plusplayer_track_type_e type; + plusplayer_get_track_type(track_h, &type); + if (data->type == type) { + if (type == PLUSPLAYER_TRACK_TYPE_VIDEO) { + data->track_selections->push_back(ParseVideoTrack(track_h)); + } else if (type == PLUSPLAYER_TRACK_TYPE_AUDIO) { + data->track_selections->push_back(ParseAudioTrack(track_h)); + } else if (type == PLUSPLAYER_TRACK_TYPE_SUBTITLE) { + data->track_selections->push_back(ParseSubtitleTrack(track_h)); + } + } + return true; + }, + &data) != PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] Fail to get track info"); + return {}; } - return trackSelections; } @@ -564,29 +668,35 @@ flutter::EncodableList PlusPlayer::GetActiveTrackInfo() { return {}; } - plusplayer::State state = GetState(player_); - if (state < plusplayer::State::kTrackSourceReady) { + plusplayer_state_e state = plusplayer_get_state(player_); + if (state < PLUSPLAYER_STATE_TRACK_SOURCE_READY) { LOG_ERROR("[PlusPlayer] Player is in invalid state."); return {}; } - const std::vector track_info = - ::GetActiveTrackInfo(player_); - - if (track_info.empty()) { + // Use the C API to iterate over active tracks. + flutter::EncodableList active_tracks; + // The callback receives each active track handle. + if (plusplayer_get_foreach_active_track( + player_, + [](plusplayer_track_h track_h, void *user_data) -> bool { + plusplayer_track_type_e type; + plusplayer_get_track_type(track_h, &type); + flutter::EncodableList *tracks = + static_cast(user_data); + if (type == PLUSPLAYER_TRACK_TYPE_AUDIO) { + tracks->push_back(ParseAudioTrack(track_h)); + } else if (type == PLUSPLAYER_TRACK_TYPE_VIDEO) { + tracks->push_back(ParseVideoTrack(track_h)); + } else { + tracks->push_back(ParseSubtitleTrack(track_h)); + } + return true; // Continue iteration. + }, + &active_tracks) != PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] Fail to get active track info"); return {}; } - - flutter::EncodableList active_tracks = {}; - for (const auto &track : track_info) { - if (track.type == plusplayer::kTrackTypeVideo) { - active_tracks.push_back(ParseVideoTrack(track)); - } else if (track.type == plusplayer::kTrackTypeAudio) { - active_tracks.push_back(ParseAudioTrack(track)); - } else if (track.type == plusplayer::kTrackTypeSubtitle) { - active_tracks.push_back(ParseSubtitleTrack(track)); - } - } return active_tracks; } @@ -599,13 +709,14 @@ bool PlusPlayer::SetTrackSelection(int32_t track_id, std::string track_type) { return false; } - plusplayer::State state = GetState(player_); - if (state < plusplayer::State::kTrackSourceReady) { + plusplayer_state_e state = plusplayer_get_state(player_); + if (state < PLUSPLAYER_STATE_TRACK_SOURCE_READY) { LOG_ERROR("[PlusPlayer] Player is in invalid state."); return false; } - if (!SelectTrack(player_, ConvertTrackType(track_type), track_id)) { + if (plusplayer_select_track(player_, ConvertTrackType(track_type), + track_id) != PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to select track."); return false; } @@ -626,28 +737,26 @@ bool PlusPlayer::SetDrm(const std::string &uri, int drm_type, return false; } - plusplayer::drm::Type type; + plusplayer_drm_type_e type; switch (drm_type) { case DrmManager::DrmType::DRM_TYPE_PLAYREADAY: - type = plusplayer::drm::Type::kPlayready; + type = plusplayer_drm_type_e::PLUSPLAYER_DRM_TYPE_PLAYREADY; break; case DrmManager::DrmType::DRM_TYPE_WIDEVINECDM: - type = plusplayer::drm::Type::kWidevineCdm; + type = plusplayer_drm_type_e::PLUSPLAYER_DRM_TYPE_WIDEVINE_CDM; break; default: - type = plusplayer::drm::Type::kNone; + type = plusplayer_drm_type_e::PLUSPLAYER_DRM_TYPE_NONE; break; } - plusplayer::drm::Property property; + plusplayer_drm_property_s property; property.handle = drm_handle; property.type = type; - property.license_acquired_cb = - reinterpret_cast(OnLicenseAcquired); - property.license_acquired_userdata = - reinterpret_cast(this); + property.license_acquired_cb = reinterpret_cast(OnLicenseAcquired); + property.license_acquired_userdata = this; property.external_decryption = false; - ::SetDrm(player_, property); + plusplayer_set_drm(player_, property); if (license_server_url.empty()) { bool success = drm_manager_->SetChallenge(uri, binary_messenger_); @@ -670,12 +779,47 @@ std::string PlusPlayer::GetStreamingProperty( LOG_ERROR("[PlusPlayer] Player not created."); return ""; } - plusplayer::State state = GetState(player_); - if (state == plusplayer::State::kNone || state == plusplayer::State::kIdle) { + plusplayer_state_e state = plusplayer_get_state(player_); + if (state == PLUSPLAYER_STATE_NONE || state == PLUSPLAYER_STATE_IDLE) { LOG_ERROR("[PlusPlayer]:Player is in invalid state[%d]", state); return ""; } - return ::GetStreamingProperty(player_, streaming_property_type); + + plusplayer_property_e property = ConvertPropertyType(streaming_property_type); + if (property == static_cast(-1)) { + return GetExtraStreamingProperty(streaming_property_type); + } + + char *value; + if (plusplayer_get_property(player_, property, &value) != + PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer]:Player fail to get streaming property"); + return ""; + } + std::string result(value); + free(value); + return result; +} + +std::string PlusPlayer::GetExtraStreamingProperty( + const std::string &streaming_property_type) { + if (streaming_property_type == "IS_LIVE") { + return IsLive() ? "true" : "false"; + } + + if (streaming_property_type == "CURRENT_BANDWIDTH") { + uint32_t current_bandwidth = 0; + plusplayer_get_current_bandwidth(player_, ¤t_bandwidth); + return std::to_string(current_bandwidth); + } + + if (streaming_property_type == "GET_LIVE_DURATION") { + uint64_t start = 0; + uint64_t end = 0; + plusplayer_get_dvr_seekable_range(player_, &start, &end); + return std::to_string(start) + "|" + std::to_string(end); + } + return ""; } bool PlusPlayer::SetBufferConfig(const std::string &key, int64_t value) { @@ -684,33 +828,34 @@ bool PlusPlayer::SetBufferConfig(const std::string &key, int64_t value) { return false; } - plusplayer::State state = GetState(player_); - if (state == plusplayer::State::kNone) { + plusplayer_state_e state = plusplayer_get_state(player_); + if (state == PLUSPLAYER_STATE_NONE) { LOG_ERROR("[PlusPlayer]:Player is in invalid state[%d]", state); return false; } const std::pair config = std::make_pair(key, value); - return ::SetBufferConfig(player_, config); + return plusplayer_set_buffer_config(player_, key.c_str(), value) == + PLUSPLAYER_ERROR_TYPE_NONE; } void PlusPlayer::SetStreamingProperty(const std::string &type, const std::string &value) { - if (!player_) { - LOG_ERROR("[PlusPlayer] Player not created."); + plusplayer_state_e state = plusplayer_get_state(player_); + if (state == PLUSPLAYER_STATE_NONE) { + LOG_ERROR("[PlusPlayer] Player is in invalid state[%d]", state); return; } - plusplayer::State state = GetState(player_); - if (state == plusplayer::State::kNone) { - LOG_ERROR("[PlusPlayer] Player is in invalid state[%d]", state); + + // Early return if format is DASH (allows all property types) + if (IsDashFormat()) { + LOG_INFO("[PlusPlayer] SetStreamingProp: type[%s], value[%s]", type.c_str(), + value.c_str()); + SetPropertyInternal(type, value); return; } - if ((!create_message_.format_hint() || - create_message_.format_hint()->empty() || - *create_message_.format_hint() != "dash") && - (type == "OPEN_HTTP_HEADER" || type == "TOKEN" || - type == "UNWANTED_FRAMERATE" || type == "UNWANTED_RESOLUTION" || - type == "UPDATE_SAME_LANGUAGE_CODE")) { + // For non-DASH formats, check if property type is supported + if (IsDashOnlyProperty(type)) { LOG_ERROR("[PlusPlayer] Only support streaming property type: %s for DASH!", type.c_str()); return; @@ -718,7 +863,7 @@ void PlusPlayer::SetStreamingProperty(const std::string &type, LOG_INFO("[PlusPlayer] SetStreamingProp: type[%s], value[%s]", type.c_str(), value.c_str()); - ::SetStreamingProperty(player_, type, value); + SetPropertyInternal(type, value); } bool PlusPlayer::SetDisplayRotate(int64_t rotation) { @@ -727,15 +872,16 @@ bool PlusPlayer::SetDisplayRotate(int64_t rotation) { return false; } - plusplayer::State state = GetState(player_); - if (state == plusplayer::State::kNone) { + plusplayer_state_e state = plusplayer_get_state(player_); + if (state == PLUSPLAYER_STATE_NONE) { LOG_ERROR("[PlusPlayer] Player is in invalid state[%d]", state); return false; } LOG_INFO("[PlusPlayer] rotation: %lld", rotation); - return ::SetDisplayRotate(player_, - static_cast(rotation)); + return plusplayer_set_display_rotation( + player_, ConvertDisplayRotationType(rotation)) == + PLUSPLAYER_ERROR_TYPE_NONE; } bool PlusPlayer::SetDisplayMode(int64_t display_mode) { @@ -744,14 +890,18 @@ bool PlusPlayer::SetDisplayMode(int64_t display_mode) { return false; } - plusplayer::State state = GetState(player_); - if (state == plusplayer::State::kNone) { + plusplayer_state_e state = plusplayer_get_state(player_); + if (state == PLUSPLAYER_STATE_NONE) { LOG_ERROR("[PlusPlayer] Player is in invalid state[%d]", state); return false; } LOG_INFO("[PlusPlayer] display_mode: %lld", display_mode); - return ::SetDisplayMode(player_, - static_cast(display_mode)); + if (plusplayer_set_display_mode(player_, ConvertDisplayMode(display_mode)) != + PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] Player fail to set display mode."); + return false; + } + return true; } bool PlusPlayer::StopAndClose() { @@ -762,18 +912,18 @@ bool PlusPlayer::StopAndClose() { } is_buffering_ = false; - plusplayer::State player_state = GetState(player_); - if (player_state < plusplayer::State::kReady) { + plusplayer_state_e player_state = plusplayer_get_state(player_); + if (player_state < PLUSPLAYER_STATE_READY) { LOG_INFO("[PlusPlayer] Player already stop, nothing to do."); return true; } - if (!::Stop(player_)) { + if (plusplayer_stop(player_) != PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to stop."); return false; } - if (!::Close(player_)) { + if (plusplayer_close(player_) != PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player fail to close."); return false; } @@ -798,12 +948,14 @@ bool PlusPlayer::Suspend() { LOG_ERROR("[PlusPlayer] Player is in prebuffer mode, do nothing."); return true; } - - memento_.reset(new plusplayer::PlayerMemento()); - if (!GetMemento(player_, memento_.get())) { + plusplayer_geometry_s display_area = memento_->display_area; + memento_.reset(new PlayerMemento()); + memento_->display_area = display_area; + if (!GetMemento(memento_.get())) { LOG_ERROR("[PlusPlayer] Player fail to get memento."); return false; } + LOG_INFO( "[PlusPlayer] Memento saved current player state: %d, position: %llu ms, " "is_live: %d", @@ -833,18 +985,18 @@ bool PlusPlayer::Suspend() { power_state); } - plusplayer::State player_state = GetState(player_); - if (player_state <= plusplayer::State::kTrackSourceReady) { - if (!::Close(player_)) { + plusplayer_state_e player_state = plusplayer_get_state(player_); + if (player_state <= PLUSPLAYER_STATE_TRACK_SOURCE_READY) { + if (plusplayer_close(player_) != PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Player close fail."); return false; } LOG_INFO("[PlusPlayer] Player is in invalid state[%d], just close.", player_state); return true; - } else if (player_state != plusplayer::State::kPaused) { + } else if (player_state != PLUSPLAYER_STATE_PAUSED) { LOG_INFO("[PlusPlayer] Player calling pause from suspend."); - if (::Suspend(player_) == false) { + if (plusplayer_suspend(player_) != PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR( "[PlusPlayer] Suspend fail, in restore player instance would be " "created newly."); @@ -865,10 +1017,10 @@ bool PlusPlayer::Restore(const CreateMessage *restore_message, return false; } - plusplayer::State player_state = GetState(player_); - if (player_state != plusplayer::State::kNone && - player_state != plusplayer::State::kPaused && - player_state != plusplayer::State::kPlaying) { + plusplayer_state_e player_state = plusplayer_get_state(player_); + if (player_state != PLUSPLAYER_STATE_NONE && + player_state != PLUSPLAYER_STATE_PAUSED && + player_state != PLUSPLAYER_STATE_PLAYING) { LOG_ERROR("[PlusPlayer] Player is in invalid state[%d].", player_state); return false; } @@ -887,7 +1039,7 @@ bool PlusPlayer::Restore(const CreateMessage *restore_message, if (restore_message->uri()) { LOG_INFO( - "[PlusPlayer] Restore URL is not emptpy, close the existing instance."); + "[PlusPlayer] Restore URL is not empty, close the existing instance."); if (!StopAndClose()) { LOG_ERROR("[PlusPlayer] Player need to stop and close, but failed."); return false; @@ -896,19 +1048,25 @@ bool PlusPlayer::Restore(const CreateMessage *restore_message, } switch (player_state) { - case plusplayer::State::kNone: + case PLUSPLAYER_STATE_NONE: return RestorePlayer(restore_message, resume_time); break; - case plusplayer::State::kPaused: - if (!::Restore(player_, memento_->state)) { + case PLUSPLAYER_STATE_PAUSED: { + if (plusplayer_restore(player_, memento_->state) != + PLUSPLAYER_ERROR_TYPE_NONE) { if (!StopAndClose()) { LOG_ERROR("[PlusPlayer] Player need to stop and close, but failed."); return false; } return RestorePlayer(restore_message, resume_time); } - break; - case plusplayer::State::kPlaying: + + plusplayer_state_e state = plusplayer_get_state(player_); + if (state == plusplayer_state_e::PLUSPLAYER_STATE_PLAYING) { + SendIsPlayingState(true); + } + } break; + case PLUSPLAYER_STATE_PLAYING: // might be the case that widget has called // restore more than once, just ignore. break; @@ -949,95 +1107,38 @@ bool PlusPlayer::RestorePlayer(const CreateMessage *restore_message, is_restored_ = false; return false; } - if (memento_->playing_time > 0 && !Seek(player_, memento_->playing_time)) { + if (memento_->playing_time > 0 && + plusplayer_seek(player_, memento_->playing_time) != + PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Fail to seek."); } SetDisplayRoi(memento_->display_area.x, memento_->display_area.y, - memento_->display_area.w, memento_->display_area.h); + memento_->display_area.width, memento_->display_area.height); return true; } -std::string BuildJsonString(const flutter::EncodableMap &data) { - rapidjson::Document doc; - doc.SetObject(); - rapidjson::Document::AllocatorType &allocator = doc.GetAllocator(); - - for (const auto &pair : data) { - std::string key_str = std::get(pair.first); - rapidjson::Value key(key_str.c_str(), allocator); - if (key_str == "max-bandwidth") { - doc.AddMember(key, rapidjson::Value(std::get(pair.second)), - allocator); - } else { - doc.AddMember(key, - rapidjson::Value(std::get(pair.second).c_str(), - allocator), - allocator); - } - } - rapidjson::StringBuffer buffer; - rapidjson::Writer writer(buffer); - doc.Accept(writer); - return buffer.GetString(); -} - -std::string BuildJsonString(const flutter::EncodableList &encodable_keys) { - rapidjson::Document doc; - doc.SetObject(); - rapidjson::Document::AllocatorType &allocator = doc.GetAllocator(); - - for (const auto &encodable_key : encodable_keys) { - std::string key_str = std::get(encodable_key); - rapidjson::Value key(key_str.c_str(), allocator); - if (key_str == "max-bandwidth") { - doc.AddMember(key, 0, allocator); - } else { - doc.AddMember(key, "", allocator); - } - } - rapidjson::StringBuffer buffer; - rapidjson::Writer writer(buffer); - doc.Accept(writer); - return buffer.GetString(); -} - -void ParseJsonString(std::string json_str, - const flutter::EncodableList &encodable_keys, - flutter::EncodableMap &output) { - rapidjson::Document doc; - doc.Parse(json_str.c_str()); - if (doc.HasParseError()) { - LOG_ERROR("[PlusPlayer] Fail to parse json string."); - return; - } - for (const auto &encodable_key : encodable_keys) { - std::string key_str = std::get(encodable_key); - if (doc.HasMember(key_str.c_str())) { - if (key_str == "max-bandwidth") { - output.insert_or_assign( - encodable_key, - flutter::EncodableValue(doc[key_str.c_str()].GetInt64())); - } else { - output.insert_or_assign( - encodable_key, - flutter::EncodableValue(doc[key_str.c_str()].GetString())); - } - } - } -} - bool PlusPlayer::SetData(const flutter::EncodableMap &data) { if (!player_) { LOG_ERROR("[PlusPlayer] Player not created."); return false; } - std::string json_data = BuildJsonString(data); - if (json_data.empty()) { - LOG_ERROR("[PlusPlayer] json_data is empty."); - return false; + bool result = true; + for (const auto &pair : data) { + std::string key = std::get(pair.first); + std::string value; + if (key == "max-bandwidth") { + value = std::to_string(std::get(pair.second)); + } else { + value = std::get(pair.second); + } + if (plusplayer_set_property(player_, ConvertPropertyType(key), + value.c_str()) != PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] Fail to set property, key : %s", key.c_str()); + result = false; + } } - return ::SetData(player_, json_data); + return result; } flutter::EncodableMap PlusPlayer::GetData(const flutter::EncodableList &data) { @@ -1046,16 +1147,24 @@ flutter::EncodableMap PlusPlayer::GetData(const flutter::EncodableList &data) { LOG_ERROR("[PlusPlayer] Player not created."); return result; } - std::string json_data = BuildJsonString(data); - if (json_data.empty()) { - LOG_ERROR("[PlusPlayer] json_data is empty."); - return result; - } - if (!::GetData(player_, json_data)) { - LOG_ERROR("[PlusPlayer] Fail to get data from player"); - return result; + + for (const auto &encodable_key : data) { + std::string key = std::get(encodable_key); + char *value; + if (plusplayer_get_property(player_, ConvertPropertyType(key), &value) != + PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] Fail to get property, key : %s", key.c_str()); + continue; + } + if (key == "max-bandwidth") { + result.insert_or_assign(encodable_key, + flutter::EncodableValue(std::stoll(value))); + } else { + result.insert_or_assign(encodable_key, + flutter::EncodableValue(std::string(value))); + } + free(value); } - ParseJsonString(json_data, data, result); return result; } @@ -1064,7 +1173,9 @@ bool PlusPlayer::UpdateDashToken(const std::string &dashToken) { LOG_ERROR("[PlusPlayer] Player not created."); return false; } - return ::UpdateDashToken(player_, dashToken); + return plusplayer_set_property(player_, PLUSPLAYER_PROPERTY_URL_AUTH_TOKEN, + dashToken.c_str()) != + PLUSPLAYER_ERROR_TYPE_NONE; } bool PlusPlayer::OnLicenseAcquired(int *drm_handle, unsigned int length, @@ -1082,7 +1193,8 @@ bool PlusPlayer::OnLicenseAcquired(int *drm_handle, unsigned int length, void PlusPlayer::OnPrepareDone(bool ret, void *user_data) { PlusPlayer *self = reinterpret_cast(user_data); - if (!SetDisplayVisible(self->player_, true)) { + if (plusplayer_set_display_visible(self->player_, true) != + PLUSPLAYER_ERROR_TYPE_NONE) { LOG_ERROR("[PlusPlayer] Fail to set display visible."); } @@ -1127,231 +1239,142 @@ void PlusPlayer::OnEos(void *user_data) { self->SendPlayCompleted(); } -void PlusPlayer::OnSubtitleData(char *data, const int size, - const plusplayer::SubtitleType &type, - const uint64_t duration, - plusplayer::SubtitleAttributeListPtr attr_list, - void *user_data) { - LOG_INFO("[PlusPlayer] Subtitle updated, duration: %llu, text: %s", duration, - data); - PlusPlayer *self = reinterpret_cast(user_data); +void PlusPlayer::OnSubtitleData(const plusplayer_subtitle_type_e type, + const uint64_t duration_in_ms, const char *data, + const int size, + plusplayer_subtitle_attr_s *attr_list, + int attr_size, void *userdata) { + LOG_INFO("[PlusPlayer] Subtitle updated, duration: %llu, text: %s", + duration_in_ms, data); + PlusPlayer *self = reinterpret_cast(userdata); - plusplayer::SubtitleAttributeList *attrs = attr_list.get(); + LOG_INFO("************attr_size is %d *********************", attr_size); flutter::EncodableList attributes_list; - for (auto attr = attrs->begin(); attr != attrs->end(); attr++) { + for (int i = 0; i < attr_size; i++) { LOG_INFO("[PlusPlayer] Subtitle update: type: %d, start: %u, end: %u", - attr->type, attr->start_time, attr->stop_time); + attr_list[i].attr, attr_list[i].start_time, + attr_list[i].stop_time); flutter::EncodableMap attributes = { {flutter::EncodableValue("attrType"), - flutter::EncodableValue(attr->type)}, + flutter::EncodableValue(attr_list[i].attr)}, {flutter::EncodableValue("startTime"), - flutter::EncodableValue((int64_t)attr->start_time)}, + flutter::EncodableValue((int64_t)attr_list[i].start_time)}, {flutter::EncodableValue("stopTime"), - flutter::EncodableValue((int64_t)attr->stop_time)}, + flutter::EncodableValue((int64_t)attr_list[i].stop_time)}, }; - switch (attr->type) { - case plusplayer::kSubAttrRegionXPos: - case plusplayer::kSubAttrRegionYPos: - case plusplayer::kSubAttrRegionWidth: - case plusplayer::kSubAttrRegionHeight: - case plusplayer::kSubAttrWindowXPadding: - case plusplayer::kSubAttrWindowYPadding: - case plusplayer::kSubAttrWindowOpacity: - case plusplayer::kSubAttrFontSize: - case plusplayer::kSubAttrFontOpacity: - case plusplayer::kSubAttrFontBgOpacity: - case plusplayer::kSubAttrWebvttCueLine: - case plusplayer::kSubAttrWebvttCueSize: - case plusplayer::kSubAttrWebvttCuePosition: { - intptr_t value_temp = reinterpret_cast(attr->value); - float value_float; - std::memcpy(&value_float, &value_temp, sizeof(float)); + switch (attr_list[i].dtype) { + case PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_FLOAT: { + float value_float = attr_list[i].value.float_value; LOG_INFO("[PlusPlayer] Subtitle update: value: %f", value_float); attributes[flutter::EncodableValue("attrValue")] = flutter::EncodableValue((double)value_float); } break; - case plusplayer::kSubAttrWindowLeftMargin: - case plusplayer::kSubAttrWindowRightMargin: - case plusplayer::kSubAttrWindowTopMargin: - case plusplayer::kSubAttrWindowBottomMargin: - case plusplayer::kSubAttrWindowBgColor: - case plusplayer::kSubAttrFontWeight: - case plusplayer::kSubAttrFontStyle: - case plusplayer::kSubAttrFontColor: - case plusplayer::kSubAttrFontBgColor: - case plusplayer::kSubAttrFontTextOutlineColor: - case plusplayer::kSubAttrFontTextOutlineThickness: - case plusplayer::kSubAttrFontTextOutlineBlurRadius: - case plusplayer::kSubAttrFontVerticalAlign: - case plusplayer::kSubAttrFontHorizontalAlign: - case plusplayer::kSubAttrWebvttCueLineNum: - case plusplayer::kSubAttrWebvttCueLineAlign: - case plusplayer::kSubAttrWebvttCueAlign: - case plusplayer::kSubAttrWebvttCuePositionAlign: - case plusplayer::kSubAttrWebvttCueVertical: - case plusplayer::kSubAttrTimestamp: { - int value_int = reinterpret_cast(attr->value); - LOG_INFO("[PlusPlayer] Subtitle update: value: %d", value_int); + case PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_DOUBLE: { + double value_double = attr_list[i].value.double_value; + LOG_INFO("[PlusPlayer] Subtitle update: value: %f", + value_double); attributes[flutter::EncodableValue("attrValue")] = - flutter::EncodableValue(value_int); + flutter::EncodableValue(value_double); } break; - case plusplayer::kSubAttrFontFamily: - case plusplayer::kSubAttrRawSubtitle: { - const char *value_chars = reinterpret_cast(attr->value); - LOG_INFO("[PlusPlayer] Subtitle update: value: %s", - value_chars); - std::string value_string(value_chars); + case PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_STRING: { + const char *value_chars = attr_list[i].value.str_value; + LOG_INFO("[PlusPlayer] Subtitle update: value: %s", value_chars); + std::string value_str(value_chars); + attributes[flutter::EncodableValue("attrValue")] = + flutter::EncodableValue(value_str); + } break; + case PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_INT: { + int value_int = attr_list[i].value.int32_value; + LOG_INFO("[PlusPlayer] Subtitle update: value: %d", value_int); attributes[flutter::EncodableValue("attrValue")] = - flutter::EncodableValue(value_string); + flutter::EncodableValue(value_int); } break; - case plusplayer::kSubAttrWindowShowBg: { - uint32_t value_uint32 = reinterpret_cast(attr->value); + case PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_UINT: { + uint32_t value_uint32 = attr_list[i].value.uint32_value; LOG_INFO("[PlusPlayer] Subtitle update: value: %u", value_uint32); attributes[flutter::EncodableValue("attrValue")] = flutter::EncodableValue((int64_t)value_uint32); } break; + case PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_INT64: { + int64_t value_int64 = attr_list[i].value.int64_value; + LOG_INFO("[PlusPlayer] Subtitle update: value: %lld", + value_int64); + attributes[flutter::EncodableValue("attrValue")] = + flutter::EncodableValue(value_int64); + } break; + case PLUSPLAYER_SUBTITLE_ATTR_DATA_TYPE_UINT64: { + uint64_t value_uint64 = attr_list[i].value.uint64_value; + LOG_INFO("[PlusPlayer] Subtitle update: value: %lld", + value_uint64); + attributes[flutter::EncodableValue("attrValue")] = + flutter::EncodableValue((int64_t)value_uint64); + } break; default: - LOG_ERROR("[PlusPlayer] Unknown Subtitle type: %d", attr->type); + LOG_ERROR("[PlusPlayer] Unknown Subtitle value type: %d", + attr_list[i].dtype); break; } attributes_list.push_back(flutter::EncodableValue(attributes)); } - self->SendSubtitleUpdate(duration, data, attributes_list); + self->SendSubtitleUpdate(duration_in_ms, data, attributes_list); } void PlusPlayer::OnResourceConflicted(void *user_data) { - LOG_ERROR("[PlusPlayer] Resource conflicted."); PlusPlayer *self = reinterpret_cast(user_data); self->SendIsPlayingState(false); } -std::string GetErrorMessage(plusplayer::ErrorType error_code) { - switch (error_code) { - case plusplayer::ErrorType::kNone: - return "Successful"; - case plusplayer::ErrorType::kOutOfMemory: - return "Out of memory"; - case plusplayer::ErrorType::kInvalidParameter: - return "Invalid parameter"; - case plusplayer::ErrorType::kNoSuchFile: - return "No such file or directory"; - case plusplayer::ErrorType::kInvalidOperation: - return "Invalid operation"; - case plusplayer::ErrorType::kFileNoSpaceOnDevice: - return "No space left on the device"; - case plusplayer::ErrorType::kFeatureNotSupportedOnDevice: - return "Not supported file on this device"; - case plusplayer::ErrorType::kSeekFailed: - return "Seek operation failure"; - case plusplayer::ErrorType::kInvalidState: - return "Invalid player state"; - case plusplayer::ErrorType::kNotSupportedFile: - return "File format not supported"; - case plusplayer::ErrorType::kNotSupportedFormat: - return "Not supported media format"; - case plusplayer::ErrorType::kInvalidUri: - return "Invalid URI"; - case plusplayer::ErrorType::kSoundPolicy: - return "Sound policy error"; - case plusplayer::ErrorType::kConnectionFailed: - return "Streaming connection failed"; - case plusplayer::ErrorType::kVideoCaptureFailed: - return "Video capture failed"; - case plusplayer::ErrorType::kDrmExpired: - return "DRM license expired"; - case plusplayer::ErrorType::kDrmNoLicense: - return "DRM no license"; - case plusplayer::ErrorType::kDrmFutureUse: - return "License for future use"; - case plusplayer::ErrorType::kDrmNotPermitted: - return "DRM format not permitted"; - case plusplayer::ErrorType::kResourceLimit: - return "Resource limit"; - case plusplayer::ErrorType::kPermissionDenied: - return "Permission denied"; - case plusplayer::ErrorType::kServiceDisconnected: - return "Service disconnected"; - case plusplayer::ErrorType::kBufferSpace: - return "No buffer space available"; - case plusplayer::ErrorType::kNotSupportedAudioCodec: - return "Not supported audio codec but video can be played"; - case plusplayer::ErrorType::kNotSupportedVideoCodec: - return "Not supported video codec but audio can be played"; - case plusplayer::ErrorType::kNotSupportedSubtitle: - return "Not supported subtitle format"; - default: - return "Not defined error"; - } -} - -void PlusPlayer::OnError(const plusplayer::ErrorType &error_code, - void *user_data) { - LOG_ERROR("[PlusPlayer] Error code: %d", error_code); +void PlusPlayer::OnError(plusplayer_error_type_e error_type, void *user_data) { PlusPlayer *self = reinterpret_cast(user_data); self->SendError("[PlusPlayer] error", - std::string("Error: ") + GetErrorMessage(error_code)); + std::string("Error: ") + GetErrorMessage(error_type)); } -void PlusPlayer::OnErrorMsg(const plusplayer::ErrorType &error_code, +void PlusPlayer::OnErrorMsg(plusplayer_error_type_e error_type, const char *error_msg, void *user_data) { - LOG_ERROR("[PlusPlayer] Error code: %d, message: %s.", error_code, error_msg); PlusPlayer *self = reinterpret_cast(user_data); self->SendError("PlusPlayer error", std::string("Error: ") + error_msg); } -void PlusPlayer::OnDrmInitData(int *drm_handle, unsigned int len, - unsigned char *pssh_data, - plusplayer::TrackType type, void *user_data) { +void PlusPlayer::OnDrmInitData(Plusplayer_DrmHandle *drm_handle, + unsigned int len, unsigned char *pssh_data, + plusplayer_track_type_e type, void *user_data) { LOG_INFO("[PlusPlayer] Drm init completed."); PlusPlayer *self = reinterpret_cast(user_data); if (self->drm_manager_) { if (self->drm_manager_->SecurityInitCompleteCB(drm_handle, len, pssh_data, nullptr)) { - DrmLicenseAcquiredDone(self->player_, type); + plusplayer_drm_license_acquired_done(self->player_, type); } } } void PlusPlayer::OnAdaptiveStreamingControlEvent( - const plusplayer::StreamingMessageType &type, - const plusplayer::MessageParam &msg, void *user_data) { - LOG_INFO("[PlusPlayer] Message type: %d, is DrmInitData (%d)", type, - type == plusplayer::StreamingMessageType::kDrmInitData); + plusplayer_streaming_message_type_e message_type, + plusplayer_message_param_s *param, void *user_data) { + LOG_INFO("[PlusPlayer] Message type: %d, is DrmInitData (%d)", message_type, + message_type == PLUSPLAYER_STREAMING_MESSAGE_TYPE_DRMINITDATA); PlusPlayer *self = reinterpret_cast(user_data); - if (type == plusplayer::StreamingMessageType::kDrmInitData) { - if (msg.data.empty() || 0 == msg.size) { + if (message_type == plusplayer_streaming_message_type_e:: + PLUSPLAYER_STREAMING_MESSAGE_TYPE_DRMINITDATA) { + if (0 == param->size) { LOG_ERROR("[PlusPlayer] Empty message."); return; } if (self->drm_manager_) { - self->drm_manager_->UpdatePsshData(msg.data.data(), msg.size); + self->drm_manager_->UpdatePsshData(param->data, param->size); } } } -void PlusPlayer::OnClosedCaptionData(std::unique_ptr data, - const int size, void *user_data) {} - -void PlusPlayer::OnCueEvent(const char *cue_data, void *user_data) {} - -void PlusPlayer::OnDateRangeEvent(const char *date_range_data, - void *user_data) {} - -void PlusPlayer::OnStopReachEvent(bool stop_reach, void *user_data) {} - -void PlusPlayer::OnCueOutContEvent(const char *cue_out_cont_data, - void *user_data) {} - -void PlusPlayer::OnChangeSourceDone(bool ret, void *user_data) {} - void PlusPlayer::OnStateChangedToPlaying(void *user_data) { PlusPlayer *self = reinterpret_cast(user_data); self->SendIsPlayingState(true); @@ -1432,4 +1455,42 @@ void PlusPlayer::OnADEventFromDash(const char *ad_data, void *user_data) { } } +bool PlusPlayer::GetMemento(PlayerMemento *memento) { + uint64_t playing_time; + if (plusplayer_get_playing_time(player_, &playing_time) != + PLUSPLAYER_ERROR_TYPE_NONE) { + return false; + } + memento->playing_time = playing_time; + memento->is_live = IsLive(); + memento->state = plusplayer_get_state(player_); + memento->display_area = current_display_roi_; + return true; +} + +bool PlusPlayer::IsDashFormat() const { + return create_message_.format_hint() && + !create_message_.format_hint()->empty() && + *create_message_.format_hint() == "dash"; +} + +bool PlusPlayer::IsDashOnlyProperty(const std::string &type) const { + static const std::unordered_set dash_only_properties = { + "OPEN_HTTP_HEADER", "TOKEN", "UNWANTED_FRAMERATE", "UNWANTED_RESOLUTION", + "UPDATE_SAME_LANGUAGE_CODE"}; + return dash_only_properties.find(type) != dash_only_properties.end(); +} + +void PlusPlayer::SetPropertyInternal(const std::string &type, + const std::string &value) { + plusplayer_property_e property = ConvertPropertyType(type); + if (property != static_cast(-1)) { + if (plusplayer_set_property(player_, property, value.c_str()) != + PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("[PlusPlayer] Fail to set streaming property type: %s.", + type.c_str()); + } + } +} + } // namespace video_player_avplay_tizen diff --git a/packages/video_player_avplay/tizen/src/plus_player.h b/packages/video_player_avplay/tizen/src/plus_player.h index 265cfa71e..2f172b907 100644 --- a/packages/video_player_avplay/tizen/src/plus_player.h +++ b/packages/video_player_avplay/tizen/src/plus_player.h @@ -13,7 +13,8 @@ #include "device_proxy.h" #include "drm_manager.h" #include "messages.h" -#include "plusplayer/plusplayer_wrapper.h" +#include "plus_player_util.h" +#include "plusplayer_capi/plusplayer_capi.h" #include "video_player.h" namespace video_player_avplay_tizen { @@ -60,59 +61,62 @@ class PlusPlayer : public VideoPlayer { flutter::EncodableList GetActiveTrackInfo() override; private: + bool GetMemento(PlayerMemento *memento); + std::string GetExtraStreamingProperty( + const std::string &streaming_property_type); bool IsLive(); std::pair GetLiveDuration(); + void PreSet(const CreateMessage &create_message); bool SetDisplay(); + bool SetAppId(); bool SetDrm(const std::string &uri, int drm_type, const std::string &license_server_url); - flutter::EncodableValue ParseVideoTrack(plusplayer::Track video_track); - flutter::EncodableValue ParseAudioTrack(plusplayer::Track audio_track); - flutter::EncodableValue ParseSubtitleTrack(plusplayer::Track subtitle_track); + void UnregisterListener(); void RegisterListener(); bool StopAndClose(); bool RestorePlayer(const CreateMessage *restore_message, int64_t resume_time); + // Helper methods for SetStreamingProperty + bool IsDashFormat() const; + bool IsDashOnlyProperty(const std::string &type) const; + void SetPropertyInternal(const std::string &type, const std::string &value); + static bool OnLicenseAcquired(int *drm_handle, unsigned int length, unsigned char *pssh_data, void *user_data); static void OnPrepareDone(bool ret, void *user_data); - static void OnBufferStatus(const int percent, void *user_data); + static void OnBufferStatus(int percent, void *user_data); static void OnSeekDone(void *user_data); static void OnEos(void *user_data); - static void OnSubtitleData(char *data, const int size, - const plusplayer::SubtitleType &type, - const uint64_t duration, - plusplayer::SubtitleAttributeListPtr attr_list, - void *user_data); + static void OnSubtitleData(const plusplayer_subtitle_type_e type, + const uint64_t duration_in_ms, const char *data, + const int size, + plusplayer_subtitle_attr_s *attr_list, + int attr_size, void *userdata); static void OnResourceConflicted(void *user_data); - static void OnError(const plusplayer::ErrorType &error_code, void *user_data); - static void OnErrorMsg(const plusplayer::ErrorType &error_code, + static void OnError(plusplayer_error_type_e error_type, void *user_data); + static void OnErrorMsg(plusplayer_error_type_e error_type, const char *error_msg, void *user_data); - static void OnDrmInitData(int *drm_andle, unsigned int len, + + static void OnDrmInitData(Plusplayer_DrmHandle *drm_andle, unsigned int len, unsigned char *pssh_data, - plusplayer::TrackType type, void *user_data); + plusplayer_track_type_e type, void *user_data); + static void OnAdaptiveStreamingControlEvent( - const plusplayer::StreamingMessageType &type, - const plusplayer::MessageParam &msg, void *user_data); - static void OnClosedCaptionData(std::unique_ptr data, const int size, - void *user_data); - static void OnCueEvent(const char *cue_data, void *user_data); - static void OnDateRangeEvent(const char *date_range_data, void *user_data); - static void OnStopReachEvent(bool stop_reach, void *user_data); - static void OnCueOutContEvent(const char *cue_out_cont_data, void *user_data); - static void OnChangeSourceDone(bool ret, void *user_data); + plusplayer_streaming_message_type_e message_type, + plusplayer_message_param_s *param, void *user_data); static void OnStateChangedToPlaying(void *user_data); static void OnADEventFromDash(const char *ad_data, void *user_data); - PlusplayerRef player_ = nullptr; - PlusplayerListener listener_; + plusplayer_h player_ = nullptr; std::unique_ptr drm_manager_; bool is_buffering_ = false; bool is_prebuffer_mode_ = false; SeekCompletedCallback on_seek_completed_; - std::unique_ptr memento_ = nullptr; + std::unique_ptr memento_ = nullptr; std::string url_; std::unique_ptr device_proxy_ = nullptr; CreateMessage create_message_; + plusplayer_geometry_s current_display_roi_{0, 0, 1, 1}; }; } // namespace video_player_avplay_tizen diff --git a/packages/video_player_avplay/tizen/src/plus_player_util.cc b/packages/video_player_avplay/tizen/src/plus_player_util.cc new file mode 100644 index 000000000..d622ec9bd --- /dev/null +++ b/packages/video_player_avplay/tizen/src/plus_player_util.cc @@ -0,0 +1,175 @@ +// Copyright 2025 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "plus_player_util.h" + +#include "log.h" +namespace video_player_avplay_tizen { + +static constexpr plusplayer_track_type_e kUnknownTrackType = + static_cast(-1); + +static const std::unordered_map + kTrackMap = {{"video", PLUSPLAYER_TRACK_TYPE_VIDEO}, + {"audio", PLUSPLAYER_TRACK_TYPE_AUDIO}, + {"text", PLUSPLAYER_TRACK_TYPE_SUBTITLE}}; + +static const std::unordered_map + kConvertPropertyMap = { + {"ADAPTIVE_INFO", PLUSPLAYER_PROPERTY_ADAPTIVE_INFO}, + {"LISTEN_SPARSE_TRACK", PLUSPLAYER_PROPERTY_LISTEN_SPARSE_TRACK}, + {"CONFIG_LOW_LATENCY", PLUSPLAYER_PROPERTY_CONFIG_LOW_LATENCY}, + {"ATSC3_L1_SERVER_TIME", PLUSPLAYER_PROPERTY_ATSC3_L1_SERVER_TIME}, + {"AUDIO_DESCRIPTION", PLUSPLAYER_PROPERTY_AUDIO_DESCRIPTION}, + {"PRESELECTION_TAG", PLUSPLAYER_PROPERTY_PRESELECTION_TAG}, + {"USE_MAIN_OUT_SHARE", PLUSPLAYER_PROPERTY_USE_MAIN_OUT_SHARE}, + {"TOKEN", PLUSPLAYER_PROPERTY_URL_AUTH_TOKEN}, + {"USER_LOW_LATENCY", PLUSPLAYER_PROPERTY_USER_LOW_LATENCY}, + {"max-bandwidth", PLUSPLAYER_PROPERTY_MAX_BANDWIDTH}, + {"MPEGH_METADATA", PLUSPLAYER_PROPERTY_MPEGH_METADATA}, + {"OPEN_HTTP_HEADER", PLUSPLAYER_PROPERTY_OPEN_HTTP_HEADER}, + {"AVAILABLE_BITRATE", PLUSPLAYER_PROPERTY_AVAILABLE_BITRATE}, + {"CUR_LATENCY", PLUSPLAYER_PROPERTY_CURRENT_LATENCY}, + {"IS_DVB_DASH", PLUSPLAYER_PROPERTY_IS_DVB_DASH}, + {"LIVE_PLAYER_START", PLUSPLAYER_PROPERTY_LIVE_PLAYER_START}, + {"START_DATE", PLUSPLAYER_PROPERTY_START_DATE}, + {"dash-stream-info", PLUSPLAYER_PROPERTY_DASH_STREAM_INFO}, + {"http-header", PLUSPLAYER_PROPERTY_HTTP_HEADER}, + {"UNWANTED_RESOLUTION", PLUSPLAYER_PROPERTY_UNWANTED_RESOLUTION}, + {"UNWANTED_FRAMERATE", PLUSPLAYER_PROPERTY_UNWANTED_FRAMERATE}, + {"AUDIO_STREAM_INFO", PLUSPLAYER_PROPERTY_AUDIO_STREAM_INFO}, + {"SUBTITLE_STREAM_INFO", PLUSPLAYER_PROPERTY_SUBTITLE_STREAM_INFO}, + {"VIDEO_STREAM_INFO", PLUSPLAYER_PROPERTY_VIDEO_STREAM_INFO}, + {"UPDATE_SAME_LANGUAGE_CODE", + PLUSPLAYER_PROPERTY_UPDATE_SAME_LANGUAGE_CODE}}; + +static const std::vector + kConvertDisplayRotationVec = {PLUSPLAYER_DISPLAY_ROTATION_TYPE_NONE, + PLUSPLAYER_DISPLAY_ROTATION_TYPE_90, + PLUSPLAYER_DISPLAY_ROTATION_TYPE_180, + PLUSPLAYER_DISPLAY_ROTATION_TYPE_270}; + +static const std::vector kConvertDisplayModeMap = { + PLUSPLAYER_DISPLAY_MODE_LETTER_BOX, + PLUSPLAYER_DISPLAY_MODE_ORIGIN_SIZE, + PLUSPLAYER_DISPLAY_MODE_FULL_SCREEN, + PLUSPLAYER_DISPLAY_MODE_CROPPED_FULL, + PLUSPLAYER_DISPLAY_MODE_ORIGIN_OR_LETTER, + PLUSPLAYER_DISPLAY_MODE_DST_ROI, + PLUSPLAYER_DISPLAY_MODE_AUTO_ASPECT_RATIO, + PLUSPLAYER_DISPLAY_MODE_ROI_AUTO_ASPECT_RATIO}; + +plusplayer_display_rotation_type_e ConvertDisplayRotationType( + const int64_t &rotation_type) { + int index = static_cast(rotation_type); + return kConvertDisplayRotationVec[index]; +} + +plusplayer_display_mode_e ConvertDisplayMode(const int64_t &display_mode) { + int index = static_cast(display_mode); + return (index >= 0 && index < kConvertDisplayModeMap.size()) + ? kConvertDisplayModeMap[index] + : static_cast(-1); +} + +plusplayer_track_type_e ConvertTrackType(const std::string &track_type) { + auto it = kTrackMap.find(track_type); + if (it != kTrackMap.end()) { + return it->second; + } + // Return a sentinel value that does not correspond to any defined enum. + return kUnknownTrackType; +} + +plusplayer_property_e ConvertPropertyType(const std::string &type_value) { + for (const auto &pair : kConvertPropertyMap) { + if (pair.first == type_value) { + return pair.second; + } + } + return static_cast(-1); +} + +std::vector Split(const std::string &s, char delim) { + std::stringstream ss(s); + std::string item; + std::vector tokens; + while (getline(ss, item, delim)) { + tokens.push_back(item); + } + return tokens; +} + +std::string GetErrorMessage(plusplayer_error_type_e error_code) { + switch (error_code) { + case PLUSPLAYER_ERROR_TYPE_NONE: + return "Successful"; + case PLUSPLAYER_ERROR_TYPE_OUT_OF_MEMORY: + return "Out of memory"; + case PLUSPLAYER_ERROR_TYPE_INVALID_PARAMETER: + return "Invalid parameter"; + case PLUSPLAYER_ERROR_TYPE_NO_SUCH_FILE: + return "No such file or directory"; + case PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION: + return "Invalid operation"; + case PLUSPLAYER_ERROR_TYPE_FILE_NO_SPACE_ON_DEVICE: + return "No space left on the device"; + case PLUSPLAYER_ERROR_TYPE_FEATURE_NOT_SUPPORTED_ON_DEVICE: + return "Not supported file on this device"; + case PLUSPLAYER_ERROR_TYPE_SEEK_FAILED: + return "Seek operation failure"; + case PLUSPLAYER_ERROR_TYPE_INVALID_STATE: + return "Invalid player state"; + case PLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_FILE: + return "File format not supported"; + case PLUSPLAYER_ERROR_TYPE_INVALID_URI: + return "Invalid URI"; + case PLUSPLAYER_ERROR_TYPE_SOUND_POLICY: + return "Sound policy error"; + case PLUSPLAYER_ERROR_TYPE_CONNECTION_FAILED: + return "Streaming connection failed"; + case PLUSPLAYER_ERROR_TYPE_VIDEO_CAPTURE_FAILED: + return "Video capture failed"; + case PLUSPLAYER_ERROR_TYPE_DRM_EXPIRED: + return "DRM license expired"; + case PLUSPLAYER_ERROR_TYPE_DRM_NO_LICENSE: + return "DRM no license"; + case PLUSPLAYER_ERROR_TYPE_DRM_FUTURE_USE: + return "License for future use"; + case PLUSPLAYER_ERROR_TYPE_NOT_PERMITTED: + return "DRM format not permitted"; + case PLUSPLAYER_ERROR_TYPE_RESOURCE_LIMIT: + return "Resource limit"; + case PLUSPLAYER_ERROR_TYPE_PERMISSION_DENIED: + return "Permission denied"; + case PLUSPLAYER_ERROR_TYPE_SERVICE_DISCONNECTED: + return "Service disconnected"; + case PLUSPLAYER_ERROR_TYPE_NO_BUFFER_SPACE: + return "No buffer space available"; + case PLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_AUDIO_CODEC: + return "Not supported audio codec but video can be played"; + case PLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_VIDEO_CODEC: + return "Not supported video codec but audio can be played"; + case PLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_SUBTITLE: + return "Not supported subtitle format"; + case PLUSPLAYER_ERROR_TYPE_DRM_DECRYPTION_FAILED: + return "Drm decryption failed"; + case PLUSPLAYER_ERROR_TYPE_NOT_SUPPORTED_FORMAT: + return "Not supported media format"; + case PLUSPLAYER_ERROR_TYPE_STREAMING_PLAYER: + return "Streaming player error"; + case PLUSPLAYER_ERROR_TYPE_DTCPFSK: + return "Type dtcpfsk"; + case PLUSPLAYER_ERROR_TYPE_PRELOADING_TIMEOUT: + return "Can't finish preloading in time"; + case PLUSPLAYER_ERROR_TYPE_NETWORK_ERROR: + return "Network error"; + case PLUSPLAYER_ERROR_TYPE_NOT_CHANNEL_SURFING_ERROR: + return "Not channel surfing error"; + default: + return "Not defined error"; + } +} + +} // namespace video_player_avplay_tizen diff --git a/packages/video_player_avplay/tizen/src/plus_player_util.h b/packages/video_player_avplay/tizen/src/plus_player_util.h new file mode 100644 index 000000000..436549c50 --- /dev/null +++ b/packages/video_player_avplay/tizen/src/plus_player_util.h @@ -0,0 +1,37 @@ +// Copyright 2023 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_PLUGIN_PLUS_PLAYER_UTIL_H_ +#define FLUTTER_PLUGIN_PLUS_PLAYER_UTIL_H_ + +#include + +#include +#include +#include +#include + +#include "plusplayer_capi/display.h" +#include "plusplayer_capi/error.h" +#include "plusplayer_capi/property.h" +#include "plusplayer_capi/state.h" +#include "plusplayer_capi/track.h" +#include "plusplayer_capi/track_capi.h" +namespace video_player_avplay_tizen { +struct PlayerMemento { + uint64_t playing_time; + plusplayer_state_e state; + plusplayer_geometry_s display_area; + bool is_live; +}; + +plusplayer_track_type_e ConvertTrackType(const std::string &track_type); +plusplayer_property_e ConvertPropertyType(const std::string &type_value); +std::vector Split(const std::string &s, char delim); +std::string GetErrorMessage(plusplayer_error_type_e error_code); +plusplayer_display_mode_e ConvertDisplayMode(const int64_t &display_mode); +plusplayer_display_rotation_type_e ConvertDisplayRotationType( + const int64_t &rotation_type); +} // namespace video_player_avplay_tizen +#endif diff --git a/packages/video_player_avplay/tizen/src/plusplayer_capi.cc b/packages/video_player_avplay/tizen/src/plusplayer_capi.cc new file mode 100644 index 000000000..ac4bedc8c --- /dev/null +++ b/packages/video_player_avplay/tizen/src/plusplayer_capi.cc @@ -0,0 +1,1402 @@ +// Copyright 2025 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "plusplayer_capi/plusplayer_capi.h" + +#include +#include +#include + +#include "log.h" + +// Function pointer types for all plusplayer functions +typedef plusplayer_h (*fun_plusplayer_create)(void); +typedef int (*fun_plusplayer_open)(plusplayer_h handle, const char* uri); +typedef int (*fun_plusplayer_prepare)(plusplayer_h handle); +typedef int (*fun_plusplayer_start)(plusplayer_h handle); +typedef int (*fun_plusplayer_stop)(plusplayer_h handle); +typedef int (*fun_plusplayer_close)(plusplayer_h handle); +typedef int (*fun_plusplayer_destroy)(plusplayer_h handle); +typedef plusplayer_state_e (*fun_plusplayer_get_state)(plusplayer_h handle); +typedef int (*fun_plusplayer_set_display)(plusplayer_h handle, + plusplayer_display_type_e type, + void* window); +typedef int (*fun_plusplayer_set_display_subsurface)( + plusplayer_h handle, plusplayer_display_type_e type, uint32_t surface_id, + plusplayer_geometry_s roi); +typedef int (*fun_plusplayer_set_prepare_async_done_cb)( + plusplayer_h handle, plusplayer_prepare_async_done_cb prepare_async_done_cb, + void* userdata); +typedef int (*fun_plusplayer_set_resource_conflicted_cb)( + plusplayer_h handle, + plusplayer_resource_conflicted_cb resource_conflicted_cb, void* userdata); +typedef int (*fun_plusplayer_set_eos_cb)(plusplayer_h handle, + plusplayer_eos_cb eos_cb, + void* userdata); +typedef int (*fun_plusplayer_set_buffer_status_cb)( + plusplayer_h handle, plusplayer_buffer_status_cb buffer_status_cb, + void* userdata); +typedef int (*fun_plusplayer_set_error_cb)(plusplayer_h handle, + plusplayer_error_cb error_cb, + void* userdata); +typedef int (*fun_plusplayer_set_error_msg_cb)( + plusplayer_h handle, plusplayer_error_msg_cb error_msg_cb, void* userdata); +typedef int (*fun_plusplayer_set_seek_done_cb)( + plusplayer_h handle, plusplayer_seek_done_cb seek_done_cb, void* userdata); +typedef int (*fun_plusplayer_set_subtitle_updated_cb)( + plusplayer_h handle, plusplayer_subtitle_updated_cb subtitle_updated_cb, + void* userdata); +typedef int (*fun_plusplayer_set_ad_event_cb)( + plusplayer_h handle, plusplayer_ad_event_cb ad_event_cb, void* userdata); +typedef int (*fun_plusplayer_prepare_async)(plusplayer_h handle); +typedef int (*fun_plusplayer_pause)(plusplayer_h handle); +typedef int (*fun_plusplayer_resume)(plusplayer_h handle); +typedef int (*fun_plusplayer_seek)(plusplayer_h handle, uint64_t time); +typedef void (*fun_plusplayer_set_prebuffer_mode)(plusplayer_h handle, + bool prebuffer_mode); +typedef int (*fun_plusplayer_set_app_id)(plusplayer_h handle, + const char* app_id); +typedef int (*fun_plusplayer_suspend)(plusplayer_h handle); +typedef int (*fun_plusplayer_restore)(plusplayer_h handle, + plusplayer_state_e target_state); +typedef int (*fun_plusplayer_get_playing_time)(plusplayer_h handle, + uint64_t* cur_time_ms); +typedef int (*fun_plusplayer_set_display_mode)(plusplayer_h handle, + plusplayer_display_mode_e mode); +typedef int (*fun_plusplayer_set_display_roi)(plusplayer_h handle, + plusplayer_geometry_s roi); +typedef int (*fun_plusplayer_set_display_rotation)( + plusplayer_h handle, plusplayer_display_rotation_type_e rotation); +typedef int (*fun_plusplayer_set_buffer_config)(plusplayer_h handle, + const char* config, int amount); +typedef int (*fun_plusplayer_get_duration)(plusplayer_h handle, + int64_t* duration_ms); +typedef int (*fun_plusplayer_set_playback_rate)(plusplayer_h handle, + const double playback_rate); +typedef int (*fun_plusplayer_deactivate_track)( + plusplayer_h handle, plusplayer_track_type_e track_type); +typedef int (*fun_plusplayer_activate_track)( + plusplayer_h handle, plusplayer_track_type_e track_type); +typedef int (*fun_plusplayer_set_property)(plusplayer_h handle, + plusplayer_property_e property, + const char* value); +typedef int (*fun_plusplayer_get_property)(plusplayer_h handle, + plusplayer_property_e property, + char** value); +typedef int (*fun_plusplayer_get_track_count)( + plusplayer_h handle, plusplayer_track_type_e track_type, int* count); +typedef int (*fun_plusplayer_select_track)(plusplayer_h handle, + plusplayer_track_type_e type, + int index); +typedef const char* (*fun_plusplayer_get_track_language_code)( + plusplayer_h handle, plusplayer_track_type_e type, int index); + +// Function pointer types for track_capi.h functions +typedef int (*fun_plusplayer_get_track_index)(plusplayer_track_h track, + int* track_index); +typedef int (*fun_plusplayer_get_track_id)(plusplayer_track_h track, + int* track_id); +typedef int (*fun_plusplayer_get_track_mimetype)(plusplayer_track_h track, + const char** track_mimetype); +typedef int (*fun_plusplayer_get_track_streamtype)( + plusplayer_track_h track, const char** track_streamtype); +typedef int (*fun_plusplayer_get_track_container_type)( + plusplayer_track_h track, const char** track_containertype); +typedef int (*fun_plusplayer_get_track_type)( + plusplayer_track_h track, plusplayer_track_type_e* track_type); +typedef int (*fun_plusplayer_get_track_codec_data)( + plusplayer_track_h track, const char** track_codecdata); +typedef int (*fun_plusplayer_get_track_codec_tag)(plusplayer_track_h track, + unsigned int* track_codectag); +typedef int (*fun_plusplayer_get_track_codec_data_len)(plusplayer_track_h track, + int* track_codecdatalen); +typedef int (*fun_plusplayer_get_track_width)(plusplayer_track_h track, + int* track_width); +typedef int (*fun_plusplayer_get_track_height)(plusplayer_track_h track, + int* track_height); +typedef int (*fun_plusplayer_get_track_maxwidth)(plusplayer_track_h track, + int* track_maxwidth); +typedef int (*fun_plusplayer_get_track_maxheight)(plusplayer_track_h track, + int* track_maxheight); +typedef int (*fun_plusplayer_get_track_framerate_num)(plusplayer_track_h track, + int* track_framerate_num); +typedef int (*fun_plusplayer_get_track_framerate_den)(plusplayer_track_h track, + int* track_framerate_den); +typedef int (*fun_plusplayer_get_track_sample_rate)(plusplayer_track_h track, + int* track_sample_rate); +typedef int (*fun_plusplayer_get_track_sample_format)(plusplayer_track_h track, + int* track_sample_format); +typedef int (*fun_plusplayer_get_track_channels)(plusplayer_track_h track, + int* track_channels); +typedef int (*fun_plusplayer_get_track_version)(plusplayer_track_h track, + int* track_version); +typedef int (*fun_plusplayer_get_track_layer)(plusplayer_track_h track, + int* track_layer); +typedef int (*fun_plusplayer_get_track_bits_per_sample)( + plusplayer_track_h track, int* track_bits_per_sample); +typedef int (*fun_plusplayer_get_track_block_align)(plusplayer_track_h track, + int* track_block_align); +typedef int (*fun_plusplayer_get_track_bitrate)(plusplayer_track_h track, + int* track_bitrate); +typedef int (*fun_plusplayer_get_track_endianness)(plusplayer_track_h track, + int* track_endianness); +typedef int (*fun_plusplayer_get_track_is_signed)(plusplayer_track_h track, + bool* track_is_signed); +typedef int (*fun_plusplayer_get_track_active)(plusplayer_track_h track, + bool* track_active); +typedef int (*fun_plusplayer_get_track_lang_code)(plusplayer_track_h track, + const char** track_lang_code); +typedef int (*fun_plusplayer_get_track_subtitle_format)( + plusplayer_track_h track, const char** track_subtitle_format); +typedef int (*fun_plusplayer_set_app_info)( + plusplayer_h handle, const plusplayer_app_info_s* app_info); +typedef int (*fun_plusplayer_set_drm)(plusplayer_h handle, + plusplayer_drm_property_s drm_property); +typedef int (*fun_plusplayer_set_drm_init_data_cb)( + plusplayer_h handle, plusplayer_drm_init_data_cb drm_init_data_callback, + void* userdata); +typedef int (*fun_plusplayer_set_adaptive_streaming_control_event_cb)( + plusplayer_h handle, + plusplayer_adaptive_streaming_control_event_cb + adaptive_streaming_control_event_cb, + void* userdata); +typedef int (*fun_plusplayer_drm_license_acquired_done)( + plusplayer_h handle, plusplayer_track_type_e track_type); +typedef int (*fun_plusplayer_set_subtitle_path)(plusplayer_h handle, + const char* uri); +typedef int (*fun_plusplayer_set_video_stillmode)( + plusplayer_h handle, plusplayer_still_mode_e stillmode); +typedef int (*fun_plusplayer_set_alternative_video_resource)( + plusplayer_h handle, unsigned int rsc_type); +typedef int (*fun_plusplayer_get_foreach_track)(plusplayer_h handle, + plusplayer_track_cb track_cb, + void* userdata); +typedef int (*fun_plusplayer_get_foreach_active_track)( + plusplayer_h handle, plusplayer_track_cb track_cb, void* userdata); +typedef int (*fun_plusplayer_set_cookie)(plusplayer_h handle, + const char* cookie); +typedef int (*fun_plusplayer_set_user_agent)(plusplayer_h handle, + const char* user_agent); +typedef int (*fun_plusplayer_set_resume_time)(plusplayer_h handle, + uint64_t resume_time_ms); +typedef int (*fun_plusplayer_is_live_streaming)(plusplayer_h handle, + bool* is_live); +typedef int (*fun_plusplayer_get_dvr_seekable_range)(plusplayer_h handle, + uint64_t* start_time_ms, + uint64_t* end_time_ms); +typedef int (*fun_plusplayer_get_current_bandwidth)( + plusplayer_h handle, uint32_t* curr_bandwidth_bps); +typedef int (*fun_plusplayer_set_volume)(plusplayer_h handle, int volume); +typedef int (*fun_plusplayer_set_display_visible)(plusplayer_h handle, + bool is_visible); + +// Structure to hold library handle and function pointers +typedef struct { + void* library_handle; + + // Function pointers + fun_plusplayer_create create; + fun_plusplayer_open open; + fun_plusplayer_prepare prepare; + fun_plusplayer_start start; + fun_plusplayer_stop stop; + fun_plusplayer_close close; + fun_plusplayer_destroy destroy; + fun_plusplayer_get_state get_state; + fun_plusplayer_set_display set_display; + fun_plusplayer_set_display_subsurface set_display_subsurface; + fun_plusplayer_set_prepare_async_done_cb set_prepare_async_done_cb; + fun_plusplayer_set_resource_conflicted_cb set_resource_conflicted_cb; + fun_plusplayer_set_eos_cb set_eos_cb; + fun_plusplayer_set_buffer_status_cb set_buffer_status_cb; + fun_plusplayer_set_error_cb set_error_cb; + fun_plusplayer_set_error_msg_cb set_error_msg_cb; + fun_plusplayer_set_seek_done_cb set_seek_done_cb; + fun_plusplayer_set_subtitle_updated_cb set_subtitle_updated_cb; + fun_plusplayer_set_ad_event_cb set_ad_event_cb; + fun_plusplayer_prepare_async prepare_async; + fun_plusplayer_pause pause; + fun_plusplayer_resume resume; + fun_plusplayer_seek seek; + fun_plusplayer_set_prebuffer_mode set_prebuffer_mode; + fun_plusplayer_set_app_id set_app_id; + fun_plusplayer_suspend suspend; + fun_plusplayer_restore restore; + fun_plusplayer_get_playing_time get_playing_time; + fun_plusplayer_set_display_mode set_display_mode; + fun_plusplayer_set_display_roi set_display_roi; + fun_plusplayer_set_display_rotation set_display_rotation; + fun_plusplayer_set_buffer_config set_buffer_config; + fun_plusplayer_get_duration get_duration; + fun_plusplayer_set_playback_rate set_playback_rate; + fun_plusplayer_deactivate_track deactivate_track; + fun_plusplayer_activate_track activate_track; + fun_plusplayer_set_property set_property; + fun_plusplayer_get_property get_property; + fun_plusplayer_get_track_count get_track_count; + fun_plusplayer_select_track select_track; + fun_plusplayer_get_track_language_code get_track_language_code; + // Track CAPI function pointers + fun_plusplayer_get_track_index get_track_index; + fun_plusplayer_get_track_id get_track_id; + fun_plusplayer_get_track_mimetype get_track_mimetype; + fun_plusplayer_get_track_streamtype get_track_streamtype; + fun_plusplayer_get_track_container_type get_track_container_type; + fun_plusplayer_get_track_type get_track_type; + fun_plusplayer_get_track_codec_data get_track_codec_data; + fun_plusplayer_get_track_codec_tag get_track_codec_tag; + fun_plusplayer_get_track_codec_data_len get_track_codec_data_len; + fun_plusplayer_get_track_width get_track_width; + fun_plusplayer_get_track_height get_track_height; + fun_plusplayer_get_track_maxwidth get_track_maxwidth; + fun_plusplayer_get_track_maxheight get_track_maxheight; + fun_plusplayer_get_track_framerate_num get_track_framerate_num; + fun_plusplayer_get_track_framerate_den get_track_framerate_den; + fun_plusplayer_get_track_sample_rate get_track_sample_rate; + fun_plusplayer_get_track_sample_format get_track_sample_format; + fun_plusplayer_get_track_channels get_track_channels; + fun_plusplayer_get_track_version get_track_version; + fun_plusplayer_get_track_layer get_track_layer; + fun_plusplayer_get_track_bits_per_sample get_track_bits_per_sample; + fun_plusplayer_get_track_block_align get_track_block_align; + fun_plusplayer_get_track_bitrate get_track_bitrate; + fun_plusplayer_get_track_endianness get_track_endianness; + fun_plusplayer_get_track_is_signed get_track_is_signed; + fun_plusplayer_get_track_active get_track_active; + fun_plusplayer_get_track_lang_code get_track_lang_code; + fun_plusplayer_get_track_subtitle_format get_track_subtitle_format; + fun_plusplayer_set_app_info set_app_info; + fun_plusplayer_set_drm set_drm; + fun_plusplayer_set_drm_init_data_cb set_drm_init_data_cb; + fun_plusplayer_set_adaptive_streaming_control_event_cb + set_adaptive_streaming_control_event_cb; + fun_plusplayer_drm_license_acquired_done drm_license_acquired_done; + fun_plusplayer_set_subtitle_path set_subtitle_path; + fun_plusplayer_set_video_stillmode set_video_stillmode; + fun_plusplayer_set_alternative_video_resource set_alternative_video_resource; + fun_plusplayer_get_foreach_track get_foreach_track; + fun_plusplayer_get_foreach_active_track get_foreach_active_track; + fun_plusplayer_set_cookie set_cookie; + fun_plusplayer_set_user_agent set_user_agent; + fun_plusplayer_set_resume_time set_resume_time; + fun_plusplayer_is_live_streaming is_live_streaming; + fun_plusplayer_get_dvr_seekable_range get_dvr_seekable_range; + fun_plusplayer_get_current_bandwidth get_current_bandwidth; + fun_plusplayer_set_volume set_volume; + fun_plusplayer_set_display_visible set_display_visible; +} plusplayer_capi_t; + +class PlusPlayerLoader { + public: + static PlusPlayerLoader& GetInstance() { + static PlusPlayerLoader instance; + return instance; + } + + int Initialize() { + pthread_mutex_lock(&mutex_); + + if (initialized_) { + pthread_mutex_unlock(&mutex_); + return PLUSPLAYER_ERROR_TYPE_NONE; + } + + library_handle_ = dlopen("libplusplayer.so", RTLD_LAZY); + if (library_handle_ == nullptr) { + LOG_ERROR("Failed to open libplusplayer.so"); + pthread_mutex_unlock(&mutex_); + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + + if (!LoadAllFunctionPointers()) { + LOG_ERROR("Failed to load function pointers"); + if (library_handle_) { + dlclose(library_handle_); + library_handle_ = nullptr; + } + pthread_mutex_unlock(&mutex_); + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + + initialized_ = true; + pthread_mutex_unlock(&mutex_); + return PLUSPLAYER_ERROR_TYPE_NONE; + } + + bool IsInitialized() const { return initialized_; } + + void Cleanup() { + pthread_mutex_lock(&mutex_); + + if (library_handle_) { + dlclose(library_handle_); + library_handle_ = nullptr; + } + + memset(&function_pointers_, 0, sizeof(function_pointers_)); + initialized_ = false; + + pthread_mutex_unlock(&mutex_); + } + + const plusplayer_capi_t* GetFunctionPointers() const { + return &function_pointers_; + } + + private: + PlusPlayerLoader() : initialized_(false), library_handle_(nullptr) { + pthread_mutex_init(&mutex_, nullptr); + memset(&function_pointers_, 0, sizeof(function_pointers_)); + } + + ~PlusPlayerLoader() { + Cleanup(); + pthread_mutex_destroy(&mutex_); + } + + PlusPlayerLoader(const PlusPlayerLoader&) = delete; + PlusPlayerLoader& operator=(const PlusPlayerLoader&) = delete; + + void* LoadFunction(const char* func_name) { + if (!library_handle_) { + LOG_ERROR("library_handle is invalid."); + return nullptr; + } + + void* func = dlsym(library_handle_, func_name); + if (!func) { + LOG_ERROR("Failed to find %s function.", func_name); + return nullptr; + } + + return func; + } + + bool LoadAllFunctionPointers() { + function_pointers_.create = + (fun_plusplayer_create)LoadFunction("plusplayer_create"); + function_pointers_.open = + (fun_plusplayer_open)LoadFunction("plusplayer_open"); + function_pointers_.prepare = + (fun_plusplayer_prepare)LoadFunction("plusplayer_prepare"); + function_pointers_.start = + (fun_plusplayer_start)LoadFunction("plusplayer_start"); + function_pointers_.stop = + (fun_plusplayer_stop)LoadFunction("plusplayer_stop"); + function_pointers_.close = + (fun_plusplayer_close)LoadFunction("plusplayer_close"); + function_pointers_.destroy = + (fun_plusplayer_destroy)LoadFunction("plusplayer_destroy"); + function_pointers_.get_state = + (fun_plusplayer_get_state)LoadFunction("plusplayer_get_state"); + function_pointers_.set_display = + (fun_plusplayer_set_display)LoadFunction("plusplayer_set_display"); + function_pointers_.set_display_subsurface = + (fun_plusplayer_set_display_subsurface)LoadFunction( + "plusplayer_set_display_subsurface"); + function_pointers_.set_prepare_async_done_cb = + (fun_plusplayer_set_prepare_async_done_cb)LoadFunction( + "plusplayer_set_prepare_async_done_cb"); + function_pointers_.set_resource_conflicted_cb = + (fun_plusplayer_set_resource_conflicted_cb)LoadFunction( + "plusplayer_set_resource_conflicted_cb"); + function_pointers_.set_eos_cb = + (fun_plusplayer_set_eos_cb)LoadFunction("plusplayer_set_eos_cb"); + function_pointers_.set_buffer_status_cb = + (fun_plusplayer_set_buffer_status_cb)LoadFunction( + "plusplayer_set_buffer_status_cb"); + function_pointers_.set_error_cb = + (fun_plusplayer_set_error_cb)LoadFunction("plusplayer_set_error_cb"); + function_pointers_.set_error_msg_cb = + (fun_plusplayer_set_error_msg_cb)LoadFunction( + "plusplayer_set_error_msg_cb"); + function_pointers_.set_seek_done_cb = + (fun_plusplayer_set_seek_done_cb)LoadFunction( + "plusplayer_set_seek_done_cb"); + function_pointers_.set_subtitle_updated_cb = + (fun_plusplayer_set_subtitle_updated_cb)LoadFunction( + "plusplayer_set_subtitle_updated_cb"); + function_pointers_.set_ad_event_cb = + (fun_plusplayer_set_ad_event_cb)LoadFunction( + "plusplayer_set_ad_event_cb"); + function_pointers_.prepare_async = + (fun_plusplayer_prepare_async)LoadFunction("plusplayer_prepare_async"); + function_pointers_.pause = + (fun_plusplayer_pause)LoadFunction("plusplayer_pause"); + function_pointers_.resume = + (fun_plusplayer_resume)LoadFunction("plusplayer_resume"); + function_pointers_.seek = + (fun_plusplayer_seek)LoadFunction("plusplayer_seek"); + function_pointers_.set_prebuffer_mode = + (fun_plusplayer_set_prebuffer_mode)LoadFunction( + "plusplayer_set_prebuffer_mode"); + function_pointers_.set_app_id = + (fun_plusplayer_set_app_id)LoadFunction("plusplayer_set_app_id"); + function_pointers_.suspend = + (fun_plusplayer_suspend)LoadFunction("plusplayer_suspend"); + function_pointers_.restore = + (fun_plusplayer_restore)LoadFunction("plusplayer_restore"); + function_pointers_.get_playing_time = + (fun_plusplayer_get_playing_time)LoadFunction( + "plusplayer_get_playing_time"); + function_pointers_.set_display_mode = + (fun_plusplayer_set_display_mode)LoadFunction( + "plusplayer_set_display_mode"); + function_pointers_.set_display_roi = + (fun_plusplayer_set_display_roi)LoadFunction( + "plusplayer_set_display_roi"); + function_pointers_.set_display_rotation = + (fun_plusplayer_set_display_rotation)LoadFunction( + "plusplayer_set_display_rotation"); + function_pointers_.set_buffer_config = + (fun_plusplayer_set_buffer_config)LoadFunction( + "plusplayer_set_buffer_config"); + function_pointers_.get_duration = + (fun_plusplayer_get_duration)LoadFunction("plusplayer_get_duration"); + function_pointers_.set_playback_rate = + (fun_plusplayer_set_playback_rate)LoadFunction( + "plusplayer_set_playback_rate"); + function_pointers_.deactivate_track = + (fun_plusplayer_deactivate_track)LoadFunction( + "plusplayer_deactivate_track"); + function_pointers_.activate_track = + (fun_plusplayer_activate_track)LoadFunction( + "plusplayer_activate_track"); + function_pointers_.set_property = + (fun_plusplayer_set_property)LoadFunction("plusplayer_set_property"); + function_pointers_.get_property = + (fun_plusplayer_get_property)LoadFunction("plusplayer_get_property"); + function_pointers_.get_track_count = + (fun_plusplayer_get_track_count)LoadFunction( + "plusplayer_get_track_count"); + function_pointers_.select_track = + (fun_plusplayer_select_track)LoadFunction("plusplayer_select_track"); + function_pointers_.get_track_language_code = + (fun_plusplayer_get_track_language_code)LoadFunction( + "plusplayer_get_track_language_code"); + function_pointers_.get_track_index = + (fun_plusplayer_get_track_index)LoadFunction( + "plusplayer_get_track_index"); + function_pointers_.get_track_id = + (fun_plusplayer_get_track_id)LoadFunction("plusplayer_get_track_id"); + function_pointers_.get_track_mimetype = + (fun_plusplayer_get_track_mimetype)LoadFunction( + "plusplayer_get_track_mimetype"); + function_pointers_.get_track_streamtype = + (fun_plusplayer_get_track_streamtype)LoadFunction( + "plusplayer_get_track_streamtype"); + function_pointers_.get_track_container_type = + (fun_plusplayer_get_track_container_type)LoadFunction( + "plusplayer_get_track_container_type"); + function_pointers_.get_track_type = + (fun_plusplayer_get_track_type)LoadFunction( + "plusplayer_get_track_type"); + function_pointers_.get_track_codec_data = + (fun_plusplayer_get_track_codec_data)LoadFunction( + "plusplayer_get_track_codec_data"); + function_pointers_.get_track_codec_tag = + (fun_plusplayer_get_track_codec_tag)LoadFunction( + "plusplayer_get_track_codec_tag"); + function_pointers_.get_track_codec_data_len = + (fun_plusplayer_get_track_codec_data_len)LoadFunction( + "plusplayer_get_track_codec_data_len"); + function_pointers_.get_track_width = + (fun_plusplayer_get_track_width)LoadFunction( + "plusplayer_get_track_width"); + function_pointers_.get_track_height = + (fun_plusplayer_get_track_height)LoadFunction( + "plusplayer_get_track_height"); + function_pointers_.get_track_maxwidth = + (fun_plusplayer_get_track_maxwidth)LoadFunction( + "plusplayer_get_track_maxwidth"); + function_pointers_.get_track_maxheight = + (fun_plusplayer_get_track_maxheight)LoadFunction( + "plusplayer_get_track_maxheight"); + function_pointers_.get_track_framerate_num = + (fun_plusplayer_get_track_framerate_num)LoadFunction( + "plusplayer_get_track_framerate_num"); + function_pointers_.get_track_framerate_den = + (fun_plusplayer_get_track_framerate_den)LoadFunction( + "plusplayer_get_track_framerate_den"); + function_pointers_.get_track_sample_rate = + (fun_plusplayer_get_track_sample_rate)LoadFunction( + "plusplayer_get_track_sample_rate"); + function_pointers_.get_track_sample_format = + (fun_plusplayer_get_track_sample_format)LoadFunction( + "plusplayer_get_track_sample_format"); + function_pointers_.get_track_channels = + (fun_plusplayer_get_track_channels)LoadFunction( + "plusplayer_get_track_channels"); + function_pointers_.get_track_version = + (fun_plusplayer_get_track_version)LoadFunction( + "plusplayer_get_track_version"); + function_pointers_.get_track_layer = + (fun_plusplayer_get_track_layer)LoadFunction( + "plusplayer_get_track_layer"); + function_pointers_.get_track_bits_per_sample = + (fun_plusplayer_get_track_bits_per_sample)LoadFunction( + "plusplayer_get_track_bits_per_sample"); + function_pointers_.get_track_block_align = + (fun_plusplayer_get_track_block_align)LoadFunction( + "plusplayer_get_track_block_align"); + function_pointers_.get_track_bitrate = + (fun_plusplayer_get_track_bitrate)LoadFunction( + "plusplayer_get_track_bitrate"); + function_pointers_.get_track_endianness = + (fun_plusplayer_get_track_endianness)LoadFunction( + "plusplayer_get_track_endianness"); + function_pointers_.get_track_is_signed = + (fun_plusplayer_get_track_is_signed)LoadFunction( + "plusplayer_get_track_is_signed"); + function_pointers_.get_track_active = + (fun_plusplayer_get_track_active)LoadFunction( + "plusplayer_get_track_active"); + function_pointers_.get_track_lang_code = + (fun_plusplayer_get_track_lang_code)LoadFunction( + "plusplayer_get_track_lang_code"); + function_pointers_.get_track_subtitle_format = + (fun_plusplayer_get_track_subtitle_format)LoadFunction( + "plusplayer_get_track_subtitle_format"); + function_pointers_.set_app_info = + (fun_plusplayer_set_app_info)LoadFunction("plusplayer_set_app_info"); + function_pointers_.set_drm = + (fun_plusplayer_set_drm)LoadFunction("plusplayer_set_drm"); + function_pointers_.set_drm_init_data_cb = + (fun_plusplayer_set_drm_init_data_cb)LoadFunction( + "plusplayer_set_drm_init_data_cb"); + function_pointers_.set_adaptive_streaming_control_event_cb = + (fun_plusplayer_set_adaptive_streaming_control_event_cb)LoadFunction( + "plusplayer_set_adaptive_streaming_control_event_cb"); + function_pointers_.drm_license_acquired_done = + (fun_plusplayer_drm_license_acquired_done)LoadFunction( + "plusplayer_drm_license_acquired_done"); + function_pointers_.set_subtitle_path = + (fun_plusplayer_set_subtitle_path)LoadFunction( + "plusplayer_set_subtitle_path"); + function_pointers_.set_video_stillmode = + (fun_plusplayer_set_video_stillmode)LoadFunction( + "plusplayer_set_video_stillmode"); + function_pointers_.set_alternative_video_resource = + (fun_plusplayer_set_alternative_video_resource)LoadFunction( + "plusplayer_set_alternative_video_resource"); + function_pointers_.get_foreach_track = + (fun_plusplayer_get_foreach_track)LoadFunction( + "plusplayer_get_foreach_track"); + function_pointers_.get_foreach_active_track = + (fun_plusplayer_get_foreach_active_track)LoadFunction( + "plusplayer_get_foreach_active_track"); + function_pointers_.set_cookie = + (fun_plusplayer_set_cookie)LoadFunction("plusplayer_set_cookie"); + function_pointers_.set_user_agent = + (fun_plusplayer_set_user_agent)LoadFunction( + "plusplayer_set_user_agent"); + function_pointers_.set_resume_time = + (fun_plusplayer_set_resume_time)LoadFunction( + "plusplayer_set_resume_time"); + function_pointers_.is_live_streaming = + (fun_plusplayer_is_live_streaming)LoadFunction( + "plusplayer_is_live_streaming"); + function_pointers_.get_dvr_seekable_range = + (fun_plusplayer_get_dvr_seekable_range)LoadFunction( + "plusplayer_get_dvr_seekable_range"); + function_pointers_.get_current_bandwidth = + (fun_plusplayer_get_current_bandwidth)LoadFunction( + "plusplayer_get_current_bandwidth"); + function_pointers_.set_volume = + (fun_plusplayer_set_volume)LoadFunction("plusplayer_set_volume"); + function_pointers_.set_display_visible = + (fun_plusplayer_set_display_visible)LoadFunction( + "plusplayer_set_display_visible"); + + return true; + } + + private: + bool initialized_; + void* library_handle_; + pthread_mutex_t mutex_; + plusplayer_capi_t function_pointers_; +}; + +static const plusplayer_capi_t* get_plusplayer_functions() { + PlusPlayerLoader& loader = PlusPlayerLoader::GetInstance(); + if (!loader.IsInitialized() && + loader.Initialize() != PLUSPLAYER_ERROR_TYPE_NONE) { + LOG_ERROR("PlusPlayer API not available. Returning nullptr."); + return nullptr; + } + return loader.GetFunctionPointers(); +} + +// PlusPlayer API implementation functions +plusplayer_h plusplayer_create(void) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->create) { + LOG_ERROR("plusplayer_create API loading failed. Returning nullptr."); + return nullptr; + } + return functions->create(); +} + +int plusplayer_open(plusplayer_h handle, const char* uri) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->open) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->open(handle, uri); +} + +int plusplayer_prepare(plusplayer_h handle) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->prepare) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->prepare(handle); +} + +int plusplayer_start(plusplayer_h handle) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->start) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->start(handle); +} + +int plusplayer_stop(plusplayer_h handle) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->stop) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->stop(handle); +} + +int plusplayer_close(plusplayer_h handle) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->close) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->close(handle); +} + +int plusplayer_destroy(plusplayer_h handle) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->destroy) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->destroy(handle); +} + +plusplayer_state_e plusplayer_get_state(plusplayer_h handle) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_state) { + return (plusplayer_state_e)(-1); + } + return functions->get_state(handle); +} + +int plusplayer_set_display(plusplayer_h handle, plusplayer_display_type_e type, + void* window) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_display) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_display(handle, type, window); +} + +int plusplayer_set_display_subsurface(plusplayer_h handle, + plusplayer_display_type_e type, + uint32_t surface_id, + plusplayer_geometry_s roi) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_display_subsurface) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_display_subsurface(handle, type, surface_id, roi); +} + +int plusplayer_set_prepare_async_done_cb( + plusplayer_h handle, plusplayer_prepare_async_done_cb prepare_async_done_cb, + void* userdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_prepare_async_done_cb) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_prepare_async_done_cb(handle, prepare_async_done_cb, + userdata); +} + +int plusplayer_set_resource_conflicted_cb( + plusplayer_h handle, + plusplayer_resource_conflicted_cb resource_conflicted_cb, void* userdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_resource_conflicted_cb) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_resource_conflicted_cb(handle, resource_conflicted_cb, + userdata); +} + +int plusplayer_set_eos_cb(plusplayer_h handle, plusplayer_eos_cb eos_cb, + void* userdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_eos_cb) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_eos_cb(handle, eos_cb, userdata); +} + +int plusplayer_set_buffer_status_cb( + plusplayer_h handle, plusplayer_buffer_status_cb buffer_status_cb, + void* userdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_buffer_status_cb) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_buffer_status_cb(handle, buffer_status_cb, userdata); +} + +int plusplayer_set_error_cb(plusplayer_h handle, plusplayer_error_cb error_cb, + void* userdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_error_cb) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_error_cb(handle, error_cb, userdata); +} + +int plusplayer_set_error_msg_cb(plusplayer_h handle, + plusplayer_error_msg_cb error_msg_cb, + void* userdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_error_msg_cb) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_error_msg_cb(handle, error_msg_cb, userdata); +} + +int plusplayer_set_seek_done_cb(plusplayer_h handle, + plusplayer_seek_done_cb seek_done_cb, + void* userdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_seek_done_cb) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_seek_done_cb(handle, seek_done_cb, userdata); +} + +int plusplayer_set_subtitle_updated_cb( + plusplayer_h handle, plusplayer_subtitle_updated_cb subtitle_updated_cb, + void* userdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_subtitle_updated_cb) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_subtitle_updated_cb(handle, subtitle_updated_cb, + userdata); +} + +int plusplayer_set_ad_event_cb(plusplayer_h handle, + plusplayer_ad_event_cb ad_event_cb, + void* userdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_ad_event_cb) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_ad_event_cb(handle, ad_event_cb, userdata); +} + +int plusplayer_prepare_async(plusplayer_h handle) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->prepare_async) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->prepare_async(handle); +} + +int plusplayer_pause(plusplayer_h handle) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->pause) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->pause(handle); +} + +int plusplayer_resume(plusplayer_h handle) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->resume) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->resume(handle); +} + +int plusplayer_seek(plusplayer_h handle, uint64_t time) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->seek) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->seek(handle, time); +} + +void plusplayer_set_prebuffer_mode(plusplayer_h handle, bool prebuffer_mode) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (functions && functions->set_prebuffer_mode) { + functions->set_prebuffer_mode(handle, prebuffer_mode); + } +} + +int plusplayer_set_app_id(plusplayer_h handle, const char* app_id) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_app_id) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_app_id(handle, app_id); +} + +int plusplayer_suspend(plusplayer_h handle) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->suspend) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->suspend(handle); +} + +int plusplayer_restore(plusplayer_h handle, plusplayer_state_e target_state) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->restore) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->restore(handle, target_state); +} + +int plusplayer_get_playing_time(plusplayer_h handle, uint64_t* cur_time_ms) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_playing_time) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_playing_time(handle, cur_time_ms); +} + +int plusplayer_set_display_mode(plusplayer_h handle, + plusplayer_display_mode_e mode) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_display_mode) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_display_mode(handle, mode); +} + +int plusplayer_set_display_roi(plusplayer_h handle, plusplayer_geometry_s roi) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_display_roi) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_display_roi(handle, roi); +} + +int plusplayer_set_display_rotation( + plusplayer_h handle, plusplayer_display_rotation_type_e rotation) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_display_rotation) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_display_rotation(handle, rotation); +} + +int plusplayer_set_buffer_config(plusplayer_h handle, const char* config, + int amount) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_buffer_config) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_buffer_config(handle, config, amount); +} + +int plusplayer_get_duration(plusplayer_h handle, int64_t* duration_ms) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_duration) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_duration(handle, duration_ms); +} + +int plusplayer_set_playback_rate(plusplayer_h handle, + const double playback_rate) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_playback_rate) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_playback_rate(handle, playback_rate); +} + +int plusplayer_deactivate_track(plusplayer_h handle, + plusplayer_track_type_e track_type) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->deactivate_track) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->deactivate_track(handle, track_type); +} + +int plusplayer_activate_track(plusplayer_h handle, + plusplayer_track_type_e track_type) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->activate_track) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->activate_track(handle, track_type); +} + +int plusplayer_set_property(plusplayer_h handle, plusplayer_property_e property, + const char* value) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_property) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_property(handle, property, value); +} + +int plusplayer_get_property(plusplayer_h handle, plusplayer_property_e property, + char** value) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_property) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_property(handle, property, value); +} + +int plusplayer_get_track_count(plusplayer_h handle, + plusplayer_track_type_e track_type, int* count) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_count) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_count(handle, track_type, count); +} + +int plusplayer_select_track(plusplayer_h handle, plusplayer_track_type_e type, + int index) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->select_track) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->select_track(handle, type, index); +} + +const char* plusplayer_get_track_language_code(plusplayer_h handle, + plusplayer_track_type_e type, + int index) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_language_code) { + return nullptr; + } + return functions->get_track_language_code(handle, type, index); +} + +int plusplayer_set_app_info(plusplayer_h handle, + const plusplayer_app_info_s* app_info) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_app_info) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_app_info(handle, app_info); +} + +int plusplayer_set_drm(plusplayer_h handle, + plusplayer_drm_property_s drm_property) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_drm) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_drm(handle, drm_property); +} + +int plusplayer_set_drm_init_data_cb( + plusplayer_h handle, plusplayer_drm_init_data_cb drm_init_data_callback, + void* userdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_drm_init_data_cb) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_drm_init_data_cb(handle, drm_init_data_callback, + userdata); +} + +int plusplayer_set_adaptive_streaming_control_event_cb( + plusplayer_h handle, + plusplayer_adaptive_streaming_control_event_cb + adaptive_streaming_control_event_cb, + void* userdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_adaptive_streaming_control_event_cb) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_adaptive_streaming_control_event_cb( + handle, adaptive_streaming_control_event_cb, userdata); +} + +int plusplayer_drm_license_acquired_done(plusplayer_h handle, + plusplayer_track_type_e track_type) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->drm_license_acquired_done) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->drm_license_acquired_done(handle, track_type); +} + +int plusplayer_set_subtitle_path(plusplayer_h handle, const char* uri) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_subtitle_path) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_subtitle_path(handle, uri); +} + +int plusplayer_set_video_stillmode(plusplayer_h handle, + plusplayer_still_mode_e stillmode) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_video_stillmode) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_video_stillmode(handle, stillmode); +} + +int plusplayer_set_alternative_video_resource(plusplayer_h handle, + unsigned int rsc_type) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_alternative_video_resource) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_alternative_video_resource(handle, rsc_type); +} + +int plusplayer_get_foreach_track(plusplayer_h handle, + plusplayer_track_cb track_cb, void* userdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_foreach_track) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_foreach_track(handle, track_cb, userdata); +} + +int plusplayer_get_foreach_active_track(plusplayer_h handle, + plusplayer_track_cb track_cb, + void* userdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_foreach_active_track) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_foreach_active_track(handle, track_cb, userdata); +} + +int plusplayer_set_cookie(plusplayer_h handle, const char* cookie) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_cookie) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_cookie(handle, cookie); +} + +int plusplayer_set_user_agent(plusplayer_h handle, const char* user_agent) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_user_agent) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_user_agent(handle, user_agent); +} + +int plusplayer_set_resume_time(plusplayer_h handle, uint64_t resume_time_ms) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_resume_time) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_resume_time(handle, resume_time_ms); +} + +int plusplayer_is_live_streaming(plusplayer_h handle, bool* is_live) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->is_live_streaming) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->is_live_streaming(handle, is_live); +} + +int plusplayer_get_dvr_seekable_range(plusplayer_h handle, + uint64_t* start_time_ms, + uint64_t* end_time_ms) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_dvr_seekable_range) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_dvr_seekable_range(handle, start_time_ms, end_time_ms); +} + +int plusplayer_get_current_bandwidth(plusplayer_h handle, + uint32_t* curr_bandwidth_bps) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_current_bandwidth) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_current_bandwidth(handle, curr_bandwidth_bps); +} + +// Track CAPI implementation functions +int plusplayer_get_track_index(plusplayer_track_h track, int* track_index) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_index) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_index(track, track_index); +} + +int plusplayer_get_track_id(plusplayer_track_h track, int* track_id) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_id) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_id(track, track_id); +} + +int plusplayer_get_track_mimetype(plusplayer_track_h track, + const char** track_mimetype) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_mimetype) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_mimetype(track, track_mimetype); +} + +int plusplayer_get_track_streamtype(plusplayer_track_h track, + const char** track_streamtype) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_streamtype) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_streamtype(track, track_streamtype); +} + +int plusplayer_get_track_container_type(plusplayer_track_h track, + const char** track_containertype) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_container_type) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_container_type(track, track_containertype); +} + +int plusplayer_get_track_type(plusplayer_track_h track, + plusplayer_track_type_e* track_type) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_type) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_type(track, track_type); +} + +int plusplayer_get_track_codec_data(plusplayer_track_h track, + const char** track_codecdata) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_codec_data) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_codec_data(track, track_codecdata); +} + +int plusplayer_get_track_codec_tag(plusplayer_track_h track, + unsigned int* track_codectag) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_codec_tag) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_codec_tag(track, track_codectag); +} + +int plusplayer_get_track_codec_data_len(plusplayer_track_h track, + int* track_codecdatalen) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_codec_data_len) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_codec_data_len(track, track_codecdatalen); +} + +int plusplayer_get_track_width(plusplayer_track_h track, int* track_width) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_width) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_width(track, track_width); +} + +int plusplayer_get_track_height(plusplayer_track_h track, int* track_height) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_height) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_height(track, track_height); +} + +int plusplayer_get_track_maxwidth(plusplayer_track_h track, + int* track_maxwidth) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_maxwidth) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_maxwidth(track, track_maxwidth); +} + +int plusplayer_get_track_maxheight(plusplayer_track_h track, + int* track_maxheight) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_maxheight) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_maxheight(track, track_maxheight); +} + +int plusplayer_get_track_framerate_num(plusplayer_track_h track, + int* track_framerate_num) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_framerate_num) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_framerate_num(track, track_framerate_num); +} + +int plusplayer_get_track_framerate_den(plusplayer_track_h track, + int* track_framerate_den) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_framerate_den) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_framerate_den(track, track_framerate_den); +} + +int plusplayer_get_track_sample_rate(plusplayer_track_h track, + int* track_sample_rate) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_sample_rate) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_sample_rate(track, track_sample_rate); +} + +int plusplayer_get_track_sample_format(plusplayer_track_h track, + int* track_sample_format) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_sample_format) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_sample_format(track, track_sample_format); +} + +int plusplayer_get_track_channels(plusplayer_track_h track, + int* track_channels) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_channels) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_channels(track, track_channels); +} + +int plusplayer_get_track_version(plusplayer_track_h track, int* track_version) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_version) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_version(track, track_version); +} + +int plusplayer_get_track_layer(plusplayer_track_h track, int* track_layer) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_layer) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_layer(track, track_layer); +} + +int plusplayer_get_track_bits_per_sample(plusplayer_track_h track, + int* track_bits_per_sample) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_bits_per_sample) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_bits_per_sample(track, track_bits_per_sample); +} + +int plusplayer_get_track_block_align(plusplayer_track_h track, + int* track_block_align) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_block_align) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_block_align(track, track_block_align); +} + +int plusplayer_get_track_bitrate(plusplayer_track_h track, int* track_bitrate) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_bitrate) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_bitrate(track, track_bitrate); +} + +int plusplayer_get_track_endianness(plusplayer_track_h track, + int* track_endianness) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_endianness) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_endianness(track, track_endianness); +} + +int plusplayer_get_track_is_signed(plusplayer_track_h track, + bool* track_is_signed) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_is_signed) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_is_signed(track, track_is_signed); +} + +int plusplayer_get_track_active(plusplayer_track_h track, bool* track_active) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_active) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_active(track, track_active); +} + +int plusplayer_get_track_lang_code(plusplayer_track_h track, + const char** track_lang_code) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_lang_code) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_lang_code(track, track_lang_code); +} + +int plusplayer_get_track_subtitle_format(plusplayer_track_h track, + const char** track_subtitle_format) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->get_track_subtitle_format) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->get_track_subtitle_format(track, track_subtitle_format); +} + +int plusplayer_set_volume(plusplayer_h handle, int volume) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_volume) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_volume(handle, volume); +} + +int plusplayer_set_display_visible(plusplayer_h handle, bool is_visible) { + const plusplayer_capi_t* functions = get_plusplayer_functions(); + if (!functions || !functions->set_display_visible) { + return PLUSPLAYER_ERROR_TYPE_INVALID_OPERATION; + } + return functions->set_display_visible(handle, is_visible); +} diff --git a/packages/video_player_avplay/tizen/src/video_player_tizen_plugin.cc b/packages/video_player_avplay/tizen/src/video_player_tizen_plugin.cc index 15a228740..943478789 100644 --- a/packages/video_player_avplay/tizen/src/video_player_tizen_plugin.cc +++ b/packages/video_player_avplay/tizen/src/video_player_tizen_plugin.cc @@ -5,6 +5,7 @@ #include "video_player_tizen_plugin.h" #include +#include #include #include #include