Documentation added.
This commit is contained in:
+31
-2
@@ -58,7 +58,18 @@
|
||||
(hash-ref fmt 'sample-rate "?")
|
||||
(hash-ref fmt 'channels "?")
|
||||
(hash-ref fmt 'bits-per-sample "?")
|
||||
(hash-ref fmt 'total-frames "?"))
|
||||
(hash-ref fmt 'total-frames (hash-ref fmt 'total-samples "?")))
|
||||
"unknown"))
|
||||
|
||||
(define (tag-summary tag-copy)
|
||||
(if (hash? tag-copy)
|
||||
(format "method=~a, success=~a, picture=~a~a"
|
||||
(hash-ref tag-copy 'method "?")
|
||||
(hash-ref tag-copy 'success? "?")
|
||||
(hash-ref tag-copy 'picture? #f)
|
||||
(let ((size (hash-ref tag-copy 'picture-size #f))
|
||||
(mt (hash-ref tag-copy 'picture-mimetype #f)))
|
||||
(if size (format ", ~a bytes, ~a" size mt) "")))
|
||||
"unknown"))
|
||||
|
||||
(define (display-result result)
|
||||
@@ -68,11 +79,26 @@
|
||||
(displayln (format "encoder : ~a" (hash-ref result 'encoder '?)))
|
||||
(displayln (format "input : ~a" (hash-ref result 'input '?)))
|
||||
(displayln (format "output : ~a" (hash-ref result 'output '?)))
|
||||
(displayln (format "frames read : ~a" (hash-ref result 'frames-read '?)))
|
||||
(displayln (format "frames written : ~a" (hash-ref result 'frames-written '?)))
|
||||
(displayln (format "input format : ~a" (format-summary (hash-ref result 'input-format #f))))
|
||||
(displayln (format "output format : ~a" (format-summary (hash-ref result 'output-format #f))))
|
||||
(displayln (format "tag copy : ~a" (tag-summary (hash-ref result 'tag-copy #f))))
|
||||
result)
|
||||
|
||||
(define (make-progress-callback)
|
||||
(define last-pct -1)
|
||||
(lambda (h)
|
||||
(let ((p (hash-ref h 'progress #f)))
|
||||
(when (number? p)
|
||||
(let ((pct (inexact->exact (round (* 100 p)))))
|
||||
(when (not (= pct last-pct))
|
||||
(set! last-pct pct)
|
||||
(printf "\rprogress : ~a%" pct)
|
||||
(flush-output))
|
||||
(when (or (>= pct 100) (eq? (hash-ref h 'phase #f) 'finished))
|
||||
(newline)))))))
|
||||
|
||||
(define (encoder-test input-file output-file encoder settings #:copy-tags? [copy-tags? #t])
|
||||
(let* ((enc (encoder-symbol encoder))
|
||||
(out (if output-file output-file (default-output-file enc))))
|
||||
@@ -81,7 +107,10 @@
|
||||
(displayln (format " -> ~a" out))
|
||||
(displayln (format "encoder : ~a" enc))
|
||||
(displayln (format "settings: ~a" settings))
|
||||
(display-result (audio-encode input-file out settings #:encoder enc #:copy-tags? copy-tags?))))
|
||||
(display-result (audio-encode input-file out settings
|
||||
#:encoder enc
|
||||
#:copy-tags? copy-tags?
|
||||
#:progress-callback (make-progress-callback)))))
|
||||
|
||||
(define (encoder-test-opus [input-file test-file3]
|
||||
[output-file #f]
|
||||
|
||||
Reference in New Issue
Block a user