add boot extra video path

Signed-off-by: chenq <chenqiang157@huawei.com>
This commit is contained in:
chenq 2024-01-09 10:09:19 +08:00
parent 2dabf02e24
commit 350bfe0396
5 changed files with 18 additions and 1 deletions

View File

@ -29,6 +29,7 @@ public:
std::string GetSoundUrl();
std::string GetCustomCfgFile();
std::string GetBootVideoPath();
std::string GetBootExtraVideoPath();
int32_t GetRotateScreenId();
int32_t GetRotateDegree();
void ParserCustomCfgFile();

View File

@ -91,6 +91,7 @@ public:
std::string custPicZipPath = {};
std::string custSoundsPath = {};
std::string custVideoPath = {};
std::string custExtraVideoPath = {};
int32_t rotateScreenId = -1;
int32_t rotateDegree = 0;
};

View File

@ -318,8 +318,10 @@ void BootAnimation::PlayVideo()
.userData_ = this,
.callback_ = std::bind(&BootAnimation::CloseVideoPlayer, this),
};
LOGI("PlayVideo setVideo screenId:%{public}d", (int32_t)defaultId_);
bootVideoPlayer_ = std::make_shared<BootVideoPlayer>();
bootVideoPlayer_->SetVideoPath(animationConfig_.GetBootVideoPath());
bootVideoPlayer_->SetVideoPath(
defaultId_ == 0 ? animationConfig_.GetBootVideoPath() : animationConfig_.GetBootExtraVideoPath());
bootVideoPlayer_->SetPlayerSurface(rsSurfaceNode_ ? rsSurfaceNode_->GetSurface() : nullptr);
bootVideoPlayer_->SetCallback(&fcb_);
if (!bootVideoPlayer_->PlayVideo()) {

View File

@ -117,6 +117,14 @@ std::string BootAnimationConfig::GetBootVideoPath()
return custConfig_.custVideoPath;
}
std::string BootAnimationConfig::GetBootExtraVideoPath()
{
if (custConfig_.custExtraVideoPath.empty()) {
return GetBootVideoPath();
}
return custConfig_.custExtraVideoPath;
}
int32_t BootAnimationConfig::GetRotateScreenId()
{
return custConfig_.rotateScreenId;

View File

@ -75,6 +75,11 @@ bool ReadCustomBootConfig(const std::string& path, BootCustomConfig& aniconfig)
aniconfig.custVideoPath = custVideoPath->valuestring;
LOGI("cust video path: %{public}s", aniconfig.custVideoPath.c_str());
}
cJSON* custExtraVideoPath = cJSON_GetObjectItem(overallData, "cust.bootanimation.video.extra");
if (custExtraVideoPath != nullptr && custExtraVideoPath->valuestring != nullptr) {
aniconfig.custExtraVideoPath = custExtraVideoPath->valuestring;
LOGI("cust extra video path: %{public}s", aniconfig.custExtraVideoPath.c_str());
}
cJSON* rotateScreenJson = cJSON_GetObjectItem(overallData, "cust.bootanimation.rotate.screenid");
if (rotateScreenJson != nullptr && rotateScreenJson->valuestring != nullptr) {
aniconfig.rotateScreenId = std::stoi(rotateScreenJson->valuestring);