├── icons └── avinaptic.ico ├── README.md ├── Makefile ├── srt.tin ├── parse-ogg.tin ├── parse-srt.tin ├── parse-pix.tin ├── avinaptic2.trp ├── parse-aud.tin ├── parse-log.tin ├── avinaptic2-cli.trp ├── parse.tin ├── info.tin ├── lang.tin ├── parse-flv.tin ├── init.tin ├── parse-avi.tin ├── drf.tin ├── parse-asf.tin ├── cfg.tin └── utils.tin /icons/avinaptic.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fsinapsi/avinaptic2/HEAD/icons/avinaptic.ico -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AVInaptic2 2 | 3 | AVInaptic is a program with a simple GUI that analyzes video file types. 4 | 5 | ## Synopsis 6 | 7 | avinaptic2 [ --cfg=\ ] [ --mgc=\ ] [ \ ] 8 | 9 | avinaptic2-cli [ --cfg=\ ] [ --mgc=\ ] [ --out=\ ] [ --drf ] [ --show-progress ] [ --bbcode | --html ] \ 10 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | all: avinaptic2 avinaptic2-cli 3 | 4 | clean: 5 | rm -f *~ *.c avinaptic2 avinaptic2-cli avinaptic2-icon.o *-compile.sh *.log *.exe 6 | 7 | install: all 8 | cp -f avinaptic2 avinaptic2-cli /usr/local/bin 9 | 10 | avinaptic2: avinaptic2.trp lang.tin utils.tin init.tin \ 11 | cfg.tin info.tin drf.tin srt.tin gui.tin dump.tin parse.tin \ 12 | parse-avi.tin parse-asf.tin parse-mkv.tin \ 13 | parse-mp4.tin parse-ogg.tin parse-flv.tin \ 14 | parse-aud.tin parse-pix.tin parse-srt.tin \ 15 | parse-log.tin 16 | trpc -f avinaptic2.trp 17 | 18 | avinaptic2-cli: avinaptic2-cli.trp lang.tin utils.tin init.tin \ 19 | cfg.tin info.tin dump.tin parse.tin \ 20 | parse-avi.tin parse-asf.tin parse-mkv.tin \ 21 | parse-mp4.tin parse-ogg.tin parse-flv.tin \ 22 | parse-aud.tin parse-pix.tin parse-srt.tin \ 23 | parse-log.tin 24 | trpc -f avinaptic2-cli.trp 25 | 26 | -------------------------------------------------------------------------------- /srt.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defnet srt-cb (self) 12 | ; FIXME 13 | (skip) ) 14 | 15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 16 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 17 | ;;;; ;;;; 18 | ;;;; ;;;; 19 | ;;;; ;;;; 20 | ;;;; ;;;; 21 | ;;;; ;;;; 22 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 23 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 24 | 25 | -------------------------------------------------------------------------------- /parse-ogg.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defnet parse-ogg (f) 12 | (not <_kv "aborted">) 13 | (fsetpos 0 f) 14 | (fail) ) 15 | 16 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 17 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 18 | ;;;; ;;;; 19 | ;;;; ;;;; 20 | ;;;; ;;;; 21 | ;;;; ;;;; 22 | ;;;; ;;;; 23 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 25 | 26 | -------------------------------------------------------------------------------- /parse-srt.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defnet parse-srt (f) 12 | (not <_kv "aborted">) 13 | (fsetpos 0 f) 14 | (fail) ) 15 | 16 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 17 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 18 | ;;;; ;;;; 19 | ;;;; ;;;; 20 | ;;;; ;;;; 21 | ;;;; ;;;; 22 | ;;;; ;;;; 23 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 25 | 26 | -------------------------------------------------------------------------------- /parse-pix.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defnet parse-pix (f) 12 | (deflocal pix tipo w h) 13 | 14 | (not <_kv "aborted">) 15 | (set pix (pix-load <_kv "path">)) 16 | (<> pix undef) 17 | (if (= (pix-loader pix) "svg") 18 | then (close pix) 19 | (set pix (rsvg-load <_kv "path">)) 20 | (set w (rsvg-width <_kv "path">)) 21 | (set h (rsvg-height <_kv "path">)) 22 | else (set w (width pix)) 23 | (set h (height pix)) ) 24 | (if (pix-grayp pix) 25 | then (if (pix-bwp pix) 26 | then (set tipo "b/w") 27 | else (set tipo "gray") ) 28 | else (set tipo "color") 29 | (if (pix-has-alpha pix) 30 | then (inc tipo " (alpha)") )) 31 | (set <_kv "filetype"> "pix") 32 | (set <_kv "fileinfo"> 33 | (list (pix-loader pix) 34 | w h tipo 35 | (pix-get-luminance pix) 36 | (pix-get-contrast pix) )) 37 | (close pix) ) 38 | 39 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 40 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 41 | ;;;; ;;;; 42 | ;;;; ;;;; 43 | ;;;; ;;;; 44 | ;;;; ;;;; 45 | ;;;; ;;;; 46 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 47 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 48 | 49 | -------------------------------------------------------------------------------- /avinaptic2.trp: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (use webp) 12 | (use qoi) 13 | (use openjp2) 14 | (use jbig2) 15 | (use rsvg) 16 | (use lept) 17 | ;(use sail) 18 | (use heif) 19 | 20 | (include "common.tin") 21 | (include "lang.tin") 22 | (include "utils.tin") 23 | (include "init.tin") 24 | (include "cfg.tin") 25 | (include "info.tin") 26 | (include "drf.tin") 27 | (include "srt.tin") 28 | (include "gui.tin") 29 | (include "dump.tin") 30 | (include "parse.tin") 31 | (include "parse-avi.tin") 32 | (include "parse-asf.tin") 33 | (include "parse-mkv.tin") 34 | (include "parse-mp4.tin") 35 | (include "parse-ogg.tin") 36 | (include "parse-flv.tin") 37 | (include "parse-aud.tin") 38 | (include "parse-pix.tin") 39 | (include "parse-srt.tin") 40 | (include "parse-log.tin") 41 | 42 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 43 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 44 | ;;;; ;;;; 45 | ;;;; ;;;; 46 | ;;;; ;;;; 47 | ;;;; ;;;; 48 | ;;;; ;;;; 49 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 50 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 51 | 52 | (defstart avinaptic) 53 | 54 | (defun cli () false) 55 | 56 | (defnet avinaptic () 57 | (set-icon "avinaptic.ico") 58 | (iup-set-lang) 59 | (init) 60 | (gui) 61 | (quit) ) 62 | 63 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 64 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 65 | ;;;; ;;;; 66 | ;;;; ;;;; 67 | ;;;; ;;;; 68 | ;;;; ;;;; 69 | ;;;; ;;;; 70 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 71 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 72 | 73 | -------------------------------------------------------------------------------- /parse-aud.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defnet parse-aud (f) 12 | (deflocal aud codec) 13 | 14 | (set codec 0) 15 | (repeat (not <_kv "aborted">) 16 | (parse-aud-check f aud codec) 17 | until (audp aud) 18 | (< codec 4) 19 | (inc codec 2) ) 20 | (set <_kv "filetype"> "aud") 21 | (set <_kv "fileinfo"> aud) 22 | (set <_kv "audio"> 1) 23 | (set <_kv "cleaner"> (netptr parse-aud-clean)) ) 24 | 25 | (defnet parse-aud-clean (fileinfo) 26 | (close fileinfo) ) 27 | 28 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 29 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 30 | ;;;; ;;;; 31 | ;;;; ;;;; 32 | ;;;; ;;;; 33 | ;;;; ;;;; 34 | ;;;; ;;;; 35 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 36 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 37 | 38 | (defnet parse-aud-check (f @aud codec) 39 | (deflocal fpout) 40 | 41 | (fsetpos 0 f) 42 | (set @aud (aud-create f codec)) 43 | (set fpout <_kv "audio-fpout">) 44 | (if (<> fpout undef) 45 | then (aud-fpout-begin @aud fpout 46 | (cfg-get-or-df "audio-saving-skip-garbage") ) 47 | (fsetpos 0 fpout) 48 | (set <_kv "audio-aud"> @aud) ) 49 | (opt* (aud-parse @aud 131072) 50 | (if (<> (aud-codec @aud) undef) 51 | then (parse-progress f "aud" undef) )) 52 | (if (or <_kv "aborted"> 53 | (= (aud-codec @aud) undef) 54 | (>= (* 5 (+ (aud-initial-skip @aud) 55 | (aud-internal-skip @aud) 56 | (aud-buf-act @aud) )) 57 | (aud-tot-read @aud) )) 58 | then (close @aud) 59 | (clr @aud) 60 | (parse-progress-close) )) 61 | 62 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 63 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 64 | ;;;; ;;;; 65 | ;;;; ;;;; 66 | ;;;; ;;;; 67 | ;;;; ;;;; 68 | ;;;; ;;;; 69 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 70 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 71 | 72 | -------------------------------------------------------------------------------- /parse-log.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defnet parse-log-x264 (path @a) 12 | (deflocal s t cnt avg-qp size) 13 | 14 | (pathexists path) 15 | (< (fsize path) 1000000) 16 | (set s (str-load path)) 17 | (stringp s) 18 | (find-and-replace s "\r" "\n") 19 | (search case "x264 [info]" s t) 20 | (set s (sub t (maxint) s)) 21 | (set @a (assoc)) 22 | (opt* (parse-log-x264-frame s t cnt avg-qp size) 23 | (set <@a t> (list cnt avg-qp size)) ) 24 | (>= (length @a) 2) ) 25 | 26 | (defnet parse-log-x264-frame (@s @type @cnt @avg-qp @size) 27 | (deflocal i) 28 | 29 | (repeat (search case "frame " @s i) 30 | (set @s (ltrim (sub (+ i 6) (maxint) @s))) 31 | (search ":" @s i) 32 | until (in i 1 .. 2) ) 33 | (set @type (sub 0 i @s)) 34 | (set @s (ltrim (sub (+ i 1) (maxint) @s))) 35 | (search " " @s i) 36 | (set @cnt (str->num (sub 0 i @s))) 37 | (integerp @cnt) 38 | (search case "avg qp:" @s i) 39 | (set @s (ltrim (sub (+ i 7) (maxint) @s))) 40 | (search " " @s i) 41 | (set @avg-qp (str->num (sub 0 i @s))) 42 | (rationalp @avg-qp) 43 | (search case "size:" @s i) 44 | (set @s (ltrim (sub (+ i 5) (maxint) @s))) 45 | (search "\n" @s i) 46 | (set @size (str->num (rtrim (sub 0 i @s)))) 47 | (integerp @size) ) 48 | 49 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 50 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 51 | ;;;; ;;;; 52 | ;;;; ;;;; 53 | ;;;; ;;;; 54 | ;;;; ;;;; 55 | ;;;; ;;;; 56 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 57 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 58 | 59 | (defnet parse-log-dgindex (path @a) 60 | (fail) ) 61 | 62 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 63 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 64 | ;;;; ;;;; 65 | ;;;; ;;;; 66 | ;;;; ;;;; 67 | ;;;; ;;;; 68 | ;;;; ;;;; 69 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 70 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 71 | 72 | (defnet parse-log-altro (path @a) 73 | (fail) ) 74 | 75 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 76 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 77 | ;;;; ;;;; 78 | ;;;; ;;;; 79 | ;;;; ;;;; 80 | ;;;; ;;;; 81 | ;;;; ;;;; 82 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 83 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 84 | 85 | -------------------------------------------------------------------------------- /avinaptic2-cli.trp: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (use webp) 12 | (use qoi) 13 | (use openjp2) 14 | (use jbig2) 15 | (use rsvg) 16 | (use lept) 17 | ;(use sail) 18 | (use heif) 19 | 20 | (include "common.tin") 21 | (include "lang.tin") 22 | (include "utils.tin") 23 | (include "init.tin") 24 | (include "cfg.tin") 25 | (include "info.tin") 26 | (include "dump.tin") 27 | (include "parse.tin") 28 | (include "parse-avi.tin") 29 | (include "parse-asf.tin") 30 | (include "parse-mkv.tin") 31 | (include "parse-mp4.tin") 32 | (include "parse-ogg.tin") 33 | (include "parse-flv.tin") 34 | (include "parse-aud.tin") 35 | (include "parse-pix.tin") 36 | (include "parse-srt.tin") 37 | (include "parse-log.tin") 38 | 39 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 40 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 41 | ;;;; ;;;; 42 | ;;;; ;;;; 43 | ;;;; ;;;; 44 | ;;;; ;;;; 45 | ;;;; ;;;; 46 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 47 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 48 | 49 | (defstart avinaptic-cli) 50 | 51 | (defun cli () true) 52 | 53 | (defnet usage () 54 | (print $"Usage" ": avinaptic2-cli [ " $"options" "... ] [ " $"options" "... ]" nl 55 | nl 56 | $"options" ":" nl 57 | " --cfg=" nl 58 | " --out=" nl 59 | " --mgc=" nl 60 | " --drf" nl 61 | " --show-progress" nl 62 | " --bbcode" nl 63 | " --html" nl ) 64 | (exit -1) ) 65 | 66 | (defnet avinaptic-cli () 67 | (deflocal out f s) 68 | 69 | (init) 70 | (if (= <_kv "path"> undef) 71 | then (quit) 72 | (usage) ) 73 | (opt (parse-low <_kv "cli-drf">) 74 | (dump-file1 <_kv "cli-type"> s) 75 | (if (cfg-get-or-df "enabled-utf8bom") 76 | then (if (<> (utf8-length s) (length s)) 77 | then (set s (+ (utf8-bom) s)) )) 78 | (if (cms-windows) 79 | then (set s (find-and-replace s "\n" "\r\n")) ) 80 | (set out <_kv "cli-out-path">) 81 | (if (= out undef) 82 | then (print s) 83 | else (set f (fcreate out)) 84 | (if (= f undef) 85 | then (print $"can't create file" " `" out "'" nl) 86 | (fail) ) 87 | (fprint f s) 88 | (close f) )) 89 | (quit) ) 90 | 91 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 92 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 93 | ;;;; ;;;; 94 | ;;;; ;;;; 95 | ;;;; ;;;; 96 | ;;;; ;;;; 97 | ;;;; ;;;; 98 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 99 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 100 | 101 | -------------------------------------------------------------------------------- /parse.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defnet parse-partial () (opt (parse-low false))) 12 | (defnet parse-complete () (parse-low true)) 13 | 14 | (defnet parse-low (complete) 15 | (deflocal path f) 16 | 17 | (set path <_kv "path">) 18 | (set f (fopenro path)) 19 | (if (= f undef) 20 | then (iup-message-warning <_kv "win"> 21 | (+ (utf8-validate path) 22 | $": file not found" )) 23 | (if (= <_kv "filesize"> undef) 24 | then (assoc-clr _kv "path") 25 | else (set <_kv "path"> (cfg-get "path")) ) 26 | (fail) ) 27 | (parse-clean) 28 | (assoc-clr _kv "fileinfo") 29 | (assoc-clr _kv "cleaner") 30 | (assoc-clr _kv "correction") 31 | (assoc-clr _kv "log-x264") 32 | (set <_kv "filetime"> (ftime path)) 33 | (set <_kv "filesize"> (length f)) 34 | (assoc-clr _kv "filetype") 35 | (set <_kv "magic"> (utf8-validate (magic-file path))) 36 | (set <_kv "id3tag"> (id3tag-file path)) 37 | (set <_kv "exif"> (exif-file path)) 38 | (set <_kv "video"> 0) 39 | (set <_kv "audio"> 0) 40 | (set <_kv "complete"> complete) 41 | (set <_kv "aborted"> false) 42 | (alt (parse-avi f) 43 | (parse-asf f) 44 | (parse-mkv f) 45 | (parse-mp4 f) 46 | (parse-ogg f) 47 | (parse-flv f) 48 | (parse-aud f) 49 | (parse-pix f) 50 | (parse-srt f) 51 | (if (not <_kv "aborted">) 52 | then (assoc-clr _kv "filetype") )) 53 | (close f) 54 | (parse-progress-close) 55 | (if <_kv "aborted"> 56 | then (set <_kv "complete"> false) ) 57 | (set <_kv "path"> path) 58 | (set <_kv "short-path"> (utf8-validate (fullpath->name path))) 59 | (set <_kv "time"> (now)) 60 | (parse-attach-correction) 61 | (parse-attach-log-x264 path) 62 | (cfg-set "path" path) 63 | (if <_kv "complete"> 64 | then (sound-alert) )) 65 | 66 | (defnet parse-attach-correction () 67 | (deflocal n a i vid fps) 68 | 69 | (set n <_kv "video">) 70 | (if (and <_kv "complete"> (> n 0)) 71 | then (set a (array default 0 n 3)) 72 | (for i in 1 .. n do 73 | (opt (info->vid-fps-low (for-pos) vid fps) 74 | (set vid) 75 | (set (if (cfg-get-or-df "enabled-credits") (vid-qscale-correction-a vid) 0)) 76 | (set (if (cfg-get-or-df "enabled-credits") (vid-qscale-correction-b vid) 0)) )) 77 | (set <_kv "correction"> a) )) 78 | 79 | (defnet parse-attach-log-x264 (path) 80 | (deflocal i) 81 | 82 | (opt (avcp) 83 | (path-fix path path) 84 | (search "/" path i (maxint)) 85 | (set path (sub 0 (+ i 1) path)) 86 | (alt (parse-log-x264 (+ path "x264 2nd pass.log") i) 87 | (parse-log-x264 (+ path "x264.log") i) ) 88 | (set <_kv "log-x264"> i) )) 89 | 90 | (defnet parse-clean () 91 | (deflocal cleaner) 92 | 93 | (set cleaner <_kv "cleaner">) 94 | (if (<> cleaner undef) 95 | then (call cleaner <_kv "fileinfo">) )) 96 | 97 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 98 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 99 | ;;;; ;;;; 100 | ;;;; ;;;; 101 | ;;;; ;;;; 102 | ;;;; ;;;; 103 | ;;;; ;;;; 104 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 105 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 106 | 107 | (defnet parse-progress (f parser vid) 108 | (if (cli) 109 | then (parse-progress-cli f parser vid) 110 | else (parse-progress-low f parser vid) )) 111 | 112 | (defnet parse-progress-cli (f parser vid) 113 | (if <_kv "cli-show-progress"> 114 | then (fprint (stderr) " progress: " (approx1 (/ (fpos f) <_kv "filesize"> 0.01)) "% \r") 115 | (fflush (stderr)) )) 116 | 117 | (defnet parse-progress-low (f parser vid) 118 | (deflocal win now pos tot pb s) 119 | 120 | (not <_kv "aborted">) 121 | (set now (now)) 122 | (set pos (fpos f)) 123 | (set tot <_kv "filesize">) 124 | (set win <_kv "progress-win">) 125 | (if (= win undef) 126 | then (set <_kv "progress-start-time"> now) 127 | (set <_kv "progress-start-pos"> pos) 128 | (parse-progress-setup) 129 | (set win <_kv "progress-win">) 130 | else (set s (/ (* (- tot pos) (- now <_kv "progress-start-time">)) 131 | (- pos <_kv "progress-start-pos">) )) 132 | (if (and (rationalp s) (< s 360000)) 133 | then (iup-set-str-attribute <_kv "progress-time"> "TITLE" 134 | (date-s2hhmmss s) ))) 135 | (set pb <_kv "progress-bar">) 136 | (iup-set-double pb "VALUE" (/ pos tot)) 137 | (iup-flush) ) 138 | 139 | (defnet parse-progress-setup () 140 | (deflocal gauge label button hbox dlg q) 141 | 142 | (set gauge (iup-gauge)) 143 | 144 | (set label (iup-label "99:59:59")) 145 | 146 | (set q (queue)) 147 | (set button (iup-button-icon $"Abort" (netptr parse-progress-abort-cb) (pix-load-static "16x16/dialog-cancel-3.png") q)) 148 | 149 | (set hbox (iup-hbox gauge label button)) 150 | (iup-set-str-attribute hbox "ALIGNMENT" "ACENTER") 151 | (iup-set-str-attribute hbox "MARGIN" "4x4") 152 | (iup-set-int hbox "GAP" 4) 153 | 154 | (set dlg (iup-dialog hbox)) 155 | (iup-set-dlg-parent <_kv "win"> dlg) 156 | (iup-set-str-attribute dlg "TITLE" $"Analysis...") 157 | (iup-set-bool dlg "DIALOGFRAME" true) 158 | (iup-set-bool dlg "SIMULATEMODAL" true) 159 | (iup-set-callback dlg "CLOSE_CB" (netptr iup-success-cb)) 160 | 161 | (iup-show-xy dlg (cmacro IUP_CENTERPARENT) (cmacro IUP_CENTERPARENT)) 162 | 163 | (set <_kv "progress-win"> dlg) 164 | (set <_kv "progress-time"> label) 165 | (set <_kv "progress-bar"> gauge) 166 | (set <_kv "progress-img"> (queue-get q)) ) 167 | 168 | (defnet parse-progress-abort-cb (self) 169 | (deflocal d) 170 | 171 | (set d (now)) 172 | (alt (seq (iup-message-confirm self $"The current operation will be aborted.\nAre you sure?") 173 | (set <_kv "aborted"> true) ) 174 | (assoc-inc _kv "progress-start-time" (- (now) d)) )) 175 | 176 | (defnet parse-progress-close () 177 | (if (cli) 178 | then (if <_kv "cli-show-progress"> 179 | then (fprint (stderr) nl) 180 | (fflush (stderr)) ) 181 | else (if (<> <_kv "progress-win"> undef) 182 | then (iup-set-bool <_kv "progress-win"> "SIMULATEMODAL" false) 183 | (close <_kv "progress-win">) 184 | (close <_kv "progress-img">) 185 | (assoc-clr _kv "progress-win") 186 | (assoc-clr _kv "progress-bar") ))) 187 | 188 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 189 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 190 | ;;;; ;;;; 191 | ;;;; ;;;; 192 | ;;;; ;;;; 193 | ;;;; ;;;; 194 | ;;;; ;;;; 195 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 196 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 197 | 198 | -------------------------------------------------------------------------------- /info.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defnet info-cb (self) 12 | (deflocal q butbox dlg i) 13 | 14 | (set q (queue)) 15 | 16 | (set butbox (iup-box-ok undef q)) 17 | 18 | (set i (iup-vbox 19 | (info-setup-tabs q) 20 | butbox )) 21 | (iup-set-str-attribute i "MARGIN" "4x4") 22 | (iup-set-int i "GAP" 0) 23 | 24 | (set dlg (iup-dialog i)) 25 | (iup-set-dlg-parent self dlg) 26 | (iup-set-str-attribute dlg "TITLE" $"About AVInaptic") 27 | (iup-set-bool dlg "DIALOGFRAME" true) 28 | (iup-set-attribute-handle dlg "DEFAULTENTER" (iup-box-ok-btn butbox)) 29 | (iup-set-attribute-handle dlg "DEFAULTESC" (iup-box-ok-btn butbox)) 30 | 31 | (sound-info) 32 | 33 | (iup-popup dlg (cmacro IUP_CENTERPARENT) (cmacro IUP_CENTERPARENT)) 34 | 35 | (close dlg) 36 | (iup-close-queue q) ) 37 | 38 | (defun info-setup-tabs (q) net info-setup-tabs) 39 | (defnet info-setup-tabs (q @wid) 40 | (set @wid (iup-tabs (info-setup-page1 q) (info-setup-page2 q) (info-setup-page3 q))) 41 | (iup-set-str-attribute @wid "TABTITLE0" $"Version") 42 | (iup-set-str-attribute @wid "TABTITLE1" $"Authors") 43 | (iup-set-str-attribute @wid "TABTITLE2" $"License") 44 | (if (clinux) 45 | then (iup-set-bgcolor @wid (white)) ) 46 | (iup-set-bool @wid "EXPAND" true) ) 47 | 48 | (defun info-setup-page1 (q) net info-setup-page1) 49 | (defnet info-setup-page1 (q @wid) 50 | (deflocal i img remote-version vbox) 51 | 52 | (set i (iup-label)) 53 | (iup-set-str-attribute i "EXPAND" "VERTICAL") 54 | (set img (iup-image-rgba (pix-load-static "128x128/avnfilm.png"))) 55 | (iup-set-attribute-handle i "IMAGE" img) 56 | (queue-put q img) 57 | 58 | (set remote-version (remote-version-cached)) 59 | 60 | (set vbox (iup-vbox 61 | (iup-fill) 62 | (iup-label 63 | "AVInaptic version: " (date->version (compile-time)) " (" (csysbits) "-bit)" ) 64 | (if (< (compile-time) remote-version) 65 | (iup-link (+ (url-home-page) "/code/avinaptic/index.html") $"There is an update" ": " (date->version remote-version)) 66 | (iup-label $"There are no updates") ) 67 | (iup-label 68 | $"Selected language" ": " <(languages) (lang)> nl 69 | $"Sound" ": " (if <_kv "enabled-sound"> $"enabled" $"disabled") nl 70 | "GC version: " (gc-version) nl 71 | "GMP version: " (gmp-version) nl 72 | "IUP version: " (iup-version) nl 73 | "IUP system: " (iup-get-global "SYSTEM") nl 74 | (if (clinux) (+ "GTK version: " (iup-get-global "GTKVERSION") nl) "") ) 75 | (iup-fill) )) 76 | (iup-set-int vbox "GAP" 0) 77 | 78 | (set @wid (iup-hbox (iup-fill) i vbox (iup-fill))) 79 | (iup-set-str-attribute @wid "ALIGNMENT" "ACENTER") 80 | (iup-set-int @wid "GAP" 40) ) 81 | 82 | (defun info-setup-page2 (q) net info-setup-page2) 83 | (defnet info-setup-page2 (q @wid) 84 | (set @wid (iup-vbox 85 | (iup-label "AVInaptic " $"was coded in TreeP by" " Frank Sinapsi") 86 | (iup-link (url-home-page)) 87 | (iup-label "\n" $"Please report bugs to") 88 | (iup-link "mailto:fsinapsi@yahoo.it" "fsinapsi@yahoo.it") 89 | (iup-label "\n" $"Source code of" " " "TreeP") 90 | (iup-link "https://github.com/fsinapsi/TreeP") 91 | (iup-label "\n" $"Source code of" " " "AVInaptic") 92 | (iup-link "https://github.com/fsinapsi/avinaptic2") )) 93 | (iup-set-str-attribute @wid "MARGIN" "20x20") ) 94 | 95 | (defun info-setup-page3 (q) net info-setup-page3) 96 | (defnet info-setup-page3 (q @wid) 97 | (set @wid (iup-text)) 98 | (iup-set-bool @wid "MULTILINE" true) 99 | (iup-set-bool @wid "READONLY" true) 100 | (iup-set-bool @wid "EXPAND" true) 101 | (iup-set-bool @wid "WORDWRAP" false) 102 | (iup-set-str-attribute @wid "PADDING" "2x0") 103 | (iup-set-str-attribute @wid "VALUE" (+ 104 | (if (= (lang) 1) 105 | "AVInaptic è un software libero: puoi ridistribuirlo e/o\n" \ 106 | "modificarlo secondo i termini della GNU General Public License\n" \ 107 | "come pubblicata da Free Software Foundation, versione 3 della\n" \ 108 | "licenza o (a tua scelta) qualsiasi versione successiva.\n" \ 109 | "\n" \ 110 | "AVInaptic è distribuito nella speranza che sia utile, ma\n" \ 111 | "SENZA ALCUNA GARANZIA; senza nemmeno la garanzia implicita di\n" \ 112 | "COMMERCIABILITÀ o IDONEITÀ PER UNO SCOPO PARTICOLARE.\n" \ 113 | "Vedere la GNU General Public License per maggiori dettagli." 114 | 115 | "AVInaptic is free software: you can redistribute it and/or modify it\n" \ 116 | "under the terms of the GNU General Public License as published by the\n" \ 117 | "Free Software Foundation, either version 3 of the License, or\n" \ 118 | "(at your option) any later version.\n" \ 119 | "\n" \ 120 | "AVInaptic is distributed in the hope that it will be useful, but\n" \ 121 | "WITHOUT ANY WARRANTY; without even the implied warranty of\n" \ 122 | "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" \ 123 | "See the GNU General Public License for more details." ) 124 | nl 125 | "----------------------------------------------------------" nl 126 | nl 127 | (license-gpl3) )) 128 | (iup-set-int @wid "VISIBLELINES" 1) 129 | (iup-set-int @wid "VISIBLECOLUMNS" 1) 130 | (iup-set-int @wid "CARETPOS" 0) ) 131 | 132 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 133 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 134 | ;;;; ;;;; 135 | ;;;; ;;;; 136 | ;;;; ;;;; 137 | ;;;; ;;;; 138 | ;;;; ;;;; 139 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 140 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 141 | 142 | (defnet info-text (s) 143 | (deflocal q text butbox vbox dlg) 144 | 145 | (set text (iup-text)) 146 | (iup-set-bool text "MULTILINE" true) 147 | (iup-set-bool text "READONLY" (not (cfg-get-or-df "text-info-editable"))) 148 | (iup-set-bool text "EXPAND" true) 149 | (iup-set-bool text "WORDWRAP" false) 150 | (iup-set-str-attribute text "PADDING" "2x0") 151 | (iup-set-str-attribute text "VALUE" s) 152 | (iup-set-int text "VISIBLELINES" 1) 153 | (iup-set-int text "VISIBLECOLUMNS" 1) 154 | 155 | (set q (queue)) 156 | (set butbox (iup-box-ok (netptr info-text-close-cb) q)) 157 | 158 | (set vbox (iup-vbox 159 | text 160 | butbox )) 161 | 162 | ; FIXME salvare posizione e dimensioni finestra 163 | 164 | (set dlg (iup-dialog vbox)) 165 | (iup-set-str-attribute dlg "TITLE" $"Copy-and-paste") 166 | (iup-set-str-attribute dlg "RASTERSIZE" "500x400") 167 | (iup-set-callback dlg "CLOSE_CB" (netptr info-text-close-cb)) 168 | (iup-set-attribute-handle dlg "DEFAULTESC" (iup-box-ok-btn butbox)) 169 | (assoc-inc _kv "info-text-windows") 170 | (iup-set-int dlg "TRPIMG" <_kv "info-text-windows">) 171 | (set <_kv (+ "info-text-windows-" <_kv "info-text-windows">)> (queue-get q)) 172 | 173 | (iup-show-xy dlg (cmacro IUP_CENTER) (cmacro IUP_CENTER)) 174 | 175 | (iup-set-int text "CARETPOS" 0) 176 | (iup-set-str-attribute text "SELECTION" "ALL") 177 | (iup-set-str-attribute text "CLIPBOARD" "COPY") 178 | (iup-flush) ) 179 | 180 | (defnet info-text-close-cb (self) 181 | (deflocal key) 182 | 183 | (set self (iup-get-dialog self)) 184 | (set key (+ "info-text-windows-" (iup-get-int self "TRPIMG"))) 185 | (close self) 186 | (close <_kv key>) 187 | (assoc-clr _kv key) ) 188 | 189 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 190 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 191 | ;;;; ;;;; 192 | ;;;; ;;;; 193 | ;;;; ;;;; 194 | ;;;; ;;;; 195 | ;;;; ;;;; 196 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 197 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 198 | 199 | -------------------------------------------------------------------------------- /lang.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defun languages () 12 | [ "English" 13 | "Italiano" 14 | ]) 15 | 16 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 17 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 18 | ;;;; ;;;; 19 | ;;;; ;;;; 20 | ;;;; ;;;; 21 | ;;;; ;;;; 22 | ;;;; ;;;; 23 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 25 | 26 | (deflang 27 | 28 | "subtitles" 29 | 1 30 | "sottotitoli" 31 | 32 | "Bitstream type (bs)" 33 | 1 34 | "Tipo di bitstream (bs)" 35 | 36 | "Duration (bs)" 37 | 1 38 | "Durata" 39 | 40 | "Duration" 41 | 1 42 | "Durata" 43 | 44 | "Sampling frequency (bs)" 45 | 1 46 | "Freq. campionamento (bs)" 47 | 48 | "Mode (bs)" 49 | 1 50 | "Modo (bs)" 51 | 52 | "About file" 53 | 1 54 | "Info sul file" 55 | 56 | "Analysis not complete" 57 | 1 58 | "L'analisi non è completa" 59 | 60 | "Analysis aborted" 61 | 1 62 | "L'analisi è stata interrotta" 63 | 64 | "File type" 65 | 1 66 | "Tipo file" 67 | 68 | "invalid utf8 string" 69 | 1 70 | "stringa utf8 non valida" 71 | 72 | "This report was created by" 73 | 1 74 | "Rapporto creato da" 75 | 76 | ") on " 77 | 1 78 | ") in data " 79 | 80 | "About AVInaptic" 81 | 1 82 | "Info su AVInaptic" 83 | 84 | "was coded in TreeP by" 85 | 1 86 | "è stato scritto in TreeP da" 87 | 88 | "Selected language" 89 | 1 90 | "Lingua selezionata" 91 | 92 | "Latest version: " 93 | 1 94 | "Versione più recente: " 95 | 96 | "Copy-and-paste" 97 | 1 98 | "Copia e incolla" 99 | 100 | "Generic infos" 101 | 1 102 | "Info generiche" 103 | 104 | "Container" 105 | 1 106 | "Contenitore" 107 | 108 | "AVI has index" 109 | 1 110 | "L'AVI ha un indice?" 111 | 112 | "Total tracks" 113 | 1 114 | "Totale tracce" 115 | 116 | "Track nr. " 117 | 1 118 | "Traccia n. " 119 | 120 | "Incomplete AVI sections" 121 | 1 122 | "Sezioni AVI incomplete" 123 | 124 | "unknown type" 125 | 1 126 | "tipo sconosciuto" 127 | 128 | "Image loader" 129 | 1 130 | "Loader dell'immagine" 131 | 132 | "Resolution" 133 | 1 134 | "Risoluzione" 135 | 136 | "Luminance" 137 | 1 138 | "Luminosità" 139 | 140 | "Contrast" 141 | 1 142 | "Contrasto" 143 | 144 | "Relevant data" 145 | 1 146 | "Dati rilevanti" 147 | 148 | "VERY HIGH" 149 | 1 150 | "MOLTO ALTA" 151 | 152 | "HIGH" 153 | 1 154 | "ALTA" 155 | 156 | "MEDIUM" 157 | 1 158 | "MEDIA" 159 | 160 | "LOW" 161 | 1 162 | "BASSA" 163 | 164 | "VERY LOW" 165 | 1 166 | "MOLTO BASSA" 167 | 168 | "multiple of " 169 | 1 170 | "multipla di " 171 | 172 | "GOOD" 173 | 1 174 | "BENE" 175 | 176 | "16 would be better" 177 | 1 178 | "sarebbe stato meglio 16" 179 | 180 | "BAD" 181 | 1 182 | "MALE" 183 | 184 | "Average DRF quality" 185 | 1 186 | "Qualità DRF medio" 187 | 188 | "Average DRF" 189 | 1 190 | "DRF medio" 191 | 192 | "Standard deviation quality" 193 | 1 194 | "Qualità deviazione standard" 195 | 196 | "Standard deviation" 197 | 1 198 | "Deviazione standard" 199 | 200 | "Std. dev. weighted mean" 201 | 1 202 | "Media pesata dev. std." 203 | 204 | "Video track" 205 | 1 206 | "Traccia video" 207 | 208 | "Resolution (bs)" 209 | 1 210 | "Risoluzione (bs)" 211 | 212 | "Total frames" 213 | 1 214 | "Totale frames" 215 | 216 | "Delay" 217 | 1 218 | "Ritardo" 219 | 220 | "Audio track" 221 | 1 222 | "Traccia audio" 223 | 224 | "Channels" 225 | 1 226 | "Canali" 227 | 228 | "Sampling frequency" 229 | 1 230 | "Freq. campionamento" 231 | 232 | "Output sampling frequency" 233 | 1 234 | "Freq. campionamento output" 235 | 236 | "Sample size" 237 | 1 238 | "Dimensione campioni" 239 | 240 | "Video bitstream" 241 | 1 242 | "Bitstream video" 243 | 244 | "Bitstream type" 245 | 1 246 | "Tipo di bitstream" 247 | 248 | "detected QP < 0" 249 | 1 250 | "rilevati QP < 0" 251 | 252 | "it seems like the video doesn't start with a keyframe" 253 | 1 254 | "sembra che il video non inizi con un keyframe" 255 | 256 | "Corrupt frames" 257 | 1 258 | "Frames corrotti" 259 | 260 | "Interlaced" 261 | 1 262 | "Interlacciamento" 263 | 264 | "Entropy coding type" 265 | 1 266 | "Tipo di codifica entropica" 267 | 268 | "DRF analysis" 269 | 1 270 | "Analisi DRF" 271 | 272 | " (corrected)" 273 | 1 274 | " (corretta)" 275 | 276 | "End of start credits time position" 277 | 1 278 | "Fine titoli di testa" 279 | 280 | "ignored frames: " 281 | 1 282 | "frames ignorati: " 283 | 284 | "End credits time position" 285 | 1 286 | "Fine dei titoli di coda" 287 | 288 | "average DRF" 289 | 1 290 | "DRF medio" 291 | 292 | "standard deviation" 293 | 1 294 | "deviazione standard" 295 | 296 | " average DRF" 297 | 1 298 | " DRF medio" 299 | 300 | " std. deviation" 301 | 1 302 | " deviazione std." 303 | 304 | "Selected profile" 305 | 1 306 | "Profilo selezionato" 307 | 308 | "Too many violations" 309 | 1 310 | "Troppe violazioni" 311 | 312 | "Min buffer fill" 313 | 1 314 | "Min riempimento buffer" 315 | 316 | "Stream size" 317 | 1 318 | "Dimensione stream" 319 | 320 | "Profile compliancy" 321 | 1 322 | "Conformità al profilo" 323 | 324 | "Max consecutive B-VOPs" 325 | 1 326 | "Max B-VOPs consecutivi" 327 | 328 | "Used warp points" 329 | 1 330 | "Warp points usati" 331 | 332 | "Description" 333 | 1 334 | "Descrizione" 335 | 336 | "File name" 337 | 1 338 | "Nome file" 339 | 340 | "Hidden" 341 | 1 342 | "Nascosto" 343 | 344 | "Selected by default" 345 | 1 346 | "Selezionato di default" 347 | 348 | "Chapters" 349 | 1 350 | "Capitoli" 351 | 352 | "Chapter nr. " 353 | 1 354 | "Capitolo n. " 355 | 356 | ": file not found" 357 | 1 358 | ": file non trovato" 359 | 360 | "Analysis..." 361 | 1 362 | "Analisi..." 363 | 364 | "Abort" 365 | 1 366 | "Interrompi" 367 | 368 | "The current operation will be aborted.\nAre you sure?" 369 | 1 370 | "L'operazione verrà interrotta.\nConfermi?" 371 | 372 | "Preferences" 373 | 1 374 | "Preferenze" 375 | 376 | "General" 377 | 1 378 | "Generale" 379 | 380 | "Font" 381 | 1 382 | "Fonte caratteri" 383 | 384 | "Tile pattern" 385 | 1 386 | "Schema riempimento" 387 | 388 | "right justified" 389 | 1 390 | "giustificato a destra" 391 | 392 | "Field name" 393 | 1 394 | "Nome campo" 395 | 396 | "Divider" 397 | 1 398 | "Separatore" 399 | 400 | "Field value" 401 | 1 402 | "Valore campo" 403 | 404 | "Indent pattern" 405 | 1 406 | "Schema indentazione" 407 | 408 | "Section" 409 | 1 410 | "Sezione" 411 | 412 | "underline" 413 | 1 414 | "sottolineato" 415 | 416 | "bold" 417 | 1 418 | "in grassetto" 419 | 420 | "Profiles" 421 | 1 422 | "Profili" 423 | 424 | "Buffer size" 425 | 1 426 | "Dimensione buffer" 427 | 428 | "enabled" 429 | 1 430 | "abilitato" 431 | 432 | "disabled" 433 | 1 434 | "disabilitato" 435 | 436 | "Comments" 437 | 1 438 | "Commenti" 439 | 440 | "Attachments" 441 | 1 442 | "Allegati" 443 | 444 | "grouped" 445 | 1 446 | "raggruppato" 447 | 448 | "Audio saving" 449 | 1 450 | "Salvataggio audio" 451 | 452 | "editable" 453 | 1 454 | "editabile" 455 | 456 | "`Copy/paste' text" 457 | 1 458 | "Testo `copia e incolla'" 459 | 460 | "Length of percent line" 461 | 1 462 | "Lunghezza linea percentuale" 463 | 464 | "normalize" 465 | 1 466 | "normalizza" 467 | 468 | "Decimals" 469 | 1 470 | "Decimali" 471 | 472 | "New profile" 473 | 1 474 | "Nuovo profilo" 475 | 476 | "Profile `" 477 | 1 478 | "Il profilo `" 479 | 480 | "' exists." 481 | 1 482 | "' esiste già." 483 | 484 | "Please select a different name." 485 | 1 486 | "Scegli un nome differente." 487 | 488 | "' will be deleted." 489 | 1 490 | "' verrà rimosso." 491 | 492 | "Are you sure?" 493 | 1 494 | "Confermi?" 495 | 496 | "The predefined profiles will be reloaded.\nAre you sure?" 497 | 1 498 | "Verranno ripristinati i profili predefiniti.\nConfermi?" 499 | 500 | "Attached file" 501 | 1 502 | "File allegato" 503 | 504 | " nr. " 505 | 1 506 | " n. " 507 | 508 | "Copy" 509 | 1 510 | "Copia" 511 | 512 | "Help" 513 | 1 514 | "Aiuto" 515 | 516 | "Check for updates" 517 | 1 518 | "Cerca aggiornamenti" 519 | 520 | "Background" 521 | 1 522 | "Sfondo" 523 | 524 | "DRF graph" 525 | 1 526 | "Grafico DRF" 527 | 528 | "Search" 529 | 1 530 | "Cerca" 531 | 532 | "Frame size range" 533 | 1 534 | "Interv. dimensione frame" 535 | 536 | "Frame type" 537 | 1 538 | "Tipo di frame" 539 | 540 | "Any type" 541 | 1 542 | "Qualsiasi" 543 | 544 | "Prev/Next" 545 | 1 546 | "Prec/Succ" 547 | 548 | "Bottom graph" 549 | 1 550 | "Grafico in basso" 551 | 552 | "Frame size" 553 | 1 554 | "Dimensione frame" 555 | 556 | "VBV buffer" 557 | 1 558 | "Buffer VBV" 559 | 560 | "Profile" 561 | 1 562 | "Profilo" 563 | 564 | "compile time" 565 | 1 566 | "a tempo di compilazione" 567 | 568 | "running time" 569 | 1 570 | "a tempo di esecuzione" 571 | 572 | "Open file" 573 | 1 574 | "Apri file" 575 | 576 | "Save the report" 577 | 1 578 | "Salva il rapporto" 579 | 580 | "Save the report as..." 581 | 1 582 | "Salva il rapporto come..." 583 | 584 | "Export (BBcode)..." 585 | 1 586 | "Esporta (BBcode)..." 587 | 588 | "Export (HTML)..." 589 | 1 590 | "Esporta (HTML)..." 591 | 592 | "Exit" 593 | 1 594 | "Esci" 595 | 596 | "Report" 597 | 1 598 | "Rapporto" 599 | 600 | "Save audio track as..." 601 | 1 602 | "Salva traccia audio come..." 603 | 604 | "Save attachment as..." 605 | 1 606 | "Salva allegato come..." 607 | 608 | "Save attachments in..." 609 | 1 610 | "Salva tutti gli allegati in..." 611 | 612 | "Full analysis/DRF Graph" 613 | 1 614 | "Analisi completa/Grafico DRF" 615 | 616 | "Set credits position" 617 | 1 618 | "Imposta la posizione dei titoli" 619 | 620 | "open file" 621 | 1 622 | "apri file" 623 | 624 | "save the report" 625 | 1 626 | "salva il rapporto" 627 | 628 | "save the report as..." 629 | 1 630 | "salva il rapporto come..." 631 | 632 | "full analysis/drf graph" 633 | 1 634 | "analisi completa/grafico drf" 635 | 636 | "edit subtitles" 637 | 1 638 | "edita sottotitoli" 639 | 640 | "preferences" 641 | 1 642 | "preferenze" 643 | 644 | "Save as..." 645 | 1 646 | "Salva come..." 647 | 648 | "File `" 649 | 1 650 | "Il file `" 651 | 652 | "Do you want to overwrite it?" 653 | 1 654 | "Vuoi sovrascriverlo?" 655 | 656 | "Report saved as" 657 | 1 658 | "Rapporto salvato come" 659 | 660 | "The analysis failed" 661 | 1 662 | "L'analisi è fallita" 663 | 664 | "Starting video frames to ignore:" 665 | 1 666 | "Frames video iniziali da ignorare:" 667 | 668 | "Ending video frames to ignore:" 669 | 1 670 | "Frames video finali da ignorare:" 671 | 672 | "Invalid data" 673 | 1 674 | "Dati non validi" 675 | 676 | "can't create file" 677 | 1 678 | "impossibile creare il file" 679 | 680 | "Audio track saved as" 681 | 1 682 | "Traccia audio salvata come" 683 | 684 | "operation failed" 685 | 1 686 | "l'operazione è fallita" 687 | 688 | "Attachment" 689 | 1 690 | "Allegato" 691 | 692 | "Save" 693 | 1 694 | "Salva" 695 | 696 | "Attachment saved as" 697 | 1 698 | "Allegato salvato come" 699 | 700 | "Select destination folder" 701 | 1 702 | "Seleziona la cartella di destinazione" 703 | 704 | "Attachment(s) saved in folder" 705 | 1 706 | "Allegati salvati nella cartella" 707 | 708 | "Sorry, you have to wait " 709 | 1 710 | "Devi aspettare " 711 | 712 | " seconds" 713 | 1 714 | " secondi" 715 | 716 | "Language" 717 | 1 718 | "Lingua" 719 | 720 | "Changing the language requires a restart to take effect." 721 | 1 722 | "Per usufruire della modifica della lingua occorre far ripartire il programma." 723 | 724 | "this version: " 725 | 1 726 | "questa versione: " 727 | 728 | "site version: " 729 | 1 730 | "versione sul sito: " 731 | 732 | "please define the environment variable `HOME'" 733 | 1 734 | "prova a definire la variabile di ambiente `HOME'" 735 | 736 | "creation of directory `" 737 | 1 738 | "la creazione della cartella `" 739 | 740 | "' failed" 741 | 1 742 | "' è fallita" 743 | 744 | "the settings file was saved as" 745 | 1 746 | "il file di configurazione è stato salvato come" 747 | 748 | "creation of settings file failed" 749 | 1 750 | "la creazione del file di configurazione è fallita" 751 | 752 | "cannot open `" 753 | 1 754 | "impossibile aprire `" 755 | 756 | "`libmagic' is not available (disable `Magic' to remove this message)" 757 | 1 758 | "`libmagic' non è disponibile (per rimuovere questo messaggio disabilita `Magic')" 759 | 760 | ": invalid option" 761 | 1 762 | ": opzione non valida" 763 | 764 | "Usage" 765 | 1 766 | "Uso" 767 | 768 | "options" 769 | 1 770 | "opzioni" 771 | 772 | "Ignored extra bytes (" 773 | 1 774 | "Extra bytes ignorati (" 775 | 776 | "Version" 777 | 1 778 | "Versione" 779 | 780 | "Authors" 781 | 1 782 | "Autori" 783 | 784 | "License" 785 | 1 786 | "Licenza" 787 | 788 | "Sound" 789 | 1 790 | "Suono" 791 | 792 | "Source code of" 793 | 1 794 | "Codice sorgente di" 795 | 796 | "There is an update" 797 | 1 798 | "C'è un aggiornamento" 799 | 800 | "There are no updates" 801 | 1 802 | "Non ci sono aggiornamenti" 803 | 804 | "Please report bugs to" 805 | 1 806 | "Si prega di segnalare errori a" 807 | ) 808 | 809 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 810 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 811 | ;;;; ;;;; 812 | ;;;; ;;;; 813 | ;;;; ;;;; 814 | ;;;; ;;;; 815 | ;;;; ;;;; 816 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 817 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 818 | 819 | -------------------------------------------------------------------------------- /parse-flv.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defnet parse-flv (f) 12 | (deflocal fileinfo) 13 | 14 | (not <_kv "aborted">) 15 | (fsetpos 0 f) 16 | (parse-flv-check f fileinfo) 17 | (set <_kv "filetype"> "flv") 18 | (set <_kv "video"> ) 19 | (set <_kv "audio"> ) 20 | (set <_kv "fileinfo"> fileinfo) 21 | (set <_kv "cleaner"> (netptr parse-flv-clean)) ) 22 | 23 | (defnet parse-flv-clean (fileinfo) 24 | (close ) 25 | (close ) ) 26 | 27 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 28 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 29 | ;;;; ;;;; 30 | ;;;; ;;;; 31 | ;;;; ;;;; 32 | ;;;; ;;;; 33 | ;;;; ;;;; 34 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 35 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 36 | 37 | (defnet parse-flv-check (f @fileinfo) 38 | (deflocal a v flags vp ap vinfo-read ainfo-read vid aud 39 | vid-size complete a-demux 40 | frame-cnt vfr enc offs type size ts prev-ts cnt ) 41 | 42 | (= (freaduint-be f 24) 0x464c56) 43 | (set v (freaduint-be f 8)) 44 | (set flags (freaduint-be f 8)) 45 | (= (flags-field flags 3 5) 0) 46 | (= (flags-field flags 1 1) 0) 47 | (fsetpos (freaduint-be f 32) f) 48 | (set vp (= (flags-field flags 0 1) 1)) ; video present 49 | (set ap (= (flags-field flags 2 1) 1)) ; audio present 50 | (set @fileinfo (assoc)) 51 | (set <@fileinfo "version"> v) 52 | (set <@fileinfo "video"> (if vp 1 0)) 53 | (set <@fileinfo "audio"> (if ap 1 0)) 54 | (set a (assoc)) 55 | (set <@fileinfo "script"> a) 56 | (set vinfo-read (not vp)) 57 | (set ainfo-read (not ap)) 58 | (set frame-cnt 0) 59 | (set vfr false) 60 | (set enc false) 61 | (set cnt 0) 62 | (set vid-size 0) 63 | (set complete <_kv "complete">) 64 | (set a-demux <_kv "audio-demux">) 65 | (opt* (skip (freaduint-be f 32)) ; size of previous packet 66 | (set type (freaduint-be f 8)) ; type of this tag 67 | (set size (freaduint-be f 24)) ; datasize 68 | (set ts (freaduint-be f 24)) ; timestamp 69 | (inc ts (* (freaduint-be f 8) 0x1000000)) ; timestamp extended 70 | (skip (freaduint-be f 24)) ; reserved 71 | (set v (= (flags-field type 5 1) 1)) ; encrypted tag 72 | (set enc (or enc v)) 73 | (set offs (+ (fpos f) size)) 74 | (set v (flags-field type 0 5)) 75 | (if (= a-demux undef) 76 | then (opt (case v of 77 | 8 (parse-flv-audio @fileinfo f size ainfo-read aud) 78 | 9 (seq (parse-flv-video @fileinfo f size vinfo-read vid vid-size) 79 | (if (and (> frame-cnt 5) (not vfr)) 80 | then (set vfr (> (abs (- (- ts prev-ts) (/ prev-ts (- frame-cnt 1)))) 1)) ) 81 | (set prev-ts ts) 82 | (inc frame-cnt) ) 83 | 18 (seq (not v) 84 | (parse-flv-script @fileinfo f size) ))) 85 | else (if (= v 8) 86 | then (parse-flv-audio @fileinfo f size ainfo-read aud) )) 87 | (or (not vinfo-read) 88 | (not ainfo-read) 89 | (<> a-demux undef) 90 | (and vp (or complete (< frame-cnt (parse-video-frame-min)))) ) 91 | (fsetpos offs f) 92 | (inc cnt) 93 | (if (= (% cnt 300) 0) 94 | then (parse-progress f "flv" undef) )) 95 | (if (and (not vfr) (not (in "framerate" @fileinfo))) 96 | then (set <@fileinfo "framerate"> (/ 1000 (/ prev-ts (- frame-cnt 1)))) ) 97 | (set v <@fileinfo "totalduration">) 98 | (if (rationalp v) 99 | then (set <@fileinfo "duration"> v) ) 100 | (set enc) 101 | (set <@fileinfo "vid"> vid) 102 | (set <@fileinfo "aud"> aud) 103 | (set <@fileinfo "vid-size"> vid-size) 104 | (if (not (in "width" @fileinfo)) 105 | then (set <@fileinfo "width"> (width vid)) ) 106 | (if (not (in "height" @fileinfo)) 107 | then (set <@fileinfo "height"> (height vid)) )) 108 | 109 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 110 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 111 | ;;;; ;;;; 112 | ;;;; ;;;; 113 | ;;;; ;;;; 114 | ;;;; ;;;; 115 | ;;;; ;;;; 116 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 117 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 118 | 119 | (defnet parse-flv-video (fileinfo f size @vinfo-read @vid @vid-size) 120 | (deflocal v id) 121 | 122 | (dec-size size 1) 123 | (set v (freaduint-be f 8)) 124 | (set id (flags-field v 0 4)) 125 | (if (not @vinfo-read) 126 | then (case id of 127 | 2 (set v "Sorenson H.263") 128 | 3 (set v "Screen video") 129 | 4 (set v "On2 VP6") 130 | 5 (set v "On2 VP6 with alpha channel") 131 | 6 (set v "Screen video version 2") 132 | 7 (seq (set v "AVC") 133 | (set @vid (vid-create f)) ) 134 | default (set v "unknown") ) 135 | (set v) 136 | (set @vinfo-read true) ) 137 | (if (= id 7) 138 | then (dec-size size 4) 139 | (set v (freaduint-be f 8)) 140 | (skip (freaduint-be f 24)) ; composition time offset 141 | (case v of 142 | 0 (vid-parse-matroska @vid size) ; AVC sequence header 143 | 1 (vid-parse @vid size) ; AVC NALU 144 | 2 (skip) )) ; AVC end of sequence 145 | (inc @vid-size size) ) 146 | 147 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 148 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 149 | ;;;; ;;;; 150 | ;;;; ;;;; 151 | ;;;; ;;;; 152 | ;;;; ;;;; 153 | ;;;; ;;;; 154 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 155 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 156 | 157 | (defnet parse-flv-audio (fileinfo f size @ainfo-read @aud) 158 | (deflocal v id afreq abits achan fpout) 159 | 160 | (dec-size size 1) 161 | (set v (freaduint-be f 8)) 162 | (set id (flags-field v 4 4)) 163 | (if (not @ainfo-read) 164 | then (set afreq <[ 5512.5 11025 22050 44100 ] (flags-field v 2 2)>) 165 | (set abits <[ 8 16 ] (flags-field v 1 1)>) 166 | (set achan <[ 1 2 ] (flags-field v 0 1)>) 167 | (case id of 168 | 0 (set v "PCM") 169 | 1 (set v "ADPCM") 170 | 2 (set v "MP3") 171 | 3 (set v "PCM (le)") 172 | 4 (seq (set v "Nellymoser") 173 | (set afreq 16000) 174 | (set achan 1) ) 175 | 5 (seq (set v "Nellymoser") 176 | (set afreq 8000) 177 | (set achan 1) ) 178 | 6 (set v "Nellymoser") 179 | 7 (set v "G.711 A-law logarithmic PCM") 180 | 8 (set v "G.711 mu-law logarithmic PCM") 181 | 10 (seq (set v "AAC") 182 | (clr afreq abits achan) ) 183 | 11 (seq (set v "Speex") 184 | (set afreq 16000) 185 | (set abits 16) 186 | (set achan 1) ) 187 | 14 (seq (set v "MP3") 188 | (set afreq 8000) ) 189 | 15 (set v "device specific sound") 190 | default (set v "unknown") ) 191 | (if (in v [ "MP3" "AAC" ] ) 192 | then (set @aud (aud-create f (if (= v "MP3") 1 7))) 193 | (set fpout <_kv "audio-fpout">) 194 | (if (<> fpout undef) 195 | then (aud-fpout-begin @aud fpout 196 | (cfg-get-or-df "audio-saving-skip-garbage") ) 197 | (set <_kv "audio-aud"> @aud) )) 198 | (set v) 199 | (set afreq) 200 | (set abits) 201 | (set achan) 202 | (set @ainfo-read true) ) 203 | (if (audp @aud) 204 | then (if (= id 10) 205 | then (dec-size size 1) 206 | (if (= (freaduint-be f 8) 0) 207 | then ; AAC sequence header 208 | (aud-parse-aac-header @aud size) 209 | else ; AAC raw 210 | (aud-parse @aud size) ) 211 | else (aud-parse @aud size) ))) 212 | 213 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 214 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 215 | ;;;; ;;;; 216 | ;;;; ;;;; 217 | ;;;; ;;;; 218 | ;;;; ;;;; 219 | ;;;; ;;;; 220 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 221 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 222 | 223 | (defnet parse-flv-script (fileinfo f size) 224 | (deflocal end) 225 | (parse-flv-data-obj fileinfo f size end) ) 226 | 227 | (defnet parse-flv-data (fileinfo f @size @v) 228 | (deflocal v) 229 | 230 | (dec-size @size 1) 231 | (case (freaduint-be f 8) of 232 | 0 (seq ; number 233 | (dec-size @size 8) 234 | (set @v (freadfloat-be f 64)) ) 235 | 1 (seq ; boolean 236 | (dec-size @size 1) 237 | (set @v (<> (freaduint-be f 8) 0)) ) 238 | 2 (seq ; string 239 | (parse-flv-str f @size @v) ) 240 | 3 (seq ; object 241 | (repeat (parse-flv-data-obj fileinfo f @size v) 242 | until v ) 243 | (clr @v) ) 244 | 4 (seq ; movie clip 245 | (parse-flv-str f @size @v) ) 246 | 5 (seq ; null 247 | (clr @v) ) 248 | 6 (seq ; undefined 249 | (clr @v) ) 250 | 7 (seq ; reference 251 | (dec-size @size 2) 252 | (set @v (freaduint-be f 16)) ) 253 | 8 (seq ; ECMA array type 254 | (dec-size @size 7) 255 | (for v in 1 .. (freaduint-be f 32) do 256 | (parse-flv-name-data fileinfo f @size) ) 257 | (= (freaduint-be f 24) 9) 258 | (clr @v) ) 259 | 10 (seq ; strict array 260 | (repeat (parse-flv-data-var fileinfo f @size v) 261 | until v ) 262 | (clr @v) ) 263 | 11 (seq ; date 264 | (dec-size @size 10) 265 | (set @v (+ (date 1970 1 1 0 0 0 0 0) 266 | (/ (freadfloat-be f 64) 1000) )) 267 | (skip (freadsint-be f 16)) ) 268 | 12 (seq ; long string 269 | (dec-size @size 4) 270 | (fsetpos (+ (fpos f) (freaduint-be f 32)) f) 271 | (set @v "[<-long string->]") ) 272 | default (fail) )) 273 | 274 | (defnet parse-flv-data-obj (fileinfo f @size @end) 275 | (dec-size @size 1) 276 | (= (freaduint-be f 8) 2) 277 | (parse-flv-data-var fileinfo f @size @end) ) 278 | 279 | (defnet parse-flv-data-var (fileinfo f @size @end) 280 | (deflocal name data) 281 | 282 | (parse-flv-str f @size name) 283 | (if (= name "") 284 | then (dec-size @size 1) 285 | (= (freaduint-be f 8) 9) 286 | (set @end true) 287 | else (parse-flv-data fileinfo f @size data) 288 | (parse-flv-store fileinfo name data) 289 | (set @end false) )) 290 | 291 | (defnet parse-flv-str (f @size @v) 292 | (deflocal len) 293 | 294 | (dec-size @size 2) 295 | (set len (freaduint-be f 16)) 296 | (dec-size @size len) 297 | (set @v (utf8-validate (freadstr f len))) ) 298 | 299 | (defnet parse-flv-name-data (fileinfo f @size) 300 | (deflocal name data) 301 | 302 | (parse-flv-str f @size name) 303 | (parse-flv-data fileinfo f @size data) 304 | (parse-flv-store fileinfo name data) ) 305 | 306 | (defnet parse-flv-store (fileinfo name data) 307 | (if (and (<> data "") 308 | (or (<> data 0) (not (in name [ "duration" "width" "height" "totaldatarate" 309 | "audiodatarate" "audiosamplerate" "audiosamplesize" 310 | "videodatarate" "framerate" 311 | "totalduration" "bytelength" ]))) ) 312 | then (set <(if (in name [ "duration" "width" "height" "totaldatarate" 313 | "audiodatarate" "audiosamplerate" "audiosamplesize" 314 | "videodatarate" "framerate" 315 | "totalduration" "bytelength" 316 | "videocodecid" "audiocodecid" ]) 317 | fileinfo 318 | ) name> data ))) 319 | 320 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 321 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 322 | ;;;; ;;;; 323 | ;;;; ;;;; 324 | ;;;; ;;;; 325 | ;;;; ;;;; 326 | ;;;; ;;;; 327 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 328 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 329 | 330 | -------------------------------------------------------------------------------- /init.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defglobal _kv) 12 | 13 | (defnet init () 14 | (set _kv (assoc)) 15 | (set <_kv "da-chiudere"> (queue)) 16 | (init-sound-before) 17 | (init-parse-args) 18 | (init-db) 19 | (init-default) 20 | (init-values) 21 | (init-magic) 22 | (init-sound-after) ) 23 | 24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 25 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 26 | ;;;; ;;;; 27 | ;;;; ;;;; 28 | ;;;; ;;;; 29 | ;;;; ;;;; 30 | ;;;; ;;;; 31 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 32 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 33 | 34 | (defnet init-parse-args () 35 | (deflocal i p path f) 36 | 37 | (if (cli) 38 | then (set <_kv "cli-drf"> false) 39 | (set <_kv "cli-type"> "file") 40 | (set <_kv "cli-show-progress"> false) ) 41 | (for i in 1 .. (- (argc) 1) do 42 | (set p (argv i)) 43 | (alt (lmatch p "-psn") ; questa specie di opzione va ignorata 44 | (seq (lmatch remove p "--cfg=") 45 | (set <_kv "cfg-path"> p) ) 46 | (seq (lmatch remove p "--mgc=") 47 | (set <_kv "mgc-path"> p) ) 48 | (seq (= (cli) true) 49 | (= p "--drf") 50 | (set <_kv "cli-drf"> true) ) 51 | (seq (= (cli) true) 52 | (= p "--bbcode") 53 | (in <_kv "cli-type"> [ "file" "bbcode" ]) 54 | (set <_kv "cli-type"> "bbcode") ) 55 | (seq (= (cli) true) 56 | (= p "--html") 57 | (in <_kv "cli-type"> [ "file" "html" ]) 58 | (set <_kv "cli-type"> "html") ) 59 | (seq (= (cli) true) 60 | (lmatch remove p "--out=") 61 | (set <_kv "cli-out-path"> p) ) 62 | (seq (= (cli) true) 63 | (= p "--show-progress") 64 | (set <_kv "cli-show-progress"> true) ) 65 | (seq (= path undef) 66 | (set f (fopenro p)) 67 | (<> f undef) 68 | (close f) 69 | (set path (realpath p)) ) 70 | (seq (iup-message-error undef (+ (utf8-validate p) $": invalid option")) 71 | (exit -1) ))) 72 | (set <_kv "path"> path) ) 73 | 74 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 75 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 76 | ;;;; ;;;; 77 | ;;;; ;;;; 78 | ;;;; ;;;; 79 | ;;;; ;;;; 80 | ;;;; ;;;; 81 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 82 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 83 | 84 | (defnet init-db () 85 | (deflocal path crea) 86 | 87 | (set path <_kv "cfg-path">) 88 | (if (= path undef) 89 | then (if (cmingw) 90 | then (set path (callpathp "avinaptic.cfg")) 91 | else (set path (datapath)) 92 | (if (= path undef) 93 | then (iup-message-error undef $"please define the environment variable `HOME'") 94 | (exit -1) ) 95 | (alt (pathexists path) 96 | (mkdir path) 97 | (seq (iup-message-error undef (+ $"creation of directory `" (utf8-validate path) $"' failed")) 98 | (exit -1) )) 99 | (inc path "avinaptic.cfg") )) 100 | (set crea (not (pathexists path))) 101 | (set _db (sqlite3-open path)) 102 | (if (= _db undef) 103 | then (iup-message-error undef (+ $"cannot open `" (utf8-validate path) "'")) 104 | (exit -1) ) 105 | (alt (not crea) 106 | (seq (sqlite3-exec _db undef 107 | "CREATE TABLE config(" \ 108 | "key char unique not null," \ 109 | "value char not null)" ) 110 | (cfg-set "date-run-first" (now)) 111 | (iup-message-info undef (+ $"the settings file was saved as" nl 112 | "`" (utf8-validate path) "'" ))) 113 | (seq (close _db) 114 | (remove path) 115 | (iup-message-error undef $"creation of settings file failed") 116 | (exit -1) )) 117 | (da-chiudere _db) 118 | (cfg-set "date-run-last" (now)) 119 | (cfg-inc "runs" 1) 120 | (set-lang (cfg-get-lang)) ) 121 | 122 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 123 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 124 | ;;;; ;;;; 125 | ;;;; ;;;; 126 | ;;;; ;;;; 127 | ;;;; ;;;; 128 | ;;;; ;;;; 129 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 130 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 131 | 132 | (defnet init-default () 133 | (deflocal default-info a) 134 | 135 | (set default-info (assoc-default (init-default))) 136 | (set <_kv "default"> default-info) 137 | (if (= (cfg-get "profiles") undef) 138 | then (init-default-profiles a) 139 | (cfg-set "profiles" a) )) 140 | 141 | (defun init-default () 142 | [ [ "length-field" . 26 ] 143 | [ "length-divider" . 2 ] 144 | [ "length-value" . 68 ] 145 | [ "tile-pattern" . "" ] 146 | [ "tile-left" . false ] 147 | [ "indent-pattern" . " " ] 148 | [ "hex-dump-max" . 160 ] 149 | [ "decimals" . 6 ] 150 | [ "color-background" . (pix-color 0x4d 0x23 0x19) ] 151 | [ "color-section" . (pix-color 0xff 0 0) ] 152 | [ "color-field" . (pix-color 0xff 0xff 0) ] 153 | [ "color-value" . (pix-color 0xff 0xff 0xff) ] 154 | [ "font" . "Monospace 10" ] 155 | [ "enabled-magic" . true ] 156 | [ "enabled-id3tag" . true ] 157 | [ "enabled-exif" . true ] 158 | [ "enabled-attachments" . true ] 159 | [ "enabled-chapters" . true ] 160 | [ "chapter-display-grouped" . true ] 161 | [ "enabled-comment" . false ] 162 | [ "enabled-profile-compliancy" . false ] 163 | [ "enabled-x264-log" . true ] 164 | [ "enabled-debug" . false ] 165 | [ "enabled-utf8bom" . true ] 166 | [ "text-info-editable" . false ] 167 | [ "enabled-sound" . true ] 168 | [ "enabled-credits" . true ] 169 | [ "audio-saving-skip-garbage" . false ] 170 | [ "user-data-grouped" . true ] 171 | [ "bbcode-color-section" . (pix-color 0x38 0xb6 0x0f) ] 172 | [ "bbcode-color-field" . (pix-color 0x1c 0x4a 0x24) ] 173 | [ "bbcode-color-value" . (pix-color 0x25 0x28 0xeb) ] 174 | [ "bbcode-bold-section" . true ] 175 | [ "bbcode-underline-section" . true ] 176 | [ "bbcode-bold-field" . true ] 177 | [ "bbcode-underline-field" . false ] 178 | [ "bbcode-bold-value" . false ] 179 | [ "bbcode-underline-value" . false ] 180 | [ "percent-line-length" . 20 ] 181 | [ "percent-line-normalize" . false ] 182 | [ "profile" . 22 ] 183 | ]) 184 | 185 | (defnet init-default-profiles (@a) 186 | (deflocal i j a) 187 | 188 | (set @a (array (length (default-profiles)) (length (car (default-profiles))))) 189 | (for i in (default-profiles) do 190 | (set a <@a (for-pos)>) 191 | (for j in i do 192 | (set j) ))) 193 | 194 | (defun default-profiles () 195 | ; nome w h fps size init rate 196 | [ [ "MPEG4 Simple @ L0" 176 144 15 163680 147312 64000 ] 197 | [ "MPEG4 Simple @ L1" 176 144 15 163680 147312 64000 ] 198 | [ "MPEG4 Simple @ L2" 352 288 15 654720 589248 128000 ] 199 | [ "MPEG4 Simple @ L3" 352 288 30 654720 589248 384000 ] 200 | [ "MPEG4 Simple @ L4a" 640 480 30 1309440 1178496 4000000 ] 201 | [ "MPEG4 Simple @ L5" 720 576 30 1833216 1649894 8000000 ] 202 | [ "MPEG4 Simple @ L6" 1280 720 30 4059264 3653338 12000000 ] 203 | [ "MPEG4 Advanced Simple @ L0" 176 144 30 163680 147312 128000 ] 204 | [ "MPEG4 Advanced Simple @ L1" 176 144 30 163680 147312 128000 ] 205 | [ "MPEG4 Advanced Simple @ L2" 352 288 15 654720 589248 384000 ] 206 | [ "MPEG4 Advanced Simple @ L3" 352 288 30 654720 589248 768000 ] 207 | [ "MPEG4 Advanced Simple @ L4" 352 576 30 1309440 1178496 3000000 ] 208 | [ "MPEG4 Advanced Simple @ L5" 720 576 30 1833216 1649894 8000000 ] 209 | [ "DivX Handheld" 176 144 15 262144 196608 537600 ] 210 | [ "DivX qMobile" 176 144 15 262144 196608 200000 ] 211 | [ "DivX Mobile" 320 240 30 655360 589824 600000 ] 212 | [ "Xvid Mobile" 320 240 30 1048576 943718 1334850 ] 213 | [ "DivX Home Theater NTSC" 720 480 30 3145728 2359296 4854000 ] 214 | [ "DivX Home Theater PAL" 720 576 25 3145728 2359296 4854000 ] 215 | [ "MTK NTSC" 720 480 30 3145728 2359296 4854000 ] 216 | [ "MTK NTSC 6000" 720 480 30 4718592 3538944 7281300 ] 217 | [ "MTK PAL" 720 576 25 3145728 2359296 4854000 ] 218 | [ "MTK PAL 6000" 720 576 25 4718592 3538944 7281300 ] 219 | [ "DivX Portable NTSC" 352 240 30 3145728 2359296 4854000 ] 220 | [ "DivX Portable PAL" 352 288 25 3145728 2359296 4854000 ] 221 | [ "DivX 720HD" 1280 720 30 6291456 4718592 9708400 ] 222 | [ "Xvid HD 720" 1280 720 30 6291456 4718592 9708400 ] 223 | [ "DivX 1080HD" 1920 1080 30 17170432 15453388 20000000 ] 224 | [ "Xvid HD 1080" 1920 1080 30 16769024 15092122 20480000 ] 225 | [ "Xbox" 704 0 25 960000 864000 3500000 ] ]) 226 | 227 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 228 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 229 | ;;;; ;;;; 230 | ;;;; ;;;; 231 | ;;;; ;;;; 232 | ;;;; ;;;; 233 | ;;;; ;;;; 234 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 235 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 236 | 237 | (defnet init-values () 238 | (deflocal default-info) 239 | 240 | (set default-info <_kv "default">) 241 | (set <_kv "length-field"> (cfg-get-or-default-num "length-field" default-info)) 242 | (set <_kv "length-divider"> (cfg-get-or-default-num "length-divider" default-info)) 243 | (set <_kv "length-value"> (cfg-get-or-default-num "length-value" default-info)) 244 | (set <_kv "tile-pattern"> (cfg-get-or-default "tile-pattern" default-info)) 245 | (set <_kv "tile-left"> (cfg-get-or-default "tile-left" default-info)) 246 | (set <_kv "color-section"> (cfg-get-or-default "color-section" default-info)) 247 | (set <_kv "color-field"> (cfg-get-or-default "color-field" default-info)) 248 | (set <_kv "color-value"> (cfg-get-or-default "color-value" default-info)) ) 249 | 250 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 251 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 252 | ;;;; ;;;; 253 | ;;;; ;;;; 254 | ;;;; ;;;; 255 | ;;;; ;;;; 256 | ;;;; ;;;; 257 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 258 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 259 | 260 | (defnet init-magic () 261 | (deflocal path) 262 | 263 | (opt (not (magic-available)) 264 | (set path <_kv "mgc-path">) 265 | (stringp path) 266 | (magic-reinit path) ) 267 | (opt (not (magic-available)) 268 | (set path (search-path-default "magic.mgc")) 269 | (stringp path) 270 | (magic-reinit path) ) 271 | (if (not (magic-available)) 272 | then (if (cfg-get-or-df "enabled-magic") 273 | then (iup-message-warning undef 274 | $"`libmagic' is not available (disable `Magic' to remove this message)" )))) 275 | 276 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 277 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 278 | ;;;; ;;;; 279 | ;;;; ;;;; 280 | ;;;; ;;;; 281 | ;;;; ;;;; 282 | ;;;; ;;;; 283 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 284 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 285 | 286 | (defnet init-sound-before () 287 | (if (not (cli)) 288 | then (set <_kv "enabled-sound"> false) 289 | (set <_kv "soundserver"> (thread-create (netptr init-sound-th) (thread-self))) )) 290 | 291 | (defnet init-sound-after () 292 | (if (not (cli)) 293 | then (set <_kv "enabled-sound"> (cfg-get-or-df "enabled-sound")) )) 294 | 295 | (defnet init-sound-th (th) 296 | (deflocal snd) 297 | 298 | (opt (not (cmingw)) 299 | (wav-play-memory (raw-load-static "silence.wav")) ) 300 | (repeat (receive snd from th) 301 | until (= snd undef) 302 | (opt (truep <_kv "enabled-sound">) 303 | (wav-play-memory snd) ))) 304 | 305 | (defnet sound-quit () 306 | (if (not (cli)) 307 | then (send undef to <_kv "soundserver">) 308 | (thread-join <_kv "soundserver">) )) 309 | 310 | (defnet sound-play (snd) 311 | (if (not (cli)) 312 | then (send snd to <_kv "soundserver">) )) 313 | 314 | (defnet sound-alert () 315 | (sound-play (raw-load-static "alert.wav")) ) 316 | 317 | (defnet sound-pop () 318 | (sound-play (raw-load-static "pop.wav")) ) 319 | 320 | (defnet sound-info () 321 | (sound-play (raw-load-static "info.wav")) ) 322 | 323 | (defnet sound-warning () 324 | (sound-play (raw-load-static "warning.wav")) ) 325 | 326 | (defnet sound-error () 327 | (sound-play (raw-load-static "error.wav")) ) 328 | 329 | (defnet sound-question () 330 | (sound-play (raw-load-static "question.wav")) ) 331 | 332 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 333 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 334 | ;;;; ;;;; 335 | ;;;; ;;;; 336 | ;;;; ;;;; 337 | ;;;; ;;;; 338 | ;;;; ;;;; 339 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 340 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 341 | 342 | -------------------------------------------------------------------------------- /parse-avi.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defnet parse-avi (f) 12 | (deflocal loc-info avi stop rec-lists streams) 13 | 14 | (not <_kv "aborted">) 15 | (fsetpos 0 f) 16 | (set avi (avi-open-input-file <_kv "path"> true)) 17 | (<> avi undef) 18 | (set loc-info (assoc-default (parse-mp4-default))) 19 | (set false) 20 | (set false) 21 | (set false) 22 | (set false) 23 | (set stop false) 24 | (set rec-lists false) 25 | (alt (seq (parse-avi-rec loc-info f (length f) undef 0 <_kv "complete"> <_kv "audio-demux"> stop rec-lists streams) 26 | (<> streams undef) ) 27 | (seq (parse-avi-clean (cons loc-info avi)) 28 | (fail) )) 29 | (parse-avi-index loc-info avi) 30 | (set rec-lists) 31 | (set <_kv "video"> ) 32 | (set <_kv "audio"> ) 33 | (set <_kv "filetype"> "avi") 34 | (set <_kv "fileinfo"> (cons loc-info avi)) 35 | (set <_kv "cleaner"> (netptr parse-avi-clean)) ) 36 | 37 | (defnet parse-avi-clean (fileinfo) 38 | (deflocal stream) 39 | 40 | (for stream in <(car fileinfo) "streams"> do 41 | (close ) ) 42 | (close (cdr fileinfo)) ) 43 | 44 | (defnet parse-avi-index (loc-info avi) 45 | (deflocal i k qk kmin kmax cnt z qz klast zlast) 46 | 47 | (for i in do 48 | (set k ) 49 | (if (vidp k) 50 | then (if (< (vid-bitstream-type k) 1) 51 | then (close k) 52 | (set undef) ))) 53 | (if (avi-has-index avi) 54 | then (set k 0) 55 | (set kmin (maxint)) 56 | (set kmax 1) 57 | (set cnt 1) 58 | (set z 0) 59 | (set qk (queue)) 60 | (set qz (queue)) 61 | (for i in 0 .. (- (avi-video-frames avi) 1) do 62 | (if (avi-video-frame-is-keyframe avi i) 63 | then (if (< (length qk) 5) 64 | then (queue-put qk i) ) 65 | (set k (+ k 1)) 66 | (set klast i) 67 | (if (and (> i 0) (< cnt kmin)) 68 | then (set kmin cnt) ) 69 | (set cnt 1) 70 | else (set cnt (+ cnt 1)) 71 | (set kmax (max kmax cnt)) ) 72 | (if (= (avi-video-size avi i) 0) 73 | then (if (< (length qz) 5) 74 | then (queue-put qz i) ) 75 | (set z (+ z 1)) 76 | (set zlast i) )) 77 | (set kmin (min kmin kmax)) 78 | (set kmin) 79 | (set kmax) 80 | (set k) 81 | (set (+ (format-int k) (if (= k 0) "" 82 | (+ " (" (sprintl qk "; ") (if (= (length qk) k) "" 83 | (sprint "; ... " klast)) ")" )))) 84 | (set (+ (format-int z) (if (= z 0) "" 85 | (+ " (" (sprintl qz "; ") (if (= (length qz) z) "" 86 | (sprint "; ... " zlast)) ")" )))) )) 87 | 88 | (defnet parse-avi-rec (loc-info f end uptype level complete a-demux @stop @rec-lists @streams) 89 | (deflocal id size size-used off ckend type) 90 | 91 | (while (and (< (+ (fpos f) 8) end) 92 | (not (and @stop (or (= uptype "movi") (= uptype "rec ")))) ) do 93 | (set id (freadstr f 4)) 94 | (set size-used (freaduint-le f 32)) 95 | (set size (+ size-used (% size-used 2))) 96 | (set off (fpos f)) 97 | (or (> off 8) (= id "RIFF")) 98 | (set ckend (+ off size)) 99 | (if (> ckend end) 100 | then (assoc-queue loc-info "corrupt" (utf8-validate id)) 101 | (set ckend end) ) 102 | (if (or (= id "RIFF") (= id "LIST")) 103 | then (set type (freadstr f 4)) 104 | (or (> off 8) (= type "AVI ")) 105 | 106 | ;(print (tile (* level 4)) '#' id "# / #" type '#' nl) 107 | 108 | (if (and (= id "LIST") (= type "strl")) 109 | then (set off) 110 | (set (+ size 8)) ) 111 | 112 | (if (and (= id "LIST") (= type "goog")) 113 | then (set (list (- off 8) (+ size 8) level)) ) 114 | 115 | (if (and (= id "LIST") (= type "odml")) 116 | then (set true) ) 117 | 118 | (if (and (= id "RIFF") (= type "AVIX")) 119 | then (set true) 120 | (set true) ) 121 | 122 | (if (and (= id "RIFF") (= type "MENU")) 123 | then (set true) ) 124 | 125 | (if (= type "rec ") 126 | then (set @rec-lists true) ) 127 | 128 | (parse-avi-rec loc-info f ckend type (+ level 1) complete a-demux @stop @rec-lists @streams) 129 | 130 | (if (= type "hdrl") 131 | then (parse-avi-setup loc-info @streams) ) 132 | 133 | else 134 | 135 | ;(print (tile (* level 4)) '#' id '#' nl) 136 | 137 | (if (= uptype "INFO") 138 | then (parse-avi-info loc-info f id size-used) ) 139 | 140 | (if (= id "JUNK") 141 | then (parse-avi-junk loc-info f size-used) ) 142 | 143 | (if (= id "indx") 144 | then (set true) 145 | (set true) ) 146 | 147 | (if (and (= uptype "hdrl") (= id "avih")) 148 | then (parse-avi-header loc-info f size-used @streams) ) 149 | 150 | (if (and (= uptype "strl") (= id "strh")) 151 | then (parse-avi-stream-header loc-info f size-used @streams) ) 152 | 153 | (if (and (= uptype "strl") (= id "strf")) 154 | then (parse-avi-stream-format loc-info a-demux f size-used @streams) ) 155 | 156 | (if (and (= uptype "strl") (= id "strn")) 157 | then (parse-avi-stream-name loc-info f size-used @streams) ) 158 | 159 | (if (and (= uptype "strl") (= id "vprp")) 160 | then (set true) 161 | (parse-avi-vprp-header loc-info f size-used @streams) ) 162 | 163 | (if (or (= uptype "movi") (= uptype "rec ")) 164 | then ;(print (tile (* level 4)) "..." nl) 165 | 166 | (parse-avi-stream loc-info f size-used 167 | <@streams (+ (* 16 (charhex2int )) (charhex2int ))> 168 | complete a-demux @stop ) 169 | 170 | else ; FIXME 171 | ; qui andrebbe l`eventuale modifica dell`albero 172 | (skip) )) 173 | (fsetpos ckend f) )) 174 | 175 | (defnet parse-avi-info (loc-info f id size-used) 176 | (deflocal i) 177 | 178 | (set i (utf8-validate (freadstr f size-used))) 179 | (if (and (<> i undef) (or (<> id "JUNK") (<> i ""))) 180 | then (assoc-queue-unique loc-info "INFO" (cons id i)) )) 181 | 182 | (defnet parse-avi-junk (loc-info f size-used) 183 | (deflocal i) 184 | 185 | (set i (utf8-validate (avi-parse-junk f size-used))) 186 | (if (and (<> i undef) (<> i "")) 187 | then (assoc-queue-unique loc-info "JUNK" i) )) 188 | 189 | (defnet parse-avi-header (loc-info f size-used @streams) 190 | (deflocal i) 191 | 192 | (>= size-used 40) 193 | (= @streams undef) 194 | (set (/ 1000000 (freaduint-le f 32))) 195 | (skip (freaduint-le f 32)) 196 | (skip (freaduint-le f 32)) 197 | (skip (freaduint-le f 32)) 198 | (set (freaduint-le f 32)) 199 | (skip (freaduint-le f 32)) 200 | (set @streams (freaduint-le f 32)) 201 | (skip (freaduint-le f 32)) 202 | (set (freaduint-le f 32)) 203 | (set i (freaduint-le f 32)) 204 | (<> i undef) 205 | (set i) 206 | (set @streams (array @streams 5)) 207 | (set @streams) 208 | (set -1) ) 209 | 210 | (defnet parse-avi-stream-header (loc-info f size-used streams) 211 | (deflocal stream type trk-info scale rate start samplesize) 212 | 213 | (>= size-used 48) 214 | (<> streams undef) 215 | (set stream (+ 1 )) 216 | (< stream (length streams)) 217 | (set stream) 218 | (set stream ) 219 | (set type (freadstr f 4)) 220 | (set type) 221 | (set trk-info (assoc)) 222 | (set trk-info) 223 | (case type of 224 | "vids" (set (utf8-validate (freadstr f 4))) 225 | default (skip (freaduint-le f 32)) ) 226 | (skip (freaduint-le f 32)) 227 | (skip (freaduint-le f 32)) 228 | (skip (freaduint-le f 32)) 229 | (set scale (freaduint-le f 32)) 230 | (set rate (freaduint-le f 32)) 231 | (set start (freaduint-le f 32)) 232 | (skip (freaduint-le f 32)) 233 | (skip (freaduint-le f 32)) 234 | (skip (freaduint-le f 32)) 235 | (set samplesize (freaduint-le f 32)) 236 | (<> samplesize undef) 237 | (set scale) 238 | (set rate) 239 | (set start) 240 | (set (/ (* start scale) rate)) 241 | (if (and (= type "vids") (= undef)) 242 | then (set (/ rate scale)) ) 243 | (if (= type "auds") 244 | then (set (= samplesize 0)) )) 245 | 246 | (defnet parse-avi-stream-format (loc-info a-demux f size-used streams) 247 | (deflocal stream trk-info aud i a-cnt) 248 | 249 | (set stream ) 250 | (>= stream 0) 251 | (set stream ) 252 | (set trk-info ) 253 | (case of 254 | "vids" (seq (>= size-used 40) 255 | (assoc-inc loc-info "video") 256 | (set (vid-create f)) 257 | (set 0) 258 | (skip (freaduint-le f 32)) 259 | (set (freaduint-le f 32)) 260 | (set (freaduint-le f 32)) 261 | (skip (freaduint-le f 16)) 262 | (skip (freaduint-le f 16)) 263 | (set (utf8-validate (freadstr f 4))) 264 | (skip (freaduint-le f 32)) 265 | (skip (freaduint-le f 32)) 266 | (skip (freaduint-le f 32)) 267 | (skip (freaduint-le f 32)) 268 | (<> (freaduint-le f 32) undef) ) 269 | "auds" (seq (>= size-used 16) 270 | (set a-cnt (+ 1 )) 271 | (set a-cnt) 272 | (set i (freaduint-le f 16)) 273 | (if (or (= a-cnt a-demux) (= a-demux undef)) 274 | then (if (in i [ 0x50 0x55 ]) 275 | then (set aud (aud-create f 1)) 276 | else (if (= i 0x2000) 277 | then (set aud (aud-create f 3)) 278 | else (if (= i 0x2001) 279 | then (set aud (aud-create f 5)) 280 | else (clr aud) ))) 281 | (if (= a-cnt a-demux) 282 | then (aud-fpout-begin aud <_kv "audio-fpout"> 283 | (cfg-get-or-df "audio-saving-skip-garbage") ) 284 | (set <_kv "audio-aud"> aud) ) 285 | else (clr aud) ) 286 | (set aud) 287 | (set 0) 288 | (set i) 289 | (set (freaduint-le f 16)) 290 | (set (freaduint-le f 32)) 291 | (set (/ (* 8 (freaduint-le f 32)) 1000)) 292 | (skip (freaduint-le f 16)) 293 | (<> (freaduint-le f 16) undef) ))) 294 | 295 | (defnet parse-avi-stream-name (loc-info f size-used streams) 296 | (deflocal i stream) 297 | 298 | (set i (utf8-validate (freadstr f size-used))) 299 | (if (and (<> i undef) (<> i "")) 300 | then (set stream ) 301 | (>= stream 0) 302 | (set stream ) 303 | (set i) )) 304 | 305 | (defnet parse-avi-vprp-header (loc-info f size-used streams) 306 | (deflocal stream trk-info) 307 | 308 | (set stream ) 309 | (>= stream 0) 310 | (set stream ) 311 | (if (= "vids") 312 | then (>= size-used 36) 313 | (set trk-info ) 314 | (skip (freaduint-le f 32)) 315 | (skip (freaduint-le f 32)) 316 | (skip (freaduint-le f 32)) 317 | (skip (freaduint-le f 32)) 318 | (skip (freaduint-le f 32)) 319 | (set (freaduint-le f 16)) 320 | (set (freaduint-le f 16)) 321 | (skip (freaduint-le f 32)) 322 | (skip (freaduint-le f 32)) 323 | (<> (freaduint-le f 32) undef) )) 324 | 325 | (defnet parse-avi-setup (loc-info streams) 326 | (deflocal vstream stream) 327 | 328 | (for stream in streams do 329 | (if (= "vids") 330 | then (if (= vstream undef) 331 | then (set vstream stream) 332 | (set ) 333 | else (if 334 | then (set "sdmf") )))) 335 | (for stream in streams do 336 | (if (= "auds") 337 | then (set vstream) ))) 338 | 339 | (defnet parse-avi-stream (loc-info f size-used stream complete a-demux @stop) 340 | (case of 341 | "vids" (if (= a-demux undef) 342 | then (parse-avi-video loc-info f size-used stream complete @stop) ) 343 | "auds" (parse-avi-audio f a-demux size-used stream @stop) )) 344 | 345 | (defnet parse-avi-video (loc-info f size-used stream complete @stop) 346 | (deflocal vid cnt i) 347 | 348 | (set vid ) 349 | (set cnt ) 350 | (if (= cnt 0) 351 | then (for i in do 352 | (if (= "auds") 353 | then (set (aud-duration ) )))) 354 | (alt (seq (vid-parse vid size-used) 355 | (set cnt (+ cnt 1)) 356 | (set cnt) 357 | (if (= (% cnt 300) 0) 358 | then (parse-progress f "avi" vid) ) 359 | (or complete (< cnt (parse-video-frame-min))) ) 360 | (set @stop true) )) 361 | 362 | (defnet parse-avi-audio (f a-demux size-used stream @stop) 363 | (deflocal aud vstream d) 364 | 365 | (opt (set aud ) 366 | (audp aud) 367 | (if (= a-demux undef) 368 | then (set vstream ) 369 | (if (= (aud-frames aud) 0) 370 | then (set ) ) 371 | (aud-parse aud size-used) 372 | (set d (abs (- (aud-duration aud) 373 | (/ ) ))) 374 | (if (> d ) 375 | then (set d) ) 376 | else (aud-parse aud size-used) 377 | (set d (+ 1 )) 378 | (set d) 379 | (if (= (% d 1000) 0) 380 | then (alt (parse-progress f "avi" undef) 381 | (set @stop true) ))))) 382 | 383 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 384 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 385 | ;;;; ;;;; 386 | ;;;; ;;;; 387 | ;;;; ;;;; 388 | ;;;; ;;;; 389 | ;;;; ;;;; 390 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 391 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 392 | 393 | -------------------------------------------------------------------------------- /drf.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defun drf-graph-width () 500) 12 | (defun drf-graph-height () 180) 13 | (defun drf-graph-descr-width () 56) 14 | (defun drf-graph-mag-step () 0.2) 15 | (defun drf-graph-mag-max () 20) 16 | (defun drf-graph-avg-int-max () 300) 17 | (defun drf-graph-max-spin-width () (if (iup-gtk3) 80 55)) 18 | 19 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 20 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 21 | ;;;; ;;;; 22 | ;;;; ;;;; 23 | ;;;; ;;;; 24 | ;;;; ;;;; 25 | ;;;; ;;;; 26 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 27 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 28 | 29 | (defnet drf (vid fps) 30 | (deflocal drf-info pix q butbox vbox dlg) 31 | 32 | (set drf-info (assoc)) 33 | (set <_kv "drf-info"> drf-info) 34 | (set vid) 35 | (set fps) 36 | (set pix (pix-create (drf-graph-width) (drf-graph-height))) 37 | (set pix) 38 | (set (cfg-get "profiles")) 39 | (set 1) 40 | 41 | (set q (queue)) 42 | 43 | (set vbox (iup-vbox 44 | (drf-setup-img1 drf-info q vid pix) 45 | (drf-setup-slide drf-info q) 46 | (drf-setup-img2 drf-info q vid pix) 47 | (drf-setup-search drf-info q vid) 48 | (drf-setup-goto drf-info q vid) 49 | (drf-setup-last-line drf-info q) )) 50 | (iup-set-str-attribute vbox "MARGIN" "4x4") 51 | (iup-set-int vbox "GAP" 0) 52 | 53 | (set dlg (iup-dialog vbox)) 54 | (iup-set-dlg-parent <_kv "win"> dlg) 55 | (iup-set-str-attribute dlg "TITLE" $"DRF graph") 56 | (iup-set-bool dlg "DIALOGFRAME" true) 57 | (iup-set-attribute-handle dlg "DEFAULTESC" ) 58 | (iup-set-callback dlg "K_ANY" (netptr drf-kb-cb)) 59 | 60 | (drf-goto 0) 61 | 62 | (iup-popup dlg (cmacro IUP_CENTERPARENT) (cmacro IUP_CENTERPARENT)) 63 | 64 | (close dlg pix) 65 | (close 66 | ) 67 | (iup-close-queue q) 68 | (assoc-clr _kv "drf-info") ) 69 | 70 | (defun drf-setup-img1 (drf-info q vid pix) net drf-setup-img1) 71 | (defnet drf-setup-img1 (drf-info q vid pix @wid) 72 | (deflocal p img lab1a lab1b) 73 | 74 | (set p (pix-create (drf-graph-descr-width) (drf-graph-height))) 75 | (if (= (vid-bitstream-type vid) 3) 76 | then (drf-pix-draw-value p "q=10" (linear 10 0 45 0 1)) 77 | (drf-pix-draw-value p "q=20" (linear 20 0 45 0 1)) 78 | (drf-pix-draw-value p "q=40" (linear 40 0 45 0 1)) 79 | else (drf-pix-draw-value p "q=4" (linear 4 0 18 0 1)) 80 | (drf-pix-draw-value p "q=8" (linear 8 0 18 0 1)) 81 | (drf-pix-draw-value p "q=16" (linear 16 0 18 0 1)) ) 82 | (pix-transparent p (pix-color 0xff 0xff 0xff)) 83 | 84 | (set lab1a (iup-label)) 85 | (set lab1a) 86 | (set img (iup-image-rgba p)) 87 | (close p) 88 | (set img) 89 | (iup-set-attribute-handle lab1a "IMAGE" img) 90 | 91 | (set lab1b (iup-label)) 92 | (set lab1b) 93 | (set img (iup-image-rgba pix)) 94 | (set img) 95 | (iup-set-attribute-handle lab1b "IMAGE" img) 96 | 97 | (set @wid (iup-hbox (iup-fill) lab1a lab1b)) 98 | (iup-set-int @wid "GAP" 4) 99 | (iup-set-int @wid "MARGIN" 0) ) 100 | 101 | (defun drf-setup-slide (drf-info q) net drf-setup-slide) 102 | (defnet drf-setup-slide (drf-info q @wid) 103 | (deflocal label slide) 104 | 105 | (set label (iup-label "000,000,000\n00:00:00")) 106 | (set label) 107 | ; (iup-set-str-attribute label "ALIGNMENT" "ARIGHT:ACENTER") 108 | 109 | (set slide (iup-val)) 110 | (set slide) 111 | (iup-set-str-attribute slide "EXPAND" "HORIZONTAL") 112 | (iup-set-callback slide "VALUECHANGED_CB" (netptr drf-slide-changed-cb)) 113 | 114 | (set @wid (iup-hbox label slide)) 115 | (iup-set-str-attribute @wid "ALIGNMENT" "ACENTER") 116 | (iup-set-int @wid "GAP" 20) 117 | (iup-set-int @wid "MARGIN" 0) ) 118 | 119 | (defun drf-setup-img2 (drf-info q vid pix) net drf-setup-img2) 120 | (defnet drf-setup-img2 (drf-info q vid pix @wid) 121 | (deflocal p img lab2a lab2b) 122 | 123 | (drf-pix-size vid 1 p) 124 | 125 | (set lab2a (iup-label)) 126 | (set lab2a) 127 | (set img (iup-image-rgba p)) 128 | (close p) 129 | (set img) 130 | (iup-set-attribute-handle lab2a "IMAGE" img) 131 | 132 | (set lab2b (iup-label)) 133 | (set lab2b) 134 | (iup-set-callback lab2b "BUTTON_CB" (netptr drf-mag-cb)) 135 | (set img (iup-image-rgba pix)) 136 | (set img) 137 | (iup-set-attribute-handle lab2b "IMAGE" img) 138 | 139 | (set @wid (iup-hbox (iup-fill) lab2a lab2b)) 140 | (iup-set-int @wid "GAP" 4) 141 | (iup-set-int @wid "MARGIN" 0) ) 142 | 143 | (defun drf-setup-search (drf-info q vid) net drf-setup-search) 144 | (defnet drf-setup-search (drf-info q vid @wid) 145 | (deflocal list hbox sb-drf-min sb-drf-max sb-size-min sb-size-max i) 146 | 147 | (set list (iup-list)) 148 | (set list) 149 | (iup-set-bool list "DROPDOWN" true) 150 | (iup-set-str-attribute list 1 $"Any type") 151 | (for i in (if (= (vid-bitstream-type vid) 3) (slice-type-list) (vop-type-list)) do 152 | (iup-set-str-attribute list (+ (for-pos) 2) i) ) 153 | (iup-set-int list "VALUE" 1) 154 | 155 | (set i (if (= (vid-bitstream-type vid) 3) 51 31)) 156 | (set sb-drf-min (iup-text-spin 0 i 0)) 157 | (set sb-drf-max (iup-text-spin 0 i i)) 158 | (set sb-drf-min) 159 | (set sb-drf-max) 160 | (iup-set-int sb-drf-min "MAXSIZE" (drf-graph-max-spin-width)) 161 | (iup-set-int sb-drf-max "MAXSIZE" (drf-graph-max-spin-width)) 162 | 163 | (set i (vid-max-frame-size vid)) 164 | (set sb-size-min (iup-text-spin 0 i 0)) 165 | (set sb-size-max (iup-text-spin 0 i i)) 166 | (set sb-size-min) 167 | (set sb-size-max) 168 | 169 | (set hbox (iup-hbox 170 | (iup-frame-with-margin "DRF range" 171 | (iup-hbox 172 | sb-drf-min 173 | sb-drf-max )) 174 | (iup-frame-with-margin $"Frame size range" 175 | (iup-hbox 176 | sb-size-min 177 | sb-size-max )) 178 | (iup-frame-with-margin $"Frame type" list) 179 | (iup-frame-with-margin $"Prev/Next" 180 | (iup-hbox 181 | (iup-button-icon undef (netptr drf-prev-cb) (pix-load-static "16x16/go-previous-7.png") q) 182 | (iup-button-icon undef (netptr drf-next-cb) (pix-load-static "16x16/go-next-7.png") q) )))) 183 | 184 | (set @wid (iup-frame-with-margin $"Search" hbox)) ) 185 | 186 | (defun drf-setup-goto (drf-info q vid) net drf-setup-goto) 187 | (defnet drf-setup-goto (drf-info q vid @wid) 188 | (deflocal goto list1 list2 avg-int profile i) 189 | 190 | (set i (iup-text-spin 0 (- (length vid) 1) 0)) 191 | (set i) 192 | 193 | (set goto (iup-hbox 194 | i 195 | (iup-button-icon undef (netptr drf-goto-cb) (pix-load-static "16x16/go-jump-4.png") q) )) 196 | 197 | (set list1 (iup-list)) 198 | (set list1) 199 | (iup-set-bool list1 "DROPDOWN" true) 200 | (iup-set-str-attribute list1 1 $"Frame size") 201 | (iup-set-str-attribute list1 2 $"VBV buffer") 202 | (iup-set-int list1 "VALUE" 1) 203 | (iup-set-callback list1 "ACTION" (netptr drf-select-graph-changed-cb)) 204 | 205 | (set list2 (iup-list)) 206 | (set list2) 207 | (iup-set-bool list2 "DROPDOWN" true) 208 | (for i in do 209 | (iup-set-str-attribute list2 (+ (for-pos) 1) ) ) 210 | (iup-set-int list2 "VALUE" (+ (cfg-get-or-df-num "profile") 1)) 211 | (iup-set-callback list2 "ACTION" (netptr drf-generic-changed-cb)) 212 | 213 | (set avg-int (cfg-setup-framed-spin "Avg int" 0 (drf-graph-avg-int-max) 0 drf-info "sb-avg-int")) 214 | (iup-set-int "MAXSIZE" (drf-graph-max-spin-width)) 215 | 216 | (set profile (iup-frame-with-margin $"Profile" list2)) 217 | 218 | (set avg-int) 219 | (set profile) 220 | 221 | (set @wid (iup-hbox 222 | (iup-frame-with-margin "Goto" goto) 223 | (iup-frame-with-margin $"Bottom graph" list1) 224 | avg-int 225 | (iup-fill) 226 | profile )) 227 | 228 | (iup-hide profile) 229 | 230 | (iup-set-callback "VALUECHANGED_CB" (netptr drf-generic-changed-cb)) ) 231 | 232 | (defun drf-setup-last-line (drf-info q) net drf-setup-last-line) 233 | (defnet drf-setup-last-line (drf-info q @wid) 234 | (deflocal label button) 235 | 236 | (set label (iup-label "")) 237 | (set label) 238 | (iup-set-str-attribute label "EXPAND" "HORIZONTAL") 239 | 240 | (set button (iup-button-icon-ok-low $"Close" undef q)) 241 | (set button) 242 | 243 | (set @wid (iup-hbox label button)) ) 244 | 245 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 246 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 247 | ;;;; ;;;; 248 | ;;;; ;;;; 249 | ;;;; ;;;; 250 | ;;;; ;;;; 251 | ;;;; ;;;; 252 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 253 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 254 | 255 | (defnet drf-kb-cb (dlg c) 256 | (= c (cmacro K_CR)) 257 | (= (iup-get-focus) <_kv "drf-info" "sb-goto">) 258 | (drf-goto-cb undef) 259 | (fail) ) 260 | 261 | (defnet drf-goto-cb (self) 262 | (deflocal drf-info frameno) 263 | 264 | (set drf-info <_kv "drf-info">) 265 | (set frameno (iup-get-int "SPINVALUE")) 266 | (iup-set-double "VALUE" (linear frameno 0 (- (length ) 1) 0 1)) 267 | (drf-goto frameno) ) 268 | 269 | (defnet drf-slide-changed-cb (self) 270 | (drf-goto (rint (linear (iup-get-double self "VALUE") 0 1 0 (- (length <_kv "drf-info" "vid">) 1)))) ) 271 | 272 | (defnet drf-goto (frameno) 273 | (opt (drf-goto-low frameno)) ) 274 | 275 | (defnet drf-goto-low (frameno) 276 | (deflocal drf-info vid pix mag fps img a) 277 | 278 | (set drf-info <_kv "drf-info">) 279 | (set vid ) 280 | (set pix ) 281 | (set mag ) 282 | (set fps ) 283 | 284 | (if (= frameno undef) 285 | then (set frameno ) 286 | else (set frameno) ) 287 | 288 | (pix-avn-graph-qscale vid pix frameno) 289 | (set img (iup-image-rgba pix)) 290 | (iup-set-attribute-handle "IMAGE" img) 291 | (close ) 292 | (set img) 293 | 294 | (if (= (iup-get-int "VALUE") 1) 295 | then (iup-hide ) 296 | (iup-show ) 297 | (pix-avn-graph-size vid pix frameno mag (iup-get-int "SPINVALUE")) 298 | else (iup-hide ) 299 | (iup-show ) 300 | (set a "VALUE") 1)>) 301 | (pix-avn-graph-vbvfill vid pix frameno fps) ) 302 | 303 | (set img (iup-image-rgba pix)) 304 | (iup-set-attribute-handle "IMAGE" img) 305 | (close ) 306 | (set img) 307 | 308 | (iup-set-str-attribute "TITLE" (+ 309 | (format-num frameno) nl 310 | (date-s2hhmmss (floor (/ frameno fps))) )) 311 | 312 | (set a (vid-cnt-type-frame vid frameno)) 313 | (iup-set-str-attribute "TITLE" (+ 314 | "Type: " 315 | (if (> a 4) "drop" <(if (= (vid-bitstream-type vid) 3) 316 | (slice-type-short) 317 | (vop-type-short) ) a>) 318 | " - q: " (vid-cnt-qscale-frame vid frameno) 319 | " - size: " (vid-cnt-size-frame vid frameno) 320 | (if (> mag 1) (+ " - mag: " mag) "") ))) 321 | 322 | (defnet drf-prev-cb (self) 323 | (drf-search false) ) 324 | 325 | (defnet drf-next-cb (self) 326 | (drf-search true) ) 327 | 328 | (defnet drf-search (forward) 329 | (deflocal drf-info vid frameno size-min size-max avg-int drf-min drf-max type) 330 | 331 | (set drf-info <_kv "drf-info">) 332 | (set vid ) 333 | (set frameno ) 334 | (set size-min (iup-get-int "SPINVALUE")) 335 | (set size-max (iup-get-int "SPINVALUE")) 336 | (set avg-int (iup-get-int "SPINVALUE")) 337 | (set drf-min (iup-get-int "SPINVALUE")) 338 | (set drf-max (iup-get-int "SPINVALUE")) 339 | (set type (iup-get-int "VALUE")) 340 | (set type (if (= type 1) undef (- type 2))) 341 | (set frameno (if forward 342 | (vid-search-next vid frameno size-min size-max avg-int drf-min drf-max type) 343 | (vid-search-prev vid frameno size-min size-max avg-int drf-min drf-max type) )) 344 | (if (<> frameno undef) 345 | then (iup-set-double "VALUE" (linear frameno 0 (- (length vid) 1) 0 1)) 346 | (drf-goto frameno) )) 347 | 348 | (defnet drf-mag-cb (self btn prs x y status) 349 | (deflocal drf-info mag pix img) 350 | 351 | (opt (= prs 1) 352 | (set drf-info <_kv "drf-info">) 353 | (= (iup-get-int "VALUE") 1) 354 | (set mag ) 355 | (case btn of 356 | 49 (seq (< mag (drf-graph-mag-max)) 357 | (inc mag (drf-graph-mag-step)) ) 358 | 50 (seq (<> mag 1) 359 | (set mag 1) ) 360 | 51 (seq (> mag 1) 361 | (dec mag (drf-graph-mag-step)) )) 362 | (set mag) 363 | (drf-pix-size mag pix) 364 | (set img (iup-image-rgba pix)) 365 | (close pix) 366 | (iup-set-attribute-handle "IMAGE" img) 367 | (close ) 368 | (set img) 369 | (drf-goto-low undef) )) 370 | 371 | (defnet drf-select-graph-changed-cb (self) 372 | (deflocal drf-info pix img) 373 | 374 | (set drf-info <_kv "drf-info">) 375 | (if (= (iup-get-int "VALUE") 1) 376 | then (drf-pix-size pix) 377 | else (drf-pix-size undef undef pix) ) 378 | (set img (iup-image-rgba pix)) 379 | (close pix) 380 | (iup-set-attribute-handle "IMAGE" img) 381 | (close ) 382 | (set img) 383 | (drf-goto undef) ) 384 | 385 | (defnet drf-generic-changed-cb (self) 386 | (drf-goto undef) ) 387 | 388 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 389 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 390 | ;;;; ;;;; 391 | ;;;; ;;;; 392 | ;;;; ;;;; 393 | ;;;; ;;;; 394 | ;;;; ;;;; 395 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 396 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 397 | 398 | (defnet drf-pix-draw-value (pix value pos) 399 | (set value (pix-text value)) 400 | (opt (pix-draw-pix pix 401 | (- (width pix) (width value)) 402 | (- (rint (linear pos 0 1 (- (height pix) 1) 0)) 4) 403 | value )) 404 | (close value) ) 405 | 406 | (defnet drf-pix-size (vid mag @pix) 407 | (deflocal max avg max-pos avg-pos) 408 | 409 | (set @pix (pix-create (drf-graph-descr-width) (drf-graph-height))) 410 | (if (<> vid undef) 411 | then (set max (vid-max-frame-size vid)) 412 | (set avg (vid-avg-frame-size vid)) 413 | (set max-pos (* (/ 10 11) mag)) 414 | (set avg-pos (linear avg 0 max 0 max-pos)) 415 | (drf-pix-draw-value @pix max max-pos) 416 | (drf-pix-draw-value @pix avg avg-pos) ) 417 | (pix-transparent @pix (pix-color 0xff 0xff 0xff)) ) 418 | 419 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 420 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 421 | ;;;; ;;;; 422 | ;;;; ;;;; 423 | ;;;; ;;;; 424 | ;;;; ;;;; 425 | ;;;; ;;;; 426 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 427 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 428 | 429 | -------------------------------------------------------------------------------- /parse-asf.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defnet parse-asf (f) 12 | (not <_kv "aborted">) 13 | (fsetpos 0 f) 14 | (= (parse-asf-guid f) 0) 15 | (fsetpos 0 f) 16 | 17 | (set <_kv "filetype"> "asf") 18 | (set <_kv "cleaner"> (netptr parse-asf-clean)) ) 19 | 20 | (defnet parse-asf-clean (fileinfo) 21 | (skip) ) 22 | 23 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 25 | ;;;; ;;;; 26 | ;;;; ;;;; 27 | ;;;; ;;;; 28 | ;;;; ;;;; 29 | ;;;; ;;;; 30 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 31 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 32 | 33 | (defun parse-asf-guid (f) net parse-asf-guid) 34 | (defnet parse-asf-guid (f @guid) 35 | (deflocal l i) 36 | 37 | (set l (parse-asf-guid1 f)) 38 | (<> l undef) 39 | (alt (in l 40 | [ ; Header (0) 41 | [ 0x30 0x26 0xB2 0x75 42 | 0x8E 0x66 0xCF 0x11 43 | 0xA6 0xD9 0x00 0xAA 44 | 0x00 0x62 0xCE 0x6C ] 45 | 46 | ; Data (1) 47 | [ 0x36 0x26 0xB2 0x75 48 | 0x8E 0x66 0xCF 0x11 49 | 0xA6 0xD9 0x00 0xAA 50 | 0x00 0x62 0xCE 0x6C ] 51 | 52 | ; Simple_Index (2) 53 | [ 0x90 0x08 0x00 0x33 54 | 0xB1 0xE5 0xCF 0x11 55 | 0x89 0xF4 0x00 0xA0 56 | 0xC9 0x03 0x49 0xCB ] 57 | 58 | ; Index (3) 59 | [ 0xD3 0x29 0xE2 0xD6 60 | 0xDA 0x35 0xD1 0x11 61 | 0x90 0x34 0x00 0xA0 62 | 0xC9 0x03 0x49 0xBE ] 63 | 64 | ; Media_Object_Index (4) 65 | [ 0xF8 0x03 0xB1 0xFE 66 | 0xAD 0x12 0x64 0x4C 67 | 0x84 0x0F 0x2A 0x1D 68 | 0x2F 0x7A 0xD4 0x8C ] 69 | 70 | ; Timecode_Index (5) 71 | [ 0xD0 0x3F 0xB7 0x3C 72 | 0x4A 0x0C 0x03 0x48 73 | 0x95 0x3D 0xED 0xF7 74 | 0xB6 0x22 0x8F 0x0C ] 75 | 76 | ; File_Properties (6) 77 | [ 0xA1 0xDC 0xAB 0x8C 78 | 0x47 0xA9 0xCF 0x11 79 | 0x8E 0xE4 0x00 0xC0 80 | 0x0C 0x20 0x53 0x65 ] 81 | 82 | ; Stream_Properties (7) 83 | [ 0x91 0x07 0xDC 0xB7 84 | 0xB7 0xA9 0xCF 0x11 85 | 0x8E 0xE6 0x00 0xC0 86 | 0x0C 0x20 0x53 0x65 ] 87 | 88 | ; Header_Extension (8) 89 | [ 0xB5 0x03 0xBF 0x5F 90 | 0x2E 0xA9 0xCF 0x11 91 | 0x8E 0xE3 0x00 0xC0 92 | 0x0C 0x20 0x53 0x65 ] 93 | 94 | ; Codec_List (9) 95 | [ 0x40 0x52 0xD1 0x86 96 | 0x1D 0x31 0xD0 0x11 97 | 0xA3 0xA4 0x00 0xA0 98 | 0xC9 0x03 0x48 0xF6 ] 99 | 100 | ; Script_Command (10) 101 | [ 0x30 0x1A 0xFB 0x1E 102 | 0x62 0x0B 0xD0 0x11 103 | 0xA3 0x9B 0x00 0xA0 104 | 0xC9 0x03 0x48 0xF6 ] 105 | 106 | ; Marker (11) 107 | [ 0x01 0xCD 0x87 0xF4 108 | 0x51 0xA9 0xCF 0x11 109 | 0x8E 0xE6 0x00 0xC0 110 | 0x0C 0x20 0x53 0x65 ] 111 | 112 | ; Bitrate_Mutual_Exclusion (12) 113 | [ 0xDC 0x29 0xE2 0xD6 114 | 0xDA 0x35 0xD1 0x11 115 | 0x90 0x34 0x00 0xA0 116 | 0xC9 0x03 0x49 0xBE ] 117 | 118 | ; Error_Correction (13) 119 | [ 0x35 0x26 0xB2 0x75 120 | 0x8E 0x66 0xCF 0x11 121 | 0xA6 0xD9 0x00 0xAA 122 | 0x00 0x62 0xCE 0x6C ] 123 | 124 | ; Content_Description (14) 125 | [ 0x33 0x26 0xB2 0x75 126 | 0x8E 0x66 0xCF 0x11 127 | 0xA6 0xD9 0x00 0xAA 128 | 0x00 0x62 0xCE 0x6C ] 129 | 130 | ; Extended_Content_Description (15) 131 | [ 0x40 0xA4 0xD0 0xD2 132 | 0x07 0xE3 0xD2 0x11 133 | 0x97 0xF0 0x00 0xA0 134 | 0xC9 0x5E 0xA8 0x50 ] 135 | 136 | ; Content_Branding (16) 137 | [ 0xFA 0xB3 0x11 0x22 138 | 0x23 0xBD 0xD2 0x11 139 | 0xB4 0xB7 0x00 0xA0 140 | 0xC9 0x55 0xFC 0x6E ] 141 | 142 | ; Stream_Bitrate_Properties (17) 143 | [ 0xCE 0x75 0xF8 0x7B 144 | 0x8D 0x46 0xD1 0x11 145 | 0x8D 0x82 0x00 0x60 146 | 0x97 0xC9 0xA2 0xB2 ] 147 | 148 | ; Content_Encryption (18) 149 | [ 0xFB 0xB3 0x11 0x22 150 | 0x23 0xBD 0xD2 0x11 151 | 0xB4 0xB7 0x00 0xA0 152 | 0xC9 0x55 0xFC 0x6E ] 153 | 154 | ; Extended_Content_Encryption (19) 155 | [ 0x14 0xE6 0x8A 0x29 156 | 0x22 0x26 0x17 0x4C 157 | 0xB9 0x35 0xDA 0xE0 158 | 0x7E 0xE9 0x28 0x9C ] 159 | 160 | ; Digital_Signature (20) 161 | [ 0xFC 0xB3 0x11 0x22 162 | 0x23 0xBD 0xD2 0x11 163 | 0xB4 0xB7 0x00 0xA0 164 | 0xC9 0x55 0xFC 0x6E ] 165 | 166 | ; Padding (21) 167 | [ 0x74 0xD4 0x06 0x18 168 | 0xDF 0xCA 0x09 0x45 169 | 0xA4 0xBA 0x9A 0xAB 170 | 0xCB 0x96 0xAA 0xE8 ] 171 | 172 | ; Extended_Stream_Properties (22) 173 | [ 0xCB 0xA5 0xE6 0x14 174 | 0x72 0xC6 0x32 0x43 175 | 0x83 0x99 0xA9 0x69 176 | 0x52 0x06 0x5B 0x5A ] 177 | 178 | ; Advanced_Mutual_Exclusion (23) 179 | [ 0xCF 0x49 0x86 0xA0 180 | 0x75 0x47 0x70 0x46 181 | 0x8A 0x16 0x6E 0x35 182 | 0x35 0x75 0x66 0xCD ] 183 | 184 | ; Group_Mutual_Exclusion (24) 185 | [ 0x40 0x5A 0x46 0xD1 186 | 0x79 0x5A 0x38 0x43 187 | 0xB7 0x1B 0xE3 0x6B 188 | 0x8F 0xD6 0xC2 0x49 ] 189 | 190 | ; Stream_Prioritization (25) 191 | [ 0x5B 0xD1 0xFE 0xD4 192 | 0xD3 0x88 0x4F 0x45 193 | 0x81 0xF0 0xED 0x5C 194 | 0x45 0x99 0x9E 0x24 ] 195 | 196 | ; Bandwidth_Sharing (26) 197 | [ 0xE6 0x09 0x96 0xA6 198 | 0x7B 0x51 0xD2 0x11 199 | 0xB6 0xAF 0x00 0xC0 200 | 0x4F 0xD9 0x08 0xE9 ] 201 | 202 | ; Language_List (27) 203 | [ 0xA9 0x46 0x43 0x7C 204 | 0xE0 0xEF 0xFC 0x4B 205 | 0xB2 0x29 0x39 0x3E 206 | 0xDE 0x41 0x5C 0x85 ] 207 | 208 | ; Metadata (28) 209 | [ 0xEA 0xCB 0xF8 0xC5 210 | 0xAF 0x5B 0x77 0x48 211 | 0x84 0x67 0xAA 0x8C 212 | 0x44 0xFA 0x4C 0xCA ] 213 | 214 | ; Metadata_Library (29) 215 | [ 0x94 0x1C 0x23 0x44 216 | 0x98 0x94 0xD1 0x49 217 | 0xA1 0x41 0x1D 0x13 218 | 0x4E 0x45 0x70 0x54 ] 219 | 220 | ; Index_Parameters (30) 221 | [ 0xDF 0x29 0xE2 0xD6 222 | 0xDA 0x35 0xD1 0x11 223 | 0x90 0x34 0x00 0xA0 224 | 0xC9 0x03 0x49 0xBE ] 225 | 226 | ; Media_Object_Index_Parameters (31) 227 | [ 0xAD 0x3B 0x20 0x6B 228 | 0x11 0x3F 0xE4 0x48 229 | 0xAC 0xA8 0xD7 0x61 230 | 0x3D 0xE2 0xCF 0xA7 ] 231 | 232 | ; Timecode_Index_Parameters (32) 233 | [ 0x6D 0x49 0x5E 0xF5 234 | 0x97 0x97 0x5D 0x4B 235 | 0x8C 0x8B 0x60 0x4D 236 | 0xFE 0x9B 0xFB 0x24 ] 237 | 238 | ; Compatibility (33) 239 | [ 0x30 0x26 0xB2 0x75 240 | 0x8E 0x66 0xCF 0x11 241 | 0xA6 0xD9 0x00 0xAA 242 | 0x00 0x62 0xCE 0x6C ] 243 | 244 | ; Advanced_Content_Encryption (34) 245 | [ 0x33 0x85 0x05 0x43 246 | 0x81 0x69 0xE6 0x49 247 | 0x9B 0x74 0xAD 0x12 248 | 0xCB 0x86 0xD5 0x8C ] 249 | 250 | ; Audio_Media (35) 251 | [ 0x40 0x9E 0x69 0xF8 252 | 0x4D 0x5B 0xCF 0x11 253 | 0xA8 0xFD 0x00 0x80 254 | 0x5F 0x5C 0x44 0x2B ] 255 | 256 | ; Video_Media (36) 257 | [ 0xC0 0xEF 0x19 0xBC 258 | 0x4D 0x5B 0xCF 0x11 259 | 0xA8 0xFD 0x00 0x80 260 | 0x5F 0x5C 0x44 0x2B ] 261 | 262 | ; Command_Media (37) 263 | [ 0xC0 0xCF 0xDA 0x59 264 | 0xE6 0x59 0xD0 0x11 265 | 0xA3 0xAC 0x00 0xA0 266 | 0xC9 0x03 0x48 0xF6 ] 267 | 268 | ; JFIF_Media (38) 269 | [ 0x00 0xE1 0x1B 0xB6 270 | 0x4E 0x5B 0xCF 0x11 271 | 0xA8 0xFD 0x00 0x80 272 | 0x5F 0x5C 0x44 0x2B ] 273 | 274 | ; Degradable_JPEG_Media (39) 275 | [ 0xE0 0x7D 0x90 0x35 276 | 0x15 0xE4 0xCF 0x11 277 | 0xA9 0x17 0x00 0x80 278 | 0x5F 0x5C 0x44 0x2B ] 279 | 280 | ; File_Transfer_Media (40) 281 | [ 0x2C 0x22 0xBD 0x91 282 | 0x1C 0xF2 0x7A 0x49 283 | 0x8B 0x6D 0x5A 0xA8 284 | 0x6B 0xFC 0x01 0x85 ] 285 | 286 | ; Binary_Media (41) 287 | [ 0xE2 0x65 0xFB 0x3A 288 | 0xEF 0x47 0xF2 0x40 289 | 0xAC 0x2C 0x70 0xA9 290 | 0x0D 0x71 0xD3 0x43 ] 291 | 292 | ; Web_Stream_Media_Subtype (42) 293 | [ 0xD4 0x57 0x62 0x77 294 | 0x27 0xC6 0xCB 0x41 295 | 0x8F 0x81 0x7A 0xC7 296 | 0xFF 0x1C 0x40 0xCC ] 297 | 298 | ; Web_Stream_Format (43) 299 | [ 0x13 0x6B 0x1E 0xDA 300 | 0x59 0x83 0x50 0x40 301 | 0xB3 0x98 0x38 0x8E 302 | 0x96 0x5B 0xF0 0x0C ] 303 | 304 | ; No_Error_Correction (44) 305 | [ 0x00 0x57 0xFB 0x20 306 | 0x55 0x5B 0xCF 0x11 307 | 0xA8 0xFD 0x00 0x80 308 | 0x5F 0x5C 0x44 0x2B ] 309 | 310 | ; Audio_Spread (45) 311 | [ 0x50 0xCD 0xC3 0xBF 312 | 0x8F 0x61 0xCF 0x11 313 | 0x8B 0xB2 0x00 0xAA 314 | 0x00 0xB4 0xE2 0x20 ] 315 | 316 | ; Reserved_1 (46) 317 | [ 0x11 0xD2 0xD3 0xAB 318 | 0xBA 0xA9 0xcf 0x11 319 | 0x8E 0xE6 0x00 0xC0 320 | 0x0C 0x20 0x53 0x65 ] 321 | 322 | ; Content_Encryption_System_Windows_Media_DRM_Network_Devices (47) 323 | [ 0xB6 0x9B 0x07 0x7A 324 | 0xA4 0xDA 0x12 0x4e 325 | 0xA5 0xCA 0x91 0xD3 326 | 0x8D 0xC1 0x1A 0x8D ] 327 | 328 | ; Reserved_2 (48) 329 | [ 0x41 0x52 0xD1 0x86 330 | 0x1D 0x31 0xD0 0x11 331 | 0xA3 0xA4 0x00 0xA0 332 | 0xC9 0x03 0x48 0xF6 ] 333 | 334 | ; Reserved_3 (49) 335 | [ 0xE3 0xCB 0x1A 0x4B 336 | 0x0B 0x10 0xD0 0x11 337 | 0xA3 0x9B 0x00 0xA0 338 | 0xC9 0x03 0x48 0xF6 ] 339 | 340 | ; Reserved_4 (50) 341 | [ 0x20 0xDB 0xFE 0x4C 342 | 0xF6 0x75 0xCF 0x11 343 | 0x9C 0x0F 0x00 0xA0 344 | 0xC9 0x03 0x49 0xCB ] 345 | 346 | ; Mutex_Language (51) 347 | [ 0x00 0x2A 0xE2 0xD6 348 | 0xDA 0x35 0xD1 0x11 349 | 0x90 0x34 0x00 0xA0 350 | 0xC9 0x03 0x49 0xBE ] 351 | 352 | ; Mutex_Bitrate (52) 353 | [ 0x01 0x2A 0xE2 0xD6 354 | 0xDA 0x35 0xD1 0x11 355 | 0x90 0x34 0x00 0xA0 356 | 0xC9 0x03 0x49 0xBE ] 357 | 358 | ; Mutex_Unknown (53) 359 | [ 0x02 0x2A 0xE2 0xD6 360 | 0xDA 0x35 0xD1 0x11 361 | 0x90 0x34 0x00 0xA0 362 | 0xC9 0x03 0x49 0xBE ] 363 | 364 | ; Bandwidth_Sharing_Exclusive (54) 365 | [ 0xAA 0x60 0x60 0xAF 366 | 0x97 0x51 0xD2 0x11 367 | 0xB6 0xAF 0x00 0xC0 368 | 0x4F 0xD9 0x08 0xE9 ] 369 | 370 | ; Bandwidth_Sharing_Partial (55) 371 | [ 0xAB 0x60 0x60 0xAF 372 | 0x97 0x51 0xD2 0x11 373 | 0xB6 0xAF 0x00 0xC0 374 | 0x4F 0xD9 0x08 0xE9 ] 375 | 376 | ; Payload_Extension_System_Timecode (56) 377 | [ 0xEC 0x95 0x95 0x39 378 | 0x67 0x86 0x2D 0x4E 379 | 0x8F 0xDB 0x98 0x81 380 | 0x4C 0xE7 0x6C 0x1E ] 381 | 382 | ; Payload_Extension_System_File_Name (57) 383 | [ 0x0E 0xEC 0x65 0xE1 384 | 0xED 0x19 0xD7 0x45 385 | 0xB4 0xA7 0x25 0xCB 386 | 0xD1 0xE2 0x8E 0x9B ] 387 | 388 | ; Payload_Extension_System_Content_Type (58) 389 | [ 0x20 0xDC 0x90 0xD5 390 | 0xBC 0x07 0x6C 0x43 391 | 0x9C 0xF7 0xF3 0xBB 392 | 0xFB 0xF1 0xA4 0xDC ] 393 | 394 | ; Payload_Extension_System_Pixel_Aspect_Ratio (59) 395 | [ 0x54 0xE5 0x1E 0x1B 396 | 0xEA 0xF9 0xC8 0x4B 397 | 0x82 0x1A 0x37 0x6B 398 | 0x74 0xE4 0xC4 0xB8 ] 399 | 400 | ; Payload_Extension_System_Sample_Duration (60) 401 | [ 0x50 0x94 0xBD 0xC6 402 | 0x7F 0x86 0x07 0x49 403 | 0x83 0xA3 0xC7 0x79 404 | 0x21 0xB7 0x33 0xAD ] 405 | 406 | ; Payload_Extension_System_Encryption_Sample_ID (61) 407 | [ 0x4E 0xB8 0x98 0x66 408 | 0xFA 0x0A 0x30 0x43 409 | 0xAE 0xB2 0x1C 0x0A 410 | 0x98 0xD7 0xA4 0x4D ] 411 | 412 | ; ext stream audio 413 | [ 0x9d 0x8c 0x17 0x31 414 | 0xe1 0x03 0x28 0x45 415 | 0xb5 0x82 0x3d 0xf9 416 | 0xdb 0x22 0xf5 0x03 ] 417 | 418 | [ 0x5d 0x8b 0xf1 0x26 419 | 0x84 0x45 0xec 0x47 420 | 0x9f 0x5f 0x0e 0x65 421 | 0x1f 0x04 0x52 0xc9 ] 422 | 423 | [ 0x20 0xde 0xaa 0xd9 424 | 0x17 0x7c 0x9c 0x4f 425 | 0xbc 0x28 0x85 0x55 426 | 0xdd 0x98 0xe2 0xa2 ] ] 427 | 428 | @guid ) 429 | (set @guid l) )) 430 | 431 | (defun parse-asf-guid1 (f) 432 | (parse-asf-guid2 f 16) ) 433 | 434 | (defun parse-asf-guid2 (f n) 435 | (if (= n 0) nil 436 | (parse-asf-guid3 (freadchar f) f n) )) 437 | 438 | (defun parse-asf-guid3 (c f n) 439 | (if (= c undef) undef 440 | (parse-asf-guid4 c (parse-asf-guid2 f (- n 1))) )) 441 | 442 | (defun parse-asf-guid4 (c l) 443 | (if (= l undef) undef 444 | (cons (length c) l) )) 445 | 446 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 447 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 448 | ;;;; ;;;; 449 | ;;;; ;;;; 450 | ;;;; ;;;; 451 | ;;;; ;;;; 452 | ;;;; ;;;; 453 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 454 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 455 | 456 | (defun parse-asf-guid2name (guid) 457 | (if (integerps guid) 458 | <[ "Header" 459 | "Data" 460 | "Simple Index" 461 | "Index" 462 | "Media Object Index" 463 | "Timecode Index" 464 | "File Properties" 465 | "Stream Properties" 466 | "Header Extension" 467 | "Codec List" 468 | "Script Command" 469 | "Marker" 470 | "Bitrate Mutual Exclusion" 471 | "Error Correction" 472 | "Content Description" 473 | "Extended Content Description" 474 | "Content Branding" 475 | "Stream Bitrate Properties" 476 | "Content Encryption" 477 | "Extended Content Encryption" 478 | "Digital Signature" 479 | "Padding" 480 | "Extended Stream Properties" 481 | "Advanced Mutual Exclusion" 482 | "Group Mutual Exclusion" 483 | "Stream Prioritization" 484 | "Bandwidth Sharing" 485 | "Language List" 486 | "Metadata" 487 | "Metadata Library" 488 | "Index Parameters" 489 | "Media Object Index Parameters" 490 | "Timecode Index Parameters" 491 | "Compatibility" 492 | "Advanced Content Encryption" 493 | "Audio Media" 494 | "Video Media" 495 | "Command Media" 496 | "JFIF Media" 497 | "Degradable JPEG Media" 498 | "File Transfer Media" 499 | "Binary Media" 500 | "Web Stream Media Subtype" 501 | "Web Stream Format" 502 | "No Error Correction" 503 | "Audio Spread" 504 | "Reserved 1" 505 | "Content Encryption System Windows Media DRM Network Devices" 506 | "Reserved 2" 507 | "Reserved 3" 508 | "Reserved 4" 509 | "Mutex Language" 510 | "Mutex Bitrate" 511 | "Mutex Unknown" 512 | "Bandwidth Sharing Exclusive" 513 | "Bandwidth Sharing Partial" 514 | "Payload Extension System Timecode" 515 | "Payload Extension System File Name" 516 | "Payload Extension System Content Type" 517 | "Payload Extension System Pixel Aspect Ratio" 518 | "Payload Extension System Sample Duration" 519 | "Payload Extension System Encryption Sample ID" 520 | 521 | "Extended Stream Audio" 522 | "guid sconosciuto 1" 523 | "guid sconosciuto 2" ] guid 524 | > 525 | (if (listp guid) 526 | (parse-asf-guid2name2 guid) 527 | undef ))) 528 | 529 | (defun parse-asf-guid2name2 (l) 530 | (sprintl (cons "Unknown GUID:" (parse-asf-guid2name3 l)) ' ') ) 531 | 532 | (defun parse-asf-guid2name3 (l) 533 | (if (= l nil) nil 534 | (cons (int->hex (car l)) (parse-asf-guid2name3 (cdr l))) )) 535 | 536 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 537 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 538 | ;;;; ;;;; 539 | ;;;; ;;;; 540 | ;;;; ;;;; 541 | ;;;; ;;;; 542 | ;;;; ;;;; 543 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 544 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 545 | 546 | -------------------------------------------------------------------------------- /cfg.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defun cfg-get-or-df (key) 12 | (cfg-get-or-default key <_kv "default">) ) 13 | 14 | (defun cfg-get-or-df-num (key) 15 | (cfg-validate-num (cfg-get-or-df key) )) 16 | 17 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 19 | ;;;; ;;;; 20 | ;;;; ;;;; 21 | ;;;; ;;;; 22 | ;;;; ;;;; 23 | ;;;; ;;;; 24 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 25 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 26 | 27 | (defnet cfg-cb (self) 28 | (deflocal cfg-info q butbox vbox dlg) 29 | 30 | (set cfg-info (assoc)) 31 | (set <_kv "cfg-info"> cfg-info) 32 | 33 | (set q (queue)) 34 | 35 | (set butbox (iup-box-ok-cancel (netptr cfg-ok) undef q)) 36 | 37 | (set vbox (iup-vbox 38 | (cfg-setup-tabs q) 39 | butbox )) 40 | (iup-set-str-attribute vbox "MARGIN" "4x4") 41 | (iup-set-int vbox "GAP" 0) 42 | 43 | (set dlg (iup-dialog vbox)) 44 | (iup-set-dlg-parent self dlg) 45 | (iup-set-str-attribute dlg "TITLE" $"Preferences") 46 | (iup-set-bool dlg "DIALOGFRAME" true) 47 | (iup-set-attribute-handle dlg "DEFAULTENTER" (iup-box-ok-cancel-btn-ok butbox)) 48 | (iup-set-attribute-handle dlg "DEFAULTESC" (iup-box-ok-cancel-btn-cancel butbox)) 49 | 50 | (iup-popup dlg (cmacro IUP_CENTERPARENT) (cmacro IUP_CENTERPARENT)) 51 | 52 | (sound-pop) 53 | (close dlg) 54 | (iup-close-queue q) 55 | (assoc-clr _kv "cfg-info") ) 56 | 57 | (defnet cfg-ok (self) 58 | (sqlite3-begin _db) 59 | (alt (seq (cfg-ok-low self) 60 | (sqlite3-end _db) ) 61 | (seq (sqlite3-rollback _db) 62 | (iup-message-error self "errore nel salvataggio configurazione") )) 63 | (init-values) 64 | (dump) 65 | (gui-update) 66 | (iup-exit-loop) ) 67 | 68 | (defnet cfg-ok-low (self) 69 | (deflocal cfg-info text c old-lang new-lang) 70 | 71 | (set cfg-info <_kv "cfg-info">) 72 | 73 | (set text <_kv "text">) 74 | (set c (iup-bgcolor )) 75 | (cfg-set "color-background" c) 76 | (iup-set-str-attribute text "BGCOLOR" (sprint (pix-color-red c) " " (pix-color-green c) " " (pix-color-blue c))) 77 | (cfg-set "color-section" (iup-bgcolor )) 78 | (cfg-set "color-field" (iup-bgcolor )) 79 | (cfg-set "color-value" (iup-bgcolor )) 80 | (set c (iup-button-font-value )) 81 | (cfg-set "font" c) 82 | (iup-set-str-attribute text "FONT" c) 83 | 84 | (cfg-set "length-field" (iup-get-int "SPINVALUE")) 85 | (cfg-set "length-divider" (iup-get-int "SPINVALUE")) 86 | (cfg-set "length-value" (iup-get-int "SPINVALUE")) 87 | (cfg-set "indent-pattern" (iup-get-str-attribute "VALUE")) 88 | (cfg-set "tile-pattern" (iup-get-str-attribute "VALUE")) 89 | (cfg-set "bbcode-color-section" (iup-bgcolor )) 90 | (cfg-set "bbcode-color-field" (iup-bgcolor )) 91 | (cfg-set "bbcode-color-value" (iup-bgcolor )) 92 | 93 | (for c in [ [ "enabled-magic" . "tb-magic" ] 94 | [ "enabled-id3tag" . "tb-id3tag" ] 95 | [ "enabled-exif" . "tb-exif" ] 96 | [ "enabled-profile-compliancy" . "tb-profile-compliancy" ] 97 | [ "enabled-comment" . "tb-comment" ] 98 | [ "enabled-attachments" . "tb-attachments" ] 99 | [ "enabled-chapters" . "tb-chapters" ] 100 | [ "chapter-display-grouped" . "tb-chapter-display-grouped" ] 101 | [ "enabled-x264-log" . "tb-log-x264" ] 102 | [ "audio-saving-skip-garbage" . "tb-audio-saving-skip-garbage" ] 103 | [ "enabled-debug" . "tb-debug" ] 104 | [ "enabled-utf8bom" . "tb-utf8bom" ] 105 | [ "text-info-editable" . "tb-text-info-editable" ] 106 | [ "enabled-sound" . "tb-sound" ] 107 | [ "enabled-credits" . "tb-credits" ] 108 | [ "user-data-grouped" . "tb-user-data-grouped" ] 109 | [ "percent-line-normalize" . "tb-percent-line-normalize" ] 110 | [ "tile-left" . "tb-tile-left" ] 111 | [ "bbcode-bold-section" . "tb-bbcode-bold-section" ] 112 | [ "bbcode-underline-section" . "tb-bbcode-underline-section" ] 113 | [ "bbcode-bold-field" . "tb-bbcode-bold-field" ] 114 | [ "bbcode-underline-field" . "tb-bbcode-underline-field" ] 115 | [ "bbcode-bold-value" . "tb-bbcode-bold-value" ] 116 | [ "bbcode-underline-value" . "tb-bbcode-underline-value" ] 117 | ] do 118 | (cfg-set (car c) (= (iup-get-str-attribute "VALUE") "ON")) ) 119 | 120 | (set <_kv "enabled-sound"> (= (iup-get-str-attribute "VALUE") "ON")) 121 | (cfg-set "percent-line-length" (iup-get-int "SPINVALUE")) 122 | (cfg-set "hex-dump-max" (iup-get-int "SPINVALUE")) 123 | (cfg-set "decimals" (iup-get-int "SPINVALUE")) 124 | (cfg-set "profiles" ) 125 | (cfg-set "profile" (- (iup-get-int "VALUE") 1)) 126 | (set old-lang (lang)) 127 | (set new-lang (- (iup-get-int "VALUE") 1)) 128 | (cfg-set "lang" new-lang) 129 | (if (<> new-lang old-lang) 130 | then (set-lang new-lang) 131 | (iup-message-warning self $"Changing the language requires a restart to take effect.") )) 132 | 133 | (defun cfg-setup-tabs (q) net cfg-setup-tabs) 134 | (defnet cfg-setup-tabs (q @wid) 135 | (set @wid (iup-tabs 136 | (cfg-setup-tabs-page1 q) 137 | (cfg-setup-tabs-page2 q) 138 | (cfg-setup-tabs-page3 q) 139 | (cfg-setup-tabs-page4 q) 140 | (cfg-setup-tabs-page5 q) )) 141 | (iup-set-str-attribute @wid "TABTITLE0" $"General") 142 | (iup-set-str-attribute @wid "TABTITLE1" "BBcode") 143 | (iup-set-str-attribute @wid "TABTITLE2" $"Profiles") 144 | (iup-set-str-attribute @wid "TABTITLE3" "Switches") 145 | (iup-set-str-attribute @wid "TABTITLE4" "Misc") 146 | (iup-set-bool @wid "EXPAND" true) ) 147 | 148 | (defun cfg-setup-tabs-page1 (q) net cfg-setup-tabs-page1) 149 | (defnet cfg-setup-tabs-page1 (q @wid) 150 | (deflocal cfg-info default-info hbox1 hbox2 hbox3 fb i) 151 | 152 | (set cfg-info <_kv "cfg-info">) 153 | (set default-info <_kv "default">) 154 | 155 | (set hbox1 (iup-hbox 156 | (cfg-setup-framed-color $"Background" (cfg-get-or-default "color-background" default-info) cfg-info "cb-background") 157 | (cfg-setup-framed-color $"Section" (cfg-get-or-default "color-section" default-info) cfg-info "cb-section") 158 | (cfg-setup-framed-color $"Field name" (cfg-get-or-default "color-field" default-info) cfg-info "cb-field") 159 | (cfg-setup-framed-color $"Field value" (cfg-get-or-default "color-value" default-info) cfg-info "cb-value") )) 160 | (iup-set-bool hbox1 "HOMOGENEOUS" true) 161 | 162 | (set fb (iup-button-font (cfg-get-or-default "font" default-info))) 163 | (set fb) 164 | 165 | (set i (iup-text)) 166 | (set i) 167 | (iup-set-str-attribute i "EXPAND" "HORIZONTAL") 168 | (iup-set-str-attribute i "VALUE" (cfg-get-or-default "tile-pattern" default-info)) 169 | 170 | (set hbox2 (iup-hbox 171 | (iup-frame-with-margin $"Font" fb) 172 | (iup-frame-with-margin $"Tile pattern" (iup-hbox i (cfg-setup-toggle $"right justified" (cfg-get-or-default "tile-left" default-info) cfg-info "tb-tile-left"))) )) 173 | 174 | (set i (iup-text)) 175 | (set i) 176 | (iup-set-str-attribute i "EXPAND" "HORIZONTAL") 177 | (iup-set-str-attribute i "VALUE" (cfg-get-or-default "indent-pattern" default-info)) 178 | 179 | (set hbox3 (iup-hbox 180 | (cfg-setup-framed-spin $"Field name" 4 80 (cfg-get-or-default-num "length-field" default-info) cfg-info "sb-length-field") 181 | (cfg-setup-framed-spin $"Divider" 0 80 (cfg-get-or-default-num "length-divider" default-info) cfg-info "sb-length-divider") 182 | (cfg-setup-framed-spin $"Field value" 10 900 (cfg-get-or-default-num "length-value" default-info) cfg-info "sb-length-value") 183 | (iup-frame-with-margin $"Indent pattern" i) )) 184 | 185 | (iup-set-int hbox1 "GAP" 5) 186 | (iup-set-int hbox2 "GAP" 5) 187 | (iup-set-int hbox3 "GAP" 5) 188 | 189 | (set @wid (iup-vbox hbox1 hbox2 hbox3)) 190 | (iup-set-int @wid "GAP" 2) ) 191 | 192 | (defun cfg-setup-tabs-page2 (q) net cfg-setup-tabs-page2) 193 | (defnet cfg-setup-tabs-page2 (q @wid) 194 | (deflocal cfg-info default-info hbox1 hbox2 hbox3) 195 | 196 | (set cfg-info <_kv "cfg-info">) 197 | (set default-info <_kv "default">) 198 | 199 | (set hbox1 (iup-hbox 200 | (iup-frame-with-margin $"Section" (iup-hbox 201 | (cfg-setup-color (cfg-get-or-default "bbcode-color-section" default-info) cfg-info "cb-bbcode-section") 202 | (cfg-setup-toggle $"bold" (cfg-get-or-default "bbcode-bold-section" default-info) cfg-info "tb-bbcode-bold-section") 203 | (cfg-setup-toggle $"underline" (cfg-get-or-default "bbcode-underline-section" default-info) cfg-info "tb-bbcode-underline-section") )))) 204 | 205 | (set hbox2 (iup-hbox 206 | (iup-frame-with-margin $"Field name" (iup-hbox 207 | (cfg-setup-color (cfg-get-or-default "bbcode-color-field" default-info) cfg-info "cb-bbcode-field") 208 | (cfg-setup-toggle $"bold" (cfg-get-or-default "bbcode-bold-field" default-info) cfg-info "tb-bbcode-bold-field") 209 | (cfg-setup-toggle $"underline" (cfg-get-or-default "bbcode-underline-field" default-info) cfg-info "tb-bbcode-underline-field") )))) 210 | 211 | (set hbox3 (iup-hbox 212 | (iup-frame-with-margin $"Field value" (iup-hbox 213 | (cfg-setup-color (cfg-get-or-default "bbcode-color-value" default-info) cfg-info "cb-bbcode-value") 214 | (cfg-setup-toggle $"bold" (cfg-get-or-default "bbcode-bold-value" default-info) cfg-info "tb-bbcode-bold-value") 215 | (cfg-setup-toggle $"underline" (cfg-get-or-default "bbcode-underline-value" default-info) cfg-info "tb-bbcode-underline-value") )))) 216 | 217 | (iup-set-int hbox1 "GAP" 5) 218 | (iup-set-int hbox2 "GAP" 5) 219 | (iup-set-int hbox3 "GAP" 5) 220 | 221 | (set @wid (iup-vbox hbox1 hbox2 hbox3)) 222 | (iup-set-int @wid "GAP" 2) ) 223 | 224 | (defun cfg-setup-tabs-page3 (q) net cfg-setup-tabs-page3) 225 | (defnet cfg-setup-tabs-page3 (q @wid) 226 | (deflocal cfg-info default-info hbox1 hbox2 hbox3 list i) 227 | 228 | (set cfg-info <_kv "cfg-info">) 229 | (set default-info <_kv "default">) 230 | 231 | (set list (iup-list)) 232 | (iup-set-bool list "DROPDOWN" true) 233 | (iup-set-callback list "ACTION" (netptr cfg-profile-changed)) 234 | (set list) 235 | (set (cfg-get "profiles")) 236 | 237 | (set i (iup-button-icon undef (netptr cfg-profile-delete-cb) (pix-load-static "16x16/edit-remove-2.png") q)) 238 | (set i) 239 | 240 | (set hbox1 (iup-hbox 241 | list 242 | (iup-fill) 243 | (iup-button-icon undef (netptr cfg-profile-add-cb) (pix-load-static "16x16/edit-add-3.png") q) 244 | i 245 | (iup-button-icon undef (netptr cfg-profile-restore-cb) (pix-load-static "16x16/document-revert-5.png") q) )) 246 | 247 | (set hbox2 (iup-hbox 248 | (iup-frame-with-margin $"Width" (cfg-setup-spin 0 16384 0 cfg-info "sb-prf-width")) 249 | (iup-frame-with-margin $"Height" (cfg-setup-spin 0 16384 0 cfg-info "sb-prf-height")) 250 | (iup-frame-with-margin "Framerate" (cfg-setup-spin 0 120 0 cfg-info "sb-prf-fps")) )) 251 | 252 | (set hbox3 (iup-hbox 253 | (iup-frame-with-margin $"Buffer size" (cfg-setup-spin 8192 67108864 0 cfg-info "sb-prf-size")) 254 | (iup-frame-with-margin "Buffer init" (cfg-setup-spin 8192 67108864 0 cfg-info "sb-prf-init")) 255 | (iup-frame-with-margin "Max rate" (cfg-setup-spin 8192 100000000 0 cfg-info "sb-prf-rate")) )) 256 | 257 | (iup-set-callback "VALUECHANGED_CB" (netptr cfg-profile-spin-changed1-cb)) 258 | (iup-set-callback "VALUECHANGED_CB" (netptr cfg-profile-spin-changed2-cb)) 259 | (iup-set-callback "VALUECHANGED_CB" (netptr cfg-profile-spin-changed3-cb)) 260 | (iup-set-callback "VALUECHANGED_CB" (netptr cfg-profile-spin-changed4-cb)) 261 | (iup-set-callback "VALUECHANGED_CB" (netptr cfg-profile-spin-changed5-cb)) 262 | (iup-set-callback "VALUECHANGED_CB" (netptr cfg-profile-spin-changed6-cb)) 263 | 264 | (iup-set-int hbox1 "GAP" 5) 265 | (iup-set-int hbox2 "GAP" 5) 266 | (iup-set-int hbox3 "GAP" 5) 267 | 268 | (cfg-profile-load (cfg-get-or-default-num "profile" default-info)) 269 | (cfg-profile-changed list) 270 | 271 | (set @wid (iup-vbox hbox1 hbox2 hbox3)) 272 | (iup-set-int @wid "GAP" 2) ) 273 | 274 | (defun cfg-setup-tabs-page4 (q) net cfg-setup-tabs-page4) 275 | (defnet cfg-setup-tabs-page4 (q @wid) 276 | (deflocal cfg-info default-info vbox hbox1 hbox2 hbox3 hbox4) 277 | 278 | (set cfg-info <_kv "cfg-info">) 279 | (set default-info <_kv "default">) 280 | 281 | (set hbox1 (iup-hbox 282 | (cfg-setup-framed-toggle "Magic" $"enabled" (cfg-get-or-default "enabled-magic" default-info) cfg-info "tb-magic") 283 | (cfg-setup-framed-toggle "ID3 Tag" $"enabled" (cfg-get-or-default "enabled-id3tag" default-info) cfg-info "tb-id3tag") 284 | (cfg-setup-framed-toggle "EXIF" $"enabled" (cfg-get-or-default "enabled-exif" default-info) cfg-info "tb-exif") 285 | (cfg-setup-framed-toggle $"Profile compliancy" $"enabled" (cfg-get-or-default "enabled-profile-compliancy" default-info) cfg-info "tb-profile-compliancy") )) 286 | 287 | (set hbox2 (iup-hbox 288 | (cfg-setup-framed-toggle $"Comments" $"enabled" (cfg-get-or-default "enabled-comment" default-info) cfg-info "tb-comment") 289 | (cfg-setup-framed-toggle $"Attachments" $"enabled" (cfg-get-or-default "enabled-attachments" default-info) cfg-info "tb-attachments") 290 | (cfg-setup-framed-toggle $"Chapters" $"enabled" (cfg-get-or-default "enabled-chapters" default-info) cfg-info "tb-chapters") 291 | (cfg-setup-framed-toggle "ChapterDisplay" $"grouped" (cfg-get-or-default "chapter-display-grouped" default-info) cfg-info "tb-chapter-display-grouped") 292 | (cfg-setup-framed-toggle "Debug infos" $"enabled" (cfg-get-or-default "enabled-debug" default-info) cfg-info "tb-debug") )) 293 | 294 | (set hbox3 (iup-hbox 295 | (cfg-setup-framed-toggle "x264 log" $"enabled" (cfg-get-or-default "enabled-x264-log" default-info) cfg-info "tb-log-x264") 296 | (cfg-setup-framed-toggle "User data" $"grouped" (cfg-get-or-default "user-data-grouped" default-info) cfg-info "tb-user-data-grouped") 297 | (cfg-setup-framed-toggle $"Audio saving" "skip garbage" (cfg-get-or-default "audio-saving-skip-garbage" default-info) cfg-info "tb-audio-saving-skip-garbage") 298 | (cfg-setup-framed-toggle "Credits correction" $"enabled" (cfg-get-or-default "enabled-credits" default-info) cfg-info "tb-credits") )) 299 | 300 | (set hbox4 (iup-hbox 301 | (cfg-setup-framed-toggle "UTF-8 BOM" $"enabled" (cfg-get-or-default "enabled-utf8bom" default-info) cfg-info "tb-utf8bom") 302 | (cfg-setup-framed-toggle $"`Copy/paste' text" $"editable" (cfg-get-or-default "text-info-editable" default-info) cfg-info "tb-text-info-editable") 303 | (cfg-setup-framed-toggle $"Sound" $"enabled" (cfg-get-or-default "enabled-sound" default-info) cfg-info "tb-sound") )) 304 | 305 | (iup-set-int hbox1 "GAP" 5) 306 | (iup-set-int hbox2 "GAP" 5) 307 | (iup-set-int hbox3 "GAP" 5) 308 | (iup-set-int hbox4 "GAP" 5) 309 | 310 | (iup-set-callback "ACTION" (netptr cfg-chapter-enabled-toggled)) 311 | (cfg-chapter-enabled-toggled ) 312 | 313 | (set @wid (iup-vbox hbox1 hbox2 hbox3 hbox4)) 314 | (iup-set-int @wid "GAP" 2) ) 315 | 316 | (defun cfg-setup-tabs-page5 (q) net cfg-setup-tabs-page5) 317 | (defnet cfg-setup-tabs-page5 (q @wid) 318 | (deflocal cfg-info default-info vbox hbox1 hbox2 list i) 319 | 320 | (set cfg-info <_kv "cfg-info">) 321 | (set default-info <_kv "default">) 322 | 323 | (set hbox1 (iup-hbox 324 | (iup-frame-with-margin $"Length of percent line" (iup-hbox 325 | (cfg-setup-spin 5 100 (cfg-get-or-default-num "percent-line-length" default-info) cfg-info "sb-percent-line-length") 326 | (cfg-setup-toggle $"normalize" (cfg-get-or-default "percent-line-normalize" default-info) cfg-info "tb-percent-line-normalize") )) 327 | (cfg-setup-framed-spin "Hex dump" 16 1024 (cfg-get-or-default-num "hex-dump-max" default-info) cfg-info "sb-hex-dump-max") 328 | (cfg-setup-framed-spin $"Decimals" 0 40 (cfg-get-or-default-num "decimals" default-info) cfg-info "sb-decimals") )) 329 | 330 | (set list (iup-list)) 331 | (set list) 332 | (iup-set-bool list "DROPDOWN" true) 333 | (for i in (languages) do 334 | (iup-set-str-attribute list (+ (for-pos) 1) i) ) 335 | (iup-set-int list "VALUE" (+ (lang) 1)) 336 | 337 | (set hbox2 (iup-hbox (iup-frame-with-margin $"Language" list))) 338 | 339 | (iup-set-int hbox1 "GAP" 5) 340 | (iup-set-int hbox2 "GAP" 5) 341 | 342 | (set @wid (iup-vbox hbox1 hbox2)) 343 | (iup-set-int @wid "GAP" 2) ) 344 | 345 | (defun cfg-setup-toggle (name status cfg-info key) net cfg-setup-toggle) 346 | (defnet cfg-setup-toggle (name status cfg-info key @wid) 347 | (set @wid (iup-toggle (if (iup-gtk3) (+ " " name) name))) 348 | (set @wid) 349 | (iup-set-str-attribute @wid "VALUE" (if status "ON" "OFF")) ) 350 | 351 | (defun cfg-setup-framed-toggle (title name status cfg-info key) 352 | (iup-frame-with-margin title (cfg-setup-toggle name status cfg-info key)) ) 353 | 354 | (defun cfg-setup-spin (vmin vmax vcur cfg-info key) net cfg-setup-spin) 355 | (defnet cfg-setup-spin (vmin vmax vcur cfg-info key @wid) 356 | (set @wid (iup-text-spin vmin vmax vcur)) 357 | (set @wid) ) 358 | 359 | (defun cfg-setup-framed-spin (title vmin vmax vcur cfg-info key) 360 | (iup-frame-with-margin title (cfg-setup-spin vmin vmax vcur cfg-info key)) ) 361 | 362 | (defun cfg-setup-color (color cfg-info key) net cfg-setup-color) 363 | (defnet cfg-setup-color (color cfg-info key @wid) 364 | (set @wid (iup-button-color color)) 365 | (set @wid) ) 366 | 367 | (defun cfg-setup-color-expand (color cfg-info key) net cfg-setup-color-expand) 368 | (defnet cfg-setup-color-expand (color cfg-info key @wid) 369 | (set @wid (cfg-setup-color color cfg-info key)) 370 | (iup-set-str-attribute @wid "EXPAND" "HORIZONTAL") ) 371 | 372 | (defun cfg-setup-framed-color (title color cfg-info key) 373 | (iup-frame-with-margin title (cfg-setup-color-expand color cfg-info key)) ) 374 | 375 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 376 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 377 | ;;;; ;;;; 378 | ;;;; ;;;; 379 | ;;;; ;;;; 380 | ;;;; ;;;; 381 | ;;;; ;;;; 382 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 383 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 384 | 385 | (defnet cfg-profile-load (value) 386 | (deflocal cfg-info list i cnt) 387 | 388 | (set cfg-info <_kv "cfg-info">) 389 | (set list ) 390 | (set cnt 1) 391 | (for i in do 392 | (iup-set-str-attribute list cnt ) 393 | (inc cnt) ) 394 | (iup-set-str-attribute list cnt) 395 | (iup-set-bool "ACTIVE" (> cnt 2)) 396 | (iup-set-int list "VALUE" (+ value 1)) ) 397 | 398 | (defnet cfg-profile-changed (list) 399 | (deflocal cfg-info a) 400 | 401 | (set cfg-info <_kv "cfg-info">) 402 | (set a ) 403 | (iup-set-int "SPINVALUE" ) 404 | (iup-set-int "SPINVALUE" ) 405 | (iup-set-int "SPINVALUE" ) 406 | (iup-set-int "SPINVALUE" ) 407 | (iup-set-int "SPINVALUE" ) 408 | (iup-set-int "SPINVALUE" ) ) 409 | 410 | (defnet cfg-profile-spin-changed (sb fieldno) 411 | (deflocal cfg-info a) 412 | 413 | (set cfg-info <_kv "cfg-info">) 414 | (set a "VALUE") 1)>) 415 | (set (iup-get-int sb "SPINVALUE")) ) 416 | 417 | (defnet cfg-profile-spin-changed1-cb (sb) 418 | (cfg-profile-spin-changed sb 1) ) 419 | 420 | (defnet cfg-profile-spin-changed2-cb (sb) 421 | (cfg-profile-spin-changed sb 2) ) 422 | 423 | (defnet cfg-profile-spin-changed3-cb (sb) 424 | (cfg-profile-spin-changed sb 3) ) 425 | 426 | (defnet cfg-profile-spin-changed4-cb (sb) 427 | (cfg-profile-spin-changed sb 4) ) 428 | 429 | (defnet cfg-profile-spin-changed5-cb (sb) 430 | (cfg-profile-spin-changed sb 5) ) 431 | 432 | (defnet cfg-profile-spin-changed6-cb (sb) 433 | (cfg-profile-spin-changed sb 6) ) 434 | 435 | (defnet cfg-profile-add-cb (self) 436 | (deflocal cfg-info a v l) 437 | 438 | (opt (iup-edit-string self undef $"New profile" l) 439 | (<> l "") 440 | (set cfg-info <_kv "cfg-info">) 441 | (set a ) 442 | (for v in a do 443 | (if (= l ) 444 | then (iup-message-warning self 445 | (+ $"Profile `" l $"' exists." nl 446 | $"Please select a different name." )) 447 | (fail) )) 448 | (set v (array 7)) 449 | (array-append a v) 450 | (set l) 451 | (set l "VALUE") 1)>) 452 | (set ) 453 | (set ) 454 | (set ) 455 | (set ) 456 | (set ) 457 | (set ) 458 | (set l (length a)) 459 | (cfg-profile-load (- l 1)) )) 460 | 461 | (defnet cfg-profile-delete-cb (self) 462 | (deflocal cfg-info a i) 463 | 464 | (opt (set cfg-info <_kv "cfg-info">) 465 | (set a ) 466 | (set i (- (iup-get-int "VALUE") 1)) 467 | (iup-message-confirm self 468 | (+ $"Profile `" $"' will be deleted." nl 469 | $"Are you sure?" )) 470 | (array-remove a i) 471 | (cfg-profile-load (if (= i (length a)) (- i 1) i)) )) 472 | 473 | (defnet cfg-profile-restore-cb (self) 474 | (deflocal cfg-info a) 475 | 476 | (opt (iup-message-confirm self $"The predefined profiles will be reloaded.\nAre you sure?") 477 | (set cfg-info <_kv "cfg-info">) 478 | (init-default-profiles a) 479 | (set a) 480 | (cfg-profile-load 22) )) 481 | 482 | (defnet cfg-chapter-enabled-toggled (but) 483 | (iup-set-bool <_kv "cfg-info" "tb-chapter-display-grouped"> "ACTIVE" (= (iup-get-str-attribute but "VALUE") "ON")) ) 484 | 485 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 486 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 487 | ;;;; ;;;; 488 | ;;;; ;;;; 489 | ;;;; ;;;; 490 | ;;;; ;;;; 491 | ;;;; ;;;; 492 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 493 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 494 | 495 | -------------------------------------------------------------------------------- /utils.tin: -------------------------------------------------------------------------------- 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 3 | ;;;; ;;;; 4 | ;;;; ;;;; 5 | ;;;; ;;;; 6 | ;;;; ;;;; 7 | ;;;; ;;;; 8 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 9 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 10 | 11 | (defun url-home-page () "http://fsinapsi.altervista.org") 12 | 13 | (defun compile-time () (date (date-year (cdate)) (date-month (cdate)) (date-day (cdate)))) 14 | 15 | (defun date->version (date) 16 | (+ (int->str (date-day date) 2 '0') "-" 17 | (int->str (date-month date) 2 '0') "-" 18 | (int->str (date-year date) 4 '0') )) 19 | 20 | (defun remote-version-key () "avinaptic-win64-20") 21 | 22 | (defun remote-version () net remote-version) 23 | (defnet remote-version (@s) 24 | (deflocal i) 25 | 26 | (set @s (download-as-string (+ (url-home-page) "/code/avinaptic/index.html"))) 27 | (stringp @s) 28 | (search (remote-version-key) @s i) 29 | (set @s (str->date (sub (+ i (- (length (remote-version-key)) 2)) 8 @s))) 30 | (datep @s) ) 31 | 32 | (defun remote-version-cached () net remote-version-cached) 33 | (defnet remote-version-cached (@s) 34 | (deflocal now s) 35 | 36 | (set now (now)) 37 | (set @s (cfg-get "last-check-for-updates-version")) 38 | (set s (- now (cfg-get "last-check-for-updates"))) 39 | (if (or (= @s undef) (= s undef) (> s (* 60 60 12))) 40 | then (set @s (remote-version)) 41 | (if (= @s undef) 42 | then (set @s (compile-time)) ) 43 | (cfg-set "last-check-for-updates-version" @s) 44 | (cfg-set "last-check-for-updates" now) )) 45 | 46 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 47 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 48 | ;;;; ;;;; 49 | ;;;; ;;;; 50 | ;;;; ;;;; 51 | ;;;; ;;;; 52 | ;;;; ;;;; 53 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 54 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 55 | 56 | (defun parse-video-frame-min () 20) 57 | (defun check-for-updates-delay () (* 60 60 1)) 58 | 59 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 60 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 61 | ;;;; ;;;; 62 | ;;;; ;;;; 63 | ;;;; ;;;; 64 | ;;;; ;;;; 65 | ;;;; ;;;; 66 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 67 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 68 | 69 | (defnet dec-size (@size n) 70 | (>= @size n) 71 | (set @size (- @size n)) ) 72 | 73 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 74 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 75 | ;;;; ;;;; 76 | ;;;; ;;;; 77 | ;;;; ;;;; 78 | ;;;; ;;;; 79 | ;;;; ;;;; 80 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 81 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 82 | 83 | (defun flags-field (flags pos n) 84 | (% (div flags (pow 2 pos)) (pow 2 n)) ) 85 | 86 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 87 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 88 | ;;;; ;;;; 89 | ;;;; ;;;; 90 | ;;;; ;;;; 91 | ;;;; ;;;; 92 | ;;;; ;;;; 93 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 94 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 95 | 96 | (defnet assoc-queue (a k v) 97 | (deflocal q) 98 | 99 | (set q ) 100 | (if (= q undef) 101 | then (set q (queue)) 102 | (set q) ) 103 | (queue-put q v) ) 104 | 105 | (defnet assoc-queue-unique (a k v) 106 | (deflocal q) 107 | 108 | (set q ) 109 | (if (= q undef) 110 | then (set q (queue)) 111 | (set q) ) 112 | (if (not (in v q)) 113 | then (queue-put q v) )) 114 | 115 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 116 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 117 | ;;;; ;;;; 118 | ;;;; ;;;; 119 | ;;;; ;;;; 120 | ;;;; ;;;; 121 | ;;;; ;;;; 122 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 123 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 124 | 125 | (defun log10 (n) 126 | (if (< n 10) 0 (+ 1 (log10 (div (floor n) 10)))) ) 127 | 128 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 129 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 130 | ;;;; ;;;; 131 | ;;;; ;;;; 132 | ;;;; ;;;; 133 | ;;;; ;;;; 134 | ;;;; ;;;; 135 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 136 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 137 | 138 | (defun format-int (n) 139 | (if (< n 1000) (sprint n) 140 | (+ (format-int (div n 1000)) "," 141 | (int->str (% n 1000) 3 "0") ))) 142 | 143 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 144 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 145 | ;;;; ;;;; 146 | ;;;; ;;;; 147 | ;;;; ;;;; 148 | ;;;; ;;;; 149 | ;;;; ;;;; 150 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 151 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 152 | 153 | (defun format-date (d) 154 | (sprint (date-day d) '-' (int->str (date-month d) 2 '0') '-' 155 | (int->str (date-year d) 2 '0') ' ' 156 | (int->str (date-hours d) 2 '0') ':' 157 | (int->str (date-minutes d) 2 '0') ':' 158 | (int->str (date-seconds d) 2 '0') )) 159 | 160 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 161 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 162 | ;;;; ;;;; 163 | ;;;; ;;;; 164 | ;;;; ;;;; 165 | ;;;; ;;;; 166 | ;;;; ;;;; 167 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 168 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 169 | 170 | (defun s->hhmmss (s) (s->hhmmss0 (approx3 s))) 171 | (defun s->hhmmss0 (s) 172 | (+ (date-s2hhmmss (floor s)) "," 173 | (int->str (* (- s (floor s)) 1000) 3 '0') )) 174 | 175 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 176 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 177 | ;;;; ;;;; 178 | ;;;; ;;;; 179 | ;;;; ;;;; 180 | ;;;; ;;;; 181 | ;;;; ;;;; 182 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 183 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 184 | 185 | (defun color2hex (color) 186 | (sprint "#" (hexdigit (div (pix-color-red color) 0x10)) 187 | (hexdigit (pix-color-red color)) 188 | (hexdigit (div (pix-color-green color) 0x10)) 189 | (hexdigit (pix-color-green color)) 190 | (hexdigit (div (pix-color-blue color) 0x10)) 191 | (hexdigit (pix-color-blue color)) )) 192 | 193 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 194 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 195 | ;;;; ;;;; 196 | ;;;; ;;;; 197 | ;;;; ;;;; 198 | ;;;; ;;;; 199 | ;;;; ;;;; 200 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 201 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 202 | 203 | (defun avistreamtype2str (type) 204 | (if (= type "vids") "video" 205 | (if (= type "auds") "audio" 206 | (if (= type "txts") $"subtitles" 207 | (if (= type "sdmf") (+ $"subtitles" " (DivX Media Format)") 208 | (+ "??? (" type ")") ))))) 209 | 210 | (defun audiotag2name (tag) 211 | (audiotag2name0 tag 212 | [ [ 0x0001 . "PCM" ] 213 | [ 0x0002 . "ADPCM" ] 214 | [ 0x0003 . "IEEE FLOAT" ] 215 | [ 0x0004 . "VSELP" ] 216 | [ 0x0005 . "IBM CVSD" ] 217 | [ 0x0006 . "aLaw" ] 218 | [ 0x0007 . "MULAW" ] 219 | [ 0x0008 . "DTS" ] 220 | [ 0x0009 . "Microsoft DRM" ] 221 | [ 0x000A . "wma9spdmo" ] 222 | [ 0x0010 . "OKI ADPCM" ] 223 | [ 0x0011 . "DVI ADPCM" ] 224 | [ 0x0012 . "Mediaspace ADPCM" ] 225 | [ 0x0013 . "Sierra ADPCM" ] 226 | [ 0x0014 . "G723 ADPCM" ] 227 | [ 0x0015 . "DIGISTD" ] 228 | [ 0x0016 . "DIGIFIX" ] 229 | [ 0x0017 . "Dialogic OKI ADPCM" ] 230 | [ 0x0018 . "Mediavision ADPCM" ] 231 | [ 0x0019 . "CU CODEC" ] 232 | [ 0x0020 . "Yamaha ADPCM" ] 233 | [ 0x0021 . "Sonarc" ] 234 | [ 0x0022 . "DSP Group TrueSpeech" ] 235 | [ 0x0023 . "ECHOSC1" ] 236 | [ 0x0024 . "Audiofile AF36" ] 237 | [ 0x0025 . "APTX" ] 238 | [ 0x0026 . "Audiofile AF10" ] 239 | [ 0x0027 . "Prosody 1612" ] 240 | [ 0x0028 . "LRC" ] 241 | [ 0x0030 . "Dolby AC2" ] 242 | [ 0x0031 . "GSM610" ] 243 | [ 0x0032 . "MSN Audio" ] 244 | [ 0x0033 . "Antex ADPCME" ] 245 | [ 0x0034 . "Control Res. VQLPC" ] 246 | [ 0x0035 . "DigiReal" ] 247 | [ 0x0036 . "DigiADPCM" ] 248 | [ 0x0037 . "Control Res. CR10" ] 249 | [ 0x0038 . "NMS VBXADPCM" ] 250 | [ 0x0039 . "CS IMAADPCM" ] 251 | [ 0x003A . "ECHOSC3" ] 252 | [ 0x003B . "Rockwell ADPCM" ] 253 | [ 0x003C . "Rockwell DIGITALK" ] 254 | [ 0x003D . "XEBEC" ] 255 | [ 0x0040 . "G721 ADPCM" ] 256 | [ 0x0041 . "G728 CELP" ] 257 | [ 0x0042 . "MSG723" ] 258 | [ 0x0043 . "IBM AVC ADPCM" ] 259 | [ 0x0045 . "ITU-T G.726 ADPCM" ] 260 | [ 0x0050 . "MPEG (MP1/MP2)" ] 261 | [ 0x0052 . "RT24" ] 262 | [ 0x0053 . "PAC" ] 263 | [ 0x0055 . "MP3" ] 264 | [ 0x0059 . "Lucent G723" ] 265 | [ 0x0060 . "Cirrus" ] 266 | [ 0x0061 . "ESPCM" ] 267 | [ 0x0062 . "Voxware" ] 268 | [ 0x0063 . "Canopus ATRAC" ] 269 | [ 0x0064 . "G726 ADPCM" ] 270 | [ 0x0065 . "G722 ADPCM" ] 271 | [ 0x0066 . "DSAT" ] 272 | [ 0x0067 . "DSAT DISPLAY" ] 273 | [ 0x0069 . "Voxware BYTE ALIGNED" ] 274 | [ 0x0070 . "Voxware AC8" ] 275 | [ 0x0071 . "Voxware AC10" ] 276 | [ 0x0072 . "Voxware AC16" ] 277 | [ 0x0073 . "Voxware AC20" ] 278 | [ 0x0074 . "Voxware RT24" ] 279 | [ 0x0075 . "Voxware RT29" ] 280 | [ 0x0076 . "Voxware RT29HW" ] 281 | [ 0x0077 . "Voxware VR12" ] 282 | [ 0x0078 . "Voxware VR18" ] 283 | [ 0x0079 . "Voxware TQ40" ] 284 | [ 0x0080 . "Softsound" ] 285 | [ 0x0081 . "Voxware TQ60" ] 286 | [ 0x0082 . "MSRT24" ] 287 | [ 0x0083 . "G729A" ] 288 | [ 0x0084 . "MVI MVI2" ] 289 | [ 0x0085 . "DF G726" ] 290 | [ 0x0086 . "DF GSM610" ] 291 | [ 0x0088 . "ISIAUDIO" ] 292 | [ 0x0089 . "ONLIVE" ] 293 | [ 0x0091 . "SBC24" ] 294 | [ 0x0092 . "Dolby AC3 SPDIF" ] 295 | [ 0x0093 . "MediaSonic G723" ] 296 | [ 0x0094 . "Prosody 8KBPS" ] 297 | [ 0x0097 . "Zyxel ADPCM" ] 298 | [ 0x0098 . "Philips LPCBB" ] 299 | [ 0x0099 . "PACKED" ] 300 | [ 0x00A0 . "Malden PhonyTalk" ] 301 | [ 0x00FF . "AAC" ] 302 | [ 0x0100 . "Rhetorax ADPCM" ] 303 | [ 0x0101 . "IRAT" ] 304 | [ 0x0102 . "ALAW" ] 305 | [ 0x0103 . "ADPCM" ] 306 | [ 0x0111 . "Vivo G723" ] 307 | [ 0x0112 . "Vivo SIREN" ] 308 | [ 0x0123 . "DEC G723" ] 309 | [ 0x0125 . "Sanyo LD ADPCM" ] 310 | [ 0x0130 . "Sipro Lab ACEPLNET" ] 311 | [ 0x0131 . "Sipro Lab ACELP4800" ] 312 | [ 0x0132 . "Sipro Lab ACELP8V3" ] 313 | [ 0x0133 . "Sipro Lab G729" ] 314 | [ 0x0134 . "Sipro Lab G729A" ] 315 | [ 0x0135 . "Sipro Lab KELVIN" ] 316 | [ 0x0140 . "G726ADPCM" ] 317 | [ 0x0150 . "Qualcomm Purevoice" ] 318 | [ 0x0151 . "Qualcomm Halfrate" ] 319 | [ 0x0155 . "TUBGSM" ] 320 | [ 0x0160 . "DivX audio v1 (WMA v1)" ] 321 | [ 0x0161 . "DivX audio v2 (WMA v2)" ] 322 | [ 0x0162 . "Windows Media Audio 9 Professional" ] 323 | [ 0x0163 . "Windows Media Audio 9 Lossless" ] 324 | [ 0x0170 . "UNISYS NAP ADPCM" ] 325 | [ 0x0171 . "UNISYS NAP ULAW" ] 326 | [ 0x0172 . "UNISYS NAP ALAW" ] 327 | [ 0x0173 . "UNISYS NAP 16K" ] 328 | [ 0x0200 . "Creative ADPCM" ] 329 | [ 0x0202 . "Creative FASTSPEECH8" ] 330 | [ 0x0203 . "Creative FASTSPEECH10" ] 331 | [ 0x0210 . "UHER ADPCM" ] 332 | [ 0x0215 . "Ulead DV ACM" ] 333 | [ 0x0216 . "Ulead DV ACM" ] 334 | [ 0x0220 . "Quarterdeck" ] 335 | [ 0x0230 . "I-Link VC" ] 336 | [ 0x0240 . "RAW SPORT" ] 337 | [ 0x0241 . "ESST AC3" ] 338 | [ 0x0250 . "IPI HSX" ] 339 | [ 0x0251 . "IPI RPELP" ] 340 | [ 0x0260 . "CS2" ] 341 | [ 0x0270 . "Sony SCX" ] 342 | [ 0x0300 . "FM TOWNS SND" ] 343 | [ 0x0400 . "BTV DIGITAL" ] 344 | [ 0x0401 . "Intel Music Coder (IMC)" ] 345 | [ 0x0402 . "Ligos Indeo Audio" ] 346 | [ 0x0450 . "QDesign MUSIC" ] 347 | [ 0x0680 . "VME VMPCM" ] 348 | [ 0x0681 . "TPC" ] 349 | [ 0x0700 . "YMPEG Alpha (dummy for MPEG-2 compressor)" ] 350 | [ 0x08AE . "Lightwave Lossless" ] 351 | [ 0x1000 . "OLIGSM" ] 352 | [ 0x1001 . "OLIADPCM" ] 353 | [ 0x1002 . "OLICELP" ] 354 | [ 0x1003 . "OLISBC" ] 355 | [ 0x1004 . "OLIOPR" ] 356 | [ 0x1100 . "LH CODEC" ] 357 | [ 0x1101 . "L & H CELP codec" ] 358 | [ 0x1102 . "L & H SBC codec" ] 359 | [ 0x1103 . "L & H SBC codec" ] 360 | [ 0x1104 . "L & H SBC codec" ] 361 | [ 0x1400 . "NORRIS" ] 362 | [ 0x1401 . "ISIAUDIO" ] 363 | [ 0x1500 . "Soundspace Musicompress" ] 364 | [ 0x181C . "VoxWare RT24 speech codec" ] 365 | [ 0x181E . "Lucent elemedia AX24000P Music codec" ] 366 | [ 0x1C07 . "Lucent SX8300P speech codec" ] 367 | [ 0x1C0C . "Lucent SX5363S G.723 compliant codec" ] 368 | [ 0x1F03 . "CUseeMe DigiTalk (ex-Rocwell)" ] 369 | [ 0x1FC4 . "NCT ALF2CD codec" ] 370 | [ 0x2000 . "AC3" ] 371 | [ 0x2001 . "DTS" ] 372 | [ 0x2002 . "RealAudio 1 / 2 14.4" ] 373 | [ 0x2003 . "RealAudio 1 / 2 28.8" ] 374 | [ 0x2004 . "RealAudio G2 / 8 Cook (low bitrate)" ] 375 | [ 0x2005 . "RealAudio 3 / 4 / 5 Music (DNET)" ] 376 | [ 0x2006 . "RealAudio 10 AAC (RAAC)" ] 377 | [ 0x2007 . "RealAudio 10 AAC+ (RACP)" ] 378 | [ 0x3313 . "makeAVIS (ffvfw fake AVI sound from AviSynth scripts)" ] 379 | [ 0x4143 . "Divio MPEG-4 AAC audio" ] 380 | [ 0x434C . "LEAD Speech" ] 381 | [ 0x564C . "LEAD Vorbis" ] 382 | [ 0x674f . "Ogg Vorbis 1" ] 383 | [ 0x6750 . "Ogg Vorbis 2" ] 384 | [ 0x6751 . "Ogg Vorbis 3" ] 385 | [ 0x676f . "Ogg Vorbis 1 PLUS" ] 386 | [ 0x6770 . "Ogg Vorbis 2 PLUS" ] 387 | [ 0x6771 . "Ogg Vorbis 3 PLUS" ] 388 | [ 0x7A21 . "GSM-AMR (CBR, no SID)" ] 389 | [ 0x7A22 . "GSM-AMR (VBR, including SID)" ] 390 | [ 0xDFAC . "DebugMode SonicFoundry Vegas FrameServer ACM Codec" ] 391 | [ 0xF1AC . "Free Lossless Audio Codec FLAC" ] 392 | [ 0xFFFE . "Extensible wave format" ] 393 | [ 0xFFFF . "development use" ] ] )) 394 | (defun audiotag2name0 (tag l) 395 | (if (= l nil) "???" 396 | (if (= tag (car (car l))) (cdr (car l)) 397 | (audiotag2name0 tag (cdr l)) ))) 398 | 399 | (defun ar-desc-mpeg4-asp (ar) 400 | <[ "Unspecified" 401 | "Square pixels" 402 | "12:11 (4:3 PAL pixel shape)" 403 | "10:11 (4:3 NTSC pixel shape)" 404 | "16:11 (16:9 PAL pixel shape)" 405 | "40:33 (16:9 NTSC pixel shape)" 406 | "Invalid aspect_ratio setting" 407 | "Invalid aspect_ratio setting" 408 | "Invalid aspect_ratio setting" 409 | "Invalid aspect_ratio setting" 410 | "Invalid aspect_ratio setting" 411 | "Invalid aspect_ratio setting" 412 | "Invalid aspect_ratio setting" 413 | "Invalid aspect_ratio setting" 414 | "Invalid aspect_ratio setting" 415 | "Custom pixel shape" ] ar >) 416 | 417 | (defun ar-desc-mpeg4-avc (ar) (ar-desc-mpeg4-avc0 (ar-desc-mpeg4-avc1 ar))) 418 | (defun ar-desc-mpeg4-avc0 (s) (if (= s undef) "Invalid aspect_ratio setting" s)) 419 | (defun ar-desc-mpeg4-avc1 (ar) 420 | <[ "Unspecified" 421 | "Square pixels" 422 | "12:11 (4:3 PAL pixel shape)" 423 | "10:11 (4:3 NTSC pixel shape)" 424 | "16:11 (16:9 PAL pixel shape)" 425 | "40:33 (16:9 NTSC pixel shape)" 426 | "24:11" 427 | "20:11" 428 | "32:11" 429 | "80:33" 430 | "18:11" 431 | "15:11" 432 | "64:33" 433 | "160:99" 434 | "4:3" 435 | "3:2" 436 | "2:1" ] ar >) 437 | 438 | (defun vop-type-list () 439 | [ "I-VOPs" "P-VOPs" "B-VOPs" "S-VOPs" "N-VOPs" ] ) 440 | 441 | (defun vop-type (type) 442 | <(vop-type-list) type> ) 443 | 444 | (defun vop-type-short () 445 | [ "I" "P" "B" "S" "N" ] ) 446 | 447 | (defun slice-type-list () 448 | [ "P-slices" "B-slices" "I-slices" "SP-slices" "SI-slices" ] ) 449 | 450 | (defun slice-type (type) 451 | <(slice-type-list) type> ) 452 | 453 | (defun slice-type-short () 454 | [ "P" "B" "I" "SP" "SI" ] ) 455 | 456 | (defun avc-profile (code) (avc-profile0 code (avc-profiles))) 457 | (defun avc-profile0 (code l) 458 | (if (= l nil) undef 459 | (if (= (car (car l)) code) (cdr (car l)) 460 | (avc-profile0 code (cdr l)) ))) 461 | 462 | (defun avc-profiles () 463 | [ [ 66 . "Baseline" ] 464 | [ 77 . "Main" ] 465 | [ 88 . "Extended" ] 466 | [ 100 . "High" ] 467 | [ 110 . "High 10" ] 468 | [ 122 . "High 4:2:2" ] 469 | [ 144 . "High 4:4:4" ] ] ) 470 | 471 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 472 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 473 | ;;;; ;;;; 474 | ;;;; ;;;; 475 | ;;;; ;;;; 476 | ;;;; ;;;; 477 | ;;;; ;;;; 478 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 479 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 480 | 481 | (defnet iup-message-info (parent msg) 482 | (if (cli) 483 | then (print "INF: " msg nl) 484 | else (sound-info) 485 | (iup-info60 parent msg) )) 486 | 487 | (defnet iup-message-warning (parent msg) 488 | (if (cli) 489 | then (print "WRN: " msg nl) 490 | else (sound-warning) 491 | (iup-warning60 parent msg) )) 492 | 493 | (defnet iup-message-error (parent msg) 494 | (if (cli) 495 | then (print "ERR: " msg nl) 496 | else (sound-error) 497 | (iup-error60 parent msg) )) 498 | 499 | (defnet iup-message-confirm (parent msg) 500 | (if (not (cli)) 501 | then (sound-question) 502 | (iup-confirm60 parent msg) )) 503 | 504 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 505 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 506 | ;;;; ;;;; 507 | ;;;; ;;;; 508 | ;;;; ;;;; 509 | ;;;; ;;;; 510 | ;;;; ;;;; 511 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 512 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 513 | 514 | (defun info->vid (n) net info->vid) 515 | (defnet info->vid (n @vid) 516 | (deflocal fps) 517 | (info->vid-fps n @vid fps) ) 518 | 519 | (defnet info->vid-fps (n @vid @fps) 520 | (= <_kv "complete"> true) 521 | (info->vid-fps-low n @vid @fps) ) 522 | 523 | (defnet info->vid-fps-low (n @vid @fps) 524 | (deflocal w h) 525 | (info->vid-fps-res-low n @vid @fps w h) ) 526 | 527 | (defnet info->vid-fps-res-low (n @vid @fps @w @h) 528 | (deflocal fileinfo i) 529 | 530 | (clr @vid @fps) 531 | (set fileinfo <_kv "fileinfo">) 532 | (case <_kv "filetype"> of 533 | "avi" (seq (for i in <(car fileinfo) "streams"> do 534 | (if (= "vids") 535 | then (dec n) ) 536 | until (= n -1) ) 537 | (set @vid ) 538 | (set i (car fileinfo)) 539 | (set @fps ) 540 | (set @w ) 541 | (set @h ) ) 542 | "mkv" (seq (for i in do 543 | (if (= <(cdr i) "TrackType"> "video") 544 | then (dec n) ) 545 | until (= n -1) ) 546 | (set i (cdr i)) 547 | (set @vid ) 548 | (set @fps ) 549 | (set @w ) 550 | (set @h ) ) 551 | "mp4" (seq (for i in do 552 | (if (= "vide") 553 | then (dec n) ) 554 | until (= n -1) ) 555 | (set @vid ) 556 | (set @fps ) 557 | (set @w ) 558 | (set @h ) ) 559 | "flv" (seq (= n 0) 560 | (set @vid ) 561 | (set @fps ) 562 | (set @w ) 563 | (set @h ) )) 564 | (<> (vid-bitstream-type @vid) undef) 565 | (> (length @vid) 0) 566 | (if (= @fps undef) 567 | then (set @fps 25) )) 568 | 569 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 570 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 571 | ;;;; ;;;; 572 | ;;;; ;;;; 573 | ;;;; ;;;; 574 | ;;;; ;;;; 575 | ;;;; ;;;; 576 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 577 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 578 | 579 | (defnet avcp () (truep (avcp))) 580 | (defun avcp () net avcp0) 581 | (defnet avcp0 (@res) 582 | (deflocal video vid fps i) 583 | 584 | (alt (seq (set video <_kv "video">) 585 | (integerp video) 586 | (for i in 1 .. video do 587 | (opt (info->vid-fps-low (for-pos) vid fps) 588 | (set @res (= (vid-bitstream-type vid) 3)) ) 589 | until @res )) 590 | (set @res false) )) 591 | 592 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 593 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 594 | ;;;; ;;;; 595 | ;;;; ;;;; 596 | ;;;; ;;;; 597 | ;;;; ;;;; 598 | ;;;; ;;;; 599 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 600 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 601 | 602 | (defun info->aud (n) net info->aud) 603 | (defnet info->aud (n @aud) 604 | (deflocal fileinfo i) 605 | 606 | (clr @aud) 607 | (set fileinfo <_kv "fileinfo">) 608 | (case <_kv "filetype"> of 609 | "aud" (seq (= n 0) 610 | (set @aud fileinfo) ) 611 | "avi" (seq (for i in <(car fileinfo) "streams"> do 612 | (if (= "auds") 613 | then (inc n -1) ) 614 | until (= n -1) ) 615 | (set @aud ) ) 616 | "mkv" (seq (for i in do 617 | (if (= <(cdr i) "TrackType"> "audio") 618 | then (dec n) ) 619 | until (= n -1) ) 620 | (set @aud <(cdr i) "low" 0>) ) 621 | "mp4" (seq (for i in do 622 | (if (= "soun") 623 | then (dec n) ) 624 | until (= n -1) ) 625 | (set @aud ) ) 626 | "flv" (seq (= n 0) 627 | (set @aud ) )) 628 | (audp @aud) ) 629 | 630 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 631 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 632 | ;;;; ;;;; 633 | ;;;; ;;;; 634 | ;;;; ;;;; 635 | ;;;; ;;;; 636 | ;;;; ;;;; 637 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 638 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 639 | 640 | (defun info->aud-queue () net info->aud-queue) 641 | (defnet info->aud-queue (@q) 642 | (deflocal i aud codec) 643 | 644 | (set @q (queue)) 645 | (set i <_kv "audio">) 646 | (for i in 1 .. (if (integerp i) i 0) do 647 | (set aud (info->aud (for-pos))) 648 | (set codec (aud-codec aud)) 649 | (if (<> codec undef) 650 | then (queue-put @q (list i aud codec)) ))) 651 | 652 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 653 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 654 | ;;;; ;;;; 655 | ;;;; ;;;; 656 | ;;;; ;;;; 657 | ;;;; ;;;; 658 | ;;;; ;;;; 659 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 660 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 661 | 662 | (defun x265-user-data (path) net x265-user-data) 663 | (defnet x265-user-data (path @s) 664 | (deflocal f l st c) 665 | 666 | (set f (fopenro path)) 667 | (<> f undef) 668 | (set l 0) 669 | (set st 0) 670 | (opt* (< l 100000) 671 | (< st 5) 672 | (set c (freadchar f)) 673 | (charp c) 674 | (inc l) 675 | (case st of 676 | 0 (if (= c 'x') 677 | then (inc st) ) 678 | 1 (if (= c '2') 679 | then (inc st) 680 | else (set st 0) ) 681 | 2 (if (= c '6') 682 | then (inc st) 683 | else (set st 0) ) 684 | 3 (if (= c '5') 685 | then (inc st) 686 | (set @s "x265") 687 | else (set st 0) ) 688 | 4 (if (and (= c (int->char 128)) (> (length @s) 20)) 689 | then (inc st) 690 | else (if (in c (int->char 32) .. (int->char 127)) 691 | then (inc @s c) 692 | else (set st 0) )))) 693 | (close f) 694 | (= st 5) ) 695 | 696 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 697 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 698 | ;;;; ;;;; 699 | ;;;; ;;;; 700 | ;;;; ;;;; 701 | ;;;; ;;;; 702 | ;;;; ;;;; 703 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 704 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 705 | 706 | (defnet da-chiudere (obj) 707 | (queue-put <_kv "da-chiudere"> obj) ) 708 | 709 | (defnet quit () 710 | (deflocal obj) 711 | 712 | (for obj in <_kv "da-chiudere"> do 713 | (close obj) ) 714 | (sound-quit) ) 715 | 716 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 717 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 718 | ;;;; ;;;; 719 | ;;;; ;;;; 720 | ;;;; ;;;; 721 | ;;;; ;;;; 722 | ;;;; ;;;; 723 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 724 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 725 | 726 | --------------------------------------------------------------------------------