cutcutcodec 1.0.post3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cutcutcodec might be problematic. Click here for more details.
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/__init__.py +6 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/__main__.py +38 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/c_build.py +33 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/_helper_properties.py +52 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/audio/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/audio/properties/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/audio/properties/duration.py +83 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/ffprobe.py +637 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/graph/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/graph/find.py +82 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/graph/time_backprop.py +68 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/rate_audio.py +239 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/rate_video.py +97 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/shape.py +107 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/stream/time_backprop.py +183 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/duration.py +162 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/nb_frames.py +159 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/rate.py +102 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/analysis/video/properties/timestamps.py +194 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/container.py +40 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/encoder.py +152 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/filter.py +33 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/frame.py +127 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/frame_audio.py +205 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/frame_video.py +322 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/layout.py +206 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/meta_filter.py +41 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/muxer.py +184 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/node.py +164 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/stream.py +182 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/stream_audio.py +130 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/classes/stream_video.py +193 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/__init__.py +7 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/ast_to_file.py +125 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/__init__.py +6 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/compatibility.py +734 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/default.py +99 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/encodec.py +40 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/muxer.py +8 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/export/rate.py +133 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/graph_to_ast.py +477 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/graph_to_json.py +104 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/graph_to_tree.py +190 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/json_to_graph.py +114 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/parse.py +123 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/__init__.py +15 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/dynamic.py +544 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/lambdify.py +612 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/preprocess.py +698 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/sympy_to_torch/printer.py +926 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/compilation/tree_to_graph.py +168 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/decision/__init__.py +8 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/operation/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/operation/add.py +73 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/edit/operation/remove.py +476 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/exceptions.py +60 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/add.py +170 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/cat.py +60 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/cut.py +112 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/delay.py +85 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/equation.py +261 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/fir.py +231 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/identity.py +48 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/resample.py +451 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/audio/subclip.py +91 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/cut.py +74 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/mix/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/mix/audio_cast.py +208 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/mix/video_cast.py +197 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/subclip.py +53 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/add.py +331 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/cat.py +60 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/cut.py +113 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/delay.py +84 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/equation.py +265 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/identity.py +48 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/pad.py +99 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/filters/video/subclip.py +91 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/audio/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/audio/empty.py +73 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/audio/equation.py +56 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/audio/noise.py +243 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/c_fractal.cpython-312-x86_64-linux-gnu.so +0 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/empty.py +69 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/equation.py +109 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/fractal/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/fractal/fractal.c +116 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/fractal/geometry.py +100 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/fractal/mandelbrot.py +176 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/generation/video/noise.py +112 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/interfaces/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/interfaces/seedable.py +82 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/read_ffmpeg.py +904 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/read_svg.py +145 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/scheduler.py +356 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/io/write.py +340 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/basic.py +35 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/clean/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/clean/graph.py +80 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/hashes/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/hashes/graph.py +81 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cache/singleton.py +47 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/cuda/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/factor/__init__.py +5 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/factor/proba.py +189 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/generalize/__init__.py +5 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/generalize/delay_to_fir.py +88 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/graph.py +17 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/parallel/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/parallel/buffer.py +90 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/core/opti/utils.py +34 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/audio_5.1_narration.oga +0 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/intro.webm +0 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/logo.svg +13 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/project.json +226 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/examples/video.mp4 +0 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/__init__.py +8 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/__main__.py +25 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/actions.py +63 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/app/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/app/app.py +248 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/base.py +50 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/container_input_ffmpeg.py +90 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_audio_delay.py +9 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_audio_equation.py +45 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_audio_fir.py +58 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_audio_subclip.py +9 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_cut.py +82 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_delay.py +20 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_subclip.py +21 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_video_delay.py +9 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_video_equation.py +53 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/filter_video_subclip.py +9 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_audio_equation.py +14 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_audio_noise.py +19 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_video_equation.py +13 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_video_mandelbrot.py +60 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/all/generator_video_noise.py +18 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/base.py +99 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/default.py +27 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/documentation.py +47 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/general.py +71 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/interface.py +305 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/loader.py +41 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edit_node_state/main.py +62 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/edition_tabs.py +34 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry/base.py +122 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry/filters.py +42 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry/generators.py +42 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/entry_tabs.py +46 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/_helper.py +54 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/container.py +226 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/doc.py +67 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/encodec.py +289 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/export/main.py +173 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/flowchart/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/flowchart/edge_properties.py +56 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/flowchart/main.py +280 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/flowchart/node.py +44 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/main.py +151 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/menu.py +21 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/preferences/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/preferences/audio_settings.py +183 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/preferences/main.py +41 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/preferences/video_settings.py +257 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/run.py +71 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/main.py +30 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/slider.py +286 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/track.py +97 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/timeline/view.py +90 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/toolbar.py +29 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/tools.py +23 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/__init__.py +3 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/audio_player.py +103 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/control.py +96 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/frame_extractor.py +254 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/gui/video_preview/main.py +115 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/__init__.py +8 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/__main__.py +27 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/coding_style.py +49 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/generation.py +52 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/install.py +72 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/run.py +58 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/abstract.py +215 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/audio_cast.py +35 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/audio_equation.py +71 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/c_memory.py +132 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/compatibility.py +27 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/compile.py +42 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/encoder.py +23 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/filter_cut.py +107 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/filter_delay.py +71 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/filter_empty.py +40 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/fir.py +143 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/hashes.py +23 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/initialisation.py +24 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/muxer.py +22 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/nan_snapshot.py +39 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/read.py +192 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/serialization_equality.py +50 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/snapshot_shape.py +21 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/sympy_to_torch.py +135 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/thread_safe.py +77 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/time_range.py +55 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/video_equation.py +77 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/testing/tests/write.py +95 -0
- cutcutcodec-1.0.post3.data/platlib/cutcutcodec/utils.py +40 -0
- cutcutcodec-1.0.post3.dist-info/LICENSE +7 -0
- cutcutcodec-1.0.post3.dist-info/METADATA +271 -0
- cutcutcodec-1.0.post3.dist-info/RECORD +233 -0
- cutcutcodec-1.0.post3.dist-info/WHEEL +5 -0
- cutcutcodec-1.0.post3.dist-info/entry_points.txt +6 -0
- cutcutcodec-1.0.post3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Generate the frame in background for the requierd timestamp.
|
|
4
|
+
|
|
5
|
+
Allows to send audio and video frames in order to have a preview of the current editing.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from fractions import Fraction
|
|
9
|
+
import functools
|
|
10
|
+
import queue
|
|
11
|
+
import threading
|
|
12
|
+
import time
|
|
13
|
+
import typing
|
|
14
|
+
|
|
15
|
+
from qtpy import QtCore, QtGui
|
|
16
|
+
import numpy as np
|
|
17
|
+
|
|
18
|
+
from cutcutcodec.core.analysis.stream.shape import optimal_shape_video
|
|
19
|
+
from cutcutcodec.core.classes.frame import Frame
|
|
20
|
+
from cutcutcodec.core.classes.frame_audio import FrameAudio
|
|
21
|
+
from cutcutcodec.core.classes.frame_video import FrameVideo
|
|
22
|
+
from cutcutcodec.core.classes.stream_audio import StreamAudio
|
|
23
|
+
from cutcutcodec.core.classes.stream_video import StreamVideo
|
|
24
|
+
from cutcutcodec.core.compilation.export.rate import suggest_audio_rate
|
|
25
|
+
from cutcutcodec.core.compilation.export.rate import suggest_video_rate
|
|
26
|
+
from cutcutcodec.core.exceptions import MissingStreamError, OutOfTimeRange
|
|
27
|
+
from cutcutcodec.core.io.scheduler import scheduler
|
|
28
|
+
from cutcutcodec.gui.base import CutcutcodecWidget
|
|
29
|
+
from cutcutcodec.gui.video_preview.audio_player import AudioPlayer
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _catch_none(func):
|
|
33
|
+
"""Call in loop while until res is not None."""
|
|
34
|
+
@functools.wraps(func)
|
|
35
|
+
def func_no_none(*args, **kwargs):
|
|
36
|
+
res = None
|
|
37
|
+
while res is None:
|
|
38
|
+
res = func(*args, **kwargs)
|
|
39
|
+
return res
|
|
40
|
+
return func_no_none
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class DynamicSheduler:
|
|
44
|
+
"""Yield in real time the frame updated with the current parameters."""
|
|
45
|
+
|
|
46
|
+
def __init__(self, frame_extractor):
|
|
47
|
+
self.frame_extractor = frame_extractor
|
|
48
|
+
self.lock = threading.Lock()
|
|
49
|
+
self.position = None
|
|
50
|
+
self.priority_frames = queue.Queue()
|
|
51
|
+
self.scheduler = None
|
|
52
|
+
self.state = {
|
|
53
|
+
"running": False,
|
|
54
|
+
"rate": 48000,
|
|
55
|
+
"fps": Fraction(30000, 1001),
|
|
56
|
+
"shape": (1080, 720),
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@_catch_none
|
|
60
|
+
def __next__(self) -> typing.Union[None, Frame]:
|
|
61
|
+
"""Wait and return the next frame at the right moment (real time)."""
|
|
62
|
+
while True:
|
|
63
|
+
if not self.state["running"]: # if need pause
|
|
64
|
+
return self.priority_frames.get()
|
|
65
|
+
try:
|
|
66
|
+
return self.priority_frames.get_nowait()
|
|
67
|
+
except queue.Empty:
|
|
68
|
+
pass
|
|
69
|
+
if self.scheduler is None:
|
|
70
|
+
self.update_scheduler()
|
|
71
|
+
with self.lock:
|
|
72
|
+
try:
|
|
73
|
+
_, frame = next(self.scheduler)
|
|
74
|
+
except (StopIteration, TypeError, MissingStreamError):
|
|
75
|
+
# if we reach the end of the stream
|
|
76
|
+
# or if self.scheduler set to None in background,
|
|
77
|
+
# or if the user try forward after the end of the stream
|
|
78
|
+
self.frame_extractor.set_pause()
|
|
79
|
+
continue
|
|
80
|
+
self.position = self.position or (frame.time, time.time())
|
|
81
|
+
date_theo = self.position[1] + frame.time - self.position[0]
|
|
82
|
+
if (sleep_time := date_theo - time.time()) > 0:
|
|
83
|
+
time.sleep(sleep_time) # overrun -> real time
|
|
84
|
+
elif sleep_time < -0.01: # if big underun (>10ms), assume delay not catchable
|
|
85
|
+
date_theo -= sleep_time # reset counter for next frame, (= time.time())
|
|
86
|
+
self.position = (frame.time, date_theo)
|
|
87
|
+
return frame
|
|
88
|
+
|
|
89
|
+
def __iter__(self):
|
|
90
|
+
"""Make the object compatible with the for loop."""
|
|
91
|
+
return self
|
|
92
|
+
|
|
93
|
+
def get_stream_audio(self) -> typing.Union[None, StreamAudio]:
|
|
94
|
+
"""Return as possible the first audio stream."""
|
|
95
|
+
for stream in self.frame_extractor.app.tree().in_streams:
|
|
96
|
+
if stream.type == "audio":
|
|
97
|
+
return stream
|
|
98
|
+
return None
|
|
99
|
+
|
|
100
|
+
def get_stream_video(self) -> typing.Union[None, StreamVideo]:
|
|
101
|
+
"""Return as possible the first video stream."""
|
|
102
|
+
for stream in self.frame_extractor.app.tree().in_streams:
|
|
103
|
+
if stream.type == "video":
|
|
104
|
+
return stream
|
|
105
|
+
return None
|
|
106
|
+
|
|
107
|
+
def update_scheduler(self):
|
|
108
|
+
"""Get an updated version of ``cutcutcodec.core.io.scheduler.scheduler`` iterator."""
|
|
109
|
+
streams, rates = [], []
|
|
110
|
+
if (stream := self.get_stream_video()) is not None:
|
|
111
|
+
streams.append(stream)
|
|
112
|
+
rates.append(self.state["fps"])
|
|
113
|
+
if (stream := self.get_stream_audio()) is not None:
|
|
114
|
+
streams.append(stream)
|
|
115
|
+
rates.append(self.state["rate"])
|
|
116
|
+
if not streams:
|
|
117
|
+
raise MissingStreamError("no audio or video stream founded in output")
|
|
118
|
+
start_time = Fraction(0) if self.position is None else self.position[0]
|
|
119
|
+
scheduler_ = (
|
|
120
|
+
iter(scheduler(streams, rates, start_time=start_time, shape=self.state["shape"]))
|
|
121
|
+
)
|
|
122
|
+
with self.lock:
|
|
123
|
+
self.position = None
|
|
124
|
+
self.scheduler = scheduler_
|
|
125
|
+
self.priority_frames.put(None) # relunch
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
class FrameExtractor(CutcutcodecWidget, QtCore.QThread):
|
|
129
|
+
"""Non-blocking thread allowing to quietly extract frames in the background."""
|
|
130
|
+
|
|
131
|
+
update_frame = QtCore.Signal(np.ndarray)
|
|
132
|
+
update_pos = QtCore.Signal(Fraction)
|
|
133
|
+
error = QtCore.Signal(object)
|
|
134
|
+
|
|
135
|
+
def __init__(self, parent):
|
|
136
|
+
super().__init__(parent)
|
|
137
|
+
self._parent = parent
|
|
138
|
+
self._stop = False
|
|
139
|
+
self.dynamic_scheduler = DynamicSheduler(self)
|
|
140
|
+
self.audio_player = AudioPlayer(daemon=True)
|
|
141
|
+
self.audio_player.start()
|
|
142
|
+
|
|
143
|
+
def __del__(self):
|
|
144
|
+
"""Stop the thread automaticaly when the object is deleted."""
|
|
145
|
+
self._stop = True
|
|
146
|
+
self.audio_player.stop() # this is blocking
|
|
147
|
+
self.wait(1000) # timeout in ms
|
|
148
|
+
if not self.isFinished():
|
|
149
|
+
self.terminate()
|
|
150
|
+
self.wait(1000) # timeout in ms
|
|
151
|
+
|
|
152
|
+
def refresh(self):
|
|
153
|
+
"""Update the elements of this widget and child widgets."""
|
|
154
|
+
# update fps, samplerate and shape
|
|
155
|
+
if stream := self.dynamic_scheduler.get_stream_audio():
|
|
156
|
+
rate = self.app.export_settings["rates"]["audio"]
|
|
157
|
+
rate = rate[0] if rate else suggest_audio_rate(stream)
|
|
158
|
+
if rate is None:
|
|
159
|
+
rate = suggest_audio_rate(stream)
|
|
160
|
+
self.dynamic_scheduler.state["rate"] = rate
|
|
161
|
+
if stream := self.dynamic_scheduler.get_stream_video():
|
|
162
|
+
fps = self.app.export_settings["rates"]["video"]
|
|
163
|
+
fps = fps[0] if fps else suggest_video_rate(stream)
|
|
164
|
+
if fps is None:
|
|
165
|
+
fps = suggest_video_rate(stream)
|
|
166
|
+
else:
|
|
167
|
+
fps = Fraction(fps)
|
|
168
|
+
self.dynamic_scheduler.state["fps"] = fps
|
|
169
|
+
shape = self.app.export_settings["shapes"]
|
|
170
|
+
shape = shape[0] if shape else (720, 1080)
|
|
171
|
+
if shape is None:
|
|
172
|
+
shape = optimal_shape_video(stream) or (720, 1080)
|
|
173
|
+
self.dynamic_scheduler.state["shape"] = shape
|
|
174
|
+
|
|
175
|
+
# refresh the frame at the current position
|
|
176
|
+
curr_pos = self.dynamic_scheduler.position
|
|
177
|
+
curr_pos = Fraction(0) if curr_pos is None else curr_pos[0]
|
|
178
|
+
self.set_position(curr_pos) # allways reset the scheduler
|
|
179
|
+
|
|
180
|
+
def run(self):
|
|
181
|
+
"""Extract frames in background until death."""
|
|
182
|
+
try:
|
|
183
|
+
while not self._stop:
|
|
184
|
+
for frame in self.dynamic_scheduler:
|
|
185
|
+
self.update_pos.emit(frame.time)
|
|
186
|
+
if self._stop:
|
|
187
|
+
break
|
|
188
|
+
if isinstance(frame, FrameVideo):
|
|
189
|
+
self.update_frame.emit(frame.to_numpy_bgr(contiguous=True))
|
|
190
|
+
elif isinstance(frame, FrameAudio):
|
|
191
|
+
self.audio_player.update_frame(frame)
|
|
192
|
+
else:
|
|
193
|
+
raise NotImplementedError("only audio and video frame are supported")
|
|
194
|
+
except Exception as err:
|
|
195
|
+
threading.Thread(target=self.error.emit, args=(err,), daemon=True).start()
|
|
196
|
+
|
|
197
|
+
@QtCore.Slot()
|
|
198
|
+
def set_pause(self):
|
|
199
|
+
"""Stop reading and updates icon."""
|
|
200
|
+
if not self.dynamic_scheduler.state["running"]: # if it is already in pause
|
|
201
|
+
return # do nothing
|
|
202
|
+
self.parent.control_bar.act_start_pause.setIcon(
|
|
203
|
+
QtGui.QIcon.fromTheme("media-playback-start")
|
|
204
|
+
)
|
|
205
|
+
self.parent.control_bar.act_start_pause.setText("start")
|
|
206
|
+
self.dynamic_scheduler.state["running"] = False
|
|
207
|
+
|
|
208
|
+
@QtCore.Slot(Fraction)
|
|
209
|
+
def set_position(self, pos: Fraction):
|
|
210
|
+
"""Seek the preview to the given position."""
|
|
211
|
+
assert isinstance(pos, Fraction), pos.__class__.__name__
|
|
212
|
+
|
|
213
|
+
# set the new position
|
|
214
|
+
delta = self.dynamic_scheduler.state["fps"]
|
|
215
|
+
if rest := pos % (1/delta):
|
|
216
|
+
pos += 1/delta - rest # pos = k*(1/fps), k integer
|
|
217
|
+
with self.dynamic_scheduler.lock:
|
|
218
|
+
self.dynamic_scheduler.scheduler = None
|
|
219
|
+
self.dynamic_scheduler.position = [pos, time.time()]
|
|
220
|
+
|
|
221
|
+
# extrat one frame at the given position
|
|
222
|
+
if (stream := self.dynamic_scheduler.get_stream_video()) is not None:
|
|
223
|
+
try:
|
|
224
|
+
frame = stream.snapshot(pos, self.dynamic_scheduler.state["shape"])
|
|
225
|
+
except OutOfTimeRange:
|
|
226
|
+
pass
|
|
227
|
+
else:
|
|
228
|
+
self.dynamic_scheduler.priority_frames.put(frame)
|
|
229
|
+
if (stream := self.dynamic_scheduler.get_stream_audio()) is not None:
|
|
230
|
+
rate = self.dynamic_scheduler.state["rate"]
|
|
231
|
+
try:
|
|
232
|
+
frame = stream.snapshot(pos, rate, max(1, rate//10)) # 100 ms
|
|
233
|
+
except OutOfTimeRange:
|
|
234
|
+
pass
|
|
235
|
+
else:
|
|
236
|
+
self.dynamic_scheduler.priority_frames.put(frame)
|
|
237
|
+
|
|
238
|
+
@QtCore.Slot()
|
|
239
|
+
def set_start(self):
|
|
240
|
+
"""Stop reading and updates icon."""
|
|
241
|
+
if self.dynamic_scheduler.state["running"]: # if it is already playing
|
|
242
|
+
return # do nothing
|
|
243
|
+
self.parent.control_bar.act_start_pause.setIcon(
|
|
244
|
+
QtGui.QIcon.fromTheme("media-playback-pause")
|
|
245
|
+
)
|
|
246
|
+
self.parent.control_bar.act_start_pause.setText("pause")
|
|
247
|
+
self.dynamic_scheduler.state["running"] = True
|
|
248
|
+
self.dynamic_scheduler.priority_frames.put(None) # relunch
|
|
249
|
+
|
|
250
|
+
@QtCore.Slot()
|
|
251
|
+
def set_stop(self):
|
|
252
|
+
"""Pause and return to the beginning."""
|
|
253
|
+
self.set_pause()
|
|
254
|
+
self.set_position(Fraction(0))
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Allow video and audio previews, but also allows interaction with editing some nodes."""
|
|
4
|
+
|
|
5
|
+
from fractions import Fraction
|
|
6
|
+
|
|
7
|
+
from qtpy import QtCore, QtGui, QtWidgets
|
|
8
|
+
import numpy as np
|
|
9
|
+
|
|
10
|
+
from cutcutcodec.gui.base import CutcutcodecWidget
|
|
11
|
+
from cutcutcodec.gui.video_preview.control import ControlBar
|
|
12
|
+
from cutcutcodec.gui.video_preview.frame_extractor import FrameExtractor
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class VideoPreview(CutcutcodecWidget, QtWidgets.QWidget):
|
|
16
|
+
"""Canva with video frames in the background, and objects in the foreground."""
|
|
17
|
+
|
|
18
|
+
def __init__(self, parent):
|
|
19
|
+
super().__init__(parent)
|
|
20
|
+
self._parent = parent
|
|
21
|
+
self.destroyed.connect(lambda: self.__del__()) # ``self.__del__`` does not work
|
|
22
|
+
|
|
23
|
+
# creation of main elements
|
|
24
|
+
self.state = {"zoom": True, "frame": np.array(())}
|
|
25
|
+
self.scene = QtWidgets.QGraphicsScene()
|
|
26
|
+
self.view = QtWidgets.QGraphicsView(self.scene, self)
|
|
27
|
+
self.view.setViewportUpdateMode(
|
|
28
|
+
QtWidgets.QGraphicsView.ViewportUpdateMode.BoundingRectViewportUpdate
|
|
29
|
+
)
|
|
30
|
+
self.view.resizeEvent = self.resizeEvent
|
|
31
|
+
self.bg_img = self.scene.addPixmap(QtGui.QPixmap()) # the background displayed frame
|
|
32
|
+
self.control_bar = ControlBar(self)
|
|
33
|
+
self.frame_extractor = FrameExtractor(self)
|
|
34
|
+
self.frame_extractor.setTerminationEnabled(True)
|
|
35
|
+
self.frame_extractor.error.connect(self.__del__)
|
|
36
|
+
self.frame_extractor.update_pos.connect(self.update_pos)
|
|
37
|
+
self.frame_extractor.update_frame.connect(self.update_frame)
|
|
38
|
+
self.frame_extractor.start()
|
|
39
|
+
|
|
40
|
+
# location
|
|
41
|
+
layout = QtWidgets.QVBoxLayout(self)
|
|
42
|
+
layout.addWidget(self.view)
|
|
43
|
+
layout.addWidget(self.control_bar)
|
|
44
|
+
self.setLayout(layout)
|
|
45
|
+
|
|
46
|
+
@QtCore.Slot(object)
|
|
47
|
+
def __del__(self, err=None):
|
|
48
|
+
"""Kill threads to avoid segfault."""
|
|
49
|
+
if err is not None:
|
|
50
|
+
raise err
|
|
51
|
+
self.frame_extractor.__del__()
|
|
52
|
+
|
|
53
|
+
def resizeEvent(self, _):
|
|
54
|
+
"""Help when called each times the view shape is changing."""
|
|
55
|
+
if self.state["frame"].size != 0:
|
|
56
|
+
self.update_frame(self.state["frame"])
|
|
57
|
+
|
|
58
|
+
def set_zoom_fit(self):
|
|
59
|
+
"""Allow to adapt the size of the video to the size of the viewer."""
|
|
60
|
+
self.state["zoom"] = True
|
|
61
|
+
self.update_frame(self.state["frame"])
|
|
62
|
+
|
|
63
|
+
def set_zoom_original(self):
|
|
64
|
+
"""Allow to adapt the size of the video to the size of the frame."""
|
|
65
|
+
self.state["zoom"] = False
|
|
66
|
+
self.update_frame(self.state["frame"])
|
|
67
|
+
|
|
68
|
+
@QtCore.Slot(np.ndarray)
|
|
69
|
+
def update_frame(self, frame: np.ndarray):
|
|
70
|
+
"""Redraw the new background frame image."""
|
|
71
|
+
assert isinstance(frame, np.ndarray), frame.__class__.__name__
|
|
72
|
+
self.state["frame"] = frame
|
|
73
|
+
if frame.size == 0: # if no frame provided
|
|
74
|
+
self.bg_img.setPixmap(QtGui.QPixmap()) # erase the actual background
|
|
75
|
+
return
|
|
76
|
+
|
|
77
|
+
# convert image
|
|
78
|
+
assert frame.ndim == 3, frame.shape
|
|
79
|
+
height, width, channels = frame.shape
|
|
80
|
+
assert height >= 1 and width >= 1, (height, width)
|
|
81
|
+
assert frame.dtype == np.uint8, frame.dtype
|
|
82
|
+
if channels == 1:
|
|
83
|
+
img_qt = QtGui.QImage(
|
|
84
|
+
frame.data, width, height, width, QtGui.QImage.Format.Format_Grayscale8
|
|
85
|
+
)
|
|
86
|
+
elif channels == 3:
|
|
87
|
+
img_qt = QtGui.QImage(
|
|
88
|
+
frame.data, width, height, 3*width, QtGui.QImage.Format.Format_BGR888
|
|
89
|
+
)
|
|
90
|
+
else:
|
|
91
|
+
raise ValueError(f"only 1 gray or 3 BGR channels image supprorted, not {channels}")
|
|
92
|
+
|
|
93
|
+
# rescale image
|
|
94
|
+
if self.state["zoom"]:
|
|
95
|
+
width, height = self.view.width()-2, self.view.height()-2
|
|
96
|
+
img_qt = img_qt.scaled(
|
|
97
|
+
width,
|
|
98
|
+
height,
|
|
99
|
+
QtCore.Qt.AspectRatioMode.KeepAspectRatio, # no stretching
|
|
100
|
+
QtCore.Qt.TransformationMode.SmoothTransformation, # bilinear filtering
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
# draw image
|
|
104
|
+
self.scene.setSceneRect(0, 0, img_qt.width(), img_qt.height()) # to center the image
|
|
105
|
+
self.bg_img.setPixmap(QtGui.QPixmap.fromImage(img_qt))
|
|
106
|
+
|
|
107
|
+
@QtCore.Slot(Fraction)
|
|
108
|
+
def update_pos(self, timestamp):
|
|
109
|
+
"""Set the cursor at the write position."""
|
|
110
|
+
self.main_window.sub_windows["edition_tabs"].timeline.view.update_pos(timestamp)
|
|
111
|
+
|
|
112
|
+
def refresh(self):
|
|
113
|
+
"""Update the elements of this widget and child widgets."""
|
|
114
|
+
self.control_bar.refresh()
|
|
115
|
+
self.frame_extractor.refresh()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Alias for ``cutcutcodec.testing.run``."""
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
import click
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@click.command()
|
|
11
|
+
@click.option("--debug", is_flag=True, help="Show more information on failure.")
|
|
12
|
+
@click.option("--skip-install", is_flag=True, help="Do not check the installation.")
|
|
13
|
+
@click.option("--skip-coding-style", is_flag=True, help="Do not check programation style.")
|
|
14
|
+
@click.option("--skip-slow", is_flag=True, help="Do not run the slow tests.")
|
|
15
|
+
def main(debug: bool = False, **kwargs) -> int:
|
|
16
|
+
"""Run several tests, alias to ``cutcutcodec-test``."""
|
|
17
|
+
from cutcutcodec.testing.run import run_tests # no global import for cutcutcodec.__main__
|
|
18
|
+
return run_tests(
|
|
19
|
+
debug=debug,
|
|
20
|
+
skip_install=kwargs.get("skip_install", False),
|
|
21
|
+
skip_coding_style=kwargs.get("skip_coding_style", False),
|
|
22
|
+
skip_slow=kwargs.get("skip_slow", False),
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
if __name__ == "__main__":
|
|
27
|
+
sys.exit(main())
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Executes analyser of code quality."""
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
from pylama.main import shell
|
|
7
|
+
except ImportError as err:
|
|
8
|
+
raise ImportError("pylama paquage required (pip install cutcutcodec[all])") from err
|
|
9
|
+
|
|
10
|
+
from cutcutcodec.utils import get_project_root
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_mccabe_pycodestyle_pydocstyle_pyflakes():
|
|
14
|
+
"""Run these linters throw pylama on cutcutcodec."""
|
|
15
|
+
root = get_project_root()
|
|
16
|
+
assert not shell( # fast checks
|
|
17
|
+
[
|
|
18
|
+
"--options", str(root.parent / "pyproject.toml"),
|
|
19
|
+
"--linters", "mccabe,pycodestyle,pydocstyle,pyflakes", "--async",
|
|
20
|
+
str(root),
|
|
21
|
+
],
|
|
22
|
+
error=False,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_mypy():
|
|
27
|
+
"""Run mypy throw pylama on cutcutcodec."""
|
|
28
|
+
root = get_project_root()
|
|
29
|
+
assert not shell( # fast checks
|
|
30
|
+
[
|
|
31
|
+
"--options", str(root.parent / "pyproject.toml"),
|
|
32
|
+
"--linters", "mypy", "--async",
|
|
33
|
+
str(root),
|
|
34
|
+
],
|
|
35
|
+
error=False,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_pylint():
|
|
40
|
+
"""Run pylint throw pylama on cutcutcodec."""
|
|
41
|
+
root = get_project_root()
|
|
42
|
+
assert not shell( # fast checks
|
|
43
|
+
[
|
|
44
|
+
"--options", str(root.parent / "pyproject.toml"),
|
|
45
|
+
"--linters", "pylint",
|
|
46
|
+
str(root),
|
|
47
|
+
],
|
|
48
|
+
error=False,
|
|
49
|
+
)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Allow to generate a multitude of objects.
|
|
4
|
+
|
|
5
|
+
Doesn't perform any test itself but allows to lighten the other tests.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import importlib
|
|
9
|
+
import inspect
|
|
10
|
+
|
|
11
|
+
from cutcutcodec.core.classes.node import Node
|
|
12
|
+
from cutcutcodec.utils import get_project_root
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def extract_cls_and_default():
|
|
16
|
+
"""Initialize and yield the example of each class."""
|
|
17
|
+
done = set()
|
|
18
|
+
for filepath in (get_project_root() / "core").rglob("*.py"):
|
|
19
|
+
mod = importlib.import_module(
|
|
20
|
+
".".join(
|
|
21
|
+
("cutcutcodec" / filepath.relative_to(get_project_root()).with_suffix("")).parts
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
for name, node_cls in inspect.getmembers(mod): # getmembers_static
|
|
25
|
+
if (
|
|
26
|
+
inspect.isclass(node_cls) and issubclass(node_cls, Node)
|
|
27
|
+
and node_cls not in done
|
|
28
|
+
and name not in {
|
|
29
|
+
"Filter", "MetaFilter", "Node", "ContainerInput", "ContainerOutput"
|
|
30
|
+
}
|
|
31
|
+
):
|
|
32
|
+
yield node_cls, node_cls.default()
|
|
33
|
+
done.add(node_cls)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def extract_cls_and_streams():
|
|
37
|
+
"""Yield all streams of all default examples."""
|
|
38
|
+
for node_cls, node in extract_cls_and_default():
|
|
39
|
+
for stream in node.out_streams:
|
|
40
|
+
yield node_cls, stream
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def extract_default():
|
|
44
|
+
"""Like ``extract_cls_and_default`` without the class."""
|
|
45
|
+
for _, node in extract_cls_and_default():
|
|
46
|
+
yield node
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def extract_streams():
|
|
50
|
+
"""Like ``extract_cls_and_streams`` without the class."""
|
|
51
|
+
for _, stream in extract_cls_and_streams():
|
|
52
|
+
yield stream
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Test if the dependents libraries are well installed and linked.
|
|
4
|
+
|
|
5
|
+
Basicaly, it checks if the installation seems to be correct.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import logging
|
|
9
|
+
import re
|
|
10
|
+
import subprocess
|
|
11
|
+
|
|
12
|
+
import av
|
|
13
|
+
import torch
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_av_ffmpeg_link():
|
|
17
|
+
"""Test the pyav and ffmpeg dependencies."""
|
|
18
|
+
try:
|
|
19
|
+
version_ffmpeg = (
|
|
20
|
+
subprocess.run(["ffmpeg", "-version"], capture_output=True, check=True).stdout.decode()
|
|
21
|
+
)
|
|
22
|
+
except subprocess.CalledProcessError as err:
|
|
23
|
+
raise ImportError(
|
|
24
|
+
"ffmpeg is not accessible from the 'ffmpeg' commande line, "
|
|
25
|
+
"please refer to the ffmpeg installation guide"
|
|
26
|
+
) from err
|
|
27
|
+
try:
|
|
28
|
+
version_ffprobe = (
|
|
29
|
+
subprocess.run(["ffprobe", "-version"], capture_output=True, check=True).stdout.decode()
|
|
30
|
+
)
|
|
31
|
+
except subprocess.CalledProcessError as err:
|
|
32
|
+
raise ImportError(
|
|
33
|
+
"ffprobe is not accessible from the 'ffprobe' but ffmpeg is installed, "
|
|
34
|
+
"please check your environement variables"
|
|
35
|
+
) from err
|
|
36
|
+
|
|
37
|
+
version_pattern = r"version\s+(?P<major>\d+)\.(?P<minor>\d+)"
|
|
38
|
+
if (version := re.search(version_pattern, version_ffmpeg)) is None:
|
|
39
|
+
raise RuntimeError("failed to decode the version of ffmpeg")
|
|
40
|
+
assert 4 <= int(version["major"]) <= 6, (
|
|
41
|
+
"only the version 4, 5, and 6 of ffmeg are supported, "
|
|
42
|
+
f"not {version['major']}.{version['minor']}"
|
|
43
|
+
)
|
|
44
|
+
if (version := re.search(version_pattern, version_ffprobe)) is None:
|
|
45
|
+
raise RuntimeError("failed to decode the version of ffprobe")
|
|
46
|
+
assert 4 <= int(version["major"]) <= 6, (
|
|
47
|
+
"only the version 4, 5, and 6 of ffprobe are supported, "
|
|
48
|
+
f"not {version['major']}.{version['minor']}"
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
version_pattern = r"(?P<major>\d+)\.\s*(?P<minor>\d+)\.\s*(?P<micro>\d+)"
|
|
52
|
+
for lib, (major, minor, micro) in av.library_versions.items():
|
|
53
|
+
if (version := re.search(rf"{lib}\s+{version_pattern}", version_ffmpeg)) is None:
|
|
54
|
+
raise RuntimeError(f"failed to extract the ffmpeg {lib} version")
|
|
55
|
+
if (
|
|
56
|
+
(major, minor, micro)
|
|
57
|
+
!= (int(version["major"]), int(version["minor"]), int(version["micro"]))
|
|
58
|
+
):
|
|
59
|
+
logging.warning(
|
|
60
|
+
"the av version of %s is %d.%d.%d but %s.%s.%s for ffmpeg, "
|
|
61
|
+
"please reinstall pyav using option --no-binary, see the installation guide "
|
|
62
|
+
"https://pyav.org/docs/develop/overview/installation.html",
|
|
63
|
+
lib, major, minor, micro, version["major"], version["minor"], version["micro"]
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def test_gpu_torch():
|
|
68
|
+
"""Test if torch is able to use the GPU."""
|
|
69
|
+
if torch.cuda.is_available():
|
|
70
|
+
return # case alway ok
|
|
71
|
+
# TODO: tests if gpu is present
|
|
72
|
+
# nvidia-smi
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Executes all the tests via the ``pytest`` module."""
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
import pytest
|
|
7
|
+
except ImportError as err:
|
|
8
|
+
raise ImportError("pytest paquage required (pip install cutcutcodec[all])") from err
|
|
9
|
+
|
|
10
|
+
from cutcutcodec.utils import get_project_root
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def run_tests(
|
|
14
|
+
debug: bool = False,
|
|
15
|
+
skip_install: bool = False,
|
|
16
|
+
skip_coding_style: bool = False,
|
|
17
|
+
skip_slow: bool = False,
|
|
18
|
+
) -> int:
|
|
19
|
+
"""Perform all unit tests."""
|
|
20
|
+
root = get_project_root()
|
|
21
|
+
debug_options = ["--full-trace"] if debug else []
|
|
22
|
+
|
|
23
|
+
# install check
|
|
24
|
+
if not skip_install:
|
|
25
|
+
print("Checking if the dependencies are corrected...")
|
|
26
|
+
paths = [f"{root / 'testing' / 'install.py'}"]
|
|
27
|
+
if (
|
|
28
|
+
code := pytest.main(debug_options + ["--verbose"] + paths)
|
|
29
|
+
):
|
|
30
|
+
return int(code)
|
|
31
|
+
|
|
32
|
+
# code quality check
|
|
33
|
+
if not skip_coding_style:
|
|
34
|
+
print("Checking if the coding style respects the PEP...")
|
|
35
|
+
paths = [f"{root / 'testing' / 'coding_style.py'}"]
|
|
36
|
+
if (
|
|
37
|
+
code := pytest.main(debug_options + [
|
|
38
|
+
"--verbose", "--exitfirst", "--capture=no", "--tb=no", "-rN" # no rapport
|
|
39
|
+
] + paths)
|
|
40
|
+
):
|
|
41
|
+
return int(code)
|
|
42
|
+
|
|
43
|
+
# classical tests
|
|
44
|
+
print("Runing all the little unit tests...")
|
|
45
|
+
paths = (
|
|
46
|
+
[str(root / "utils.py")]
|
|
47
|
+
+ [str(root / "core")]
|
|
48
|
+
+ sorted(str(p) for p in (root / "testing" / "tests").rglob("*.py"))
|
|
49
|
+
)
|
|
50
|
+
if (code := pytest.main(debug_options + ["-m", "not slow", "--doctest-modules"] + paths)):
|
|
51
|
+
return int(code)
|
|
52
|
+
|
|
53
|
+
# slow tests
|
|
54
|
+
if not skip_slow:
|
|
55
|
+
print("Runing the slow unit tests...")
|
|
56
|
+
if (code := pytest.main(debug_options + ["-m", "slow", "--verbose"] + paths)):
|
|
57
|
+
return int(code)
|
|
58
|
+
return 0
|