From: Carl Hetherington Date: Tue, 5 Oct 2021 23:16:28 +0000 (+0200) Subject: Add some details about verification to the manual. X-Git-Tag: v2.15.167~10 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=da5a9e65ca466fe6652bafc04d344b7a57efcaf0 Add some details about verification to the manual. --- diff --git a/doc/manual/.gitignore b/doc/manual/.gitignore index 3fa250264..bc9331596 100644 --- a/doc/manual/.gitignore +++ b/doc/manual/.gitignore @@ -1 +1,4 @@ screenshots/*.pdf +verify_bv21_errors.xml +verify_errors.xml +verify_warnings.xml diff --git a/doc/manual/Makefile b/doc/manual/Makefile index d57dd2630..d08dffe51 100644 --- a/doc/manual/Makefile +++ b/doc/manual/Makefile @@ -1,6 +1,7 @@ # DCP-o-matic manual makefile INKSCAPE = ~/Applications/inkscape +LIBDCP = ~/src/libdcp all: html pdf @@ -104,11 +105,24 @@ SHORTCUTS := ../../src/tools/dcpomatic.cc shortcuts.xml: $(SHORTCUTS) shortcuts.py python3 shortcuts.py $(SHORTCUTS) > $@ +LIBDCP_DEPS = $(LIBDCP)/src/verify_j2k.cc $(LIBDCP)/src/dcp.cc $(LIBDCP)/src/verify.cc + +verify_errors.xml: verifier.py $(LIBDCP_DEPS) + python3 verifier.py $(LIBDCP) ERROR > $@ + +verify_bv21_errors.xml: verifier.py $(LIBDCP_DEPS) + python3 verifier.py $(LIBDCP) BV21_ERROR > $@ + +verify_warnings.xml: verifier.py $(LIBDCP_DEPS) + python3 verifier.py $(LIBDCP) WARNING > $@ + + # # HTML # -html: $(XML) config.xml shortcuts.xml dcpomatic-html.xsl extensions-html.ent dcpomatic.css dcpomatic_create.xml dcpomatic_cli.xml dcpomatic_kdm_cli.xml \ +html: $(XML) config.xml shortcuts.xml verify_errors.xml verify_bv21_errors.xml verify_warnings.xml \ + dcpomatic-html.xsl extensions-html.ent dcpomatic.css dcpomatic_create.xml dcpomatic_cli.xml dcpomatic_kdm_cli.xml \ $(subst .pdf,.png,$(addprefix html/screenshots/,$(SCREENSHOTS))) \ $(subst .svg,.png,$(addprefix diagrams/,$(DIAGRAMS))) \ @@ -128,7 +142,8 @@ html: $(XML) config.xml shortcuts.xml dcpomatic-html.xsl extensions-html.ent dcp # PDF # -pdf: $(XML) config.xml dcpomatic-pdf.xsl extensions-pdf.ent dcpomatic_create.xml dcpomatic_cli.xml dcpomatic_kdm_cli.xml \ +pdf: $(XML) config.xml shortcuts.xml verify_errors.xml verify_bv21_errors.xml verify_warnings.xml \ + dcpomatic-pdf.xsl extensions-pdf.ent dcpomatic_create.xml dcpomatic_cli.xml dcpomatic_kdm_cli.xml \ $(addprefix screenshots/,$(SCREENSHOTS)) \ $(subst .svg,.pdf,$(addprefix diagrams/,$(DIAGRAMS))) diff --git a/doc/manual/dcpomatic.xml b/doc/manual/dcpomatic.xml index 797a49fe5..87d3287ae 100644 --- a/doc/manual/dcpomatic.xml +++ b/doc/manual/dcpomatic.xml @@ -3741,7 +3741,7 @@ The full details of OV and VF files are discussed in - Playing and verifying DCPs + Playing DCPs DCP-o-matic includes a DCP player, and although it requires a very high-speed CPU to play DCPs in full resolution, it can also @@ -3767,12 +3767,43 @@ The full details of OV and VF files are discussed in + + + + + Verifying DCPs + - The player also offers a simple DCP validator. To check a DCP, + The player also offers a DCP validator. To check a DCP, open it and then select Verify DCP from the - Tools menu. This will run some basic checks to see if the DCP meets the required standards. + Tools menu. This will run various checks on the DCP. + + + + The validator will report three kinds of problems: + + Errors — serious problems with the DCP that are likely to cause problems on playback. + Bv2.1 errors — errors described by the SMPTE Bv2.1 standard. + Warnings — small problems that may not matter. + + +
+ Errors + +
+ +
+ Bv2.1 errors + +
+ +
+ Warnings + +
+
diff --git a/doc/manual/verifier.py b/doc/manual/verifier.py new file mode 100644 index 000000000..877a118a1 --- /dev/null +++ b/doc/manual/verifier.py @@ -0,0 +1,59 @@ +#!/usr/bin/python3 + +from pathlib import Path +import re +import sys +import subprocess + +if len(sys.argv) < 3: + print(f"Syntax: {sys.argv[0]} ") + sys.exit(1) + +libdcp = Path(sys.argv[1]) +type = sys.argv[2] +header = libdcp / "src" / "verify.h" + +types = ("BV21_ERROR", "ERROR", "WARNING") + +def find_type(name): + """ + Search source code to find where a given code is used and hence find out whether + it represents an error, Bv2.1 "error" or warning. + """ + previous = '' + for source in ["verify_j2k.cc", "dcp.cc", "verify.cc"]: + path = libdcp / "src" / source + with open(path) as s: + for line in s: + if line.find(name) != -1: + line_with_previous = previous + line + for t in types: + if line_with_previous.find(t) != -1: + return t + assert False + previous = line + + +print('') + +active = False +with open(header) as h: + for line in h: + strip = line.strip() + if strip == "enum class Code {": + active = True + elif strip == "};": + active = False + elif active: + if strip.startswith('/**'): + text = strip.replace('/**', '').replace('*/', '').strip() + elif not strip.startswith('/*') and not strip.startswith('*') and strip.endswith(','): + this_type = find_type(strip[:-1]) + if this_type == type: + text = re.sub(r"\[.*?\]", lambda m: f'(Bv2.1 {m[0][7:-1]})', text) + text = text.replace('<', '<') + text = text.replace('>', '>') + text = re.sub(r"_(.*?)_", r"\1", text) + print(f'{text}.') + +print('')