Skip to content

Commit

Permalink
Merge pull request #23 from darkxex/master
Browse files Browse the repository at this point in the history
Subtitle Blur Intensity
  • Loading branch information
darkxex authored Feb 8, 2022
2 parents 4a6db8c + 817ac1e commit 4acd8dc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions include/libmpv.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class libMpv{
void setSubPos(int value,bool osd);
void setSubFontSize(int value,bool osd);
void setSubBorderSize(int value,bool osd);
void setSubBorderBlur(double value,bool osd);
void setShadowIntensity(double value,bool osd);
void setShadowOffset(int value,bool osd);
void setSubFontColor(std::string hexcolor);
Expand Down
12 changes: 11 additions & 1 deletion source/UI/playerWindows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace playerWindows{
static float drag_subdelay = 0.0f;
static int drag_subfontsize = 55;
static int drag_subfontbordersize = 3;
static float drag_subborderblur = 0.0f;
static int drag_shadowposition = 1;
static float drag_shadowintensity = 0.25f;

Expand Down Expand Up @@ -640,10 +641,17 @@ namespace playerWindows{
libmpv->setSubBorderSize(drag_subfontbordersize,item.playershowcontrols);
}
//endbordersize
//blursize
ImGui::SetCursorPosX((windowWidth - ImGui::CalcTextSize("Blur Intensity", NULL, true).x) * 0.5f);
ImGui::Text("Blur Intensity");
if(ImGui::DragFloat("Blur Intensity", &drag_subborderblur, 0.050f, 0.0f, 5.0f, "%.2f", ImGuiSliderFlags_NoInput)){
libmpv->setSubBorderBlur(drag_subborderblur,item.playershowcontrols);
}
//endblursize
//shadowintensity
ImGui::SetCursorPosX((windowWidth - ImGui::CalcTextSize("Shadow Intensity", NULL, true).x) * 0.5f);
ImGui::Text("Shadow Intensity");
if(ImGui::DragFloat("Shadow Intensity", &drag_shadowintensity, 0.010f, 0.0f, 1.0f, "%.3f", ImGuiSliderFlags_NoInput)){
if(ImGui::DragFloat("Shadow Intensity", &drag_shadowintensity, 0.010f, 0.0f, 1.0f, "%.2f", ImGuiSliderFlags_NoInput)){
libmpv->setShadowIntensity(drag_shadowintensity,item.playershowcontrols);
}
//shadowintensity
Expand All @@ -669,11 +677,13 @@ namespace playerWindows{
drag_subfontbordersize = 3;
drag_shadowposition = 1;
drag_shadowintensity = 0.25f;
drag_subborderblur = 0.0f;
ignorestyleidx = 0;
mpv_command_string(libmpv->getHandle(),"no-osd set sub-ass yes ; no-osd seek -1");
libmpv->setShadowOffset(drag_shadowposition,false);
libmpv->setShadowIntensity(drag_shadowintensity,false);
libmpv->setSubBorderSize(drag_subfontbordersize,false);
libmpv->setSubBorderBlur(drag_subborderblur,false);
libmpv->setSubPos(drag_subpos,false);
libmpv->setSubDelay(drag_subdelay,false);
libmpv->setSubFontSize(drag_subfontsize,false);
Expand Down
10 changes: 10 additions & 0 deletions source/libmpv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,16 @@ void libMpv::setSubBorderSize(int value,bool osd){
}
}

void libMpv::setSubBorderBlur(double value,bool osd){
if(osd){
std::string cmd = "set sub-blur " + std::to_string(value);
mpv_command_string(handle, cmd.c_str());
}else{
std::string cmd = "no-osd set sub-blur " + std::to_string(value);
mpv_command_string(handle, cmd.c_str());
}
}

void libMpv::setShadowIntensity(double value,bool osd){
if(osd){
std::string cmd = "set sub-shadow-color 0.0/0.0/0.0/" + std::to_string(value);
Expand Down

0 comments on commit 4acd8dc

Please sign in to comment.