This commit is contained in:
2026-02-23 19:00:25 +01:00
parent 3439bd8fdc
commit 7807a7a209
3 changed files with 13 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
flac-read
flac-read-meta
flac-stream-state
flac-stop
(all-from-out "flac-definitions.rkt")
kinds
last-buffer last-buf-len
@@ -79,6 +80,7 @@
(define (flac-read handle)
(let* ((ffi-handler (flac-handle-ffi-decoder-handler handle))
(state (ffi-handler 'state)))
(set-flac-handle-stop-reading! handle #f)
(letrec ((reader (lambda (frame-nr)
(let* ((st (ffi-handler 'state)))
(ffi-handler 'process-single)
@@ -88,6 +90,8 @@
(format "Now in state ~a (frame-nr = ~a) (int-state = ~a)"
st frame-nr (ffi-handler 'int-state)))
)
(when (flac-handle-stop-reading handle)
'stopped-reading)
(when (ffi-handler 'has-errno?)
(displayln
(format "Error in stream: ~a" (ffi-handler 'errno)))
@@ -124,5 +128,8 @@
(lambda (meta) (process-meta handle meta)))
(flac-handle-stream-info handle))
#f)))
(define (flac-stop handle)
(set-flac-handle-stop-reading! handle #t))
); end of module

View File

@@ -13,6 +13,8 @@
set-flac-handle-cb-stream-info!
flac-handle-cb-audio
set-flac-handle-cb-audio!
flac-handle-stop-reading
set-flac-handle-stop-reading!
flac-handle->string
@@ -94,6 +96,7 @@
[cb-stream-info #:auto #:mutable]
[cb-audio #:auto #:mutable]
[stream-info #:auto #:mutable]
[stop-reading #:auto #:mutable]
)
#:auto-value #f
;#:transparent