Skip to content

Commit

Permalink
refactor(rtsp-output): Removed redundant code.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamscottxu committed Dec 23, 2023
1 parent da8f1f8 commit 4b9009f
Showing 1 changed file with 12 additions and 36 deletions.
48 changes: 12 additions & 36 deletions ui/rtsp_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,20 +293,7 @@ void RtspProperties::LoadConfig(config_t *config) const
{
ui->checkBoxAuto->setChecked(
config_get_bool(config, CONFIG_SECTIION, "AutoStart"));
/*
ui->checkBoxAudioTrack1->setChecked(
config_get_bool(config, CONFIG_SECTIION, "AudioTrack1"));
ui->checkBoxAudioTrack2->setChecked(
config_get_bool(config, CONFIG_SECTIION, "AudioTrack2"));
ui->checkBoxAudioTrack3->setChecked(
config_get_bool(config, CONFIG_SECTIION, "AudioTrack3"));
ui->checkBoxAudioTrack4->setChecked(
config_get_bool(config, CONFIG_SECTIION, "AudioTrack4"));
ui->checkBoxAudioTrack5->setChecked(
config_get_bool(config, CONFIG_SECTIION, "AudioTrack5"));
ui->checkBoxAudioTrack6->setChecked(
config_get_bool(config, CONFIG_SECTIION, "AudioTrack6"));
*/

{
auto tracks =
config_get_uint(config, CONFIG_SECTIION, "AudioTracks");
Expand All @@ -325,27 +312,16 @@ void RtspProperties::SaveConfig(config_t *config) const
return;
config_set_bool(config, CONFIG_SECTIION, "AutoStart",
ui->checkBoxAuto->isChecked());
/*
config_set_bool(config, CONFIG_SECTIION, "AudioTrack1",
ui->checkBoxAudioTrack1->isChecked());
config_set_bool(config, CONFIG_SECTIION, "AudioTrack2",
ui->checkBoxAudioTrack2->isChecked());
config_set_bool(config, CONFIG_SECTIION, "AudioTrack3",
ui->checkBoxAudioTrack3->isChecked());
config_set_bool(config, CONFIG_SECTIION, "AudioTrack4",
ui->checkBoxAudioTrack4->isChecked());
config_set_bool(config, CONFIG_SECTIION, "AudioTrack5",
ui->checkBoxAudioTrack5->isChecked());
config_set_bool(config, CONFIG_SECTIION, "AudioTrack6",
ui->checkBoxAudioTrack6->isChecked());
*/
uint64_t tracks = 0;
tracks |= ui->checkBoxAudioTrack1->isChecked() ? (1 << 0) : 0;
tracks |= ui->checkBoxAudioTrack2->isChecked() ? (1 << 1) : 0;
tracks |= ui->checkBoxAudioTrack3->isChecked() ? (1 << 2) : 0;
tracks |= ui->checkBoxAudioTrack4->isChecked() ? (1 << 3) : 0;
tracks |= ui->checkBoxAudioTrack5->isChecked() ? (1 << 4) : 0;
tracks |= ui->checkBoxAudioTrack6->isChecked() ? (1 << 5) : 0;
config_set_uint(config, CONFIG_SECTIION, "AudioTracks", tracks);

{
uint64_t tracks = 0;
tracks |= ui->checkBoxAudioTrack1->isChecked() ? (1 << 0) : 0;
tracks |= ui->checkBoxAudioTrack2->isChecked() ? (1 << 1) : 0;
tracks |= ui->checkBoxAudioTrack3->isChecked() ? (1 << 2) : 0;
tracks |= ui->checkBoxAudioTrack4->isChecked() ? (1 << 3) : 0;
tracks |= ui->checkBoxAudioTrack5->isChecked() ? (1 << 4) : 0;
tracks |= ui->checkBoxAudioTrack6->isChecked() ? (1 << 5) : 0;
config_set_uint(config, CONFIG_SECTIION, "AudioTracks", tracks);
}
config_save(config);
}

0 comments on commit 4b9009f

Please sign in to comment.