emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/subed 861cf58b2d 3/3: subed-waveform: Handle files with in


From: ELPA Syncer
Subject: [nongnu] elpa/subed 861cf58b2d 3/3: subed-waveform: Handle files with invalid duration
Date: Wed, 6 Nov 2024 16:01:24 -0500 (EST)

branch: elpa/subed
commit 861cf58b2ddf3ef7688e5122a64344a4406744e5
Author: Sacha Chua <sacha@sachachua.com>
Commit: Sacha Chua <sacha@sachachua.com>

    subed-waveform: Handle files with invalid duration
    
    * subed/subed-waveform.el (subed-waveform-file-duration-ms):
    Add a warning when the file does not report duration.
---
 subed/subed-waveform.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/subed/subed-waveform.el b/subed/subed-waveform.el
index 66fce8b7a5..3ed7ac6209 100644
--- a/subed/subed-waveform.el
+++ b/subed/subed-waveform.el
@@ -344,6 +344,7 @@ Example:
 
 (defun subed-waveform-file-duration-ms (&optional filename)
   "Return the duration of FILENAME in milliseconds."
+  (setq filename (or filename (subed-media-file)))
   (cond
    (subed-waveform-file-duration-ms-cache
     (when (> subed-waveform-file-duration-ms-cache 0)
@@ -351,10 +352,12 @@ Example:
    (subed-waveform-ffprobe-executable
     (setq subed-waveform-file-duration-ms-cache
           (subed-waveform-ffprobe-duration-ms
-           (or filename (subed-media-file))))
-    (if (> subed-waveform-file-duration-ms-cache 0)
+           filename))
+    (if (and (numberp subed-waveform-file-duration-ms-cache)
+             (> subed-waveform-file-duration-ms-cache 0))
         subed-waveform-file-duration-ms-cache
       ;; mark as invalid
+      (warn "Could not get file duration for %s" filename)
       (setq subed-waveform-file-duration-ms-cache -1)
       nil))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]