(load "/usr/local/slisp/dlna/liveview-info.lsp")(defvar dlnad-area 'pal)

(defvar with-freesat nil)(defvar pfeit-pp-pid nil)

(defun pmt-parser (pmt)(when with-freesat
(let ((header) (firstlp) (secondlp) (esheader) (esdesclp)(stype) (espid) (len) (tag nil) (pid nil) (private))

(setf header (first pmt))(setf firstlp (second pmt))(setf secondlp (third pmt))

(setf private nil)(mapcar
#'(lambda (desc)(when (eq (+ 2 (second desc)) (length desc))(case (first desc)(#x5F
(when (and (eq (nth 1 desc) 4)(eq (nth 2 desc) #x46)(eq (nth 3 desc) #x53)(eq (nth 4 desc) #x41)(eq (nth 5 desc) #x54))(setf private t)))(#xD0
(do ((y 0))((or (>= y (nth 1 desc)) tag))(when (eq (nth (+ 2 y) desc) 2)(setf tag (nth (+ 3 y) desc)))(setf y (+ y 2))))(otherwise
))))
firstlp)(unless private
(setf tag nil))

(mapcar
#'(lambda (eslp)(unless pid
(setf esheader (first eslp))(setf esdesclp (second eslp))(setf stype (first esheader))(setf espid (+ (* (logand (second esheader) #x1F) #x100)(third esheader)))(when (eq stype 5)(setf private nil)(mapcar
#'(lambda (desc)(when (and (eq (+ 2 (second desc)) (length desc))(not pid))(case (first desc)(#x5F
(when (and (eq (nth 1 desc) 4)(eq (nth 2 desc) #x46)(eq (nth 3 desc) #x53)(eq (nth 4 desc) #x41)(eq (nth 5 desc) #x54))(setf private t)))(#xD1
(unless tag
(do ((y 0))((or (>= y (nth 1 desc)) pid))(when (eq (nth (+ 2 y) desc) 2)(setf pid espid))(setf y (+ y 1)))))(#x52
(when (and tag (eq tag (nth 2 desc)))(setf pid espid)(setf private t)))(otherwise))))
esdesclp))

(unless private
(setf pid nil))))
secondlp)

(when (not (eq pid pfeit-pp-pid))(setf pfeit-pp-pid pid)(send-event SC_RES_EIT_PF_PP_PID
4 (if pfeit-pp-pid
pfeit-pp-pid
-1))))))

(svl-watch "surfer-tune-tsl"
#'(lambda (x)(make-event 'sel-tsl-update))
nil)
