diff --git a/packages/video_player/tizen/inc/ftpw_video_player.h b/packages/video_player/tizen/inc/ftpw_video_player.h new file mode 100644 index 000000000..06c33ae44 --- /dev/null +++ b/packages/video_player/tizen/inc/ftpw_video_player.h @@ -0,0 +1,28 @@ +// Copyright 2026 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_TIZEN_PLUGINS_WRAPPER_VIDEO_PLAYER_H_ +#define FLUTTER_TIZEN_PLUGINS_WRAPPER_VIDEO_PLAYER_H_ + +#include + +typedef enum { + PLAYER_ADAPTIVE_INFO_LIVE_DURATION = 3, + PLAYER_ADAPTIVE_INFO_IS_LIVE = 19, +} player_adaptive_Info_e; + +#ifdef __cplusplus +extern "C" { +#endif + +int ftpw_video_player_player_get_adaptive_streaming_info(void *player, + void *adaptive_info, + int adaptive_type); +int ftpw_video_player_screensaver_reset_timeout(void); +int ftpw_video_player_screensaver_override_reset(bool onoff); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/packages/video_player/tizen/lib/aarch64/libftpw_video_player.so b/packages/video_player/tizen/lib/aarch64/libftpw_video_player.so new file mode 100755 index 000000000..f52f649aa Binary files /dev/null and b/packages/video_player/tizen/lib/aarch64/libftpw_video_player.so differ diff --git a/packages/video_player/tizen/lib/armel/libftpw_video_player.so b/packages/video_player/tizen/lib/armel/libftpw_video_player.so new file mode 100755 index 000000000..d81ae12b5 Binary files /dev/null and b/packages/video_player/tizen/lib/armel/libftpw_video_player.so differ diff --git a/packages/video_player/tizen/lib/i586/libftpw_video_player.so b/packages/video_player/tizen/lib/i586/libftpw_video_player.so new file mode 100755 index 000000000..09af3fa1f Binary files /dev/null and b/packages/video_player/tizen/lib/i586/libftpw_video_player.so differ diff --git a/packages/video_player/tizen/lib/x86_64/libftpw_video_player.so b/packages/video_player/tizen/lib/x86_64/libftpw_video_player.so new file mode 100755 index 000000000..aa5ef1c63 Binary files /dev/null and b/packages/video_player/tizen/lib/x86_64/libftpw_video_player.so differ diff --git a/packages/video_player/tizen/project_def.prop b/packages/video_player/tizen/project_def.prop index e4b3eb48b..fb232a89d 100644 --- a/packages/video_player/tizen/project_def.prop +++ b/packages/video_player/tizen/project_def.prop @@ -18,3 +18,7 @@ USER_CPP_UNDEFS = USER_INC_DIRS = inc src USER_INC_FILES = USER_CPP_INC_FILES = + +# User libraries +USER_LIB_DIRS += lib/${BUILD_ARCH} +USER_LIBS += ftpw_video_player diff --git a/packages/video_player/tizen/src/media_player_proxy.cc b/packages/video_player/tizen/src/media_player_proxy.cc deleted file mode 100644 index 08128faa8..000000000 --- a/packages/video_player/tizen/src/media_player_proxy.cc +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2024 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 "media_player_proxy.h" - -#include - -#include "log.h" - -typedef int (*FuncPlayerGetAdaptiveStreamingInfo)(player_h player, - void* adaptive_info, - int adaptive_type); - -MediaPlayerProxy::MediaPlayerProxy() { - media_player_handle_ = dlopen("libcapi-media-player.so.0", RTLD_LAZY); - if (media_player_handle_ == nullptr) { - LOG_ERROR("Failed to open media player."); - } -} - -MediaPlayerProxy::~MediaPlayerProxy() { - if (media_player_handle_) { - dlclose(media_player_handle_); - media_player_handle_ = nullptr; - } -} - -int MediaPlayerProxy::player_get_adaptive_streaming_info(player_h player, - void* adaptive_info, - int adaptive_type) { - if (!media_player_handle_) { - LOG_ERROR("media_player_handle_ not valid"); - return PLAYER_ERROR_NOT_AVAILABLE; - } - FuncPlayerGetAdaptiveStreamingInfo player_get_adaptive_streaming_info = - reinterpret_cast( - dlsym(media_player_handle_, "player_get_adaptive_streaming_info")); - if (!player_get_adaptive_streaming_info) { - LOG_ERROR("Fail to find player_get_adaptive_streaming_info."); - return PLAYER_ERROR_NOT_AVAILABLE; - } - return player_get_adaptive_streaming_info(player, adaptive_info, - adaptive_type); -} diff --git a/packages/video_player/tizen/src/media_player_proxy.h b/packages/video_player/tizen/src/media_player_proxy.h deleted file mode 100644 index d50b48181..000000000 --- a/packages/video_player/tizen/src/media_player_proxy.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2024 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_MEDIA_PLAYER_PROXY_H_ -#define FLUTTER_PLUGIN_MEDIA_PLAYER_PROXY_H_ - -#include - -typedef enum { - PLAYER_ADAPTIVE_INFO_BITRATE_INIT, - PLAYER_ADAPTIVE_INFO_BITRATE_INIT_NUM, - PLAYER_ADAPTIVE_INFO_DURATION, - PLAYER_ADAPTIVE_INFO_LIVE_DURATION, - PLAYER_ADAPTIVE_INFO_AVAILABLE_BITRATES, - PLAYER_ADAPTIVE_INFO_RATE_RETURNED, - PLAYER_ADAPTIVE_INFO_CURRENT_BITRATE, - PLAYER_ADAPTIVE_INFO_GET_BUFFER_SIZE, - PLAYER_ADAPTIVE_INFO_FIXED_BITRATE, - PLAYER_ADAPTIVE_INFO_ADAPTIVE_BITRATE, - PLAYER_ADAPTIVE_INFO_MAX_BYTES, - PLAYER_ADAPTIVE_INFO_DRM_TYPE, - PLAYER_ADAPTIVE_INFO_RATE_REQUESTED, - PLAYER_ADAPTIVE_INFO_AUDIO_TRACK_REQUESTED, - PLAYER_ADAPTIVE_INFO_FORMAT, - PLAYER_ADAPTIVE_INFO_BLOCK, - PLAYER_ADAPTIVE_INFO_MIN_PERCENT, - PLAYER_ADAPTIVE_INFO_MIN_LATENCY, - PLAYER_ADAPTIVE_INFO_MAX_LATENCY, - PLAYER_ADAPTIVE_INFO_IS_LIVE, - PLAYER_ADAPTIVE_INFO_EMIT_SIGNAL, - PLAYER_ADAPTIVE_INFO_LOG_LEVEL, - PLAYER_ADAPTIVE_INFO_CURRENT_BANDWIDTH, - PLAYER_ADAPTIVE_INFO_URL_CUSTOM, - PLAYER_ADAPTIVE_INFO_GET_AUDIO_INFO, - PLAYER_ADAPTIVE_INFO_GET_VIDEO_INFO, - PLAYER_ADAPTIVE_INFO_GET_TEXT_INFO, - PLAYER_ADAPTIVE_INFO_RESUME_TIME, - PLAYER_ADAPTIVE_INFO_AUDIO_INDEX, - PLAYER_ADAPTIVE_INFO_PROXY_SETTING, - PLAYER_ADAPTIVE_INFO_ATSC3_L1_SERVER_TIME, - PLAYER_ADAPTIVE_INFO_VIDEO_FRAMES_DROPPED, - PLAYER_ADAPTIVE_INFO_STREAMING_IS_BUFFERING, - PLAYER_ADAPTIVE_INFO_PRESELECTION_ID, - PLAYER_ADAPTIVE_INFO_URI_TYPE -} player_adaptive_Info_e; - -class MediaPlayerProxy { - public: - MediaPlayerProxy(); - ~MediaPlayerProxy(); - - int player_get_adaptive_streaming_info(player_h player, void* adaptive_info, - int adaptive_type); - - private: - void* media_player_handle_ = nullptr; -}; - -#endif // FLUTTER_PLUGIN_MEDIA_PLAYER_PROXY_H_ diff --git a/packages/video_player/tizen/src/video_player.cc b/packages/video_player/tizen/src/video_player.cc index e1e1ee355..d07c03ad0 100644 --- a/packages/video_player/tizen/src/video_player.cc +++ b/packages/video_player/tizen/src/video_player.cc @@ -4,13 +4,13 @@ #include "video_player.h" -#include #include #include #include #include +#include "ftpw_video_player.h" #include "log.h" #include "video_player_error.h" @@ -82,38 +82,6 @@ FlutterDesktopGpuSurfaceDescriptor *VideoPlayer::ObtainGpuSurface( return gpu_surface_.get(); } -#ifdef TV_PROFILE -void VideoPlayer::InitScreenSaverApi() { - LOG_INFO("[VideoPlayer] InitScreenSaverApi()"); - screensaver_handle_ = dlopen("libcapi-screensaver.so", RTLD_LAZY); - if (!screensaver_handle_) { - LOG_ERROR("[VideoPlayer] dlopen failed: %s", dlerror()); - return; - } - - screensaver_reset_timeout_ = reinterpret_cast( - dlsym(screensaver_handle_, "screensaver_reset_timeout")); - if (!screensaver_reset_timeout_) { - LOG_ERROR("[VideoPlayer] Symbol not found: %s", dlerror()); - return; - } - - ScreensaverOverrideReset screensaver_override_reset = - reinterpret_cast( - dlsym(screensaver_handle_, "screensaver_override_reset")); - if (!screensaver_override_reset) { - LOG_ERROR("[VideoPlayer] Symbol not found: %s", dlerror()); - return; - } - - int ret = screensaver_override_reset(false); - if (ret != 0) { - LOG_ERROR("screensaver_override_reset failed: %s", get_error_message(ret)); - return; - } -} -#endif - VideoPlayer::VideoPlayer(flutter::PluginRegistrar *plugin_registrar, flutter::TextureRegistrar *texture_registrar, const std::string &uri, VideoPlayerOptions &options, @@ -137,8 +105,6 @@ VideoPlayer::VideoPlayer(flutter::PluginRegistrar *plugin_registrar, gpu_surface_ = std::make_unique(); texture_id_ = texture_registrar->RegisterTexture(texture_variant_.get()); - media_player_proxy_ = std::make_unique(); - int ret = player_create(&player_); if (ret != PLAYER_ERROR_NONE) { throw VideoPlayerError("player_create failed", get_error_message(ret)); @@ -231,7 +197,10 @@ VideoPlayer::VideoPlayer(flutter::PluginRegistrar *plugin_registrar, } #ifdef TV_PROFILE - InitScreenSaverApi(); + ret = ftpw_video_player_screensaver_override_reset(false); + if (ret != 0) { + LOG_ERROR("screensaver_override_reset failed: %s", get_error_message(ret)); + } #endif SetUpEventChannel(plugin_registrar->messenger()); } @@ -485,11 +454,6 @@ void VideoPlayer::Dispose() { } #ifdef TV_PROFILE - if (screensaver_handle_) { - dlclose(screensaver_handle_); - screensaver_handle_ = nullptr; - } - if (timer_id_ != 0) { g_source_remove(timer_id_); } @@ -562,8 +526,8 @@ void VideoPlayer::SendInitialized() { } } - // TODO(jsuya): Since media_player_proxy is not supported in Tizen - // profile(common), we cannot know whether the content is live or not. When + // TODO(jsuya): The adaptive streaming API is unavailable on the common + // profile, so we cannot know whether the content is live or not. When // the content is live, duration is always returned as 0, so we check if // duration is 1(Because of we set it to 1 to prevent video_player from // crashing when duration is returned as 0). @@ -597,14 +561,10 @@ void VideoPlayer::SendIsPlayingStateUpdate(bool is_playing) { } #ifdef TV_PROFILE -gboolean VideoPlayer::ResetScreensaverTimeout(gpointer data) { +gboolean VideoPlayer::ResetScreensaverTimeout(gpointer) { LOG_DEBUG("[VideoPlayer] Reset screen saver timeout."); - auto *player = static_cast(data); - if (!player->screensaver_reset_timeout_) { - return G_SOURCE_REMOVE; - } - int ret = player->screensaver_reset_timeout_(); + int ret = ftpw_video_player_screensaver_reset_timeout(); if (ret != 0) { LOG_ERROR("screensaver_reset_timeout failed: %s", get_error_message(ret)); return G_SOURCE_REMOVE; @@ -745,7 +705,7 @@ int64_t VideoPlayer::GetLiveDuration() { std::string live_duration_str = ""; char *live_duration_buff = static_cast(malloc(sizeof(char) * 64)); memset(live_duration_buff, 0, sizeof(char) * 64); - int ret = media_player_proxy_->player_get_adaptive_streaming_info( + int ret = ftpw_video_player_player_get_adaptive_streaming_info( player_, (void *)&live_duration_buff, PLAYER_ADAPTIVE_INFO_LIVE_DURATION); if (ret != PLAYER_ERROR_NONE) { LOG_ERROR("[MediaPlayer] player_get_adaptive_streaming_info failed: %s", @@ -766,7 +726,7 @@ int64_t VideoPlayer::GetLiveDuration() { bool VideoPlayer::IsLive() { int is_live = 0; - int ret = media_player_proxy_->player_get_adaptive_streaming_info( + int ret = ftpw_video_player_player_get_adaptive_streaming_info( player_, &is_live, PLAYER_ADAPTIVE_INFO_IS_LIVE); if (ret != PLAYER_ERROR_NONE) { LOG_ERROR("[MediaPlayer] player_get_adaptive_streaming_info failed: %s", diff --git a/packages/video_player/tizen/src/video_player.h b/packages/video_player/tizen/src/video_player.h index fd7b3097a..af2456e2b 100644 --- a/packages/video_player/tizen/src/video_player.h +++ b/packages/video_player/tizen/src/video_player.h @@ -18,14 +18,10 @@ #include #include -#include "media_player_proxy.h" #include "video_player_options.h" namespace video_player_tizen { -typedef int (*ScreensaverResetTimeout)(void); -typedef int (*ScreensaverOverrideReset)(bool onoff); - class VideoPlayer { public: using SeekCompletedCallback = std::function; @@ -60,9 +56,6 @@ class VideoPlayer { void Initialize(); void SendInitialized(); void SendIsPlayingStateUpdate(bool is_playing); -#ifdef TV_PROFILE - void InitScreenSaverApi(); -#endif static void OnPrepared(void *data); static void OnBuffering(int percent, void *data); @@ -94,7 +87,6 @@ class VideoPlayer { std::unique_ptr> event_sink_; player_h player_ = nullptr; - std::unique_ptr media_player_proxy_ = nullptr; int64_t texture_id_ = -1; std::string uri_; @@ -107,8 +99,6 @@ class VideoPlayer { SeekCompletedCallback on_seek_completed_; #ifdef TV_PROFILE - void *screensaver_handle_ = nullptr; - ScreensaverResetTimeout screensaver_reset_timeout_; guint timer_id_ = 0; #endif