From 3d65231c425db0d53d95987d9a614e18ebb43e88 Mon Sep 17 00:00:00 2001 From: Victor Arvidsson Date: Thu, 24 Oct 2024 07:26:12 +0200 Subject: [PATCH 1/2] Fixed small bug in replace_all. Start_pos should of course be 0... Signed-off-by: Victor Arvidsson --- core/save-profiledata.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/save-profiledata.cpp b/core/save-profiledata.cpp index 5715c698f..0765baf2a 100644 --- a/core/save-profiledata.cpp +++ b/core/save-profiledata.cpp @@ -47,10 +47,10 @@ static std::string video_time(int secs) return format_string_std("%d:%02d:%02d.000,", hours, mins, secs); } -void replace_all(std::string& str, const std::string& old_value, const std::string& new_value) { +static void replace_all(std::string &str, const std::string &old_value, const std::string &new_value) { if (old_value.empty()) return; - size_t start_pos = std::string::npos; + size_t start_pos = 0; while ((start_pos = str.find(old_value, start_pos)) != std::string::npos) { str.replace(start_pos, old_value.length(), new_value); start_pos += new_value.length(); // In case 'new_value' contains 'old_value', like replacing 'x' with 'yx' From 3655b5c784c69b4633edbcd37240c11a5b1e2df4 Mon Sep 17 00:00:00 2001 From: Victor Arvidsson Date: Thu, 24 Oct 2024 07:39:45 +0200 Subject: [PATCH 2/2] Updated user-maunal with new instructions for subtitles. Signed-off-by: Victor Arvidsson --- Documentation/user-manual.txt | 43 ++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index 8feea6b7f..b22b00b4c 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -1816,15 +1816,52 @@ from the _Media_ tab as well as the dive profile. By right-clicking on a video and selecting the "Save dive data as subtitles" option, a subtitles file with the same name as the video but with an ".ass" extension is created that contains -time dependent dive data (runtime, depth, temperature, NDL, TTS, surface GF) to be overlayed -with the video. The VLC video player automatically finds this file upon playing the video -and overlays the dive data. Alternatively, the ffmpeg video encoder can be used to create a +time dependent dive data to be overlayed with the video. The format of the subtitle is specified +in the _Media preferences_ (_File->Preferences->Media_). The tags used in the format string are +replaced with the actual values, if present, or removed if not present in the data. +The VLC video player automatically finds this file upon playing +the video and overlays the dive data. Alternatively, the ffmpeg video encoder can be used to create a new video file with the dive data encoded in the video stream. To do so run ffmpeg -v video.mp4 -vf "ass=video.ass" video_with_data.mp4 from the command line. You need to have the libass library installed. +Available tags are: +* Dive time: [time] +* Depth: [depth] +* Temperature: [temperature] +* Ceiling: [ceiling] +* NDL: [ndl] +* TTS: [tts] +* RBT: [rbt] +* Stop time: [stoptime] +* Stop depth: [stopdepth] +* CNS: [cns] +* SAC: [sac] +* pO₂: [p_o2] +* pN₂: [p_n2] +* pHe: [p_he] +* O₂ pressure (rebreather): [o2_pressure] +* O₂ setpoint: [o2_setpoint] +* SCR ΔpO₂: [scr_oc_po2] +* MOD: [mod] +* EAD: [ead] +* END: [end] +* EADD: [eadd] +* Vertical speed: [speed] +* In deco (calculated): [in_deco] +* NDL (calculated): [ndl_calc] +* TTS (calculated): [tts_calc] +* Stop time (calculated): [stoptime_calc] +* Stop depth (calculated): [stopdepth_calc] +* Heartrate: [heartrate] +* Bearing: [bearing] +* Surface GF: [surface_gf] +* Current GF: [current_gf] +* Density: [density] +* ICD Warning: [icd_warning] + ==== Media on an external hard disk Most underwater photographers store media on an external drive. If such a drive can be mapped by the operating system (almost always the case) the media can be directly accessed by _Subsurface_. This eases the interaction