#if BUILDFLAG(IS_TIZEN_TV)
#include "ewk/efl_integration/common/application_type.h"
+#include "media/base/efl/media_player_util_efl.h"
#include "tizen_src/chromium_impl/tizen/tizen_tv_platform.h"
#endif
(media_resource->GetType() == media::MediaResource::Type::KUrl)) {
pre_player_count =
media::MediaPlayerRegistry::GetInstance()->GetMediaPlayers().size();
+
+ if (media::GetScalerCount() >= 4) {
+ LOG(INFO) << "(" << static_cast<void*>(this)
+ << ") tv support 4 scaler, disable mixer mode";
+ disable_mixer_mode_ = true;
+ }
}
#endif
#if BUILDFLAG(IS_TIZEN_TV)
#include <player_product.h>
+#include <tv-resource-manager/rm_resource.h>
#endif
#include <device/power.h>
#endif
}
+int GetScalerCount() {
+#if BUILDFLAG(IS_TIZEN_TV)
+ int count = 0;
+ rm_resource_list_h list;
+ if (rm_get_resource_list(RM_CATEGORY_SCALER_PROGRESSIVE, &list) != RM_OK) {
+ LOG(INFO) << "rm_get_resource_list failed";
+ return count;
+ }
+
+ count = rm_resource_list_get_count(list);
+ LOG(INFO) << "rm_resource_list_get_count:" << count;
+ rm_free_resource_list(list);
+ return count;
+#else
+ return 1;
+#endif
+}
+
} // namespace media
bool accurate,
player_seek_completed_cb callback,
void* user_data);
+int GetScalerCount();
} // namespace media
namespace media {
-VideoPlaneControllerCapi::VideoPlaneControllerCapi(player_h player)
- : player_handle_(player) {}
+VideoPlaneControllerCapi::VideoPlaneControllerCapi(
+ MediaPlayerBridgeCapi* player)
+ : player_(player) {}
VideoPlaneControllerCapi::~VideoPlaneControllerCapi() {}
int VideoPlaneControllerCapi::Initialize() {
int ret = PLAYER_ERROR_NONE;
#if BUILDFLAG(IS_TIZEN_TV)
- ret = player_set_display_mode(player_handle_, PLAYER_DISPLAY_MODE_DST_ROI);
+ if (!player_) {
+ LOG(INFO) << "player is destroyed";
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+ player_h player_handle = player_->GetPlayerHandle();
+
+ ret = player_set_display_mode(player_handle, PLAYER_DISPLAY_MODE_DST_ROI);
if (ret != PLAYER_ERROR_NONE)
return ret;
int VideoPlaneControllerCapi::SetVideoRect(const gfx::RectF& rect) {
int ret = PLAYER_ERROR_NONE;
#if BUILDFLAG(IS_TIZEN_TV)
- ret = player_set_display_roi_area(player_handle_, rect.x(), rect.y(),
+ if (!player_) {
+ LOG(INFO) << "player is destroyed";
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+ player_h player_handle = player_->GetPlayerHandle();
+
+ ret = player_set_display_roi_area(player_handle, rect.x(), rect.y(),
rect.width(), rect.height());
- if (is_multi_video_) {
+ if (is_multi_video_ && !player_->Is4thVideo()) {
int mix_ret = player_video_mixer_set_displayarea(
- player_handle_, 0, 0, rect.x(), rect.y(), rect.width(), rect.height());
+ player_handle, 0, 0, rect.x(), rect.y(), rect.width(), rect.height());
LOG(INFO) << "[MIXER] mixer_displayarea : (" << rect.x() << ", " << rect.y()
- << ", " << rect.width() << ", " << rect.height() << ")";
+ << ", " << rect.width() << ", " << rect.height() << ")"
+ << ", player id:" << player_->GetPlayerId();
if (mix_ret != PLAYER_ERROR_NONE)
LOG(ERROR) << "[MIXER] player_video_mixer_set_displayarea, ret ="
<< mix_ret;
int VideoPlaneControllerCapi::PlayerSetCropRatio(const gfx::RectF& rect) {
int ret = PLAYER_ERROR_NONE;
#if BUILDFLAG(IS_TIZEN_TV)
+ if (!player_) {
+ LOG(INFO) << "player is destroyed";
+ return PLAYER_ERROR_INVALID_OPERATION;
+ }
+ player_h player_handle = player_->GetPlayerHandle();
+
LOG(INFO) << "crop_ratio : (" << rect.x() << ", " << rect.y() << ", "
- << rect.width() << ", " << rect.height() << ")";
+ << rect.width() << ", " << rect.height() << ")"
+ << ", player id:" << player_->GetPlayerId();
- ret = player_set_crop_ratio(player_handle_, rect.x(), rect.y(), rect.width(),
+ ret = player_set_crop_ratio(player_handle, rect.x(), rect.y(), rect.width(),
rect.height());
#endif
return ret;
player_state_e VideoPlaneControllerCapi::GetPlayerState() {
player_state_e state = PLAYER_STATE_NONE;
- player_get_state(player_handle_, &state);
+ if (!player_) {
+ LOG(INFO) << "player is destroyed";
+ return state;
+ }
+ player_h player_handle = player_->GetPlayerHandle();
+ player_get_state(player_handle, &state);
return state;
}
}
void VideoPlaneControllerCapi::SetDisplayRotation(int rotation_degree) {
+ if (!player_) {
+ LOG(INFO) << "player is destroyed";
+ return;
+ }
+ player_h player_handle = player_->GetPlayerHandle();
+
int ret = PLAYER_ERROR_NONE;
player_display_rotation_e screen_rotation =
static_cast<player_display_rotation_e>(
ConvertToPlayerDisplayRotation(rotation_degree));
#if BUILDFLAG(IS_TIZEN_TV)
- if (is_multi_video_) {
+ if (is_multi_video_ && !player_->Is4thVideo()) {
LOG(INFO) << "[MIXER] this: " << this << ", rotation : " << rotation_degree
- << ", video rotate angle : " << screen_rotation;
+ << ", video rotate angle : " << screen_rotation
+ << ", player id:" << player_->GetPlayerId();
player_video_mixer_set_position_of_mixedframe(
- player_handle_, DEPRECATED_PARAM, 0, 0, MIXER_SCREEN_WIDTH,
+ player_handle, DEPRECATED_PARAM, 0, 0, MIXER_SCREEN_WIDTH,
MIXER_SCREEN_HEIGHT);
if (screen_rotation == PLAYER_DISPLAY_ROTATION_90 ||
screen_rotation == PLAYER_DISPLAY_ROTATION_270) {
ret = player_video_mixer_set_resolution_of_mixedframe(
- player_handle_, DEPRECATED_PARAM, MIXER_SCREEN_HEIGHT,
+ player_handle, DEPRECATED_PARAM, MIXER_SCREEN_HEIGHT,
MIXER_SCREEN_WIDTH);
} else {
ret = player_video_mixer_set_resolution_of_mixedframe(
- player_handle_, DEPRECATED_PARAM, MIXER_SCREEN_WIDTH,
+ player_handle, DEPRECATED_PARAM, MIXER_SCREEN_WIDTH,
MIXER_SCREEN_HEIGHT);
}
if (ret != PLAYER_ERROR_NONE) {
#endif
player_display_rotation_e rotation = PLAYER_DISPLAY_ROTATION_NONE;
- ret = player_get_display_rotation(player_handle_, &rotation);
+ ret = player_get_display_rotation(player_handle, &rotation);
+ LOG(INFO) << "player_get_display_rotation:" << rotation
+ << ", player id:" << player_->GetPlayerId();
+
if (ret == PLAYER_ERROR_NONE && screen_rotation != rotation) {
LOG(INFO) << "current player rotate angle : " << rotation
<< " , video should rotate angle : " << screen_rotation;
#if BUILDFLAG(IS_TIZEN_TV)
- if (is_multi_video_) {
+ if (is_multi_video_ && !player_->Is4thVideo()) {
ret = player_video_mixer_set_rotation_degree_of_mixedframe(
- player_handle_, 0, screen_rotation);
+ player_handle, 0, screen_rotation);
if (ret != PLAYER_ERROR_NONE) {
LOG(ERROR) << "[MIXER] "
"player_video_mixer_set_rotation_degree_of_mixedframe, "
#endif
{
LOG(INFO) << "Display rotation sets with " << screen_rotation;
- ret = player_set_display_rotation(player_handle_, screen_rotation);
- if (ret != PLAYER_ERROR_NONE) {
+ ret = player_set_display_rotation(player_handle, screen_rotation);
+ if (ret != PLAYER_ERROR_NONE)
LOG(ERROR) << "Cannot set display rotation : "
<< GetErrorString(static_cast<player_error_e>(ret));
- }
}
}
}
}
int VideoPlaneControllerCapi::ConvertToPlayerDisplayRotation(int rotation) {
-#if BUILDFLAG(IS_TIZEN_TV)
- bool video_counter_rotation = false;
- if (!is_multi_video_) {
- video_counter_rotation = true;
- }
-#endif
-
switch (rotation) {
#if BUILDFLAG(IS_TIZEN_TV)
case 90:
- return video_counter_rotation ? PLAYER_DISPLAY_ROTATION_270
- : PLAYER_DISPLAY_ROTATION_90;
+ return PLAYER_DISPLAY_ROTATION_270;
case 180:
return PLAYER_DISPLAY_ROTATION_180;
case 270:
- return video_counter_rotation ? PLAYER_DISPLAY_ROTATION_90
- : PLAYER_DISPLAY_ROTATION_270;
+ return PLAYER_DISPLAY_ROTATION_90;
#else
case 90:
return PLAYER_DISPLAY_ROTATION_90;
#pragma GCC diagnostic pop
#include "media/base/tizen/video_plane_controller.h"
+#include "tizen_src/chromium_impl/media/filters/media_player_bridge_capi.h"
namespace media {
class MEDIA_EXPORT VideoPlaneControllerCapi : public VideoPlaneController {
public:
- VideoPlaneControllerCapi(player_h player);
+ VideoPlaneControllerCapi(MediaPlayerBridgeCapi* player);
~VideoPlaneControllerCapi() override;
bool is_multi_video_{false};
#endif
- player_h player_handle_;
+ MediaPlayerBridgeCapi* player_;
};
} // namespace media
// browser support 1 video and 1 audio at most.
// Reason : browser cannot support mixer mode, scroll function
// has some issue when browser in mixer mode(video shows issue).
- count = 3;
+
+ // 2024 new requirement to support lfd 4 videos,3 mixer+1 dvde1
+ // or rosep 4 UHD
+ count = 4;
} else if (MediaType::Video == type && IsDualDecodingSupported()) {
count = 2;
} else if (media::IsMultiPlayerSupported()) {
<< __func__ << " is_video_hole : " << is_video_hole;
is_video_hole_ = is_video_hole;
if (is_video_hole_ && player_ && !video_plane_controller_) {
- video_plane_controller_.reset(new VideoPlaneControllerCapi(player_));
+ video_plane_controller_.reset(new VideoPlaneControllerCapi(this));
}
}
bool IsMultiVideo() const override { return false; };
void SetMultiVideo(bool is_multi_video) override{};
+ player_h GetPlayerHandle() { return player_; }
+ virtual bool Is4thVideo() { return false; }
#if defined(TIZEN_VIDEO_HOLE)
void SetVideoHole(bool is_video_hole) override;
player_h MediaPlayerBridgeCapiTV::mixer_player_active_audio_ = 0;
int MediaPlayerBridgeCapiTV::mixer_player_counts_ = 0;
int MediaPlayerBridgeCapiTV::total_player_counts_ = 0;
-int MediaPlayerBridgeCapiTV::mixer_decoder_hw_state_[2] = {NOT_USED, NOT_USED};
+int MediaPlayerBridgeCapiTV::mixer_decoder_state_[3] = {NOT_USED, NOT_USED,
+ NOT_USED};
+int MediaPlayerBridgeCapiTV::scaler_state_[4] = {NOT_USED, NOT_USED, NOT_USED,
+ NOT_USED};
MediaPlayerBridgeCapiTV::MediaPlayerBridgeCapiTV(const GURL& url,
const std::string& user_agent,
Resume();
return;
}
+ // the are 2 method to support 4 videos play
+ // 1. 4 scaler(24 rosep)
+ if (GetScalerCount() >= 4 && !GetTransparent()) {
+ if (scaler_state_[SCALER_MAIN] == NOT_USED) {
+ scaler_state_[SCALER_MAIN] = IN_USED;
+ scaler_type_ = PLAYER_SCALER_MAIN;
+ LOG_ID(INFO, player_id_) << " this: " << this << ",PLAYER_SCALER_MAIN";
+ } else if (scaler_state_[SCALER_SUB] == NOT_USED) {
+ scaler_state_[SCALER_SUB] = IN_USED;
+ scaler_type_ = PLAYER_SCALER_SUB;
+ LOG_ID(INFO, player_id_) << " this: " << this << ",PLAYER_SCALER_SUB";
+ } else if (scaler_state_[SCALER_SUB2] == NOT_USED) {
+ scaler_state_[SCALER_SUB2] = IN_USED;
+ scaler_type_ = PLAYER_SCALER_SUB2;
+ LOG_ID(INFO, player_id_) << " this: " << this << ",PLAYER_SCALER_SUB2";
+ } else if (scaler_state_[SCALER_SUB3] == NOT_USED) {
+ scaler_state_[SCALER_SUB3] = IN_USED;
+ scaler_type_ = PLAYER_SCALER_SUB3;
+ LOG_ID(INFO, player_id_) << " this: " << this << ",PLAYER_SCALER_SUB3";
+ }
+ player_set_fixed_video_scaler(player_, scaler_type_);
- // LFD TV mixer mode
- if (IsMultiVideo()) {
+ if (scaler_type_ != PLAYER_SCALER_MAIN)
+ player_deactivate_stream(player_, PLAYER_STREAM_TYPE_AUDIO);
+ }
+ // 2. LFD TV mixer mode: 3 mixer decoder + 1 dvde1 decoder
+ else if (IsMultiVideo()) {
SetMultiVideoState();
#if defined(TIZEN_VIDEO_HOLE)
if (is_video_hole_) {
- video_plane_controller_->SetDisplayRotation();
video_plane_controller_->SetMultiVideo(true);
+ video_plane_controller_->SetDisplayRotation();
}
#endif
- LOG_ID(INFO, GetPlayerId())
- << "[MIXER] this: " << this << ",mixer mode prepare "
- << ", type :" << mixer_decoder_type_;
- if (HW_MAIN == mixer_decoder_type_) {
- ret = player_video_mixer_open(player_, PLAYER_MIXER_DECODER_HW_MAIN);
- } else if (HW_SUB == mixer_decoder_type_) {
- ret = player_video_mixer_open(player_, PLAYER_MIXER_DECODER_HW_SUB);
- } else {
- ret = player_video_mixer_open(player_, PLAYER_MIXER_DECODER_SW);
- }
- if (ret != PLAYER_ERROR_NONE)
- LOG_ID(ERROR, GetPlayerId())
- << "[MIXER] Mixer open deocder fail,ret:" << ret
- << " , type :" << mixer_decoder_type_;
- else {
- mixer_player_counts_++;
- is_player_mixer_opened_ = true;
+ if (is_4th_video_) {
+ // when the 4th video comes, it use dvde1 decoder and it didn't support
+ // mixer mode
LOG_ID(INFO, GetPlayerId())
- << "[MIXER] mixer mode open , mixer_player_counts_ :"
- << mixer_player_counts_
- << " ; is_player_mixer_opened_ : " << is_player_mixer_opened_;
+ << "the 4th video use dvde1 decoder,this:" << (void*)this;
+ ret = player_set_fixed_video_scaler(player_, PLAYER_SCALER_SUB);
+ if (ret != PLAYER_ERROR_NONE)
+ LOG_ID(ERROR, GetPlayerId())
+ << "|player_set_fixed_video_scaler| failed";
+ ret = player_set_fixed_video_decoder(
+ player_, PLAYER_VIDEO_DECODER_DEDICATE_TRIPLE);
+ if (ret != PLAYER_ERROR_NONE)
+ LOG_ID(ERROR, GetPlayerId())
+ << "|player_set_fixed_video_decoder| failed";
+ } else {
+ LOG_ID(INFO, GetPlayerId())
+ << "[MIXER] this: " << this << ",mixer mode prepare "
+ << ", type :" << mixer_decoder_type_;
+ if (HW_MAIN == mixer_decoder_type_) {
+ ret = player_video_mixer_open(player_, PLAYER_MIXER_DECODER_HW_MAIN);
+ } else if (HW_SUB == mixer_decoder_type_) {
+ ret = player_video_mixer_open(player_, PLAYER_MIXER_DECODER_HW_SUB);
+ } else {
+ ret = player_video_mixer_open(player_, PLAYER_MIXER_DECODER_SW);
+ }
+
+ if (ret != PLAYER_ERROR_NONE)
+ LOG_ID(ERROR, GetPlayerId())
+ << "[MIXER] Mixer open deocder fail,ret:" << ret
+ << " , type :" << mixer_decoder_type_;
+ else {
+ mixer_player_counts_++;
+ is_player_mixer_opened_ = true;
+ LOG_ID(INFO, GetPlayerId())
+ << "[MIXER] mixer mode open , mixer_player_counts_ :"
+ << mixer_player_counts_
+ << " ; is_player_mixer_opened_ : " << is_player_mixer_opened_;
+ }
}
player_deactivate_stream(player_, PLAYER_STREAM_TYPE_AUDIO);
}
player_unset_pes_cb(player_, -999);
#endif
- if (IsMultiVideo()) {
+ if (GetScalerCount() >= 4 && !GetTransparent()) {
+ if (scaler_type_ == PLAYER_SCALER_MAIN)
+ scaler_state_[SCALER_MAIN] = NOT_USED;
+ else if (scaler_type_ == PLAYER_SCALER_SUB)
+ scaler_state_[SCALER_SUB] = NOT_USED;
+ else if (scaler_type_ == PLAYER_SCALER_SUB2)
+ scaler_state_[SCALER_SUB2] = NOT_USED;
+ else if (scaler_type_ == PLAYER_SCALER_SUB3)
+ scaler_state_[SCALER_SUB3] = NOT_USED;
+ } else if (IsMultiVideo()) {
if (player_)
mixer_player_group_[player_index_] = 0;
if (HW_MAIN == mixer_decoder_type_)
- mixer_decoder_hw_state_[HW_MAIN] = NOT_USED;
+ mixer_decoder_state_[HW_MAIN] = NOT_USED;
else if (HW_SUB == mixer_decoder_type_)
- mixer_decoder_hw_state_[HW_SUB] = NOT_USED;
+ mixer_decoder_state_[HW_SUB] = NOT_USED;
+ else if (SW == mixer_decoder_type_)
+ mixer_decoder_state_[SW] = NOT_USED;
if (mixer_player_active_audio_ == player_)
mixer_player_active_audio_ = 0;
}
}
// Video Mixer decoder type selector
- if (mixer_decoder_hw_state_[HW_MAIN] == NOT_USED) {
- mixer_decoder_hw_state_[HW_MAIN] = IN_USED;
+ if (mixer_decoder_state_[HW_MAIN] == NOT_USED) {
+ mixer_decoder_state_[HW_MAIN] = IN_USED;
mixer_decoder_type_ = HW_MAIN;
LOG_ID(INFO, GetPlayerId()) << "[MIXER] Video mixer decoder type: HW-MAIN";
- } else if (mixer_decoder_hw_state_[HW_SUB] == NOT_USED) {
- mixer_decoder_hw_state_[HW_SUB] = IN_USED;
+ } else if (mixer_decoder_state_[HW_SUB] == NOT_USED) {
+ mixer_decoder_state_[HW_SUB] = IN_USED;
mixer_decoder_type_ = HW_SUB;
LOG_ID(INFO, GetPlayerId()) << "[MIXER] Video mixer decoder type: HW-SUB";
- } else {
+ } else if (mixer_decoder_state_[SW] == NOT_USED) {
+ mixer_decoder_state_[SW] = IN_USED;
mixer_decoder_type_ = SW;
LOG_ID(INFO, GetPlayerId()) << "[MIXER] Video mixer decoder type: SW";
+ } else {
+ LOG_ID(INFO, GetPlayerId()) << "the 4th video will use dvde1 decoder";
+ is_4th_video_ = true;
}
}
SW,
};
+enum ScalerType {
+ SCALER_MAIN = 0,
+ SCALER_SUB,
+ SCALER_SUB2,
+ SCALER_SUB3,
+};
+
enum InitDataError {
ERROR_NONE = 0,
NOT_CENC_DATA,
void ActivateCurrentStream(player_stream_type_e stream_type);
bool IsMultiVideo() const override;
void SetMultiVideo(bool is_multi_video) override;
+ bool Is4thVideo() override { return is_4th_video_; }
#if defined(TIZEN_VD_NGA)
void OnAudioPreselectionInfo(
// LFD TV mixer mode
bool is_multi_video_{false};
bool is_player_mixer_opened_{false};
+ bool is_4th_video_{false};
int player_index_{0};
int mixer_decoder_type_{-1};
static player_h mixer_player_group_[kMaxPlayerMixerNum];
- static int mixer_decoder_hw_state_[2];
+ static int mixer_decoder_state_[3];
static int mixer_player_counts_;
static int total_player_counts_;
static player_h mixer_player_active_audio_;
+ player_scaler_type_e scaler_type_;
+ static int scaler_state_[4];
#if defined(TIZEN_VD_NGA)
std::vector<AudioPreselectionInfos> audio_preselection_infos_;