Skip to content

Commit

Permalink
avisynth: Validate downmix option
Browse files Browse the repository at this point in the history
Because... let's maybe not let users make Aegisub call arbitrary
symbols in avisynth.dll/so just by editing the config.json.
  • Loading branch information
arch1t3cht committed Aug 9, 2022
1 parent 55b38f1 commit 53a31f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/audio_provider_avs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ void AvisynthAudioProvider::LoadFromClip(AVSValue clip) {
AVSValue script;

// Convert to one channel
if (OPT_GET("Audio/Downmixer")->GetString() != "None")
script = env->Invoke(OPT_GET("Audio/Downmixer")->GetString().c_str(), clip);
std::string downmixtype = OPT_GET("Audio/Downmixer")->GetString();
if (downmixtype == "ConvertToMono" || downmixtype == "GetLeftChannel" || downmixtype == "GetRightChannel")
script = env->Invoke(downmixtype.c_str(), clip);
else
script = clip;

Expand Down

0 comments on commit 53a31f9

Please sign in to comment.