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,280 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Allow to view and edit the assembly graph with a ``block`` view."""
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
import pathlib
|
|
7
|
+
import typing
|
|
8
|
+
|
|
9
|
+
from qtpy import QtCore, QtWidgets
|
|
10
|
+
from qtpynodeeditor.connection_graphics_object import ConnectionGraphicsObject
|
|
11
|
+
from qtpynodeeditor.enums import PortType
|
|
12
|
+
from qtpynodeeditor.node_data import NodeDataModel, NodeDataType
|
|
13
|
+
from qtpynodeeditor.node_graphics_object import NodeGraphicsObject
|
|
14
|
+
from qtpynodeeditor.type_converter import TypeConverter
|
|
15
|
+
import qtpynodeeditor
|
|
16
|
+
|
|
17
|
+
from cutcutcodec.core.analysis.ffprobe import get_streams_type
|
|
18
|
+
from cutcutcodec.core.compilation.tree_to_graph import new_node
|
|
19
|
+
from cutcutcodec.core.edit.operation.add import add_edge, add_node
|
|
20
|
+
from cutcutcodec.core.edit.operation.remove import remove_elements
|
|
21
|
+
from cutcutcodec.core.io.read_ffmpeg import ContainerInputFFMPEG
|
|
22
|
+
from cutcutcodec.gui.base import CutcutcodecWidget
|
|
23
|
+
from cutcutcodec.gui.edit_node_state.main import EditNodeWindow
|
|
24
|
+
from cutcutcodec.gui.flowchart.edge_properties import edge_properties
|
|
25
|
+
from cutcutcodec.gui.flowchart.node import meta_node_creator
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class FlowScene(CutcutcodecWidget, qtpynodeeditor.FlowScene):
|
|
29
|
+
"""Able more acurate control on certain actions."""
|
|
30
|
+
|
|
31
|
+
def __init__(self, *args, parent=None, **kwargs):
|
|
32
|
+
super().__init__(*args, **kwargs)
|
|
33
|
+
self._parent = parent
|
|
34
|
+
self.qtnode_to_name = {} # to each graphic node, associate the node name
|
|
35
|
+
|
|
36
|
+
def create_complete_node(
|
|
37
|
+
self, data_model: NodeDataModel, name: str
|
|
38
|
+
) -> qtpynodeeditor.node.Node:
|
|
39
|
+
"""Add a graphical node to the scene.
|
|
40
|
+
|
|
41
|
+
Parameters
|
|
42
|
+
----------
|
|
43
|
+
data_model : NodeDataModel
|
|
44
|
+
The description class of the node.
|
|
45
|
+
name : str
|
|
46
|
+
The name of the node in the app tree.
|
|
47
|
+
"""
|
|
48
|
+
assert isinstance(name, str), name.__class__.__name__
|
|
49
|
+
assert name in self.app.graph
|
|
50
|
+
data_model.name = name
|
|
51
|
+
self.registry.register_model(data_model, category="")
|
|
52
|
+
node = super().create_node(data_model)
|
|
53
|
+
self.qtnode_to_name[node] = name
|
|
54
|
+
return node
|
|
55
|
+
|
|
56
|
+
def create_connection(
|
|
57
|
+
self,
|
|
58
|
+
port_a: qtpynodeeditor.port.Port,
|
|
59
|
+
port_b: typing.Optional[qtpynodeeditor.port.Port] = None,
|
|
60
|
+
*, converter: typing.Optional[qtpynodeeditor.type_converter.TypeConverter] = None,
|
|
61
|
+
check_cycles=True
|
|
62
|
+
) -> qtpynodeeditor.connection.Connection:
|
|
63
|
+
"""Add the tool tip to the complete connection."""
|
|
64
|
+
connection = super().create_connection(
|
|
65
|
+
port_a, port_b, converter=converter, check_cycles=check_cycles
|
|
66
|
+
)
|
|
67
|
+
if not connection.is_complete:
|
|
68
|
+
return connection
|
|
69
|
+
|
|
70
|
+
dst_ind, src_ind = connection.ports
|
|
71
|
+
src_ind, dst_ind = src_ind.index, dst_ind.index
|
|
72
|
+
node_src = self.qtnode_to_name[connection.output_node]
|
|
73
|
+
node_dst = self.qtnode_to_name[connection.input_node]
|
|
74
|
+
edge_name = (node_src, node_dst, f"{src_ind}->{dst_ind}")
|
|
75
|
+
|
|
76
|
+
for item in self.items():
|
|
77
|
+
if isinstance(item, qtpynodeeditor.connection_graphics_object.ConnectionGraphicsObject):
|
|
78
|
+
if item.connection is connection:
|
|
79
|
+
item.setToolTip(edge_properties(self, edge_name))
|
|
80
|
+
break
|
|
81
|
+
else:
|
|
82
|
+
raise RuntimeError(f"connection {connection} not found in the scene")
|
|
83
|
+
|
|
84
|
+
return connection
|
|
85
|
+
|
|
86
|
+
def remove_node(self, node: qtpynodeeditor.node.Node):
|
|
87
|
+
"""Keep updated the node traduction table."""
|
|
88
|
+
del self.qtnode_to_name[node]
|
|
89
|
+
super().remove_node(node)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class FlowView(CutcutcodecWidget, qtpynodeeditor.FlowView):
|
|
93
|
+
"""Change the default menu, manage drag and drop an element deletion."""
|
|
94
|
+
|
|
95
|
+
def __init__(self, scene, parent=None):
|
|
96
|
+
super().__init__(scene, parent=parent)
|
|
97
|
+
self._parent = parent
|
|
98
|
+
self.setAcceptDrops(True)
|
|
99
|
+
|
|
100
|
+
def generate_context_menu(self, pos: QtCore.QPoint):
|
|
101
|
+
"""Skip the menu creation."""
|
|
102
|
+
menu = QtWidgets.QMenu()
|
|
103
|
+
return menu
|
|
104
|
+
|
|
105
|
+
def delete_selected(self):
|
|
106
|
+
"""Delete the selected elements."""
|
|
107
|
+
elements = []
|
|
108
|
+
for item in self._scene.selectedItems():
|
|
109
|
+
if isinstance(item, ConnectionGraphicsObject):
|
|
110
|
+
dst, src = item.connection.ports
|
|
111
|
+
edge_name = (
|
|
112
|
+
self.scene.qtnode_to_name[item.connection.output_node],
|
|
113
|
+
self.scene.qtnode_to_name[item.connection.input_node],
|
|
114
|
+
f"{src.index}->{dst.index}",
|
|
115
|
+
)
|
|
116
|
+
elements.append(edge_name)
|
|
117
|
+
if isinstance(item, NodeGraphicsObject):
|
|
118
|
+
elements.append(self.scene.qtnode_to_name[item.node])
|
|
119
|
+
|
|
120
|
+
backup_graph = self.app.graph.copy()
|
|
121
|
+
trans = remove_elements(self.app.graph, elements)
|
|
122
|
+
try:
|
|
123
|
+
self.app.tree()
|
|
124
|
+
except AssertionError as err:
|
|
125
|
+
self.app.graph = backup_graph
|
|
126
|
+
QtWidgets.QMessageBox.warning(
|
|
127
|
+
None, "Deletion not permitted", f"Unable to delete {elements} : {err}"
|
|
128
|
+
)
|
|
129
|
+
else:
|
|
130
|
+
for element, action in trans.items():
|
|
131
|
+
if action is None:
|
|
132
|
+
print(f"delete {element}")
|
|
133
|
+
else:
|
|
134
|
+
print(f"rename {element} to {action}")
|
|
135
|
+
self.main_window.refresh()
|
|
136
|
+
|
|
137
|
+
def dragEnterEvent(self, event):
|
|
138
|
+
"""Drag and drop selection."""
|
|
139
|
+
if not event.mimeData().hasFormat("application/x-qabstractitemmodeldatalist"):
|
|
140
|
+
# case drag from file manager
|
|
141
|
+
if not event.mimeData().hasFormat("text/plain"):
|
|
142
|
+
event.ignore()
|
|
143
|
+
return
|
|
144
|
+
if not event.mimeData().hasUrls():
|
|
145
|
+
logging.error("drag-and-drop failed (no text)")
|
|
146
|
+
event.ignore()
|
|
147
|
+
return
|
|
148
|
+
for url in event.mimeData().urls():
|
|
149
|
+
url_str = url.toString()
|
|
150
|
+
if not url_str.startswith("file:"):
|
|
151
|
+
logging.error("drag-and-drop failed (not file %s)", url_str)
|
|
152
|
+
continue
|
|
153
|
+
path = pathlib.Path(url_str[5:])
|
|
154
|
+
if not path.is_file():
|
|
155
|
+
logging.error("drag-and-drop failed (not file exists %s)", path)
|
|
156
|
+
continue
|
|
157
|
+
if not get_streams_type(path, ignore_errors=True):
|
|
158
|
+
logging.error("drag-and-drop failed (not multimedia stream %s)", path)
|
|
159
|
+
continue
|
|
160
|
+
if self.app.global_vars.get("drag_an_drop", None) is not None:
|
|
161
|
+
logging.error("drag-and-drop ignore %s (only one file accepted)", path)
|
|
162
|
+
continue
|
|
163
|
+
self.app.global_vars["drag_an_drop"] = (
|
|
164
|
+
new_node(self.app.graph, ContainerInputFFMPEG.default())
|
|
165
|
+
)
|
|
166
|
+
self.app.global_vars["drag_an_drop"][1]["state"]["filename"] = str(path)
|
|
167
|
+
if self.app.global_vars.get("drag_an_drop", None) is None:
|
|
168
|
+
event.ignore()
|
|
169
|
+
return
|
|
170
|
+
event.accept()
|
|
171
|
+
|
|
172
|
+
def dropEvent(self, _):
|
|
173
|
+
"""Drag and drop management."""
|
|
174
|
+
# creation of the new node in the main graph
|
|
175
|
+
node_name, attrs = self.app.global_vars["drag_an_drop"]
|
|
176
|
+
self.app.global_vars["drag_an_drop"] = None
|
|
177
|
+
add_node(self.app.graph, node_name, attrs)
|
|
178
|
+
print(f"create {node_name}")
|
|
179
|
+
|
|
180
|
+
# very light graphical update, beter than self.parent.refresh()
|
|
181
|
+
node_cls_widget = meta_node_creator(self.app.tree_node(node_name))
|
|
182
|
+
self.scene.create_complete_node(node_cls_widget, node_name)
|
|
183
|
+
|
|
184
|
+
def dragMoveEvent(self, event):
|
|
185
|
+
"""Need to be defined for calling ``dropEvent``."""
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class FlowChart(CutcutcodecWidget, QtWidgets.QWidget):
|
|
189
|
+
"""Nodes graph viewer."""
|
|
190
|
+
|
|
191
|
+
def __init__(self, parent):
|
|
192
|
+
super().__init__(parent)
|
|
193
|
+
self._parent = parent
|
|
194
|
+
|
|
195
|
+
registry = qtpynodeeditor.DataModelRegistry()
|
|
196
|
+
audio_converter = TypeConverter(
|
|
197
|
+
NodeDataType("audio", None), NodeDataType("stream", "free"), lambda d: d
|
|
198
|
+
)
|
|
199
|
+
registry.register_type_converter(
|
|
200
|
+
NodeDataType("audio", None), NodeDataType("stream", "free"), audio_converter
|
|
201
|
+
)
|
|
202
|
+
video_converter = TypeConverter(
|
|
203
|
+
NodeDataType("video", None), NodeDataType("stream", "free"), lambda d: d
|
|
204
|
+
)
|
|
205
|
+
registry.register_type_converter(
|
|
206
|
+
NodeDataType("video", None), NodeDataType("stream", "free"), video_converter
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
self.scene = FlowScene(parent=self, registry=registry)
|
|
210
|
+
self.scene.style_collection.connection.use_data_defined_colors = True
|
|
211
|
+
self.scene.connection_created.connect(self.connection_created)
|
|
212
|
+
self.scene.node_double_clicked.connect(self.node_double_clicked)
|
|
213
|
+
self.scene.node_moved.connect(self.node_moved)
|
|
214
|
+
self.view = FlowView(self.scene, parent=self)
|
|
215
|
+
|
|
216
|
+
self.edge_prop_win = {} # the popup edge properties window
|
|
217
|
+
|
|
218
|
+
layout = QtWidgets.QVBoxLayout()
|
|
219
|
+
layout.addWidget(self.view)
|
|
220
|
+
self.setLayout(layout)
|
|
221
|
+
|
|
222
|
+
def connection_created(self, connection: qtpynodeeditor.connection.Connection):
|
|
223
|
+
"""Help when called when a connection has just been created."""
|
|
224
|
+
dst_ind, src_ind = connection.ports
|
|
225
|
+
src_ind, dst_ind = src_ind.index, dst_ind.index
|
|
226
|
+
node_src = self.scene.qtnode_to_name[connection.output_node]
|
|
227
|
+
node_dst = self.scene.qtnode_to_name[connection.input_node]
|
|
228
|
+
edge_name = (node_src, node_dst, f"{src_ind}->{dst_ind}")
|
|
229
|
+
if edge_name not in self.app.graph.edges:
|
|
230
|
+
backup_graph = self.app.graph.copy()
|
|
231
|
+
add_edge(self.app.graph, node_src, node_dst, src_ind)
|
|
232
|
+
try:
|
|
233
|
+
self.app.tree()
|
|
234
|
+
except AssertionError as err:
|
|
235
|
+
self.app.graph = backup_graph
|
|
236
|
+
self.scene.delete_connection(connection)
|
|
237
|
+
QtWidgets.QMessageBox.warning(
|
|
238
|
+
None, "Creation not permitted", f"Unable to create {edge_name} : {err}"
|
|
239
|
+
)
|
|
240
|
+
else:
|
|
241
|
+
print(f"create {edge_name}")
|
|
242
|
+
self.main_window.refresh()
|
|
243
|
+
|
|
244
|
+
def node_double_clicked(self, qtnode: qtpynodeeditor.node.Node):
|
|
245
|
+
"""Open the node edition window."""
|
|
246
|
+
name = self.scene.qtnode_to_name[qtnode]
|
|
247
|
+
graph_win = EditNodeWindow(self, name)
|
|
248
|
+
graph_win.exec()
|
|
249
|
+
|
|
250
|
+
def node_moved(self, node: qtpynodeeditor.node.Node):
|
|
251
|
+
"""Record the new position of the node."""
|
|
252
|
+
position = [node.position.x(), node.position.y()]
|
|
253
|
+
prop = self.app.graph.nodes[self.scene.qtnode_to_name[node]]
|
|
254
|
+
prop["display"] = prop.get("display", {})
|
|
255
|
+
prop["display"]["position"] = position
|
|
256
|
+
|
|
257
|
+
def refresh(self):
|
|
258
|
+
"""Update the elements of this widget and child widgets."""
|
|
259
|
+
# remove all the widgets on the scene
|
|
260
|
+
self.scene.clear_scene()
|
|
261
|
+
|
|
262
|
+
# the nodes
|
|
263
|
+
for node_name in self.app.graph.nodes:
|
|
264
|
+
node_cls_widget = meta_node_creator(self.app.tree_node(node_name))
|
|
265
|
+
node = self.scene.create_complete_node(node_cls_widget, node_name)
|
|
266
|
+
prop = self.app.graph.nodes(data=True)[self.scene.qtnode_to_name[node]]
|
|
267
|
+
try:
|
|
268
|
+
node.position = prop["display"]["position"]
|
|
269
|
+
except KeyError:
|
|
270
|
+
pass
|
|
271
|
+
|
|
272
|
+
# the edges
|
|
273
|
+
name_to_qtnode = {n: q for q, n in self.scene.qtnode_to_name.items()}
|
|
274
|
+
for src, dst, key in self.app.graph.edges:
|
|
275
|
+
src_ind, dst_ind = key.split("->")
|
|
276
|
+
src_ind, dst_ind = int(src_ind), int(dst_ind)
|
|
277
|
+
self.scene.create_connection(
|
|
278
|
+
name_to_qtnode[src][PortType.output][src_ind],
|
|
279
|
+
name_to_qtnode[dst][PortType.input][dst_ind],
|
|
280
|
+
)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Description of a node for the flow chart."""
|
|
4
|
+
|
|
5
|
+
from qtpynodeeditor.enums import PortType
|
|
6
|
+
from qtpynodeeditor.node_data import NodeDataModel, NodeDataType
|
|
7
|
+
|
|
8
|
+
from cutcutcodec.core.classes.container import ContainerInput
|
|
9
|
+
from cutcutcodec.core.classes.node import Node
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class AssemblyGraphNode(NodeDataModel, verify=False):
|
|
13
|
+
"""General assembly graph node widget."""
|
|
14
|
+
|
|
15
|
+
caption_visible = True
|
|
16
|
+
port_caption_visible = False
|
|
17
|
+
data_type = None # solve w0223 'data_type' is abstract
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def caption(self) -> str:
|
|
21
|
+
"""Allow to display the correct name."""
|
|
22
|
+
return self.name
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def meta_node_creator(node: Node) -> type:
|
|
26
|
+
"""Complete the class attributes of a node present in the graph."""
|
|
27
|
+
data_type = {
|
|
28
|
+
PortType.input: {i: NodeDataType(s.type, None) for i, s in enumerate(node.in_streams)},
|
|
29
|
+
PortType.output: {i: NodeDataType(s.type, None) for i, s in enumerate(node.out_streams)},
|
|
30
|
+
}
|
|
31
|
+
if not isinstance(node, ContainerInput):
|
|
32
|
+
data_type[PortType.input][len(node.in_streams)] = NodeDataType("stream", "free")
|
|
33
|
+
return type(
|
|
34
|
+
f"{node.__class__.__name__}Widget",
|
|
35
|
+
(AssemblyGraphNode,),
|
|
36
|
+
{
|
|
37
|
+
"name": node.__class__.__name__,
|
|
38
|
+
"num_ports": {
|
|
39
|
+
PortType.input: len(data_type[PortType.input]),
|
|
40
|
+
PortType.output: len(data_type[PortType.output]),
|
|
41
|
+
},
|
|
42
|
+
"data_type": data_type,
|
|
43
|
+
},
|
|
44
|
+
)
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Entry point of the graphic interface."""
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import logging
|
|
7
|
+
import multiprocessing
|
|
8
|
+
import pathlib
|
|
9
|
+
import typing
|
|
10
|
+
|
|
11
|
+
from qtpy import QtCore, QtWidgets
|
|
12
|
+
|
|
13
|
+
from cutcutcodec.core.analysis.ffprobe import get_streams_type
|
|
14
|
+
from cutcutcodec.core.compilation.tree_to_graph import new_node
|
|
15
|
+
from cutcutcodec.core.edit.operation.add import add_node
|
|
16
|
+
from cutcutcodec.core.io.read_ffmpeg import ContainerInputFFMPEG
|
|
17
|
+
from cutcutcodec.gui.actions import create_actions
|
|
18
|
+
from cutcutcodec.gui.app.app import App
|
|
19
|
+
from cutcutcodec.gui.base import CutcutcodecWidget
|
|
20
|
+
from cutcutcodec.gui.edition_tabs import EditionTabs
|
|
21
|
+
from cutcutcodec.gui.entry_tabs import EntryTabs
|
|
22
|
+
from cutcutcodec.gui.export.main import WindowsExportSettings
|
|
23
|
+
from cutcutcodec.gui.menu import fill_menu
|
|
24
|
+
from cutcutcodec.gui.preferences.main import PreferencesTabs
|
|
25
|
+
from cutcutcodec.gui.toolbar import MainToolBar
|
|
26
|
+
from cutcutcodec.gui.tools import WaitCursor
|
|
27
|
+
from cutcutcodec.gui.video_preview.main import VideoPreview
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class MainWindow(CutcutcodecWidget, QtWidgets.QMainWindow):
|
|
31
|
+
"""Return the main window for video editing interface."""
|
|
32
|
+
|
|
33
|
+
def __init__(self, output: multiprocessing.Queue):
|
|
34
|
+
super().__init__()
|
|
35
|
+
self._parent = None
|
|
36
|
+
|
|
37
|
+
self.output = output
|
|
38
|
+
self._app = App()
|
|
39
|
+
|
|
40
|
+
self.actions = create_actions(self)
|
|
41
|
+
|
|
42
|
+
# declaration
|
|
43
|
+
self.setWindowTitle("cutcutcodec")
|
|
44
|
+
self.sub_windows = {
|
|
45
|
+
"toolbar": MainToolBar(self, self.actions),
|
|
46
|
+
"entry_tabs": EntryTabs(self),
|
|
47
|
+
"video_preview": VideoPreview(self),
|
|
48
|
+
"edition_tabs": EditionTabs(self),
|
|
49
|
+
}
|
|
50
|
+
fill_menu(self.menuBar(), self.actions)
|
|
51
|
+
|
|
52
|
+
# location
|
|
53
|
+
self.addToolBar(self.sub_windows["toolbar"])
|
|
54
|
+
h_splitter = QtWidgets.QSplitter(QtCore.Qt.Orientation.Horizontal, self)
|
|
55
|
+
h_splitter.addWidget(self.sub_windows["entry_tabs"])
|
|
56
|
+
h_splitter.addWidget(self.sub_windows["video_preview"])
|
|
57
|
+
v_splitter = QtWidgets.QSplitter(QtCore.Qt.Orientation.Vertical, self)
|
|
58
|
+
v_splitter.addWidget(h_splitter)
|
|
59
|
+
v_splitter.addWidget(self.sub_windows["edition_tabs"])
|
|
60
|
+
self.setCentralWidget(v_splitter)
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def app(self):
|
|
64
|
+
"""Allow to rewrite this method of the parent class."""
|
|
65
|
+
return self._app
|
|
66
|
+
|
|
67
|
+
def closeEvent(self, event):
|
|
68
|
+
"""Take precautions before properly releasing resources."""
|
|
69
|
+
box = QtWidgets.QMessageBox(self)
|
|
70
|
+
box.setWindowTitle("Unregistered changes")
|
|
71
|
+
box.setText("Do you want to save before closing?")
|
|
72
|
+
box.setStandardButtons(
|
|
73
|
+
QtWidgets.QMessageBox.StandardButton.Save | QtWidgets.QMessageBox.StandardButton.Discard
|
|
74
|
+
)
|
|
75
|
+
box.setIcon(QtWidgets.QMessageBox.Icon.Question)
|
|
76
|
+
button = box.exec()
|
|
77
|
+
if button == QtWidgets.QMessageBox.StandardButton.Save:
|
|
78
|
+
self.save()
|
|
79
|
+
event.accept()
|
|
80
|
+
|
|
81
|
+
def crash(self, msg):
|
|
82
|
+
"""Display a critical error message."""
|
|
83
|
+
QtWidgets.QMessageBox.critical(None, "Application crashed", msg)
|
|
84
|
+
|
|
85
|
+
def export(self):
|
|
86
|
+
"""Brings up the export window."""
|
|
87
|
+
self.sub_windows["export"] = WindowsExportSettings(self)
|
|
88
|
+
self.sub_windows["export"].exec()
|
|
89
|
+
del self.sub_windows["export"]
|
|
90
|
+
|
|
91
|
+
def import_files(self):
|
|
92
|
+
"""Append files to the project."""
|
|
93
|
+
new_files, _ = QtWidgets.QFileDialog.getOpenFileNames(self, "Import Multimedia Files")
|
|
94
|
+
for file in new_files:
|
|
95
|
+
if not get_streams_type(file, ignore_errors=True):
|
|
96
|
+
logging.error("failed to import %s (not multimedia stream found)", file)
|
|
97
|
+
continue
|
|
98
|
+
node_name, attrs = new_node(self.app.graph, ContainerInputFFMPEG.default())
|
|
99
|
+
attrs["state"]["filename"] = file
|
|
100
|
+
add_node(self.app.graph, node_name, attrs)
|
|
101
|
+
print(f"create {node_name}")
|
|
102
|
+
self.refresh()
|
|
103
|
+
|
|
104
|
+
def open(self, file: typing.Union[None, str, pathlib.Path] = None):
|
|
105
|
+
"""Load a new project file.
|
|
106
|
+
|
|
107
|
+
Parameters
|
|
108
|
+
----------
|
|
109
|
+
file : pathlike, optional
|
|
110
|
+
The name or path of the file. If not provide, a dialog file explorator windows pop.
|
|
111
|
+
"""
|
|
112
|
+
if file is None:
|
|
113
|
+
file, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Open", filter="*.json")
|
|
114
|
+
if not file:
|
|
115
|
+
return
|
|
116
|
+
assert isinstance(file, (str, pathlib.Path)), file.__class__.__name__
|
|
117
|
+
with open(file, "r", encoding="utf8") as raw:
|
|
118
|
+
state = json.load(raw)
|
|
119
|
+
self.app.__setstate__(state)
|
|
120
|
+
self.app.set_save_file(file)
|
|
121
|
+
self.refresh()
|
|
122
|
+
|
|
123
|
+
def preferences(self):
|
|
124
|
+
"""Display the preferences window."""
|
|
125
|
+
self.sub_windows["preferences"] = PreferencesTabs(self)
|
|
126
|
+
self.sub_windows["preferences"].exec()
|
|
127
|
+
del self.sub_windows["preferences"]
|
|
128
|
+
|
|
129
|
+
def refresh(self):
|
|
130
|
+
"""Update the elements of this widget and child widgets."""
|
|
131
|
+
with WaitCursor(self):
|
|
132
|
+
for sub_window in self.sub_windows.values():
|
|
133
|
+
sub_window.refresh()
|
|
134
|
+
|
|
135
|
+
def save(self):
|
|
136
|
+
"""Save all the state in a file, nn ."""
|
|
137
|
+
if self.app.get_save_file() is None:
|
|
138
|
+
self.save_as()
|
|
139
|
+
return
|
|
140
|
+
with open(self.app.get_save_file(), "w", encoding="utf8") as file:
|
|
141
|
+
json.dump(self.app.__getstate__(), file, check_circular=False, indent=4, sort_keys=True)
|
|
142
|
+
|
|
143
|
+
def save_as(self):
|
|
144
|
+
"""Set a new recording file and invoque save."""
|
|
145
|
+
file, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Save Project", filter="*.json")
|
|
146
|
+
if not file:
|
|
147
|
+
return
|
|
148
|
+
file = pathlib.Path(file)
|
|
149
|
+
file = file.with_suffix(".json")
|
|
150
|
+
self.app.set_save_file(file)
|
|
151
|
+
self.save()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Used to configure the main menu."""
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def fill_menu(menu, actions):
|
|
7
|
+
"""Add fields to the empty menu."""
|
|
8
|
+
file_menu = menu.addMenu("File")
|
|
9
|
+
file_menu.addAction(actions["open"])
|
|
10
|
+
file_menu.addAction(actions["save"])
|
|
11
|
+
file_menu.addAction(actions["save_as"])
|
|
12
|
+
file_menu.addSeparator()
|
|
13
|
+
file_menu.addAction(actions["import"])
|
|
14
|
+
file_menu.addAction(actions["export"])
|
|
15
|
+
|
|
16
|
+
edit_menu = menu.addMenu("Edit")
|
|
17
|
+
edit_menu.addAction(actions["refresh"])
|
|
18
|
+
edit_menu.addAction(actions["undo"])
|
|
19
|
+
edit_menu.addAction(actions["redo"])
|
|
20
|
+
edit_menu.addSeparator()
|
|
21
|
+
edit_menu.addAction(actions["preferences"])
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
"""Allow to select the parameters of an audio stream."""
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
import re
|
|
7
|
+
import typing
|
|
8
|
+
|
|
9
|
+
from qtpy import QtWidgets
|
|
10
|
+
|
|
11
|
+
from cutcutcodec.core.compilation.export.compatibility import Compatibilities
|
|
12
|
+
from cutcutcodec.core.compilation.export.rate import available_audio_rates, suggest_audio_rate
|
|
13
|
+
from cutcutcodec.gui.base import CutcutcodecWidget
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
CLASSICAL_RATES = {
|
|
17
|
+
8000: "telephone",
|
|
18
|
+
11025: "lower-quality PCM",
|
|
19
|
+
22050: "speech low quality",
|
|
20
|
+
32000: "speech hight quality",
|
|
21
|
+
37800: "cd-rom-xa",
|
|
22
|
+
44056: "ntsc",
|
|
23
|
+
44100: "standard cd-audio, human perception threshold",
|
|
24
|
+
47250: "pcm",
|
|
25
|
+
48000: "standard video",
|
|
26
|
+
50000: "sound-stream",
|
|
27
|
+
50400: "Mitsubishi X-80",
|
|
28
|
+
88200: "pro audio gear uses 2*44100",
|
|
29
|
+
96000: "dvd-audio, bd-rom 2*48000",
|
|
30
|
+
176400: "pro audio gear uses 4*44100",
|
|
31
|
+
192000: "pro audio gear uses 4*48000",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class PreferencesAudio(CutcutcodecWidget, QtWidgets.QWidget):
|
|
36
|
+
"""Allow to select the sampling frequency and the number of channels of an audio stream."""
|
|
37
|
+
|
|
38
|
+
def __init__(self, parent, index_abs):
|
|
39
|
+
super().__init__(parent)
|
|
40
|
+
self._parent = parent
|
|
41
|
+
|
|
42
|
+
self.rate_textbox = None
|
|
43
|
+
self.rate_combobox = None
|
|
44
|
+
|
|
45
|
+
tree = self.app.tree()
|
|
46
|
+
self.stream = tree.in_streams[index_abs]
|
|
47
|
+
self.index_rel = None
|
|
48
|
+
for i, stream in enumerate(tree.in_select("audio")):
|
|
49
|
+
if stream is self.stream:
|
|
50
|
+
self.index_rel = i
|
|
51
|
+
assert self.index_rel is not None, "the output container has been modified in background"
|
|
52
|
+
|
|
53
|
+
grid_layout = QtWidgets.QGridLayout()
|
|
54
|
+
self.init_rate(grid_layout)
|
|
55
|
+
self.setLayout(grid_layout)
|
|
56
|
+
self.refresh()
|
|
57
|
+
|
|
58
|
+
def _select_rate(self, text: str):
|
|
59
|
+
"""From combo box."""
|
|
60
|
+
# decode the rate int or None
|
|
61
|
+
if "automatic" in text:
|
|
62
|
+
rate = None
|
|
63
|
+
elif text == "manual":
|
|
64
|
+
rate = self.best_rate
|
|
65
|
+
else:
|
|
66
|
+
rate = int(re.search(r"\d+", text).group())
|
|
67
|
+
|
|
68
|
+
# update only if it changed
|
|
69
|
+
if rate != self.app.export_settings["rates"]["audio"][self.index_rel]:
|
|
70
|
+
self.app.export_settings["rates"]["audio"][self.index_rel] = rate
|
|
71
|
+
print(f"update rate (stream audio {self.index_rel}) to {rate}")
|
|
72
|
+
self.main_window.refresh()
|
|
73
|
+
|
|
74
|
+
def _validate_rate(self):
|
|
75
|
+
"""Check that the sample rate is a correct integer."""
|
|
76
|
+
text = self.rate_textbox.text()
|
|
77
|
+
# parsing verification
|
|
78
|
+
if re.fullmatch(r"\d*[1-9]\d*", text): # ensure != 0
|
|
79
|
+
rate = int(text)
|
|
80
|
+
elif re.fullmatch(r"\s*", text):
|
|
81
|
+
rate = None
|
|
82
|
+
else:
|
|
83
|
+
self.rate_textbox.setStyleSheet("background:red;")
|
|
84
|
+
return
|
|
85
|
+
|
|
86
|
+
# update and continue checking only if it changed
|
|
87
|
+
if rate != self.app.export_settings["rates"]["audio"][self.index_rel]:
|
|
88
|
+
# compatibility with codec verification
|
|
89
|
+
if rate is not None and (choices := self.available_rates) is not None:
|
|
90
|
+
if rate not in choices:
|
|
91
|
+
self.rate_textbox.setStyleSheet("background:red;")
|
|
92
|
+
msg = (
|
|
93
|
+
f"the only available sample rates are {sorted(choices)}, "
|
|
94
|
+
f"but {rate} is specified"
|
|
95
|
+
)
|
|
96
|
+
logging.warning(msg)
|
|
97
|
+
return
|
|
98
|
+
|
|
99
|
+
# validation, apply changed
|
|
100
|
+
self.app.export_settings["rates"]["audio"][self.index_rel] = rate
|
|
101
|
+
print(f"update rate (stream audio {self.index_rel}): {rate}")
|
|
102
|
+
self.rate_textbox.setStyleSheet("background:none;")
|
|
103
|
+
|
|
104
|
+
# refresh all
|
|
105
|
+
if rate in CLASSICAL_RATES:
|
|
106
|
+
self.rate_combobox.setCurrentText(f"{rate} ({CLASSICAL_RATES[rate]})")
|
|
107
|
+
else:
|
|
108
|
+
self.rate_combobox.setCurrentText("manual")
|
|
109
|
+
self.main_window.refresh()
|
|
110
|
+
|
|
111
|
+
@property
|
|
112
|
+
def available_rates(self) -> typing.Union[None, set[int]]:
|
|
113
|
+
"""Return the set of the available sample rates for the given encoder/muxer.
|
|
114
|
+
|
|
115
|
+
The value None means there is no constraints.
|
|
116
|
+
"""
|
|
117
|
+
if self.app.export_settings["encoders"]["audio"][self.index_rel] is not None:
|
|
118
|
+
encoders = {self.app.export_settings["encoders"]["audio"][self.index_rel]}
|
|
119
|
+
elif self.app.export_settings["codecs"]["audio"][self.index_rel] is not None:
|
|
120
|
+
muxer = self.app.export_settings["muxer"]
|
|
121
|
+
muxers = [muxer] if muxer is not None else None
|
|
122
|
+
encoders = set(Compatibilities().encoders_audio(
|
|
123
|
+
self.app.export_settings["codecs"]["audio"][self.index_rel], muxers,
|
|
124
|
+
layout=self.stream.layout.name, # we should to forward 'profile' as well
|
|
125
|
+
rate=self.app.export_settings["rates"]["audio"][self.index_rel],
|
|
126
|
+
))
|
|
127
|
+
else:
|
|
128
|
+
return None
|
|
129
|
+
return available_audio_rates(encoders)
|
|
130
|
+
|
|
131
|
+
@property
|
|
132
|
+
def best_rate(self) -> int:
|
|
133
|
+
"""Return the most appropriated rate for the current configuration.
|
|
134
|
+
|
|
135
|
+
If the rate is specified by the user, it returns the given rate.
|
|
136
|
+
Otherwise it ask to ``cutcutcodec.core.compilation.export.rate.suggest_audio_rate``
|
|
137
|
+
for the best estimation.
|
|
138
|
+
"""
|
|
139
|
+
if (rate := self.app.export_settings["rates"]["audio"][self.index_rel]) is not None:
|
|
140
|
+
return rate
|
|
141
|
+
return suggest_audio_rate(self.stream, self.available_rates)
|
|
142
|
+
|
|
143
|
+
def init_rate(self, grid_layout, ref_span=0):
|
|
144
|
+
"""Display and allows to modify the framerate."""
|
|
145
|
+
grid_layout.addWidget(QtWidgets.QLabel("Sample Rate (Hz):"), ref_span, 0)
|
|
146
|
+
self.rate_textbox = QtWidgets.QLineEdit()
|
|
147
|
+
self.rate_textbox.editingFinished.connect(self._validate_rate)
|
|
148
|
+
grid_layout.addWidget(self.rate_textbox, ref_span, 1)
|
|
149
|
+
grid_layout.addWidget(QtWidgets.QLabel("Selection:"), ref_span+1, 0)
|
|
150
|
+
self.rate_combobox = QtWidgets.QComboBox()
|
|
151
|
+
self.rate_combobox.textActivated.connect(self._select_rate)
|
|
152
|
+
grid_layout.addWidget(self.rate_combobox, ref_span+1, 1)
|
|
153
|
+
return ref_span + 2
|
|
154
|
+
|
|
155
|
+
def refresh(self):
|
|
156
|
+
"""Update the elements of this widget and child widgets."""
|
|
157
|
+
# update combobox items
|
|
158
|
+
self.rate_combobox.clear()
|
|
159
|
+
self.rate_combobox.addItem("automatic (optimal Nyquist–Shannon)")
|
|
160
|
+
self.rate_combobox.addItem("manual")
|
|
161
|
+
choices = set()
|
|
162
|
+
for rate in sorted(self.available_rates or CLASSICAL_RATES):
|
|
163
|
+
if rate in CLASSICAL_RATES:
|
|
164
|
+
choices.add(rate)
|
|
165
|
+
self.rate_combobox.addItem(f"{rate} ({CLASSICAL_RATES[rate]})")
|
|
166
|
+
|
|
167
|
+
# select the write combobox item
|
|
168
|
+
if (rate := self.app.export_settings["rates"]["audio"][self.index_rel]) is None:
|
|
169
|
+
self.rate_combobox.setCurrentText("automatic (optimal Nyquist–Shannon)")
|
|
170
|
+
elif rate in choices:
|
|
171
|
+
self.rate_combobox.setCurrentText(f"{rate} ({CLASSICAL_RATES[rate]})")
|
|
172
|
+
else:
|
|
173
|
+
self.rate_combobox.setCurrentText("manual")
|
|
174
|
+
|
|
175
|
+
# update textbox item
|
|
176
|
+
self.rate_textbox.setPlaceholderText(
|
|
177
|
+
str(suggest_audio_rate(self.stream, self.available_rates))
|
|
178
|
+
)
|
|
179
|
+
if (rate := self.app.export_settings["rates"]["audio"][self.index_rel]) is not None:
|
|
180
|
+
self.rate_textbox.setText(str(rate))
|
|
181
|
+
else:
|
|
182
|
+
self.rate_textbox.setText("")
|
|
183
|
+
self.rate_textbox.setStyleSheet("background:none;")
|