From 0c31d21d95a0e537770fb28c8f90a05f55a7569d Mon Sep 17 00:00:00 2001
From: ochibani <11yzyv86j@relay.firefox.com>
Date: Tue, 25 Jun 2024 03:47:10 +0200
Subject: [PATCH] add audio bitrate
---
interfaces/main.ui | 59 +++++++++++++++++++++++++++++++---------
locales/ar.ftl | 5 ++++
locales/ar_YE.ftl | 5 ++++
locales/en.ftl | 7 ++++-
locales/en_US.ftl | 7 ++++-
src/config_management.rs | 1 +
src/ffmpeg_interface.rs | 1 +
src/main.rs | 24 ++++++++++++++--
8 files changed, 92 insertions(+), 17 deletions(-)
diff --git a/interfaces/main.ui b/interfaces/main.ui
index c65e941..d206996 100644
--- a/interfaces/main.ui
+++ b/interfaces/main.ui
@@ -14,11 +14,17 @@
-
diff --git a/locales/ar.ftl b/locales/ar.ftl
index ae37a34..ec39634 100644
--- a/locales/ar.ftl
+++ b/locales/ar.ftl
@@ -10,6 +10,7 @@ address-alessandro-toia = Alessandro Toia
address-alex-benishek = Alex Benishek
address-amerey = Amerey https://github.com/Amereyeu
address-chibani = O.Chibani <11yzyv86j@relay.firefox.com>
+address-hamir-mahal = Hamir Mahal https://github.com/hamirmahal
address-hanny-sabbagh = M.Hanny Sabbagh
address-gmou3 = gmou3 https://github.com/gmou3
address-larry-wei = Larry Wei https://github.com/larryw3i
@@ -35,6 +36,9 @@ apply = طبق
# Area select button
area-chooser = محدد المنطقة
+# Audio bitrate label
+audio-bitrate = B/Audio:
+
# Audio source input
audio-input = مصدر الصوت الافتراضي
@@ -138,6 +142,7 @@ website = الموقع
# Tooltip
about-tooltip = ما يُستَحسَنُ أن تعلمه عن المسجل الأزرق
area-tooltip = يحدد المنطقة المُراد تسجيلها
+audio-bitrate-tooltip = Set audio bitrate in KB/s
audio-source-tooltip = لاختيار مدخل الصوت
audio-tooltip = Mic audio recording
delay-tooltip = مُهلة قبل بدء التسجيل
diff --git a/locales/ar_YE.ftl b/locales/ar_YE.ftl
index ae37a34..ec39634 100644
--- a/locales/ar_YE.ftl
+++ b/locales/ar_YE.ftl
@@ -10,6 +10,7 @@ address-alessandro-toia = Alessandro Toia
address-alex-benishek = Alex Benishek
address-amerey = Amerey https://github.com/Amereyeu
address-chibani = O.Chibani <11yzyv86j@relay.firefox.com>
+address-hamir-mahal = Hamir Mahal https://github.com/hamirmahal
address-hanny-sabbagh = M.Hanny Sabbagh
address-gmou3 = gmou3 https://github.com/gmou3
address-larry-wei = Larry Wei https://github.com/larryw3i
@@ -35,6 +36,9 @@ apply = طبق
# Area select button
area-chooser = محدد المنطقة
+# Audio bitrate label
+audio-bitrate = B/Audio:
+
# Audio source input
audio-input = مصدر الصوت الافتراضي
@@ -138,6 +142,7 @@ website = الموقع
# Tooltip
about-tooltip = ما يُستَحسَنُ أن تعلمه عن المسجل الأزرق
area-tooltip = يحدد المنطقة المُراد تسجيلها
+audio-bitrate-tooltip = Set audio bitrate in KB/s
audio-source-tooltip = لاختيار مدخل الصوت
audio-tooltip = Mic audio recording
delay-tooltip = مُهلة قبل بدء التسجيل
diff --git a/locales/en.ftl b/locales/en.ftl
index d107de0..c660d53 100644
--- a/locales/en.ftl
+++ b/locales/en.ftl
@@ -10,6 +10,7 @@ address-alessandro-toia = Alessandro Toia
address-alex-benishek = Alex Benishek
address-amerey = Amerey https://github.com/Amereyeu
address-chibani = O.Chibani <11yzyv86j@relay.firefox.com>
+address-hamir-mahal = Hamir Mahal https://github.com/hamirmahal
address-hanny-sabbagh = M.Hanny Sabbagh
address-gmou3 = gmou3 https://github.com/gmou3
address-larry-wei = Larry Wei https://github.com/larryw3i
@@ -35,6 +36,9 @@ apply = Apply
# Area select button
area-chooser = Area Chooser
+# Audio bitrate label
+audio-bitrate = B/Audio:
+
# Audio source input
audio-input = Default Input Source
@@ -134,13 +138,14 @@ website = Website
# Tooltip
about-tooltip = Information about Blue Recorder
area-tooltip = Select area to record
+audio-bitrate-tooltip = Set audio bitrate in KB/s
audio-source-tooltip = Select audio source
audio-tooltip = Mic audio recording
delay-tooltip = Delay time before starting record
folder-tooltip = Select storage location
follow-mouse-tooltip = Make the grabbed area follow the mouse
format-tooltip = Select file format
-frames-tooltip = Frames rate
+frames-tooltip = Set frames rate
hide-tooltip = Hide window when start recording
mouse-tooltip = Mouse appears in video recording
video-bitrate-tooltip = Set video bitrate in KB/s
diff --git a/locales/en_US.ftl b/locales/en_US.ftl
index d107de0..c660d53 100644
--- a/locales/en_US.ftl
+++ b/locales/en_US.ftl
@@ -10,6 +10,7 @@ address-alessandro-toia = Alessandro Toia
address-alex-benishek = Alex Benishek
address-amerey = Amerey https://github.com/Amereyeu
address-chibani = O.Chibani <11yzyv86j@relay.firefox.com>
+address-hamir-mahal = Hamir Mahal https://github.com/hamirmahal
address-hanny-sabbagh = M.Hanny Sabbagh
address-gmou3 = gmou3 https://github.com/gmou3
address-larry-wei = Larry Wei https://github.com/larryw3i
@@ -35,6 +36,9 @@ apply = Apply
# Area select button
area-chooser = Area Chooser
+# Audio bitrate label
+audio-bitrate = B/Audio:
+
# Audio source input
audio-input = Default Input Source
@@ -134,13 +138,14 @@ website = Website
# Tooltip
about-tooltip = Information about Blue Recorder
area-tooltip = Select area to record
+audio-bitrate-tooltip = Set audio bitrate in KB/s
audio-source-tooltip = Select audio source
audio-tooltip = Mic audio recording
delay-tooltip = Delay time before starting record
folder-tooltip = Select storage location
follow-mouse-tooltip = Make the grabbed area follow the mouse
format-tooltip = Select file format
-frames-tooltip = Frames rate
+frames-tooltip = Set frames rate
hide-tooltip = Hide window when start recording
mouse-tooltip = Mouse appears in video recording
video-bitrate-tooltip = Set video bitrate in KB/s
diff --git a/src/config_management.rs b/src/config_management.rs
index 3f3efb7..1e21643 100755
--- a/src/config_management.rs
+++ b/src/config_management.rs
@@ -60,6 +60,7 @@ fn default() {
set("default", "hidecheck", "0");
set("default", "speakercheck", "0");
set("default", "mode", "screen");
+ set("default", "audiobitrate", "0");
}
fn merge_previous_version() -> Option {
diff --git a/src/ffmpeg_interface.rs b/src/ffmpeg_interface.rs
index 05f1651..15ec17d 100644
--- a/src/ffmpeg_interface.rs
+++ b/src/ffmpeg_interface.rs
@@ -41,6 +41,7 @@ pub struct Ffmpeg {
pub temp_video_filename: String,
pub bundle: String,
pub video_record_bitrate: SpinButton,
+ pub audio_record_bitrate: SpinButton,
}
impl Ffmpeg {
diff --git a/src/main.rs b/src/main.rs
index 8714b8b..ff3f59e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -89,6 +89,8 @@ pub fn build_ui(application: &Application) {
let area_set_button: Button = builder.object("area_set_button").unwrap();
let about_button: Button = builder.object("aboutbutton").unwrap();
let about_dialog: AboutDialog = builder.object("about_dialog").unwrap();
+ let audio_bitrate_label: Label = builder.object("audio_bitrate_label").unwrap();
+ let audio_bitrate_spin: SpinButton = builder.object("audio_bitrate").unwrap();
let audio_source_combobox: ComboBoxText = builder.object("audiosource").unwrap();
let audio_source_label: Label = builder.object("audio_source_label").unwrap();
let audio_switch: CheckButton = builder.object("audioswitch").unwrap();
@@ -397,6 +399,8 @@ pub fn build_ui(application: &Application) {
.value().unwrap(), None, &mut vec![]).to_string()));
video_bitrate_spin.set_tooltip_text(Some(&bundle.format_pattern(bundle.get_message("video-bitrate-tooltip").unwrap()
.value().unwrap(), None, &mut vec![]).to_string()));
+ audio_bitrate_spin.set_tooltip_text(Some(&bundle.format_pattern(bundle.get_message("audio-bitrate-tooltip").unwrap()
+ .value().unwrap(), None, &mut vec![]).to_string()));
frames_spin.set_value(
config_management::get("default",
&format!
@@ -418,6 +422,11 @@ pub fn build_ui(application: &Application) {
.parse::()
.unwrap(),
);
+ audio_bitrate_spin.set_value(
+ config_management::get("default", "audiobitrate")
+ .parse::()
+ .unwrap(),
+ );
let _format_chooser_combobox = format_chooser_combobox.clone();
let _frames_spin = frames_spin.clone();
@@ -473,6 +482,12 @@ pub fn build_ui(application: &Application) {
&_format_chooser_combobox.active().unwrap().to_string()),
_video_bitrate_spin.value().to_string().as_str());
});
+ let _audio_bitrate_spin = audio_bitrate_spin.to_owned();
+ audio_bitrate_spin.connect_value_changed(move |_| {
+ config_management::set("default",
+ "audio_bitrate",
+ _audio_bitrate_spin.value().to_string().as_str());
+ });
// Labels
command_label.set_label(&bundle.format_pattern(bundle.get_message("run-command").unwrap()
@@ -483,6 +498,8 @@ pub fn build_ui(application: &Application) {
.value().unwrap(), None, &mut vec![]).to_string());
video_bitrate_label.set_label(&bundle.format_pattern(bundle.get_message("video-bitrate").unwrap()
.value().unwrap(), None, &mut vec![]).to_string());
+ audio_bitrate_label.set_label(&bundle.format_pattern(bundle.get_message("audio-bitrate").unwrap()
+ .value().unwrap(), None, &mut vec![]).to_string());
audio_source_label.set_label(&bundle.format_pattern(bundle.get_message("audio-source").unwrap()
.value().unwrap(), None, &mut vec![]).to_string());
@@ -628,6 +645,7 @@ pub fn build_ui(application: &Application) {
temp_video_filename: String::new(),
bundle: bundle_msg,
video_record_bitrate: video_bitrate_spin,
+ audio_record_bitrate: audio_bitrate_spin,
}));
// Record Button
@@ -731,7 +749,7 @@ pub fn build_ui(application: &Application) {
about_dialog.set_transient_for(Some(&main_window));
about_dialog.set_program_name(Some(&bundle.format_pattern(bundle.get_message("blue-recorder").unwrap()
.value().unwrap(), None, &mut vec![]).to_string()));
- about_dialog.set_version(Some("0.2.0"));
+ about_dialog.set_version(Some("0.3.0"));
about_dialog.set_copyright(Some(&bundle.format_pattern(bundle.get_message("copy-right").unwrap()
.value().unwrap(), None, &mut vec![]).to_string()));
about_dialog.set_wrap_license(true);
@@ -749,13 +767,15 @@ pub fn build_ui(application: &Application) {
.value().unwrap(), None, &mut vec![]).to_string(),
&bundle.format_pattern(bundle.get_message("address-chibani").unwrap()
.value().unwrap(), None, &mut vec![]).to_string(),
+ &bundle.format_pattern(bundle.get_message("address-hamir-mahal").unwrap()
+ .value().unwrap(), None, &mut vec![]).to_string(),
&bundle.format_pattern(bundle.get_message("address-hanny-sabbagh").unwrap()
.value().unwrap(), None, &mut vec![]).to_string(),
&bundle.format_pattern(bundle.get_message("address-salem-yaslem").unwrap()
.value().unwrap(), None, &mut vec![]).to_string(),
&bundle.format_pattern(bundle.get_message("address-suliman-altassan").unwrap()
.value().unwrap(), None, &mut vec![]).to_string(),
- ]
+ ]
);
// Patreon suppoters
about_dialog.add_credit_section(