(defvar special-prio nil)(defvar base-prio (1- (get-default-prio)))(defvar stream-dir "/stream")(defvar data-dir "/data")(defvar nodirect-mode nil)(defvar mp-msg-pipe nil)(defvar rui-msg-pipe nil)(defvar stream-valid nil)(defvar st-status nil)(defvar need-retry nil)(defvar resume-mark nil)(defvar req-pause nil)(defvar pause-play nil)(defvar stopped t)(defvar stop-mode nil)(defvar current-time nil)(defvar next-flag nil)(defvar loop-flag nil)(defvar last-video-codec nil)(defvar amute-start nil)(defvar play-mode "normal")(defvar content-id nil)(defvar req-content-id nil)(defvar play-speed 100)(defvar trik-speed 100)(defvar skip-seconds nil)(defvar last-skip-seconds nil)(defvar trik-mode nil)(defvar skip-restart nil)(defvar pmt-svcid nil)(defvar req-stream-m-index nil)(defvar req-stream-m-pos nil)(defvar req-stream-s-index nil)(defvar req-stream-s-pts nil)(defvar req-stream-s-pos nil)(defvar stream-s-index nil)(defvar stream-s-pts nil)(defvar stream-s-pos nil)(defvar stream-m-index nil)(defvar stream-m-pos nil)(defvar req-section1-index nil)(defvar req-section1-pos nil)(defvar req-section2-index nil)(defvar req-section2-pos nil)(defvar *player-type* nil)(defvar hdd-mode nil)(defvar dlna-mode nil)(defvar timeshift-mode nil)(defvar navi-mode nil)(defvar chap-navi-mode nil)(defvar disable-resume nil)(defvar play-pause-mode nil)(defvar play-skip-pause-mode nil)(defvar play-retry-mode nil)(defvar play-skip-pause-seconds nil)(defvar req-play-last nil)(defvar delay-stream-flag nil)(defvar content-uri nil)(defvar req-content-uri nil)(defvar content-tsl-key nil)(defvar restart-flag nil)(defvar index-uri nil)(defvar dlna-protocol nil)(defvar seek-time nil)(defvar play-time-buf nil)(defvar play-status-buf nil)(defvar play-error-buf nil)(defvar not-dlnadoc nil)(defvar proxy nil)(defvar proxy-port nil)(defvar content-drm nil)(defvar dlna-disable-tts nil)(defvar dlna-disable-ts nil)(defvar *status-stop* 0)(defvar *status-loading* 1)(defvar *status-playing* 2)(defvar *status-pause* 3)(defvar *event-play-finish* 0)(defvar *event-play-ok* 1)(defvar *event-play-ng* 2)(defvar *event-waiting* 3)(defvar *event-recover* 4)(defvar with-4k nil)(defvar is-4k-fmt nil)(defvar set-4k-dec-p nil)(defvar reopen-for-4k-p nil)(defvar with-multi-play nil)(defmacro check-player (type)
`(if (eq ,type *player-type*)
t
nil))(defmacro check-ca-result ()
`(if (or (check-player 'actvila)(check-player 'hikaritv))(eq (get-ca-result 'ca) 'CA_SATISFIED)
t))(defun is_rtsp_protocol (uri)(and (= (char content-uri 0) #x72)(= (char content-uri 1) #x74)(= (char content-uri 2) #x73)(= (char content-uri 3) #x70)(= (char content-uri 4) #x3a)))(defmacro uhd-format-p (fmt depth)
`(or (> (nth 0 ,fmt) 1920) (> (nth 1 ,fmt) 1088) (> (nth 0, depth) 8) (> (nth 1, depth) 8)))(defmacro set-rui-msg-pipe (fd)
`(setf rui-msg-pipe (register-message 'rui-msg-form
:fd ,fd
:header-size 4
:length-field 4)))(defvar rui-last-event nil)(defun rui-send-event (event)(unless (eq rui-last-event event)(when event
(write-bytes rui-msg-pipe 1000 4 event))(setf rui-last-event event)))(defvar trik-play-info (list nil nil nil nil))(defmacro set-trik-video-pid (pid)
`(setf (nth 0 trik-play-info) ,pid))(defmacro get-trik-video-pid ()
`(nth 0 trik-play-info))(defmacro set-trik-video-codec (codec)
`(setf (nth 1 trik-play-info) ,codec))(defmacro get-trik-video-codec ()
`(nth 1 trik-play-info))(defmacro set-trik-audio-pid (pid)
`(setf (nth 2 trik-play-info) ,pid))(defmacro get-trik-audio-pid ()
`(nth 2 trik-play-info))(defmacro set-trik-audio-format (format)
`(setf (nth 3 trik-play-info) ,format))(defmacro get-trik-audio-format ()
`(nth 3 trik-play-info))(defvar notify-trick-cap nil)(defun send-trick-cap ()(when (and notify-trick-cap (get-stream-trickcap) (not (check-player 'actvila)))(send-trick-cap-info (get-stream-trickcap))(setf notify-trick-cap nil)))(defun send-decode-info (vstat astat))(defvar sinfo (list 'STREAM_TTS_MODE nil nil nil nil nil nil nil nil nil))(defun set-stream-info (dev)(let ((info nil))(setf info (stream-info dev
'stream-type
'video-codec
'audio-codec
'video-pid
'audio-pid
'pcr-pid
'video-streamid
'audio-streamid
'e-emi
'trickcap))(setf sinfo (if info info (list 'STREAM_TTS_MODE nil nil nil nil nil nil nil nil nil)))(send-trick-cap)(case (get-stream-type)(STREAM_PS_MODE
(when (and (get-stream-video-streamid) (get-stream-audio-streamid))(unless (eq req-audio (get-stream-audio-streamid))(when req-audio
(clear-dualmode nil))(setf req-audio (get-stream-audio-streamid)))(let ((vlist) (alist))(setf vlist (list (list (get-stream-video-streamid))))(setf alist (list (list (get-stream-audio-streamid)(get-audio-codec-id (get-stream-audio-codec)))))(send-ps-choice-list vlist alist nil))))(otherwise
))))(defmacro get-stream-type ()
`(nth 0 sinfo))(defmacro get-stream-video-codec ()
`(nth 1 sinfo))(defmacro get-stream-audio-codec ()
`(nth 2 sinfo))(defmacro get-stream-video-pid ()
`(nth 3 sinfo))(defmacro get-stream-audio-pid ()
`(nth 4 sinfo))(defmacro get-stream-pcr-pid ()
`(nth 5 sinfo))(defmacro get-stream-video-streamid ()
`(nth 6 sinfo))(defmacro get-stream-audio-streamid ()
`(nth 7 sinfo))(defmacro get-stream-eemi ()
`(nth 8 sinfo))(defmacro get-stream-trickcap ()
`(nth 9 sinfo))(defmacro pause-resume-capable-p ()
`(if (get-stream-trickcap) (eq (logand (get-stream-trickcap) #x01) #x01) nil))(defmacro play-capable-p (speed)
`(if (eq ,speed 100)
t
(if (get-stream-trickcap)(if (> ,speed 100)(eq (logand (get-stream-trickcap) #x02) #x02)(if (and (> ,speed 0) (< ,speed 100))(eq (logand (get-stream-trickcap) #x10) #x10)(if (<= ,speed -100)(eq (logand (get-stream-trickcap) #x04) #x04)(if (and (< ,speed 0) (> ,speed -100))(eq (logand (get-stream-trickcap) #x20) #x20)(if (= ,speed 0)(eq (logand (get-stream-trickcap) #x01) #x01)
nil)))))
nil)))(defmacro skip-capable-p ()
`(if (get-stream-trickcap) (eq (logand (get-stream-trickcap) #x08) #x08) nil))(defmacro seek-capable-p ()
`(if (get-stream-trickcap) (eq (logand (get-stream-trickcap) #x08) #x08) nil))(defmacro get-period (speed)
`(if (and (<= ,speed 130) (>= ,speed -100))
250
(if dlna-mode
500
100)))(defun set-play-timer (speed)(when (/= speed 0)(set-timer #'(lambda (arg)(send-play-time))
'play-time-timer
nil
nil
(get-period speed))))(defvar *media-env* 'movie)(defun movie-env ()(stop)(device-priority 'video (get-default-prio))(device-priority 'audio (get-default-prio))(setf *media-env* 'movie))(defun movie-p ()(eq *media-env* 'movie))(defun music-env ()(stop)(device-priority 'video base-prio)(device-priority 'audio base-prio)(setf *media-env* 'music))(defun music-p ()(eq *media-env* 'music))(defvar last-video nil)(defvar last-audio nil)(defvar req-video nil)(defvar req-audio nil)(defvar req-dualmode nil)(register-device 'stream-in
"stream-in"
(get-default-prio)
#'(lambda (sig)(case sig
(LOST
(set-owner 'stream-in nil))(AVAILABLE
(set-owner 'stream-in t))(INFO_CHANGE
(set-stream-info 'stream-in)(when (or (check-player 'actvila)(check-player 'hikaritv))(eval-copy-protection))(setf trik-mode nil)(make-event 'trik-mode-off)(if (or (not (get-trik-video-pid))(eq trik-speed 100)(not (or (eq (get-stream-type) 'STREAM_TTS_MODE)(eq (get-stream-type) 'STREAM_TS_MODE))))(if (stream-errno 'stream-in)(progn
(setf req-content-uri nil)(temp-priority)(setf stop-mode nil)(make-event 'request-stop)(video-stop 'video))(set-trik-video-pid nil)(set-trik-video-codec nil)(set-trik-audio-pid nil)(set-trik-audio-format nil)(setf play-mode "resume")(setf seek-time nil)(setf stream-valid nil)(make-event 'stream-change))(when (find-timer 'ppat-reset-timer)(reset-section 'ppat)(make-event 'restart-pat-reset-monitor))(when (find-timer 'ppmt-reset-timer)(reset-section 'ppmt)(make-event 'restart-pmt-reset-monitor))(setf trik-mode t)(make-event 'trik-mode-on)))(DRM_CHANGE
(eval-copy-protection)(when (or (check-player 'actvila)(check-player 'hikaritv))(make-event 'ca-update)))(STREAM_PLAY_OK
(send-play-ok-msg))(STREAM_PLAY_TRICK
(clear-msg)(when play-error-buf
(write-data play-error-buf 'int 0))(rui-send-event (if (eq rui-last-event *event-waiting*) *event-recover* *event-play-ok*))(setf trik-mode nil)(make-event 'trik-mode-off)(when (find-timer 'pat-reset-timer)(reset-section 'pat)(make-event 'restart-pat-reset-monitor))(when (find-timer 'pmt-reset-timer)(reset-section 'pmt)(make-event 'restart-pmt-reset-monitor))(setf trik-mode t)(make-event 'trik-mode-on))(STREAM_STOP
(when dlna-mode
(make-event 'stream-stop)))(STREAM_LIMIT
(when content-id
(setf play-mode "section")(setf loop-flag t)(make-event 'stream-limit)))(STREAM_FINISH
(when content-id
(if need-retry
(progn
(setf need-retry nil)(stream-stop 'stream-in)(stream-skip 'stream-in -4)(stream-open 'stream-in
:mode "last"))(if (if (or (> trik-speed 0) (and req-pause (> last-skip-seconds 0)))(stream-index-next 'stream-in)(stream-index-prev 'stream-in))(progn
(setf seek-time nil)(setf next-flag t))(if play-retry-mode
(progn
(setf delay-stream-flag t)(setf req-play-last t)(set-timer #'(lambda (arg)(setf delay-stream-flag nil)(make-event 'delay-flag-update))
'delay-stream-timer
nil
1
500)(send-finish-event 1))(if (or navi-mode chap-navi-mode)(progn
(stream-index-reset 'stream-in)(when (and req-stream-s-index req-stream-s-pts)(setf play-mode "resume")(setf loop-flag t))(setf next-flag t))(when content-id
(cancel-timer 'play-time-timer)(send-finish-event content-id)(unless disable-resume
(stream-mark-reset 'stream-in))(setf req-content-id nil)))))(temp-priority)(make-event 'stream-finish)))(when dlna-mode
(cancel-timer 'play-time-timer)(send-play-time)(send-finish-event 0)(setf req-content-uri nil)(temp-priority)(setf stop-mode nil)(make-event 'stream-finish)(video-stop 'video)(rui-send-event *event-play-finish*))(when timeshift-mode
(send-finish-event 0)))(STREAM_PLAY_NG
(when dlna-mode
(cancel-timer 'play-time-timer)(let ((errno))(setf errno (stream-errno 'stream-in))(when errno
(setf req-content-uri nil)(temp-priority)(setf stop-mode nil)(make-event 'request-stop)(video-stop 'video)(send-play-ng-msg errno)(write-data play-error-buf 'int errno)(rui-send-event *event-play-ng*)))))(STREAM_PLAY_VALID
(when req-pause
(send-play-time)(if play-skip-pause-seconds
(progn
(setf skip-seconds play-skip-pause-seconds)(setf trik-speed 101)(make-event 'skip-request)(setf play-skip-pause-seconds nil))(pause-action)))(when (and dlna-mode
(not (eq play-speed 100)) (not (eq play-speed 0))(stream-info 'stream-in 'trick-pause))(clear-msg)(when play-error-buf
(write-data play-error-buf 'int 0))(rui-send-event (if (eq rui-last-event *event-waiting*) *event-recover* *event-play-ok*))(setf trik-mode nil)(make-event 'trik-mode-off)(when (find-timer 'ppat-reset-timer)(reset-section 'ppat)(make-event 'restart-pat-reset-monitor))(when (find-timer 'ppmt-reset-timer)(reset-section 'ppmt)(make-event 'restart-pmt-reset-monitor))(send-play-time)(setf trik-mode t)(make-event 'trik-mode-on)))(STREAM_READY
(make-event 'request-play))(STREAM_HDD_FATAL
(temp-priority)(setf st-status sig)(make-event 'hdd-error)(send-hdd-fatal))(STREAM_HDD_HANGUP
(temp-priority)(setf st-status sig)(make-event 'hdd-error)(send-hdd-hangup)))))(register-device 'tsport-in
"tsport"
(get-default-prio)
#'(lambda (sig)(case sig
(LOST
(set-owner 'tsport-in nil))(AVAILABLE
(set-owner 'tsport-in t)))))(register-device 'psi-in
"psi"
(get-default-prio)
#'(lambda (sig)(case sig
(LOST
(set-owner 'psi-in nil))(AVAILABLE
(set-owner 'psi-in t)))))(register-node 'content-fixed
#'(lambda ()(or (and hdd-mode (not delay-stream-flag)
content-id (eq content-id req-content-id) (not next-flag) (not loop-flag))(and dlna-mode (stream-status 'stream-in) (or content-uri content-tsl-key) (eq content-uri req-content-uri) (not next-flag) (not restart-flag))))
#'(lambda ()(unless (eq content-id req-content-id)(setf req-play-last nil)(setf delay-stream-flag nil)(setf content-id req-content-id))(content-fixed-local)(if (movie-p)(unless (eq content-uri req-content-uri)(stream-reset-content 'stream-in)(setf content-uri req-content-uri))(setf content-uri nil))(when hdd-mode
(if (and next-flag (not loop-flag))(progn
(setf stream-s-index nil)(setf stream-s-pos nil)(setf stream-s-pts nil))(setf stream-s-index req-stream-s-index)(setf stream-s-pts req-stream-s-pts)(setf stream-s-pos req-stream-s-pos)(setf stream-m-index req-stream-m-index)(setf stream-m-pos req-stream-m-pos))(setf loop-flag nil))(setf restart-flag nil)(unless (music-p)(setf next-flag nil))(eval-events (list 'request-play 'request-stop 'request-restart 'stream-finish 'delay-flag-update 'stream-limit)))
#'(lambda ()
nil))(register-node 'stream-play
#'(lambda ()
stream-valid)
#'(lambda ()(when (not stream-valid)(setf stream-valid (if hdd-mode
(if req-play-last
(progn
(setf req-play-last nil)(stream-skip 'stream-in -1)(stream-open 'stream-in
:mode "last"))(stream-open 'stream-in
:mode play-mode
:mode nodirect-mode
:seek seek-time
:stream-dir stream-dir
:data-dir data-dir
:stream-index stream-s-index
:stream-pts stream-s-pts
:stream-pos stream-s-pos
:moved-index stream-m-index
:moved-pos stream-m-pos
:content-id content-id
:drm content-drm))(stream-open 'stream-in
:mode play-mode
:seek seek-time
:speed trik-speed
:proxy proxy
:proxy-port proxy-port
:content-uri content-uri
:dlna-protocol dlna-protocol
:not-dlnadoc not-dlnadoc
:index-uri index-uri
:size content-size
:duration content-duration
:drm content-drm
:tsl content-tsl-key)))(if hdd-mode
(if (and (not stream-valid) content-id)(send-finish-event content-id)(when (< trik-speed 0)(setf need-retry t)))(let ((errno))(setf errno (stream-errno 'stream-in))(write-data play-error-buf 'int errno)(when (and (or stream-valid (not errno)) (not (string= play-mode "resume")))(write-data play-status-buf 'int *status-loading*))(if errno
(progn
(send-play-ng-msg errno)(rui-send-event *event-play-ng*))(timeout-count-start *dlna-open-timeout* nil))(when (or stream-valid (not errno) (not (string= play-mode "resume")))(write-data play-status-buf 'int *status-loading*)))(when (or seek-time (string= play-mode "normal"))(setf seek-time nil))(set-stream-info 'stream-in)(when (or (and dlna-disable-tts (eq (get-stream-type) 'STREAM_TTS_MODE))(and dlna-disable-ts (eq (get-stream-type) 'STREAM_TS_MODE)))(setf stream-valid nil)(send-play-ng-msg (stream-errno 'stream-in 'unsupported-format))))(when (or (string= play-mode "resume")(string= play-mode "section"))(setf play-mode "normal")))(eval-events (list 'stream-change)))
#'(lambda ()(when play-status-buf
(write-data play-status-buf 'int *status-stop*))(when (video-pid 'video)(if (or navi-mode chap-navi-mode) (video-stop 'video) (video-pause 'video)))(when (audio-pid 'audio)(audio-stop 'audio))(stream-close 'stream-in)(setf current-time nil)(when stream-valid
(when resume-mark
(stream-mark 'stream-in))(setf stream-valid nil))))(register-node 'play-monitor
#'(lambda ()
t)
#'(lambda ()(when (and hdd-mode play-retry-mode)(set-timer #'(lambda (id)(send-content-time-msg id (stream-content-time 'stream-in)))
'monitor-content-timer
content-id
nil
500))(set-play-timer 100))
#'(lambda ()(cancel-timer 'play-time-timer)(cancel-timer 'monitor-content-timer)))(register-node 'tsport-play
#'(lambda ()(device-source-p 'tsport-in 'stream-in))
#'(lambda ()(tsport-connect 'tsport-in 'stream-in))
#'(lambda ()
nil))(register-node 'trik-mode
#'(lambda ()(and trik-mode (get-video-cp 'video) (get-trik-video-pid) (check-ca-result)))
#'(lambda ()(eval-events (list 'trik-mode-on 'trik-mode-off 'video-cp-update 'ca-update)))
#'(lambda ()(setf trik-mode nil)(setf last-video nil)(setf last-audio nil)(set-trik-video-pid nil)(set-trik-video-codec nil)(set-trik-audio-pid nil)(set-trik-audio-format nil)))(register-node 'play-speed-set
#'(lambda ()(and (eq play-speed trik-speed) (not skip-seconds) stopped (or pause-play (not (eq play-speed 0)))))
#'(lambda ()(when (or skip-seconds (not (eq play-speed trik-speed)) (and req-pause (eq trik-speed 0))(and (or content-uri content-tsl-key)(or (eq (get-stream-type) 'STREAM_TTS_MODE)(eq (get-stream-type) 'STREAM_TS_MODE))))(if (or (check-player 'hikaritv)(is_rtsp_protocol content-uri))(progn
(setf stopped (and (or skip-seconds
(not (eq play-speed trik-speed))(and req-pause (eq trik-speed 0))(stream-block 'stream-in))(stream-stop 'stream-in stop-mode))))(setf stopped (stream-stop 'stream-in stop-mode)))(when skip-seconds
(stream-skip 'stream-in skip-seconds)(unless pause-play
(setf skip-restart t))(setf skip-seconds nil))(setf play-speed trik-speed)(send-play-time)(unless (eq trik-speed 0)(setf pause-play nil))(when dlna-mode
(if (not (eq play-speed 0))(unless err-msg
(timeout-count-start *dlna-play-timeout* t))(timeout-count-stop)))(when (eq play-speed 0)(when play-status-buf
(write-data play-status-buf 'int *status-pause*))(cancel-timer 'play-time-timer))(when hdd-mode
(make-event 'psi-speed-check)))(eval-events (list 'play-speed-change 'skip-request 'stream-stop)))
#'(lambda ()(setf stopped (stream-stop 'stream-in stop-mode))(setf play-speed 100)))(defvar trik-restart nil)(defun trik-restart ()(setf trik-restart t)(make-event 'trik-restart)(setf trik-restart nil)(make-event 'trik-restart))(register-node 'trik-play
#'(lambda ()(not trik-restart))
#'(lambda ()(when play-status-buf
(write-data play-status-buf 'int *status-playing*))(setf need-retry nil)(when dlna-mode
(stream-select 'stream-in
:video (or (get-video-pid 'video) (get-video-streamid 'video))
:audio (or (get-audio-pid 'audio) (get-audio-streamid 'audio))))(when hdd-mode
(video-ext-mask 'video
:mode (get-video-ext 'video)))(when (or (not dlna-mode) (play-capable-p play-speed))(stream-play 'stream-in play-speed))(if (check-player 'hikaritv)(setf stop-mode nil)(setf stop-mode t))(setf last-video-codec (get-trik-video-codec))(set-play-timer play-speed)(eval-events (list 'trik-restart)))
#'(lambda ()))(register-node 'decode-monitor
#'(lambda ()
t)
#'(lambda ()(unless (get-video-result 'video)(set-video-result 'video (video-status 'video)))(unless (get-audio-result 'audio)(set-audio-result 'audio (audio-status 'audio)))(unless play-pause-mode
(video-unmute 'video))(when with-4k
(let ((vfmt) (vdepth))(when (eq (get-video-result 'video) 'DECODE_SUCCESS)(setf vfmt (video-format 'video))(setf vdepth (video-bitdepth 'video))(unless (uhd-format-p vfmt vdepth)(set-av-dec-for-4k-delay nil))(setf is-4k-fmt (uhd-format-p vfmt vdepth)))(when (eq (get-video-result 'video) 'DECODE_ERROR)(when is-4k-fmt
(set-av-dec-for-4k-delay t)))))(when (get-audio-result 'audio)(when (or amute-start (not play-skip-pause-seconds))(audio-unmute 'audio))(send-audio-decode-info (get-audio-result 'audio)))(when (and dlna-mode (get-video-result 'video)(or (not (or (get-audio-pid 'audio) (get-audio-streamid 'audio)))(not (eq trik-speed 100)) (get-audio-result 'audio)))(if (or (eq (get-video-result 'video) 'DECODE_SUCCESS)(eq (get-audio-result 'audio) 'DECODE_SUCCESS))(progn
(clear-msg)(when play-error-buf
(write-data play-error-buf 'int 0))(rui-send-event (if (eq rui-last-event *event-waiting*) *event-recover* *event-play-ok*)))(unless err-msg
(timeout-count-start *dlna-play-timeout* t))(when (or (eq rui-last-event *event-play-ok*)(eq rui-last-event *event-recover*))(rui-send-event *event-waiting*))))(send-decode-info (get-audio-result 'video) (get-audio-result 'audio))(eval-events (list 'video-result-fix 'audio-result-fix 'video-result-update 'audio-result-update 'request-pause 'rui-event-reset)))
#'(lambda ()(send-audio-decode-info nil)(send-decode-info nil nil)(set-video-result 'video nil)(set-audio-result 'audio nil)))(defun eval-copy-protection ()(when (device-open-p 'cp)(if (not (or (eq (get-stream-type) 'STREAM_TTS_MODE)(eq (get-stream-type) 'STREAM_TS_MODE)))(make-event 'eval-cp-nonts)(when (or (and (device-open-p 'ca-out) (eq (cp-create 'cp
:psi 'psi-in
:src 'stream-in
:dst (get-cp-dst 'cp)
:info (get-cp-stream-info 'cp)
:ca 'ca-out
:live-uri follow-live-uri
:umt-ver umt-version
:type (get-cp-svc-type 'cp)
:emi (if hdd-mode (get-cp-emi 'cp) nil)
:e-emi (if dlna-mode (if (get-stream-eemi) (get-stream-eemi) 0) nil)
:request (get-cp-request 'cp)
:cog-mode (get-cp-cog-mode 'cp)
:generation (get-cp-opt-generation 'cp)
:category (get-cp-opt-category 'cp))
t))(eq (cp-create 'cp
:psi 'psi-in
:src 'stream-in
:dst (get-cp-dst 'cp)
:info (get-cp-stream-info 'cp)
:type (get-cp-svc-type 'cp)
:emi (if hdd-mode (get-cp-emi 'cp) nil)
:e-emi (if dlna-mode (if (get-stream-eemi) (get-stream-eemi) 0) nil)
:request (get-cp-request 'cp)
:cog-mode (get-cp-cog-mode 'cp)
:generation (get-cp-opt-generation 'cp)
:category (get-cp-opt-category 'cp))
t))(do-copy-protection)))))(defun eval-copy-protection-nonts ()(when (device-open-p 'cp)(when (eq (cp-create 'cp
:src 'stream-in
:e-emi (if dlna-mode (if (get-stream-eemi) (get-stream-eemi) 0) nil))
t)(do-copy-protection))))(defvar parental-condition t)(defun set-parental-condition (t-or-nil)(unless (eq parental-condition t-or-nil)(setf parental-condition t-or-nil)(make-event 'parental-check)))(register-node 'parental-check
#'(lambda ()
parental-condition)
#'(lambda ()(eval-events (list 'parental-check)))
#'(lambda ()
nil))(register-node 'ca-check
#'(lambda ()(check-ca-result))
#'(lambda ()(when (or (check-player 'actvila)(check-player 'hikaritv))(ca-request 'ca 'psi-in (get-ca-pids 'ca))(set-ca-result 'ca (ca-status 'ca))(eval-copy-protection)(unless (get-ca-result 'ca)(stream-stop 'stream-in)))(eval-events (list 'ca-update)))
#'(lambda ()(when (or (check-player 'actvila)(check-player 'hikaritv))(ca-cancel 'ca))))(register-node 'speed-100
#'(lambda ()(or dlna-mode
(and (or (eq play-speed 100) (eq play-speed 0)) (not skip-restart))))
#'(lambda ()(setf skip-restart nil)(eval-events (list 'psi-speed-check)))
#'(lambda ()
nil))(unregister-node 'video-play)(register-node 'video-play
#'(lambda ()
t)
#'(lambda ()(video-play 'video
:psi (if (or (eq (get-stream-type) 'STREAM_TTS_MODE)(eq (get-stream-type) 'STREAM_TS_MODE)) 'psi-in nil)
:codec (get-video-codec 'video)
:pid (get-video-pid 'video)
:pcr (get-video-pcr 'video)
:streamid (get-video-streamid 'video)
:mode (if (and hdd-mode (eq trik-speed 100)) "sync" "noplay")
:ext (get-video-ext 'video))(when (and dlna-mode
(not (get-audio-pid 'audio))(not (get-audio-streamid 'audio)))(setf trik-mode t)(make-event 'trik-mode-on))(eval-events (list 'video-update 'video-available)))
#'(lambda ()(when (and hdd-mode
(and (not play-pause-mode)(or navi-mode chap-navi-mode)))(video-stop 'video))))(unregister-node 'audio-play)(register-node 'audio-play
#'(lambda ()
t)
#'(lambda ()(audio-play 'audio
:psi (if (or (eq (get-stream-type) 'STREAM_TTS_MODE)(eq (get-stream-type) 'STREAM_TS_MODE)) 'psi-in nil)
:format (get-audio-format 'audio)
:pid (get-audio-pid 'audio)
:pcr (get-audio-pcr 'audio)
:streamid (get-audio-streamid 'audio)
:ext (if (eq (get-stream-type) 'STREAM_MP4_MODE) "raw-payload" nil)
:mode (and amute-start "mute")
:mode (if (and hdd-mode (eq trik-speed 100)) "sync" "noplay")
:dmix-mode (get-audio-dmix-mode 'audio))(setf trik-mode t)(make-event 'trik-mode-on)(eval-events (list 'audio-update 'audio-available)))
#'(lambda ()(when (and (and (not play-pause-mode)(or navi-mode chap-navi-mode))
hdd-mode)(audio-stop 'audio))))(register-node 'device-check
#'(lambda ()(not (and hdd-mode
(or (eq st-status 'STREAM_HDD_FATAL)(eq st-status 'STREAM_HDD_HANGUP)))))
#'(lambda ()(eval-events (list 'hdd-error)))
#'(lambda ()
nil))(register-node 'decoder-ready
#'(lambda ()(or (and (owner-p 'video) (owner-p 'audio))(and (device-source-p 'video 'tsport-in) (device-source-p 'audio 'tsport-in))))
#'(lambda ()(unless (and (device-source-p 'video 'tsport-in) (device-source-p 'audio 'tsport-in))(video-stop 'video)(audio-stop 'audio))(eval-events (list 'video-source-change 'audio-source-change 'video-available 'audio-available)))
#'(lambda ()
nil))(register-node 'ts-stream
#'(lambda ()(or (eq (get-stream-type) 'STREAM_TTS_MODE) (eq (get-stream-type) 'STREAM_TS_MODE)))
#'(lambda ()(eval-events (list 'stream-change)))
#'(lambda ()))(defun reset-section (sym)(section-disable sym)(section-enable sym))(defvar ppmt-*pid* nil)(defvar ppmt-*svcid* nil)(register-section 'ppat
#'(lambda (data)(let ((ptr) (svcid nil) (pid nil))(setf ptr (nthcdr 8 (nth 0 data)))(do ((x 8 (+ x 4)))((or (> x (length (nth 0 data))) pid))(setf svcid (+ (* (first ptr) #x100) (second ptr)))(unless (eq svcid 0)(setf pid (+ (* (logand (third ptr) #x1F) #x100) (fourth ptr))))(setf ptr (nthcdr 4 ptr)))(setf ppmt-*pid* pid)(setf ppmt-*svcid* svcid)(if (get-section-valid 'ppat)(make-event 'ppat-update)(set-section-valid 'ppat t)(make-event 'ppat-valid)))))(register-section 'ppmt
#'(lambda (data)(if (get-section-valid 'ppmt)(make-event 'ppmt-update)(set-section-valid 'ppmt t)(make-event 'ppmt-valid))))(register-node 'ppat-request
#'(lambda ()(get-section-valid 'ppat))
#'(lambda ()(unless (get-section-valid 'ppat)(section-open 'ppat)(section-disable 'ppat)(set-section-pid 'ppat 0)(setf (nth 0 (get-section-filter 'ppat)) 0)(setf (nth 0 (get-section-mask 'ppat)) 0)(section-filter 'ppat
:type "version"
:source 'tsport-in
:pid (get-section-pid 'ppat)
:length (get-section-length 'ppat)
:filter (get-section-filter 'ppat)
:mask (get-section-mask 'ppat)
:elength (get-section-elength 'ppat)
:efilter (get-section-efilter 'ppat)
:emask (get-section-emask 'ppat))(section-enable 'ppat))(eval-events (list 'ppat-valid)))
#'(lambda ()(section-close 'ppat)(set-section-valid 'ppat nil)))(register-node 'ppmt-pid-valid
#'(lambda ()(and ppmt-*pid* ppmt-*svcid*
(eq ppmt-*pid* (get-section-pid 'ppmt))(eq (/ ppmt-*svcid* #x100) (nth 3 (get-section-filter 'ppmt)))(eq (logand ppmt-*svcid* #xFF) (nth 4 (get-section-filter 'ppmt)))))
#'(lambda ()(when ppmt-*pid*
(set-section-pid 'ppmt ppmt-*pid*))(when ppmt-*svcid*
(setf (nth 3 (get-section-filter 'ppmt)) (/ ppmt-*svcid* #x100))(setf (nth 3 (get-section-mask 'ppmt)) 0)(setf (nth 4 (get-section-filter 'ppmt)) (logand ppmt-*svcid* #xFF))(setf (nth 4 (get-section-mask 'ppmt)) 0))(eval-events (list 'ppat-update)))
#'(lambda ()(setf ppmt-*pid* nil)(setf ppmt-*svcid* nil)))(register-node 'ppmt-request
#'(lambda ()(get-section-valid 'ppmt))
#'(lambda ()(unless (get-section-valid 'ppmt)(section-open 'ppmt)(section-disable 'ppmt)(setf (nth 0 (get-section-filter 'ppmt)) 2)(setf (nth 0 (get-section-mask 'ppmt)) 0)(section-filter 'ppmt
:type "version"
:source 'tsport-in
:pid (get-section-pid 'ppmt)
:length (get-section-length 'ppmt)
:filter (get-section-filter 'ppmt)
:mask (get-section-mask 'ppmt)
:elength (get-section-elength 'ppmt)
:efilter (get-section-efilter 'ppmt)
:emask (get-section-emask 'ppmt))(if (section-enable 'ppmt)(cancel-timer 'ppmt-retry-timer)(set-timer #'(lambda (arg)(when (section-enable 'ppmt)(cancel-timer 'ppmt-retry-timer)))
'ppmt-retry-timer
nil
nil
500)))(eval-events (list 'ppmt-valid)))
#'(lambda ()(cancel-timer 'ppmt-retry-timer)(section-close 'ppmt)(set-section-valid 'ppmt nil)))(register-node 'parse-ppmt
#'(lambda ()(psi-status 'psi-in))
#'(lambda (key)(psi-validate 'psi-in 'ppmt)(parse-psi 'psi-in key)(eval-events (list 'ppmt-update)))
#'(lambda (key)(psi-invalidate 'psi-in)(funcall (get-pmt-hook 'psi-in) nil key)))(register-node 'ppat-reset-monitor
#'(lambda ()
t)
#'(lambda ()(when content-uri
(set-timer #'reset-section
'ppat-reset-timer
'ppat
nil
1000))(eval-events (list 'restart-pat-reset-monitor)))
#'(lambda ()(cancel-timer 'ppat-reset-timer)))(register-node 'ppmt-reset-monitor
#'(lambda ()
t)
#'(lambda ()(when content-uri
(set-timer #'reset-section
'ppmt-reset-timer
'ppmt
nil
1000))(eval-events (list 'restart-pmt-reset-monitor)))
#'(lambda ()(cancel-timer 'ppmt-reset-timer)))(register-node 'non-ts-check
#'(lambda ()(and (or (and (get-video-streamid 'video)(get-audio-streamid 'audio))(and (get-video-pid 'video) (get-video-pcr 'video)(and (get-audio-pid 'audio) (get-audio-pcr 'audio))))(get-video-cp 'video) (get-audio-cp 'audio)))
#'(lambda ()(eval-copy-protection-nonts)(case (get-stream-type)(STREAM_PS_MODE
(set-video-codec 'video (get-stream-video-codec))(set-video-streamid 'video (get-stream-video-streamid))(audio-attr 'audio (get-video-codec 'video))(set-audio-format 'audio (get-stream-audio-codec))(set-audio-streamid 'audio (get-stream-audio-streamid))(set-trik-video-codec (get-stream-video-codec))(set-trik-video-pid (get-stream-video-streamid)))(STREAM_MP4_MODE
(set-video-codec 'video (get-stream-video-codec))(set-video-pcr 'video (get-stream-pcr-pid))(set-video-pid 'video (get-stream-video-pid))(audio-attr 'audio (get-video-codec 'video))(set-audio-format 'audio (get-stream-audio-codec))(set-audio-pcr 'audio (get-stream-pcr-pid))(set-audio-pid 'audio (get-stream-audio-pid))(set-trik-video-codec (get-stream-video-codec))(set-trik-video-pid (get-stream-video-pid))))(unless (eq last-video-codec (get-trik-video-codec))(setf stop-mode nil))(eval-events (list 'eval-cp-nonts)))
#'(lambda ()(set-video-pid 'video nil)(set-video-codec 'video nil)(set-video-pcr 'video nil)(set-video-streamid 'video nil)(set-audio-pid 'audio nil)(set-audio-format 'audio nil)(set-audio-streamid 'audio nil)(set-audio-pcr 'audio nil)))(copy-node 'video-play-nonts 'video-play)(copy-node 'audio-play-nonts 'audio-play)(defvar vcnode-id nil)(defun set-vcnode-id (id)(setf vcnode-id id))(defun connect-first ()(my-device-open 'video 0)(my-device-open 'audio 0)(init-video-object 'video)(init-audio-object 'audio))(defvar fix-dec-ch nil)(defun connect-fix-ch (no)(setf fix-dec-ch no)(if (or fix-dec-ch vcnode-id)(progn
(video-config 'video
:use "DISPLAY_MAIN"
:hint vcnode-id)(my-device-open 'video (video-openquery :ch no))(my-device-open 'audio (device-id 'video))(init-video-object 'video)(init-audio-object 'audio))(progn
(connect-first))))(defun connect-fix-ch-4k (no)(setf fix-dec-ch no)(if (or fix-dec-ch vcnode-id)(progn
(video-config 'video
:use "4K"
:hint vcnode-id
:cost 'VIDEO_COST_4K)(my-device-open 'video (video-openquery :ch no))(my-device-open 'audio (device-id 'video))(init-video-object 'video)(init-audio-object 'audio))(progn
(connect-first))))(defvar once-recv-size nil)(defvar busyloop-count-between-recv nil)(defvar ip-protocol nil)(defvar systime_valid nil)(defun buffering-enable ()(stream-config 'stream-in
:buffering-size 1572864
:buffering-timeout 5000
:buffering-time 2000))(defvar multi-play-stream-path nil)(defun connect-multi-play (disp)(let ((psi-no))(case disp
(2
(setf psi-no 10)(setf multi-play-stream-path "memin2"))(1
(setf psi-no 9)(setf multi-play-stream-path "memin1"))(otherwise
(setf psi-no 8)(setf multi-play-stream-path "memin0")))(setf with-multi-play t)(connect-path psi-no)))(defun connect ()(setf with-multi-play nil)(connect-path 1))(defun connect-path (no)(my-device-open 'psi-in no)(my-device-open 'cp nil)(if (and with-multi-play multi-play-stream-path)(my-device-open 'tsport-in multi-play-stream-path)(my-device-open 'tsport-in "memin0"))(my-device-open 'stream-in 'tsport-in)(setf st-status (stream-status 'stream-in))(init-section-object 'ppat)(init-section-object 'ppmt)(init-psi-object 'psi-in #'ppmt-parser)(init-cp-object 'cp)(set-cp-hook 'cp #'(lambda (sig)(when (eq sig 'INFO_CHANGE)(eval-copy-protection))))(case *player-type*
(actvila
(my-device-open 'ca 'stream-in)(init-ca-object 'ca)(stream-config 'stream-in
:nouse-dlna-header t
:actvila t
:ip-protocol ip-protocol
:time-valid systime_valid
:dns-timeout 15
:try-record-num 3
:buffering-size 1572864
:once-recv-size once-recv-size
:busyloop-count-between-recv busyloop-count-between-recv))(netcamera
(stream-config 'stream-in
:nouse-dlna-header t
:buffering-time 2000))(ruiplay
(stream-config 'stream-in
:http-retry-count 3))(otherwise
))(resource-node 'player-resource (list 'stream-in))(append-t
'player-resource
'device-check
'decoder-ready
'content-fixed
'stream-play
'tsport-play
'speed-100
'ts-stream
'ppat-request
'ppmt-pid-valid
'ppmt-request
'parse-ppmt
'parental-check
'ca-check
'display-cp-valid)(append-t
'ppat-request
'ppat-reset-monitor)(append-t
'ppmt-request
'ppmt-reset-monitor)(append-t
'display-cp-valid
'video-pid-valid
'video-play)(append-t
'display-cp-valid
'audio-pid-valid
'audio-play)(append-nil
'ts-stream
'non-ts-check)(append-t
'non-ts-check
'video-play-nonts)(append-t
'non-ts-check
'audio-play-nonts)(unless navi-mode
(stream-trik 'stream-in 'video 'audio)(append-t
'stream-play
'play-monitor)(append-t
'content-fixed
'trik-mode
'play-speed-set)(append-t
'play-speed-set
'trik-play
'decode-monitor))(connect-local *player-type*)(eval-node 'player-resource)(when (boundp 'with-music)(music-connect)))(defun disconnect ()(when (boundp 'with-music)(music-disconnect))(setf stop-mode nil)(cancel-node 'player-resource)(init-node 'player-resource)(my-device-close 'stream-in)(my-device-close 'tsport-in)(my-device-close 'psi-in)(my-device-close 'cp)(my-device-close 'ca)(disconnect-local *player-type*)(setf st-status nil)(setf need-retry nil)(setf resume-mark nil)(setf pause-play nil)(setf stopped t)(setf play-mode "normal")(setf content-id nil)(setf req-content-id nil)(setf play-speed 100)(setf trik-speed 100)(setf skip-seconds nil)(setf last-skip-seconds nil)(setf trik-mode nil)(setf skip-restart nil)(setf pmt-svcid nil)(setf last-video-codec nil)(setf content-uri nil)(setf req-content-uri nil)(setf monitor-content-uri nil)(setf index-uri nil)(setf dlna-protocol nil)(setf seek-time nil)(setf not-dlnadoc nil)(timeout-count-stop)(setf rui-last-event nil)(setf sinfo (list 'STREAM_TTS_MODE nil nil nil nil nil nil nil nil nil)))(defun set-input-digital ())(defun temp-priority ()(when (and special-prio (movie-p))(device-priority 'video special-prio)(device-priority 'audio special-prio)(set-timer #'(lambda (x)(device-priority 'video (get-default-prio))(device-priority 'audio (get-default-prio)))
'temp-priority
nil
1
3000)))(defun switch-hdd-mode ()(setf hdd-mode t)(setf dlna-mode nil)(setf req-content-uri nil))(defun switch-dlna-mode ()(setf hdd-mode nil)(setf dlna-mode t)(setf req-content-id nil))(defun hdd-start-prepare (content okkake drm)(switch-hdd-mode)(temp-priority)(setf last-skip-seconds nil)(setf pause-play nil)(when (eq req-content-id content)(when (or req-section1-index req-section1-pos
req-section2-index req-section2-pos)(reset-play-section))(stream-index-reset 'stream-in)(setf content-id nil))(setf seek-time nil)(setf play-retry-mode (or okkake nil))(setq play-pause-mode nil)(setq play-skip-pause-seconds nil)(setf req-content-id content)(setf content-drm drm)(setf req-section1-index nil)(setf req-section1-pos nil)(setf req-section2-index nil)(setf req-section2-pos nil)(setq req-stream-m-index nil)(setq req-stream-m-pos nil)(setq req-stream-s-index nil)(setq req-stream-s-pts nil)(setq req-stream-s-pos nil))(defun set-proxy (addr port)(setf proxy addr)(setf proxy-port port))(defun dlna-play-start-inner (uri index protocol speed seek)(switch-dlna-mode)(temp-priority)(rui-send-event nil)(setf req-pause nil)(dlna-start-local speed seek)(if (and content-uri seek (eq seek (* (stream-play-time 'stream-in) 1000)))(if (eq trik-speed speed)(make-event 'rui-event-reset)(play speed))(if (and content-uri seek)(setf play-mode "resume")(setf stop-mode nil)(setf play-mode "normal"))(setf trik-speed speed)(setf req-content-uri (if (or (not uri) (string= "(null)" uri) (eq (char uri 0) 0)) nil uri))(setf index-uri (if (or (not index) (string= "(null)" index) (eq (char index 0) 0)) nil index))(setf dlna-protocol (if (or (not protocol) (string= "(null)" protocol) (eq (char protocol 0) 0)) nil protocol))(setf seek-time seek)(setf next-flag t)(make-event 'request-play)(send-play-time)))(defun dlna-next-inner (uri index protocol)(switch-dlna-mode)(temp-priority)(setf req-pause nil)(if (> trik-speed 0)(setf play-mode "normal")(setf play-mode "reverse"))(setf req-content-uri (if (or (not uri) (string= "(null)" uri) (eq (char uri 0) 0)) nil uri))(setf index-uri (if (or (not index) (string= "(null)" index) (eq (char index 0) 0)) nil index))(setf dlna-protocol (if (or (not protocol) (string= "(null)" protocol) (eq (char protocol 0) 0)) nil protocol))(setf seek-time 0)(setf next-flag t)(make-event 'request-play)(send-play-time))(defvar content-size nil)(defvar content-duration nil)(defun dlna-play-start (uri index protocol speed seek)(setf notify-trick-cap t)(setf req-video nil)(setf req-audio nil)(setf req-dualmode nil)(setf content-drm nil)(setf content-size nil)(setf content-duration nil)(dlna-play-start-inner uri index protocol 100 nil))(defun rui-movie-start (uri index protocol speed seek)(unless (movie-p)(movie-env))(setf notify-trick-cap t)(setf req-video nil)(setf req-audio nil)(setf req-dualmode nil)(setf content-drm nil)(setf content-size nil)(setf content-duration nil)(dlna-play-start-inner uri index protocol speed seek))(defun rui-music-start (uri protocol speed seek)(unless (music-p)(music-env))(setf notify-trick-cap t)(setf req-video nil)(setf req-audio nil)(setf req-dualmode nil)(setf content-size nil)(setf content-duration nil)(dlna-play-start-inner uri nil protocol speed seek))(defun stop ()(temp-priority)(setf req-pause nil)(setf stop-mode nil)(if hdd-mode
(progn
(when (or req-section1-index req-section1-pos
req-section2-index req-section2-pos)(reset-play-section))(setf last-skip-seconds nil)(setf req-content-id nil)(unless (or navi-mode chap-navi-mode disable-resume)(setf resume-mark t))(make-event 'request-stop)(video-stop 'video)(stream-index-reset 'stream-in)(setf resume-mark nil))(setf req-content-uri nil)(setf content-drm nil)(setf content-tsl-key nil)(make-event 'request-stop)(video-stop 'video)(stream-reset-content 'stream-in)(stop-local)(clear-dualmode nil)(clear-msg)(if (pause-resume-capable-p)(stream-mark 'stream-in)
0)))(defun stop2 ()(temp-priority)(setf trik-speed 0)(setf stop-mode nil)(make-event 'play-speed-change)(if (pause-resume-capable-p)(stream-mark 'stream-in)
0))(defun play (speed)(when (or (not dlna-mode) (play-capable-p speed))(setf req-pause nil)(unless (eq trik-speed speed)(temp-priority)(make-event 'video-update)(make-event 'audio-update)(if (> speed 0)(setf play-mode "normal")(setf play-mode "reverse"))(setf trik-speed speed)(play-local)(make-event 'play-speed-change))))(defun pause ()(when (or (not dlna-mode) (pause-resume-capable-p))(setf req-pause t)(send-play-time)(when (stream-play-status 'stream-in)(pause-action))))(defun send-play-time ()(let ((tm))(setf tm (stream-play-time 'stream-in))(when tm
(when (and hdd-mode (not current-time) (not timeshift-mode))(send-content-time-msg content-id (stream-content-time 'stream-in)))(setf current-time tm)(if play-time-buf
(write-data play-time-buf 'int (* current-time 1000))(unless timeshift-mode
(if (and hdd-mode content-id)(send-play-time-msg content-id current-time)(send-play-time-msg 0 current-time)))))))(defun pause-action ()(when req-pause
(temp-priority)(setf trik-speed 0)(setf pause-play nil)(when (find-timer 'play-time-timer)(cancel-timer 'play-time-timer))(if play-pause-mode
(send-play-pause-event)(make-event 'play-speed-change))))(defun skip (seconds)(when (or (not dlna-mode) (skip-capable-p))(temp-priority)(if hdd-mode
(progn
(let ((ttm))(when (and play-retry-mode
current-time (>= current-time 0) (> seconds 0))(setf ttm (stream-content-time 'stream-in))(if (> current-time ttm)(setf seconds nil)(when (>= (+ current-time seconds) (- ttm 3))(if (>= seconds 4)(setf seconds (- (- ttm current-time) 3))(setf seconds 0)))(when seconds
(setf current-time (+ current-time seconds))))))(when (and current-time seconds)(setf skip-seconds seconds)(setf last-skip-seconds seconds)(if (eq trik-speed 0)(progn
(setf req-pause t)(setf pause-play t))(unless (eq trik-speed 130)(setf trik-speed 100)))(setf play-mode "normal")(make-event 'skip-request)))(if (eq trik-speed 0)(progn
(setf req-pause t)(setf pause-play t))(setf trik-speed 100))(setf play-mode "resume")(let ((tm))(setf tm (stream-play-time 'stream-in))(when (and tm (>= tm 0))(setf seek-time (+ tm seconds))(setf seek-time (* seek-time 1000))(setf next-flag t)(make-event 'request-play)(send-play-time))))))(defun skip-play (seconds option)(when (or (not dlna-mode) (skip-capable-p))(setf req-pause nil)(temp-priority)(if hdd-mode
(when (and current-time seconds)(setf seek-time (+ current-time seconds))(setf seek-time (* seek-time 1000))(setf trik-speed 100)(setf play-mode "normal")(setf next-flag t)(make-event 'request-play)(setf current-time (/ seek-time 1000))(setf seek-time nil))(setf trik-speed 100)(setf play-mode "resume")(let ((tm))(setf tm (stream-play-time 'stream-in))(when (and tm (>= tm 0))(if (eq option 'abs-time)(setf seek-time seconds)(setf seek-time (+ tm seconds)))(setf seek-time (* seek-time 1000))(setf next-flag t)(make-event 'request-play)(send-play-time))))))(defun skip-play-pause (seconds)(when (or (not dlna-mode) (skip-capable-p))(setf req-pause nil)(temp-priority)(if hdd-mode
(when (and current-time seconds)(setf seek-time (+ current-time seconds))(setf seek-time (* seek-time 1000))(if (eq trik-speed 0)(progn
(setf req-pause t)(setf pause-play t))(unless (eq trik-speed 130)(setf trik-speed 100)))(setf play-mode "normal")(setf next-flag t)(make-event 'request-play)(setf current-time (/ seek-time 1000))(setf seek-time nil)))))(defun seek (msec)(setf req-pause nil)(if (not content-uri)(write-data play-time-buf 'int msec)(when (or (not dlna-mode) (seek-capable-p))(unless (eq msec (* (stream-play-time 'stream-in) 1000))(temp-priority)(setf play-mode "resume")(setf seek-time msec)(when (eq trik-speed 0)(setf req-pause t)(setf pause-play t))(setf next-flag t)(make-event 'request-play)(send-play-time)))))(defmacro hdd-stop ()
`(stop))(defmacro hdd-play (speed)
`(play ,speed))(defmacro hdd-pause ()
`(pause))(defmacro hdd-skip (seconds)
`(skip ,seconds))(defmacro hdd-skip-play (seconds)
`(skip-play ,seconds))(defmacro hdd-skip-play-pause (seconds)
`(skip-play-pause ,seconds))(defmacro dlna-stop ()
`(stop))(defmacro dlna-stop2 ()
`(stop2))(defmacro dlna-play (speed)
`(play ,speed))(defmacro dlna-pause ()
`(pause))(defmacro dlna-skip (seconds)
`(skip ,seconds))(defmacro dlna-skip-play (seconds)
`(skip-play ,seconds 'abs-time))(defmacro dlna-chapter-skip (seconds)
`(skip ,seconds))(defun dlna-test-content (uri index protocol)(if (stream-open 'stream-in
:mode "test"
:content-uri uri
:index-uri index
:dlna-protocol protocol)
1
0))(defun set-play-section (point)(when (= trik-speed 100)(case point
(1
(setf req-section1-index (stream-index-get 'stream-in))(setf req-section1-pos (stream-play-size 'stream-in :mode "index")))(2
(setf req-section2-index (stream-index-get 'stream-in))(setf req-section2-pos (stream-play-size 'stream-in :mode "index"))(stream-set-play-section 'stream-in
:section1-index req-section1-index
:section1-pos req-section1-pos
:section2-index req-section2-index
:section2-pos req-section2-pos))(otherwise
(reset-play-section)))))(defun reset-play-section ()(setf play-mode "normal")(setf req-section1-index nil)(setf req-section1-pos nil)(setf req-section2-index nil)(setf req-section2-pos nil)(stream-reset-play-section 'stream-in))(defun set-storage-config (sdir ddir nodirect noresume)(stop)(stream-reset-content 'stream-in)(setf stream-dir sdir)(setf data-dir ddir)(setf nodirect-mode nodirect)(setf disable-resume noresume))(defun get-audio-codec-id (sym)(case sym
(AUDIO_FORMAT_MPEG12 0)(AUDIO_FORMAT_AAC    1)(AUDIO_FORMAT_AC3    2)(AUDIO_FORMAT_LPCMV  3)(AUDIO_FORMAT_WAV    4)(otherwise           5)))(defun disable-ipconv (onoff)(set-video-ext 'video
(if onoff
"disable-ipconv"
nil)))(defun play-reopen-av-dec-for-4k (is-4k)(my-device-close 'video)(my-device-close 'audio)(if is-4k
(my-device-open 'video (list (video-openquery :error nil)))(my-device-open 'video (list (video-openquery :ch fix-dec-ch))))(my-device-open 'audio (device-id 'video))(when (boundp 'with-music)(music-disconnect)(music-connect)))(defun set-av-dec-for-4k (is-4k)(let ((video-old-id))(unless (eq set-4k-dec-p is-4k)(setf trik-mode nil)(setf stop-mode nil)(make-event 'trik-mode-off)(if is-4k
(progn
(setf video-old-id (device-id 'video))(video-config 'video
:use "4K"
:hint vcnode-id
:cost 'VIDEO_COST_4K)(play-reopen-av-dec-for-4k t)(if (eq (device-id 'video) video-old-id)(progn
(setf trik-mode t)(make-event 'trik-mode-on)(setf set-4k-dec-p is-4k))(my-device-close 'audio)(write-bytes mp-msg-pipe 600 4 (device-id 'video))))(video-config 'video
:use "DISPLAY_MAIN"
:hint vcnode-id)(play-reopen-av-dec-for-4k nil)(setf trik-mode t)(make-event 'trik-mode-on)(setf set-4k-dec-p is-4k)))))(defun set-av-dec-for-4k-delay (is-4k)(set-timer 'set-av-dec-for-4k
'set-av-dec-delayed-tiemr
is-4k
1
0))(defun set-av-dec-for-4k-and-start (ch)(setf fix-dec-ch ch)(unless set-4k-dec-p
(video-config 'video
:use "4K"
:hint vcnode-id
:cost 'VIDEO_COST_4K)(play-reopen-av-dec-for-4k t)(setf trik-mode t)(make-event 'trik-mode-on))(setf set-4k-dec-p t))(defun reset-4k-setup (ch)(setf fix-dec-ch ch)(when set-4k-dec-p
(video-config 'video
:use "DISPLAY_MAIN"
:hint vcnode-id)(play-reopen-av-dec-for-4k nil)(setf set-4k-dec-p nil))(setf is-4k-fmt nil))
