correct the finding of nearest i-frames

the original code used >= or <= as the test, but the code actually
implemented > or <. This causes an ffmpeg error when there is only 1
i-frame between the lower and upper bound.
This commit is contained in:
Leo Butler 2020-07-23 08:07:54 -05:00 committed by Leo Butler
parent 88dcc5b470
commit 306bd7c0ce

View File

@ -196,15 +196,16 @@
(define (mythtv-get-retention-list chanid starttime cut-or-skip)
(apply mythtv-make-concat-list (mysql-get-cut/skip-list chanid starttime cut-or-skip)))
(define (mythtv-find-nearest-i-frame-before/after idx frame-info i test i-frame)
(define (mythtv-find-nearest-i-frame-before/after idx frame-info test i-frame)
(cond ((null? frame-info) i-frame)
(#t
(let ((cpn (fourth (car frame-info))))
(if (test cpn idx) i-frame (mythtv-find-nearest-i-frame-before/after idx (cdr frame-info) cpn test(car frame-info)))))))
(define (mythtv-find-nearest-i-frame-before idx frame-info i)
(mythtv-find-nearest-i-frame-before/after idx frame-info i >= '()))
(define (mythtv-find-nearest-i-frame-after idx frame-info i)
(mythtv-find-nearest-i-frame-before/after idx (reverse frame-info) i <= '()))
(let* ((i-frame (car frame-info))
(cpn (fourth i-frame)))
(if (test cpn idx) i-frame (mythtv-find-nearest-i-frame-before/after idx (cdr frame-info) test i-frame))))))
(define (mythtv-find-nearest-i-frame-before idx frame-info)
(mythtv-find-nearest-i-frame-before/after idx frame-info >= (first frame-info)))
(define (mythtv-find-nearest-i-frame-after idx frame-info)
(mythtv-find-nearest-i-frame-before/after idx (reverse frame-info) <= (last frame-info)))
(define-immutable-record-type recording
(make-recording chanid starttime recorded-table streams-info i-frame-info retain-list)
@ -303,7 +304,7 @@
(#t
(m-c-i-f-i-t-t (cdr indices)
(append times
(list (cons (car (mythtv-find-nearest-i-frame-after (caar indices) i-frame-info 0)) (car (mythtv-find-nearest-i-frame-before (cdar indices) i-frame-info 0)))))))))
(list (cons (car (mythtv-find-nearest-i-frame-after (caar indices) i-frame-info)) (car (mythtv-find-nearest-i-frame-before (cdar indices) i-frame-info)))))))))
(map normalize-times (m-c-i-f-i-t-t indices '()))))
(define (mythtv-recorded-table->metadata rec)
@ -451,6 +452,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MAIN ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (ffmpeg-myth args)
(display args) (newline)
;;(shell-command-to-string #t "printenv") (newline)
(let* ((rgs (read-from-string (cdr args)))
(cmd (eval (car rgs) (interaction-environment)))
(result