codemirror-lang-liquidsoap 0.2.9 → 0.3.0
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.
- package/dist/cli.js +2 -2
- package/dist/index.js +2 -2
- package/package.json +4 -3
- package/src/cli.ts +0 -0
- package/src/liquidsoap.grammar +1 -1
- package/src/parser.js +1 -1
- package/tests/liquidsoap/.github/alpine/APKBUILD-minimal.in +1 -1
- package/tests/liquidsoap/.github/alpine/APKBUILD.in +1 -1
- package/tests/liquidsoap/.github/alpine/liquidsoap.pre-install +0 -0
- package/tests/liquidsoap/.github/debian/rules +1 -1
- package/tests/liquidsoap/.github/debian/rules-minimal +1 -1
- package/tests/liquidsoap/.github/opam/liquidsoap-core-windows.opam +4 -3
- package/tests/liquidsoap/.github/opam/packages/ffmpeg-av-windows/ffmpeg-av-windows.1.2.0/opam +38 -0
- package/tests/liquidsoap/.github/opam/packages/ffmpeg-avcodec-windows/ffmpeg-avcodec-windows.1.2.0/opam +37 -0
- package/tests/liquidsoap/.github/opam/packages/ffmpeg-avdevice-windows/ffmpeg-avdevice-windows.1.2.0/opam +37 -0
- package/tests/liquidsoap/.github/opam/packages/ffmpeg-avfilter-windows/ffmpeg-avfilter-windows.1.2.0/opam +37 -0
- package/tests/liquidsoap/.github/opam/packages/ffmpeg-avutil-windows/ffmpeg-avutil-windows.1.2.0/opam +37 -0
- package/tests/liquidsoap/.github/opam/packages/ffmpeg-swresample-windows/ffmpeg-swresample-windows.1.2.0/opam +38 -0
- package/tests/liquidsoap/.github/opam/packages/ffmpeg-swscale-windows/ffmpeg-swscale-windows.1.2.0/opam +37 -0
- package/tests/liquidsoap/.github/opam/packages/ffmpeg-windows/ffmpeg-windows.1.2.0/opam +35 -0
- package/tests/liquidsoap/.github/scripts/add-local-opam-packages.sh +0 -0
- package/tests/liquidsoap/.github/scripts/build-apk.sh +0 -0
- package/tests/liquidsoap/.github/scripts/build-deb.sh +0 -0
- package/tests/liquidsoap/.github/scripts/build-details.sh +1 -1
- package/tests/liquidsoap/.github/scripts/build-doc.sh +0 -0
- package/tests/liquidsoap/.github/scripts/build-docker-alpine.sh +0 -0
- package/tests/liquidsoap/.github/scripts/build-docker.sh +0 -0
- package/tests/liquidsoap/.github/scripts/build-posix.sh +16 -13
- package/tests/liquidsoap/.github/scripts/build-website.sh +0 -0
- package/tests/liquidsoap/.github/scripts/build-win32.sh +0 -0
- package/tests/liquidsoap/.github/scripts/checkout-deps.sh +0 -0
- package/tests/liquidsoap/.github/scripts/export-metrics.sh +0 -0
- package/tests/liquidsoap/.github/scripts/push-docker.sh +0 -0
- package/tests/liquidsoap/.github/scripts/stats-posix.sh +0 -0
- package/tests/liquidsoap/.github/scripts/test-posix.sh +0 -0
- package/tests/liquidsoap/.github/workflows/ci.yml +10 -1
- package/tests/liquidsoap/.pre-commit-config.yaml +1 -1
- package/tests/liquidsoap/CHANGES.md +101 -1
- package/tests/liquidsoap/README.md +1 -1
- package/tests/liquidsoap/ROADMAP.md +28 -26
- package/tests/liquidsoap/doc/content/cookbook.md +46 -3
- package/tests/liquidsoap/doc/content/database.md +126 -0
- package/tests/liquidsoap/doc/content/documentation.md +1 -0
- package/tests/liquidsoap/doc/content/encoding_formats.md +6 -7
- package/tests/liquidsoap/doc/content/ffmpeg_encoder.md +20 -0
- package/tests/liquidsoap/doc/content/hls_output.md +27 -2
- package/tests/liquidsoap/doc/content/index.md +1 -1
- package/tests/liquidsoap/doc/content/liq/basic-radio.liq +14 -6
- package/tests/liquidsoap/doc/content/liq/check +0 -0
- package/tests/liquidsoap/doc/content/liq/liquidsoap +0 -0
- package/tests/liquidsoap/doc/content/liq/medialib.sqlite.liq +4 -0
- package/tests/liquidsoap/doc/content/liq/on2-if2.liq +5 -2
- package/tests/liquidsoap/doc/content/liq/on2-initial.liq +10 -5
- package/tests/liquidsoap/doc/content/liq/on2-replaygain.liq +13 -4
- package/tests/liquidsoap/doc/content/liq/on2-volume.liq +4 -2
- package/tests/liquidsoap/doc/content/liq/playlists.liq +2 -1
- package/tests/liquidsoap/doc/content/liq/radiopi.liq +2 -6
- package/tests/liquidsoap/doc/content/liq/source-cue.liq +26 -0
- package/tests/liquidsoap/doc/content/liq/space_overhead.liq +0 -0
- package/tests/liquidsoap/doc/content/liq/split-cue.liq +7 -8
- package/tests/liquidsoap/doc/content/liq/sqlite.liq +120 -0
- package/tests/liquidsoap/doc/content/liq/video-in-video.liq +2 -0
- package/tests/liquidsoap/doc/content/migrating.md +12 -0
- package/tests/liquidsoap/doc/content/on2_part2.md +1 -1
- package/tests/liquidsoap/doc/content/playlist_parsers.md +2 -10
- package/tests/liquidsoap/doc/content/seek.md +1 -20
- package/tests/liquidsoap/doc/dune.inc +655 -0
- package/tests/liquidsoap/dune-project +8 -5
- package/tests/liquidsoap/liquidsoap +0 -0
- package/tests/liquidsoap/liquidsoap-core.opam +6 -4
- package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_bitstream_filters.ml +100 -128
- package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_decoder.ml +10 -11
- package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_encoder.ml +14 -15
- package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_filters.ml +33 -3
- package/tests/liquidsoap/src/core/builtins/builtins_files.ml +64 -12
- package/tests/liquidsoap/src/core/builtins/builtins_optionals.ml +0 -1
- package/tests/liquidsoap/src/core/builtins/builtins_prometheus.ml +4 -4
- package/tests/liquidsoap/src/core/builtins/builtins_request.ml +16 -1
- package/tests/liquidsoap/src/core/builtins/builtins_resolvers.ml +1 -1
- package/tests/liquidsoap/src/core/builtins/builtins_settings.ml +12 -2
- package/tests/liquidsoap/src/core/builtins/builtins_socket.ml +17 -4
- package/tests/liquidsoap/src/core/builtins/builtins_source.ml +17 -7
- package/tests/liquidsoap/src/core/builtins/builtins_sqlite.ml +362 -0
- package/tests/liquidsoap/src/core/builtins/builtins_ssl.ml +18 -9
- package/tests/liquidsoap/src/core/builtins/builtins_tls.ml +38 -27
- package/tests/liquidsoap/src/core/clock.ml +1 -1
- package/tests/liquidsoap/src/core/clock.mli +1 -1
- package/tests/liquidsoap/src/core/conversions/conversion.ml +4 -38
- package/tests/liquidsoap/src/core/conversions/mean.ml +12 -14
- package/tests/liquidsoap/src/core/conversions/stereo.ml +4 -4
- package/tests/liquidsoap/src/core/conversions/swap.ml +8 -23
- package/tests/liquidsoap/src/core/decoder/aac_decoder.ml +3 -3
- package/tests/liquidsoap/src/core/decoder/decoder.ml +134 -129
- package/tests/liquidsoap/src/core/decoder/decoder.mli +11 -4
- package/tests/liquidsoap/src/core/decoder/decoder_utils.ml +8 -9
- package/tests/liquidsoap/src/core/decoder/decoder_utils.mli +2 -2
- package/tests/liquidsoap/src/core/decoder/external_decoder.ml +7 -5
- package/tests/liquidsoap/src/core/decoder/ffmpeg_copy_decoder.ml +1 -1
- package/tests/liquidsoap/src/core/decoder/ffmpeg_decoder.ml +138 -60
- package/tests/liquidsoap/src/core/decoder/ffmpeg_decoder_common.ml +10 -0
- package/tests/liquidsoap/src/core/decoder/ffmpeg_internal_decoder.ml +1 -2
- package/tests/liquidsoap/src/core/decoder/ffmpeg_raw_decoder.ml +1 -1
- package/tests/liquidsoap/src/core/decoder/flac_metadata_plug.ml +3 -3
- package/tests/liquidsoap/src/core/decoder/gstreamer_decoder.ml +1 -2
- package/tests/liquidsoap/src/core/decoder/id3_plug.ml +3 -3
- package/tests/liquidsoap/src/core/decoder/image/sdlimage_decoder.ml +3 -3
- package/tests/liquidsoap/src/core/decoder/image_decoder.ml +25 -23
- package/tests/liquidsoap/src/core/decoder/image_plug.ml +3 -3
- package/tests/liquidsoap/src/core/decoder/liq_flac_decoder.ml +10 -11
- package/tests/liquidsoap/src/core/decoder/liq_ogg_decoder.ml +5 -5
- package/tests/liquidsoap/src/core/decoder/mad_decoder.ml +6 -7
- package/tests/liquidsoap/src/core/decoder/midi_decoder.ml +10 -10
- package/tests/liquidsoap/src/core/decoder/ogg_metadata_plug.ml +3 -3
- package/tests/liquidsoap/src/core/decoder/srt_decoder.ml +23 -15
- package/tests/liquidsoap/src/core/decoder/taglib_plug.ml +3 -3
- package/tests/liquidsoap/src/core/decoder/text/video_text_sdl.ml +12 -7
- package/tests/liquidsoap/src/core/decoder/video_plug.ml +3 -3
- package/tests/liquidsoap/src/core/dune +19 -22
- package/tests/liquidsoap/src/core/encoder/encoder.ml +1 -1
- package/tests/liquidsoap/src/core/encoder/encoder.mli +1 -1
- package/tests/liquidsoap/src/core/encoder/encoder_formats.ml +6 -0
- package/tests/liquidsoap/src/core/encoder/encoder_utils.ml +66 -0
- package/tests/liquidsoap/src/core/encoder/encoders/avi_encoder.ml +38 -39
- package/tests/liquidsoap/src/core/encoder/encoders/fdkaac_encoder.ml +1 -1
- package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_copy_encoder.ml +26 -24
- package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_encoder.ml +24 -6
- package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_encoder_common.ml +52 -45
- package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_internal_encoder.ml +55 -34
- package/tests/liquidsoap/src/core/encoder/encoders/gstreamer_encoder.ml +27 -22
- package/tests/liquidsoap/src/core/encoder/encoders/lame_encoder.ml +5 -4
- package/tests/liquidsoap/src/core/encoder/encoders/ogg_encoder.ml +14 -7
- package/tests/liquidsoap/src/core/encoder/encoders/shine_encoder.ml +4 -5
- package/tests/liquidsoap/src/core/encoder/formats/ffmpeg_format.ml +9 -0
- package/tests/liquidsoap/src/core/encoder/lang/lang_ffmpeg.ml +13 -10
- package/tests/liquidsoap/src/core/encoder/lang_encoder.ml +1 -1
- package/tests/liquidsoap/src/core/harbor/harbor.ml +7 -2
- package/tests/liquidsoap/src/core/harbor/harbor_base.ml +7 -3
- package/tests/liquidsoap/src/core/io/alsa_io.ml +8 -5
- package/tests/liquidsoap/src/core/io/ffmpeg_filter_io.ml +9 -14
- package/tests/liquidsoap/src/core/io/ffmpeg_io.ml +23 -24
- package/tests/liquidsoap/src/core/io/gstreamer_io.ml +24 -20
- package/tests/liquidsoap/src/core/io/oss_io.ml +7 -5
- package/tests/liquidsoap/src/core/io/portaudio_io.ml +7 -5
- package/tests/liquidsoap/src/core/io/pulseaudio_io.ml +8 -7
- package/tests/liquidsoap/src/core/io/srt_io.ml +115 -114
- package/tests/liquidsoap/src/core/io/udp_io.ml +6 -3
- package/tests/liquidsoap/src/core/lang.mli +3 -0
- package/tests/liquidsoap/src/core/lang_source.ml +23 -9
- package/tests/liquidsoap/src/core/ogg_formats/opus_encoder.ml +1 -1
- package/tests/liquidsoap/src/core/operators/accelerate.ml +10 -23
- package/tests/liquidsoap/src/core/operators/add.ml +131 -122
- package/tests/liquidsoap/src/core/operators/amplify.ml +36 -27
- package/tests/liquidsoap/src/core/operators/available.ml +20 -8
- package/tests/liquidsoap/src/core/operators/biquad_filter.ml +8 -8
- package/tests/liquidsoap/src/core/operators/chord.ml +7 -9
- package/tests/liquidsoap/src/core/operators/clip.ml +7 -7
- package/tests/liquidsoap/src/core/operators/comb.ml +7 -8
- package/tests/liquidsoap/src/core/operators/compand.ml +9 -9
- package/tests/liquidsoap/src/core/operators/compress.ml +15 -10
- package/tests/liquidsoap/src/core/operators/compress_exp.ml +8 -9
- package/tests/liquidsoap/src/core/operators/cross.ml +180 -247
- package/tests/liquidsoap/src/core/operators/defer.ml +8 -18
- package/tests/liquidsoap/src/core/operators/delay.ml +10 -18
- package/tests/liquidsoap/src/core/operators/delay_line.ml +9 -8
- package/tests/liquidsoap/src/core/operators/dtmf.ml +18 -16
- package/tests/liquidsoap/src/core/operators/dyn_op.ml +66 -63
- package/tests/liquidsoap/src/core/operators/echo.ml +8 -7
- package/tests/liquidsoap/src/core/operators/filter.ml +8 -8
- package/tests/liquidsoap/src/core/operators/filter_rc.ml +11 -10
- package/tests/liquidsoap/src/core/operators/fir_filter.ml +8 -7
- package/tests/liquidsoap/src/core/operators/flanger.ml +9 -8
- package/tests/liquidsoap/src/core/operators/frei0r_op.ml +113 -91
- package/tests/liquidsoap/src/core/operators/gate.ml +9 -8
- package/tests/liquidsoap/src/core/operators/iir_filter.ml +7 -7
- package/tests/liquidsoap/src/core/operators/insert_metadata.ml +29 -54
- package/tests/liquidsoap/src/core/operators/ladspa_op.ml +38 -36
- package/tests/liquidsoap/src/core/operators/lilv_op.ml +44 -44
- package/tests/liquidsoap/src/core/operators/lufs.ml +8 -8
- package/tests/liquidsoap/src/core/operators/map_metadata.ml +23 -20
- package/tests/liquidsoap/src/core/operators/map_op.ml +6 -7
- package/tests/liquidsoap/src/core/operators/max_duration.ml +21 -20
- package/tests/liquidsoap/src/core/operators/midi_routing.ml +13 -9
- package/tests/liquidsoap/src/core/operators/ms_stereo.ml +13 -15
- package/tests/liquidsoap/src/core/operators/muxer.ml +30 -101
- package/tests/liquidsoap/src/core/operators/noblank.ml +26 -48
- package/tests/liquidsoap/src/core/operators/normalize.ml +13 -9
- package/tests/liquidsoap/src/core/operators/on_end.ml +25 -12
- package/tests/liquidsoap/src/core/operators/on_frame.ml +9 -9
- package/tests/liquidsoap/src/core/operators/on_metadata.ml +9 -10
- package/tests/liquidsoap/src/core/operators/on_offset.ml +20 -13
- package/tests/liquidsoap/src/core/operators/on_track.ml +7 -10
- package/tests/liquidsoap/src/core/operators/pan.ml +7 -8
- package/tests/liquidsoap/src/core/operators/pipe.ml +14 -17
- package/tests/liquidsoap/src/core/operators/pitch.ml +7 -5
- package/tests/liquidsoap/src/core/operators/replaygain_op.ml +6 -6
- package/tests/liquidsoap/src/core/operators/resample.ml +7 -6
- package/tests/liquidsoap/src/core/operators/rms_smooth.ml +8 -8
- package/tests/liquidsoap/src/core/operators/sequence.ml +48 -58
- package/tests/liquidsoap/src/core/operators/soundtouch_op.ml +12 -12
- package/tests/liquidsoap/src/core/operators/st_bpm.ml +8 -7
- package/tests/liquidsoap/src/core/operators/stereotool_op.ml +5 -7
- package/tests/liquidsoap/src/core/operators/still_frame.ml +13 -10
- package/tests/liquidsoap/src/core/operators/switch.ml +128 -168
- package/tests/liquidsoap/src/core/operators/time_warp.ml +44 -103
- package/tests/liquidsoap/src/core/operators/track/merge_metadata.ml +31 -48
- package/tests/liquidsoap/src/core/operators/track_map.ml +6 -32
- package/tests/liquidsoap/src/core/operators/video_effects.ml +48 -13
- package/tests/liquidsoap/src/core/operators/video_fade.ml +69 -57
- package/tests/liquidsoap/src/core/operators/window_op.ml +8 -8
- package/tests/liquidsoap/src/core/outputs/graphics_out.ml +11 -8
- package/tests/liquidsoap/src/core/outputs/harbor_output.ml +3 -3
- package/tests/liquidsoap/src/core/outputs/hls_output.ml +203 -116
- package/tests/liquidsoap/src/core/outputs/icecast2.ml +31 -5
- package/tests/liquidsoap/src/core/outputs/output.ml +27 -31
- package/tests/liquidsoap/src/core/outputs/output.mli +4 -5
- package/tests/liquidsoap/src/core/outputs/pipe_output.ml +19 -8
- package/tests/liquidsoap/src/core/outputs/sdl_out.ml +12 -9
- package/tests/liquidsoap/src/core/playlist_parser.ml +2 -6
- package/tests/liquidsoap/src/core/request.ml +84 -36
- package/tests/liquidsoap/src/core/request.mli +11 -8
- package/tests/liquidsoap/src/core/source.ml +343 -181
- package/tests/liquidsoap/src/core/source.mli +147 -33
- package/tests/liquidsoap/src/core/sources/alsa_in.ml +4 -6
- package/tests/liquidsoap/src/core/sources/audio_gen.ml +23 -22
- package/tests/liquidsoap/src/core/sources/bjack_in.ml +7 -5
- package/tests/liquidsoap/src/core/sources/blank.ml +55 -36
- package/tests/liquidsoap/src/core/sources/debug_sources.ml +2 -2
- package/tests/liquidsoap/src/core/sources/external_input_video.ml +2 -3
- package/tests/liquidsoap/src/core/sources/generated.ml +25 -47
- package/tests/liquidsoap/src/core/sources/harbor_input.ml +7 -9
- package/tests/liquidsoap/src/core/sources/latest_metadata.ml +1 -2
- package/tests/liquidsoap/src/core/sources/noise.ml +38 -27
- package/tests/liquidsoap/src/core/sources/request_dynamic.ml +181 -198
- package/tests/liquidsoap/src/core/sources/synthesized.ml +36 -23
- package/tests/liquidsoap/src/core/sources/video_board.ml +8 -10
- package/tests/liquidsoap/src/core/sources/video_testsrc.ml +9 -11
- package/tests/liquidsoap/src/core/sources/video_text.ml +8 -11
- package/tests/liquidsoap/src/core/stream/aFrame.ml +0 -32
- package/tests/liquidsoap/src/core/stream/aFrame.mli +2 -46
- package/tests/liquidsoap/src/core/stream/content.ml +96 -11
- package/tests/liquidsoap/src/core/stream/content.mli +32 -22
- package/tests/liquidsoap/src/core/stream/content_audio.ml +8 -4
- package/tests/liquidsoap/src/core/stream/content_base.ml +24 -35
- package/tests/liquidsoap/src/core/stream/content_midi.ml +0 -1
- package/tests/liquidsoap/src/core/stream/content_pcm_base.ml +0 -1
- package/tests/liquidsoap/src/core/stream/content_timed.ml +15 -1
- package/tests/liquidsoap/src/core/stream/content_video.ml +91 -30
- package/tests/liquidsoap/src/core/stream/ffmpeg_content_base.ml +0 -49
- package/tests/liquidsoap/src/core/stream/ffmpeg_copy_content.ml +2 -1
- package/tests/liquidsoap/src/core/stream/ffmpeg_raw_content.ml +2 -1
- package/tests/liquidsoap/src/core/stream/frame.ml +67 -118
- package/tests/liquidsoap/src/core/stream/frame.mli +49 -43
- package/tests/liquidsoap/src/core/stream/frame_base.ml +20 -32
- package/tests/liquidsoap/src/core/stream/frame_settings.ml +13 -36
- package/tests/liquidsoap/src/core/stream/generator.ml +47 -140
- package/tests/liquidsoap/src/core/stream/generator.mli +6 -13
- package/tests/liquidsoap/src/core/stream/mFrame.ml +0 -12
- package/tests/liquidsoap/src/core/stream/mFrame.mli +0 -19
- package/tests/liquidsoap/src/core/stream/metadata_base.ml +75 -0
- package/tests/liquidsoap/src/core/stream/vFrame.ml +0 -16
- package/tests/liquidsoap/src/core/stream/vFrame.mli +1 -35
- package/tests/liquidsoap/src/core/synth/dssi_op.ml +19 -20
- package/tests/liquidsoap/src/core/synth/keyboard.ml +6 -10
- package/tests/liquidsoap/src/core/synth/keyboard_sdl.ml +5 -11
- package/tests/liquidsoap/src/core/synth/synth_op.ml +11 -10
- package/tests/liquidsoap/src/core/tools/http.ml +40 -6
- package/tests/liquidsoap/src/core/tools/http.mli +21 -3
- package/tests/liquidsoap/src/core/tools/liq_posix_time.ml +3 -1
- package/tests/liquidsoap/src/core/tools/producer_consumer.ml +7 -18
- package/tests/liquidsoap/src/core/tools/server.ml +1 -1
- package/tests/liquidsoap/src/core/tools/server_builtins.ml +1 -1
- package/tests/liquidsoap/src/core/tools/start_stop.ml +2 -6
- package/tests/liquidsoap/src/core/tools/tutils.ml +1 -1
- package/tests/liquidsoap/src/core/track.ml +1 -2
- package/tests/liquidsoap/src/core/visualization/midimeter.ml +7 -5
- package/tests/liquidsoap/src/core/visualization/video_volume.ml +55 -68
- package/tests/liquidsoap/src/core/visualization/vis_volume.ml +1 -1
- package/tests/liquidsoap/src/js/index.html +4 -4
- package/tests/liquidsoap/src/{core/builtins/builtins_magic.ml → lang/active_value.ml} +16 -12
- package/tests/liquidsoap/src/lang/active_value.mli +33 -0
- package/tests/liquidsoap/src/lang/builtins_math.ml +7 -6
- package/tests/liquidsoap/src/lang/dune +1 -0
- package/tests/liquidsoap/src/lang/environment.ml +3 -1
- package/tests/liquidsoap/src/lang/evaluation.ml +13 -2
- package/tests/liquidsoap/src/lang/lang.mli +3 -0
- package/tests/liquidsoap/src/lang/lang_core.ml +13 -6
- package/tests/liquidsoap/src/lang/lexer.ml +2 -0
- package/tests/liquidsoap/src/lang/methods.ml +1 -0
- package/tests/liquidsoap/src/lang/methods.mli +1 -0
- package/tests/liquidsoap/src/lang/modules.ml +1 -0
- package/tests/liquidsoap/src/lang/parser_helper.ml +10 -1
- package/tests/liquidsoap/src/lang/parser_helper.mli +8 -1
- package/tests/liquidsoap/src/lang/term/parsed_term.ml +2 -0
- package/tests/liquidsoap/src/lang/term/runtime_term.ml +6 -1
- package/tests/liquidsoap/src/lang/term/term_base.ml +128 -74
- package/tests/liquidsoap/src/lang/term/term_reducer.ml +69 -3
- package/tests/liquidsoap/src/lang/term.ml +0 -47
- package/tests/liquidsoap/src/lang/type.ml +17 -1
- package/tests/liquidsoap/src/lang/type.mli +1 -0
- package/tests/liquidsoap/src/lang/types/type_base.ml +1 -1
- package/tests/liquidsoap/src/lang/utils.ml +1 -0
- package/tests/liquidsoap/src/lang/value.ml +16 -2
- package/tests/liquidsoap/src/libs/error.liq +16 -0
- package/tests/liquidsoap/src/libs/extra/deprecations.liq +18 -0
- package/tests/liquidsoap/src/libs/extra/metadata.liq +101 -0
- package/tests/liquidsoap/src/libs/extra/openai.liq +152 -0
- package/tests/liquidsoap/src/libs/extra/server.liq +39 -25
- package/tests/liquidsoap/src/libs/extra/source.liq +188 -0
- package/tests/liquidsoap/src/libs/fades.liq +92 -46
- package/tests/liquidsoap/src/libs/file.liq +71 -5
- package/tests/liquidsoap/src/libs/medialib.liq +384 -2
- package/tests/liquidsoap/src/libs/metadata.liq +1 -9
- package/tests/liquidsoap/src/libs/playlist.liq +224 -141
- package/tests/liquidsoap/src/libs/request.liq +112 -84
- package/tests/liquidsoap/src/libs/server.liq +12 -0
- package/tests/liquidsoap/src/libs/source.liq +24 -3
- package/tests/liquidsoap/src/libs/sqlite.liq +164 -0
- package/tests/liquidsoap/src/libs/stdlib.liq +4 -0
- package/tests/liquidsoap/src/libs/string.liq +35 -1
- package/tests/liquidsoap/src/libs/utils.liq +8 -0
- package/tests/liquidsoap/src/libs/video.liq +2 -1
- package/tests/liquidsoap/src/runtime/build_config.ml +1 -1
- package/tests/liquidsoap/src/runtime/main.ml +1 -1
- package/tests/liquidsoap/src/tooling/parsed_json.ml +4 -0
- package/tests/liquidsoap/tests/core/content_test.ml +32 -20
- package/tests/liquidsoap/tests/core/decoder_test.ml +4 -4
- package/tests/liquidsoap/tests/core/ffmpeg_quality.ml +2 -0
- package/tests/liquidsoap/tests/core/frame_test.ml +0 -35
- package/tests/liquidsoap/tests/core/generator_test.ml +4 -4
- package/tests/liquidsoap/tests/core/more_types.ml +2 -0
- package/tests/liquidsoap/tests/core/output_encoded_test.ml +7 -5
- package/tests/liquidsoap/tests/core/output_test.ml +6 -11
- package/tests/liquidsoap/tests/core/stream_decoder_test.ml +3 -4
- package/tests/liquidsoap/tests/failures/ctype.liq +0 -0
- package/tests/liquidsoap/tests/failures/error.liq +0 -0
- package/tests/liquidsoap/tests/failures/record-invalid-member1.liq +0 -0
- package/tests/liquidsoap/tests/failures/record-invalid-member2.liq +0 -0
- package/tests/liquidsoap/tests/failures/ref.liq +0 -0
- package/tests/liquidsoap/tests/fixme/GH1170.liq +0 -0
- package/tests/liquidsoap/tests/fixme/cross2.liq +0 -0
- package/tests/liquidsoap/tests/fixme/cross3.liq +0 -0
- package/tests/liquidsoap/tests/fixme/sequence-1.liq +0 -0
- package/tests/liquidsoap/tests/language/bool.liq +1 -12
- package/tests/liquidsoap/tests/language/dune.inc +12 -0
- package/tests/liquidsoap/tests/language/file.liq +7 -2
- package/tests/liquidsoap/tests/language/functions.liq +2 -13
- package/tests/liquidsoap/tests/language/interactive.liq +5 -16
- package/tests/liquidsoap/tests/language/list.liq +73 -78
- package/tests/liquidsoap/tests/language/loop.liq +6 -18
- package/tests/liquidsoap/tests/language/mem_usage.liq +0 -1
- package/tests/liquidsoap/tests/language/metadata.liq +9 -13
- package/tests/liquidsoap/tests/language/null.liq +8 -12
- package/tests/liquidsoap/tests/language/number.liq +10 -0
- package/tests/liquidsoap/tests/language/pp.liq +8 -20
- package/tests/liquidsoap/tests/language/predicate.liq +6 -18
- package/tests/liquidsoap/tests/language/ref.liq +3 -15
- package/tests/liquidsoap/tests/language/regexp.liq +14 -25
- package/tests/liquidsoap/tests/language/sqlite.liq +96 -0
- package/tests/liquidsoap/tests/language/stdlib.liq +7 -20
- package/tests/liquidsoap/tests/language/string.liq +7 -0
- package/tests/liquidsoap/tests/media/dune.inc +39 -0
- package/tests/liquidsoap/tests/media/encoder_audio_only.liq.in +1 -1
- package/tests/liquidsoap/tests/media/encoder_audio_video.liq.in +1 -1
- package/tests/liquidsoap/tests/media/encoder_multitrack.liq.in +1 -1
- package/tests/liquidsoap/tests/media/encoder_video_only.liq.in +1 -1
- package/tests/liquidsoap/tests/media/ffmpeg_bitstream_filter.liq +94 -0
- package/tests/liquidsoap/tests/media/ffmpeg_complex_filter.liq +1 -1
- package/tests/liquidsoap/tests/media/ffmpeg_filter.liq +3 -9
- package/tests/liquidsoap/tests/media/ffmpeg_raw_hls.liq +15 -12
- package/tests/liquidsoap/tests/media/ffmpeg_transparency_filter.liq +3 -9
- package/tests/liquidsoap/tests/media/gen_dune.ml +1 -0
- package/tests/liquidsoap/tests/media/mk_encoder_test.sh +0 -0
- package/tests/liquidsoap/tests/media/mk_stream_test.sh +0 -0
- package/tests/liquidsoap/tests/media/multitrack.liq +21 -1
- package/tests/liquidsoap/tests/media/stream_audio.liq.in +0 -0
- package/tests/liquidsoap/tests/media/stream_video.liq.in +0 -0
- package/tests/liquidsoap/tests/performance/erathostenes.liq +0 -0
- package/tests/liquidsoap/tests/performance/memory.liq +0 -0
- package/tests/liquidsoap/tests/performance/small-record.liq +0 -0
- package/tests/liquidsoap/tests/regression/GH1327.liq +8 -0
- package/tests/liquidsoap/tests/regression/GH3316.liq +2 -0
- package/tests/liquidsoap/tests/regression/GH3645.liq +16 -0
- package/tests/liquidsoap/tests/regression/GH3675.liq +37 -0
- package/tests/liquidsoap/tests/regression/LS354-2.liq +11 -3
- package/tests/liquidsoap/tests/regression/dune.inc +45 -14
- package/tests/liquidsoap/tests/regression/track_sensitive.liq +17 -0
- package/tests/liquidsoap/tests/regression/unified-pcm-types.aac +0 -0
- package/tests/liquidsoap/tests/regression/unified-pcm-types.liq +3 -0
- package/tests/liquidsoap/tests/run_test.ml +7 -3
- package/tests/liquidsoap/tests/streams/195.liq +4 -1
- package/tests/liquidsoap/tests/streams/cross-override.liq +12 -4
- package/tests/liquidsoap/tests/streams/cross-persist-override.liq +12 -4
- package/tests/liquidsoap/tests/streams/cross.liq +1 -1
- package/tests/liquidsoap/tests/streams/crossfade.liq +11 -24
- package/tests/liquidsoap/tests/streams/cue-cut.liq +16 -0
- package/tests/liquidsoap/tests/streams/dtmf.liq +3 -0
- package/tests/liquidsoap/tests/streams/dtmf_pcm_s16.liq +4 -0
- package/tests/liquidsoap/tests/streams/dune.inc +145 -0
- package/tests/liquidsoap/tests/streams/fades-persistent-override.liq +7 -2
- package/tests/liquidsoap/tests/streams/hls_discontinuity.liq +68 -0
- package/tests/liquidsoap/tests/streams/hls_id3v2.liq +76 -4
- package/tests/liquidsoap/tests/streams/hls_large_frame.liq +31 -0
- package/tests/liquidsoap/tests/streams/merge_metadata.liq +2 -4
- package/tests/liquidsoap/tests/streams/no-cue-cut.liq +22 -0
- package/tests/liquidsoap/tests/streams/random.liq +4 -4
- package/tests/liquidsoap/tests/streams/rotate.liq +44 -21
- package/tests/liquidsoap/tests/streams/sharing.liq +5 -0
- package/tests/liquidsoap/tests/streams/source-cue.liq +134 -0
- package/tests/liquidsoap/tests/streams/srt_raw_pcm.liq +5 -0
- package/tests/liquidsoap/tests/test.liq +1 -2
- package/tests/run.sh +0 -0
- package/tests/liquidsoap/.github/opam/packages/duppy/duppy.0.9.3/opam +0 -37
- package/tests/liquidsoap/.github/opam/packages/ssl/ssl.0.7.0/opam +0 -40
- package/tests/liquidsoap/src/core/liqmagic.disabled.ml +0 -2
- package/tests/liquidsoap/src/core/liqmagic.enabled.ml +0 -3
- package/tests/liquidsoap/src/core/liqmagic.mli +0 -4
- package/tests/liquidsoap/src/core/operators/cuepoint.ml +0 -216
- package/tests/liquidsoap/tests/regression/GH3121.liq +0 -16
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
(*****************************************************************************
|
|
2
|
+
|
|
3
|
+
Liquidsoap, a programmable audio stream generator.
|
|
4
|
+
Copyright 2003-2023 Savonet team
|
|
5
|
+
|
|
6
|
+
This program is free software; you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation; either version 2 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details, fully stated in the COPYING
|
|
15
|
+
file at the root of the liquidsoap distribution.
|
|
16
|
+
|
|
17
|
+
You should have received a copy of the GNU General Public License
|
|
18
|
+
along with this program; if not, write to the Free Software
|
|
19
|
+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
20
|
+
|
|
21
|
+
*****************************************************************************)
|
|
22
|
+
|
|
23
|
+
module Pcre = Re.Pcre
|
|
24
|
+
|
|
25
|
+
let error fmt =
|
|
26
|
+
Printf.ksprintf
|
|
27
|
+
(fun message -> Runtime_error.raise ~pos:[] ~message "sqlite")
|
|
28
|
+
fmt
|
|
29
|
+
|
|
30
|
+
let escape =
|
|
31
|
+
let rex = Pcre.regexp "'" in
|
|
32
|
+
fun s -> "'" ^ Pcre.substitute ~rex ~subst:(fun _ -> "''") s ^ "'"
|
|
33
|
+
|
|
34
|
+
type Type.constr_t += Insert_value | Insert_record
|
|
35
|
+
|
|
36
|
+
let insert_value_constr =
|
|
37
|
+
let open Type in
|
|
38
|
+
{
|
|
39
|
+
t = Insert_value;
|
|
40
|
+
constr_descr = "int, float, string or null.";
|
|
41
|
+
univ_descr = None;
|
|
42
|
+
satisfied =
|
|
43
|
+
(fun ~subtype:_ ~satisfies b ->
|
|
44
|
+
let rec check typ =
|
|
45
|
+
match (deref typ).descr with
|
|
46
|
+
| Var _ -> satisfies typ
|
|
47
|
+
| Nullable typ -> check typ
|
|
48
|
+
| Custom { typ = Ground.Float.Type }
|
|
49
|
+
| Custom { typ = Ground.Int.Type }
|
|
50
|
+
| Custom { typ = Ground.String.Type } ->
|
|
51
|
+
()
|
|
52
|
+
| _ -> raise Unsatisfied_constraint
|
|
53
|
+
in
|
|
54
|
+
check b);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let insert_record_constr =
|
|
58
|
+
let open Type in
|
|
59
|
+
{
|
|
60
|
+
t = Insert_record;
|
|
61
|
+
constr_descr = "a record with int, float, string or null methods.";
|
|
62
|
+
univ_descr = None;
|
|
63
|
+
satisfied =
|
|
64
|
+
(fun ~subtype ~satisfies b ->
|
|
65
|
+
let m, b = split_meths b in
|
|
66
|
+
match b.descr with
|
|
67
|
+
| Var _ -> satisfies b
|
|
68
|
+
| Tuple [] when m = [] -> raise Unsatisfied_constraint
|
|
69
|
+
| Tuple [] ->
|
|
70
|
+
List.iter
|
|
71
|
+
(fun { scheme = _, typ } ->
|
|
72
|
+
subtype typ (var ~constraints:[insert_value_constr] ()))
|
|
73
|
+
m
|
|
74
|
+
| _ -> raise Unsatisfied_constraint);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
type row = { row : Sqlite3.row; headers : Sqlite3.headers }
|
|
78
|
+
|
|
79
|
+
module SqliteRow = struct
|
|
80
|
+
include Value.MkAbstract (struct
|
|
81
|
+
type content = row
|
|
82
|
+
|
|
83
|
+
let name = "sqlite.row"
|
|
84
|
+
|
|
85
|
+
let to_json ~pos _ =
|
|
86
|
+
Runtime_error.raise ~pos
|
|
87
|
+
~message:"Sqlite rows cannot be represented as json" "json"
|
|
88
|
+
|
|
89
|
+
let descr _ = "sqlite.row"
|
|
90
|
+
let compare = Stdlib.compare
|
|
91
|
+
end)
|
|
92
|
+
|
|
93
|
+
let t =
|
|
94
|
+
Lang.method_t t
|
|
95
|
+
[
|
|
96
|
+
( "to_list",
|
|
97
|
+
( [],
|
|
98
|
+
Lang.fun_t []
|
|
99
|
+
(Lang.list_t
|
|
100
|
+
(Lang.product_t Lang.string_t (Lang.nullable_t Lang.string_t)))
|
|
101
|
+
),
|
|
102
|
+
"Return the row as an associative `[(label, value)]` list." );
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
let to_value v =
|
|
106
|
+
let to_list { headers; row } =
|
|
107
|
+
List.fold_left2
|
|
108
|
+
(fun l header row ->
|
|
109
|
+
Lang.product (Lang.string header)
|
|
110
|
+
(match row with None -> Lang.null | Some r -> Lang.string r)
|
|
111
|
+
:: l)
|
|
112
|
+
[] (Array.to_list headers) (Array.to_list row)
|
|
113
|
+
in
|
|
114
|
+
Lang.meth (to_value v)
|
|
115
|
+
[("to_list", Lang.val_fun [] (fun _ -> Lang.list (to_list v)))]
|
|
116
|
+
|
|
117
|
+
let of_value v = of_value (Lang.demeth v)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
let header_types ty =
|
|
121
|
+
let open Type in
|
|
122
|
+
let headers, _ = split_meths ty in
|
|
123
|
+
let rec to_type ~nullable ty =
|
|
124
|
+
match (deref ty).descr with
|
|
125
|
+
| Nullable typ ->
|
|
126
|
+
let typ = to_type ~nullable:false typ in
|
|
127
|
+
if nullable then `Nullable typ else typ
|
|
128
|
+
| Custom { typ = Ground.Float.Type } -> `Float
|
|
129
|
+
| Custom { typ = Ground.Int.Type } -> `Int
|
|
130
|
+
| Custom { typ = Ground.String.Type } -> `String
|
|
131
|
+
| Var _ -> raise Not_found
|
|
132
|
+
| _ -> assert false
|
|
133
|
+
in
|
|
134
|
+
let headers =
|
|
135
|
+
List.fold_left
|
|
136
|
+
(fun headers { Type.meth = lbl; scheme = _, ty } ->
|
|
137
|
+
try (lbl, to_type ~nullable:true ty) :: headers
|
|
138
|
+
with Not_found -> headers)
|
|
139
|
+
[] headers
|
|
140
|
+
in
|
|
141
|
+
headers
|
|
142
|
+
|
|
143
|
+
let rec string_of_typ = function
|
|
144
|
+
| `Nullable typ -> Printf.sprintf "%s?" (string_of_typ typ)
|
|
145
|
+
| `Int -> "int"
|
|
146
|
+
| `Float -> "float"
|
|
147
|
+
| `String -> "string"
|
|
148
|
+
|
|
149
|
+
let check db ?sql ans =
|
|
150
|
+
let sql =
|
|
151
|
+
match sql with
|
|
152
|
+
| Some sql -> Printf.sprintf " Statement: %s." sql
|
|
153
|
+
| None -> ""
|
|
154
|
+
in
|
|
155
|
+
if not (Sqlite3.Rc.is_success ans) then
|
|
156
|
+
error "Command failed (%s): %s.%s" (Sqlite3.Rc.to_string ans)
|
|
157
|
+
(Sqlite3.errmsg db) sql
|
|
158
|
+
|
|
159
|
+
let exec db ?cb sql = Sqlite3.exec db ?cb sql |> check db ~sql
|
|
160
|
+
|
|
161
|
+
let rec parse_value ~pos ~header ~typ v =
|
|
162
|
+
let open Sqlite3.Data in
|
|
163
|
+
match (typ, v) with
|
|
164
|
+
| `Nullable _, NULL -> Lang.null
|
|
165
|
+
| `Nullable typ, v -> parse_value ~pos ~header ~typ v
|
|
166
|
+
| `Int, INT i -> Lang.int (Int64.to_int i)
|
|
167
|
+
| `Int, TEXT s -> Lang.int (int_of_string s)
|
|
168
|
+
| `Int, BLOB s -> Lang.int (int_of_string s)
|
|
169
|
+
| `Float, FLOAT f -> Lang.float f
|
|
170
|
+
| `Float, TEXT s -> Lang.float (float_of_string s)
|
|
171
|
+
| `Float, BLOB s -> Lang.float (float_of_string s)
|
|
172
|
+
| `String, TEXT s -> Lang.string s
|
|
173
|
+
| `String, BLOB s -> Lang.string s
|
|
174
|
+
| _ ->
|
|
175
|
+
Runtime_error.raise ~pos
|
|
176
|
+
~message:
|
|
177
|
+
(Printf.sprintf
|
|
178
|
+
"Parse error: sqlite query response for column %s with value %s \
|
|
179
|
+
cannot be parsed as type %s"
|
|
180
|
+
header
|
|
181
|
+
(match to_string v with None -> "NULL" | Some s -> s)
|
|
182
|
+
(string_of_typ typ))
|
|
183
|
+
"sqlite"
|
|
184
|
+
|
|
185
|
+
let parse_row ~pos ~header_types { row; headers } =
|
|
186
|
+
let row = Array.to_list row in
|
|
187
|
+
let headers = Array.to_list headers in
|
|
188
|
+
List.fold_left2
|
|
189
|
+
(fun l header row ->
|
|
190
|
+
match List.assoc_opt header header_types with
|
|
191
|
+
| Some typ ->
|
|
192
|
+
(header, parse_value ~pos ~header ~typ (Sqlite3.Data.opt_text row))
|
|
193
|
+
:: l
|
|
194
|
+
| None -> l)
|
|
195
|
+
[] headers row
|
|
196
|
+
|> Lang.record
|
|
197
|
+
|
|
198
|
+
let query_parser ~db query =
|
|
199
|
+
let ans = ref [] in
|
|
200
|
+
let cb row headers = ans := SqliteRow.to_value { row; headers } :: !ans in
|
|
201
|
+
exec db ~cb query;
|
|
202
|
+
let ans = List.rev !ans in
|
|
203
|
+
Lang.list ans
|
|
204
|
+
|
|
205
|
+
let _ =
|
|
206
|
+
let return_t = Type.var ~constraints:[insert_record_constr] () in
|
|
207
|
+
Lang.add_builtin "_sqlite_row_parser_" ~category:`String ~flags:[`Hidden]
|
|
208
|
+
~descr:"Internal sql row parser"
|
|
209
|
+
[
|
|
210
|
+
("type", Value.RuntimeType.t, None, Some "Runtime type");
|
|
211
|
+
("", SqliteRow.t, None, None);
|
|
212
|
+
]
|
|
213
|
+
return_t
|
|
214
|
+
(fun p ->
|
|
215
|
+
let row = SqliteRow.of_value (List.assoc "" p) in
|
|
216
|
+
let ty = Value.RuntimeType.of_value (List.assoc "type" p) in
|
|
217
|
+
let header_types = header_types ty in
|
|
218
|
+
let pos = Lang.pos p in
|
|
219
|
+
try parse_row ~pos ~header_types row
|
|
220
|
+
with exn -> (
|
|
221
|
+
let bt = Printexc.get_raw_backtrace () in
|
|
222
|
+
match exn with
|
|
223
|
+
| Runtime_error.Runtime_error _ as exn ->
|
|
224
|
+
Printexc.raise_with_backtrace exn bt
|
|
225
|
+
| _ ->
|
|
226
|
+
Runtime_error.raise ~bt ~pos
|
|
227
|
+
~message:
|
|
228
|
+
(Printf.sprintf
|
|
229
|
+
"Parse error: sqlite query response value cannot be \
|
|
230
|
+
parsed as type: %s"
|
|
231
|
+
(Type.to_string ty))
|
|
232
|
+
"sqlite"))
|
|
233
|
+
|
|
234
|
+
let sqlite =
|
|
235
|
+
let meth =
|
|
236
|
+
[
|
|
237
|
+
( "exec",
|
|
238
|
+
([], Lang.fun_t [(false, "", Lang.string_t)] Lang.unit_t),
|
|
239
|
+
"Execute an SQL operation.",
|
|
240
|
+
fun db ->
|
|
241
|
+
Lang.val_fun
|
|
242
|
+
[("", "", None)]
|
|
243
|
+
(fun p ->
|
|
244
|
+
let sql = List.assoc "" p |> Lang.to_string in
|
|
245
|
+
exec db sql;
|
|
246
|
+
Lang.unit) );
|
|
247
|
+
( "query",
|
|
248
|
+
([], Lang.fun_t [(false, "", Lang.string_t)] (Lang.list_t SqliteRow.t)),
|
|
249
|
+
"Execute an SQL operation returning the result. Result can be parsed \
|
|
250
|
+
using `let sqlite.query = ...`.",
|
|
251
|
+
fun db ->
|
|
252
|
+
Lang.val_fun
|
|
253
|
+
[("", "", None)]
|
|
254
|
+
(fun p ->
|
|
255
|
+
let query = List.assoc "" p |> Lang.to_string in
|
|
256
|
+
query_parser ~db query) );
|
|
257
|
+
( "iter",
|
|
258
|
+
( [],
|
|
259
|
+
Lang.fun_t
|
|
260
|
+
[
|
|
261
|
+
(false, "", Lang.fun_t [(false, "", SqliteRow.t)] Lang.unit_t);
|
|
262
|
+
(false, "", Lang.string_t);
|
|
263
|
+
]
|
|
264
|
+
Lang.unit_t ),
|
|
265
|
+
"Iterate a function over all the results of a query. Result can be \
|
|
266
|
+
parsed using `let sqlite.row = ...`.",
|
|
267
|
+
fun db ->
|
|
268
|
+
Lang.val_fun
|
|
269
|
+
[("", "", None); ("", "", None)]
|
|
270
|
+
(fun p ->
|
|
271
|
+
let f = Lang.assoc "" 1 p in
|
|
272
|
+
let sql = Lang.assoc "" 2 p |> Lang.to_string in
|
|
273
|
+
let cb row headers =
|
|
274
|
+
let row = SqliteRow.to_value { row; headers } in
|
|
275
|
+
ignore (Lang.apply f [("", row)])
|
|
276
|
+
in
|
|
277
|
+
exec db ~cb sql;
|
|
278
|
+
Lang.unit) );
|
|
279
|
+
( "insert",
|
|
280
|
+
( [],
|
|
281
|
+
Lang.fun_t
|
|
282
|
+
[
|
|
283
|
+
(false, "table", Lang.string_t);
|
|
284
|
+
(true, "replace", Lang.bool_t);
|
|
285
|
+
(false, "", Type.var ~constraints:[insert_record_constr] ());
|
|
286
|
+
]
|
|
287
|
+
Lang.unit_t ),
|
|
288
|
+
"Insert a value represented as a record into a table.",
|
|
289
|
+
fun db ->
|
|
290
|
+
Lang.val_fun
|
|
291
|
+
[
|
|
292
|
+
("table", "table", None);
|
|
293
|
+
("replace", "replace", Some (Lang.bool false));
|
|
294
|
+
("", "", None);
|
|
295
|
+
]
|
|
296
|
+
(fun p ->
|
|
297
|
+
let table = List.assoc "table" p |> Lang.to_string in
|
|
298
|
+
let replace = List.assoc "replace" p |> Lang.to_bool in
|
|
299
|
+
let v =
|
|
300
|
+
List.assoc "" p |> Liquidsoap_lang.Builtins_json.json_of_value
|
|
301
|
+
in
|
|
302
|
+
match v with
|
|
303
|
+
| `Assoc l ->
|
|
304
|
+
let l =
|
|
305
|
+
List.map
|
|
306
|
+
(fun (k, v) ->
|
|
307
|
+
( k,
|
|
308
|
+
match v with
|
|
309
|
+
| `String s -> Sqlite3.Data.opt_text (Some s)
|
|
310
|
+
| `Int n -> Sqlite3.Data.opt_int (Some n)
|
|
311
|
+
| `Float x -> Sqlite3.Data.opt_float (Some x)
|
|
312
|
+
| `Null -> Sqlite3.Data.NULL
|
|
313
|
+
| _ -> error "Unexpected content for field %s." k
|
|
314
|
+
))
|
|
315
|
+
l
|
|
316
|
+
in
|
|
317
|
+
let sql =
|
|
318
|
+
let replace = if replace then " OR REPLACE" else "" in
|
|
319
|
+
let fields = l |> List.map fst |> String.concat ", " in
|
|
320
|
+
let values =
|
|
321
|
+
l |> List.map (fun _ -> "?") |> String.concat ", "
|
|
322
|
+
in
|
|
323
|
+
Printf.sprintf "INSERT%s INTO %s (%s) VALUES (%s)" replace
|
|
324
|
+
table fields values
|
|
325
|
+
in
|
|
326
|
+
let insert = Sqlite3.prepare db sql in
|
|
327
|
+
l |> List.map snd
|
|
328
|
+
|> List.iteri (fun i v ->
|
|
329
|
+
Sqlite3.bind insert (i + 1) v |> check db);
|
|
330
|
+
Sqlite3.step insert |> check db ~sql;
|
|
331
|
+
Sqlite3.finalize insert |> check db;
|
|
332
|
+
Lang.unit
|
|
333
|
+
| _ -> error "A record was expected.") );
|
|
334
|
+
( "close",
|
|
335
|
+
([], Lang.fun_t [] Lang.unit_t),
|
|
336
|
+
"Close the database. It should not be accessed afterward.",
|
|
337
|
+
fun db ->
|
|
338
|
+
Lang.val_fun [] (fun _p ->
|
|
339
|
+
Sqlite3.db_close db |> ignore;
|
|
340
|
+
Lang.unit) );
|
|
341
|
+
]
|
|
342
|
+
in
|
|
343
|
+
let t =
|
|
344
|
+
List.map (fun (name, typ, doc, _) -> (name, typ, doc)) meth
|
|
345
|
+
|> Lang.method_t Lang.unit_t
|
|
346
|
+
in
|
|
347
|
+
Lang.add_builtin "sqlite" ~category:`Programming
|
|
348
|
+
~descr:"Manipulate an SQLITE database."
|
|
349
|
+
[("", Lang.string_t, None, Some "File where the data base is stored")]
|
|
350
|
+
t
|
|
351
|
+
(fun p ->
|
|
352
|
+
let fname = List.assoc "" p |> Lang.to_string in
|
|
353
|
+
let db = Sqlite3.db_open fname in
|
|
354
|
+
let meth = List.map (fun (name, _, _, f) -> (name, f db)) meth in
|
|
355
|
+
Lang.meth Lang.unit meth)
|
|
356
|
+
|
|
357
|
+
let _ =
|
|
358
|
+
Lang.add_builtin "escape" ~base:sqlite ~category:`Programming
|
|
359
|
+
~descr:"Escape a string for use in a query."
|
|
360
|
+
[("", Lang.string_t, None, Some "String to escape.")]
|
|
361
|
+
Lang.string_t
|
|
362
|
+
(fun p -> List.assoc "" p |> Lang.to_string |> escape |> Lang.string)
|
|
@@ -21,10 +21,6 @@
|
|
|
21
21
|
|
|
22
22
|
*****************************************************************************)
|
|
23
23
|
|
|
24
|
-
let set_socket_default ~read_timeout ~write_timeout fd =
|
|
25
|
-
ignore (Option.map (Unix.setsockopt_float fd Unix.SO_RCVTIMEO) read_timeout);
|
|
26
|
-
ignore (Option.map (Unix.setsockopt_float fd Unix.SO_SNDTIMEO) write_timeout)
|
|
27
|
-
|
|
28
24
|
let log = Log.make ["ssl"]
|
|
29
25
|
|
|
30
26
|
let protocol_of_value protocol_val =
|
|
@@ -82,12 +78,17 @@ let server ~min_protocol ~max_protocol ~read_timeout ~write_timeout ~password
|
|
|
82
78
|
object
|
|
83
79
|
method transport = transport
|
|
84
80
|
|
|
85
|
-
method accept sock =
|
|
86
|
-
let s, caller =
|
|
81
|
+
method accept ?timeout sock =
|
|
82
|
+
let s, caller = Http.accept ?timeout sock in
|
|
87
83
|
try
|
|
88
|
-
|
|
84
|
+
(match timeout with
|
|
85
|
+
| Some timeout ->
|
|
86
|
+
Http.set_socket_default ~read_timeout:timeout
|
|
87
|
+
~write_timeout:timeout s
|
|
88
|
+
| None -> ());
|
|
89
89
|
let ssl_s = Ssl.embed_socket s context in
|
|
90
90
|
Ssl.accept ssl_s;
|
|
91
|
+
Http.set_socket_default ~read_timeout ~write_timeout s;
|
|
91
92
|
(ssl_socket transport ssl_s, caller)
|
|
92
93
|
with exn ->
|
|
93
94
|
let bt = Printexc.get_raw_backtrace () in
|
|
@@ -102,7 +103,7 @@ let transport ~min_protocol ~max_protocol ~read_timeout ~write_timeout ~password
|
|
|
102
103
|
method protocol = "https"
|
|
103
104
|
method default_port = 443
|
|
104
105
|
|
|
105
|
-
method connect ?bind_address ?timeout host port =
|
|
106
|
+
method connect ?bind_address ?timeout ?prefer host port =
|
|
106
107
|
try
|
|
107
108
|
let ctx =
|
|
108
109
|
Ssl.create_context (Ssl.SSLv23 [@alert "-deprecated"])
|
|
@@ -123,7 +124,9 @@ let transport ~min_protocol ~max_protocol ~read_timeout ~write_timeout ~password
|
|
|
123
124
|
with _ -> ());
|
|
124
125
|
Ssl.set_verify_depth ctx 3;
|
|
125
126
|
ignore (Ssl.set_default_verify_paths ctx);
|
|
126
|
-
let unix_socket =
|
|
127
|
+
let unix_socket =
|
|
128
|
+
Http.connect ?bind_address ?timeout ?prefer host port
|
|
129
|
+
in
|
|
127
130
|
try
|
|
128
131
|
let socket = Ssl.embed_socket unix_socket ctx in
|
|
129
132
|
(try Ssl.set_client_SNI_hostname socket host with _ -> ());
|
|
@@ -206,9 +209,15 @@ let _ =
|
|
|
206
209
|
let read_timeout =
|
|
207
210
|
Lang.to_valued_option Lang.to_float (List.assoc "read_timeout" p)
|
|
208
211
|
in
|
|
212
|
+
let read_timeout =
|
|
213
|
+
Option.value ~default:Harbor_base.conf_timeout#get read_timeout
|
|
214
|
+
in
|
|
209
215
|
let write_timeout =
|
|
210
216
|
Lang.to_valued_option Lang.to_float (List.assoc "write_timeout" p)
|
|
211
217
|
in
|
|
218
|
+
let write_timeout =
|
|
219
|
+
Option.value ~default:Harbor_base.conf_timeout#get write_timeout
|
|
220
|
+
in
|
|
212
221
|
let password =
|
|
213
222
|
Lang.to_valued_option Lang.to_string (List.assoc "password" p)
|
|
214
223
|
in
|
|
@@ -36,6 +36,14 @@ module Liq_tls = struct
|
|
|
36
36
|
let n = Unix.read h.fd h.buf 0 (min len buf_len) in
|
|
37
37
|
Cstruct.of_bytes ~len:n h.buf
|
|
38
38
|
|
|
39
|
+
let read_pending h = function
|
|
40
|
+
| None -> ()
|
|
41
|
+
| Some data -> Buffer.add_string h.read_pending (Cstruct.to_string data)
|
|
42
|
+
|
|
43
|
+
let write_response h = function
|
|
44
|
+
| None -> ()
|
|
45
|
+
| Some data -> write_all h.fd data
|
|
46
|
+
|
|
39
47
|
let handshake h =
|
|
40
48
|
let rec f () =
|
|
41
49
|
if Tls.Engine.handshake_in_progress h.state then (
|
|
@@ -44,21 +52,18 @@ module Liq_tls = struct
|
|
|
44
52
|
Runtime_error.raise ~pos:[]
|
|
45
53
|
~message:"Connection closed while negotiating TLS handshake!"
|
|
46
54
|
"tls"
|
|
47
|
-
| Ok (`
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
data);
|
|
60
|
-
ignore (Option.map (write_all h.fd) response);
|
|
61
|
-
h.state <- state;
|
|
55
|
+
| Ok ((`Ok _ as step), `Response response, `Data data)
|
|
56
|
+
| Ok ((`Alert _ as step), `Response response, `Data data) ->
|
|
57
|
+
read_pending h data;
|
|
58
|
+
write_response h response;
|
|
59
|
+
(match step with
|
|
60
|
+
| `Ok state -> h.state <- state
|
|
61
|
+
| `Alert alert ->
|
|
62
|
+
Runtime_error.raise ~pos:[]
|
|
63
|
+
~message:
|
|
64
|
+
(Printf.sprintf "TLS handshake error: %s"
|
|
65
|
+
(Tls.Packet.alert_type_to_string alert))
|
|
66
|
+
"tls");
|
|
62
67
|
f ()
|
|
63
68
|
| Error (error, `Response response) ->
|
|
64
69
|
write_all h.fd response;
|
|
@@ -146,11 +151,6 @@ module Liq_tls = struct
|
|
|
146
151
|
Unix.close h.fd
|
|
147
152
|
end
|
|
148
153
|
|
|
149
|
-
let set_socket_default ~read_timeout ~write_timeout fd =
|
|
150
|
-
Unix.set_close_on_exec fd;
|
|
151
|
-
ignore (Option.map (Unix.setsockopt_float fd Unix.SO_RCVTIMEO) read_timeout);
|
|
152
|
-
ignore (Option.map (Unix.setsockopt_float fd Unix.SO_SNDTIMEO) write_timeout)
|
|
153
|
-
|
|
154
154
|
let tls_socket ~session transport =
|
|
155
155
|
object
|
|
156
156
|
method typ = "tls"
|
|
@@ -191,11 +191,16 @@ let server ~read_timeout ~write_timeout ~certificate ~key transport =
|
|
|
191
191
|
object
|
|
192
192
|
method transport = transport
|
|
193
193
|
|
|
194
|
-
method accept sock =
|
|
195
|
-
let fd, caller =
|
|
194
|
+
method accept ?timeout sock =
|
|
195
|
+
let fd, caller = Http.accept ?timeout sock in
|
|
196
196
|
try
|
|
197
|
+
(match timeout with
|
|
198
|
+
| Some timeout ->
|
|
199
|
+
Http.set_socket_default ~read_timeout:timeout
|
|
200
|
+
~write_timeout:timeout fd
|
|
201
|
+
| None -> ());
|
|
197
202
|
let session = Liq_tls.init_server ~server fd in
|
|
198
|
-
set_socket_default ~read_timeout ~write_timeout fd;
|
|
203
|
+
Http.set_socket_default ~read_timeout ~write_timeout fd;
|
|
199
204
|
(tls_socket ~session transport, caller)
|
|
200
205
|
with exn ->
|
|
201
206
|
let bt = Printexc.get_raw_backtrace () in
|
|
@@ -209,7 +214,7 @@ let transport ~read_timeout ~write_timeout ~certificate ~key () =
|
|
|
209
214
|
method protocol = "https"
|
|
210
215
|
method default_port = 443
|
|
211
216
|
|
|
212
|
-
method connect ?bind_address ?timeout host port =
|
|
217
|
+
method connect ?bind_address ?timeout ?prefer host port =
|
|
213
218
|
let domain = Domain_name.host_exn (Domain_name.of_string_exn host) in
|
|
214
219
|
let authenticator = Result.get_ok (Ca_certs.authenticator ()) in
|
|
215
220
|
let certificate_authenticator =
|
|
@@ -233,7 +238,7 @@ let transport ~read_timeout ~write_timeout ~certificate ~key () =
|
|
|
233
238
|
if Result.is_ok r then r else authenticator ?ip ~host certs
|
|
234
239
|
in
|
|
235
240
|
let client = Tls.Config.client ~authenticator ~peer_name:domain () in
|
|
236
|
-
let fd = Http.connect ?bind_address ?timeout host port in
|
|
241
|
+
let fd = Http.connect ?bind_address ?timeout ?prefer host port in
|
|
237
242
|
let session = Liq_tls.init_client ~client fd in
|
|
238
243
|
tls_socket ~session self
|
|
239
244
|
|
|
@@ -247,11 +252,11 @@ let _ =
|
|
|
247
252
|
( "read_timeout",
|
|
248
253
|
Lang.nullable_t Lang.float_t,
|
|
249
254
|
Some Lang.null,
|
|
250
|
-
Some "Read timeout" );
|
|
255
|
+
Some "Read timeout. Defaults to harbor's timeout if `null`." );
|
|
251
256
|
( "write_timeout",
|
|
252
257
|
Lang.nullable_t Lang.float_t,
|
|
253
258
|
Some Lang.null,
|
|
254
|
-
Some "Write timeout" );
|
|
259
|
+
Some "Write timeout. Defaults to harbor's timeout if `null`." );
|
|
255
260
|
( "certificate",
|
|
256
261
|
Lang.nullable_t Lang.string_t,
|
|
257
262
|
Some Lang.null,
|
|
@@ -271,9 +276,15 @@ let _ =
|
|
|
271
276
|
let read_timeout =
|
|
272
277
|
Lang.to_valued_option Lang.to_float (List.assoc "read_timeout" p)
|
|
273
278
|
in
|
|
279
|
+
let read_timeout =
|
|
280
|
+
Option.value ~default:Harbor_base.conf_timeout#get read_timeout
|
|
281
|
+
in
|
|
274
282
|
let write_timeout =
|
|
275
283
|
Lang.to_valued_option Lang.to_float (List.assoc "write_timeout" p)
|
|
276
284
|
in
|
|
285
|
+
let write_timeout =
|
|
286
|
+
Option.value ~default:Harbor_base.conf_timeout#get write_timeout
|
|
287
|
+
in
|
|
277
288
|
let find name () =
|
|
278
289
|
match Lang.to_valued_option Lang.to_string (List.assoc name p) with
|
|
279
290
|
| None ->
|
|
@@ -209,7 +209,7 @@ module MkClock (Time : Liq_time.T) = struct
|
|
|
209
209
|
| `Auto ->
|
|
210
210
|
List.exists
|
|
211
211
|
(fun (state, (s : Source.active_source)) ->
|
|
212
|
-
state = `Active && snd s#self_sync && s#is_ready
|
|
212
|
+
state = `Active && snd s#self_sync && s#is_ready)
|
|
213
213
|
outputs
|
|
214
214
|
| `CPU -> false
|
|
215
215
|
| `None -> true
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
*
|
|
81
81
|
* About dependent clocks:
|
|
82
82
|
* - The following is mostly implemented in [Child_support] for reference.
|
|
83
|
-
* - In some operators such as [cross], [
|
|
83
|
+
* - In some operators such as [cross], [soundtouch] and etc, the main
|
|
84
84
|
* operator wants full control over the children's clock.
|
|
85
85
|
* - In this case, the children's source must all be statically non [self_sync]
|
|
86
86
|
* - A main clock and a children clock are created. All children are placed in the
|
|
@@ -20,47 +20,13 @@
|
|
|
20
20
|
|
|
21
21
|
*****************************************************************************)
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class base ?(audio = false) ?(video = false) ?(midi = false) ~converter
|
|
26
|
-
(source : Source.source) =
|
|
27
|
-
object (self)
|
|
23
|
+
class base ~converter (source : Source.source) =
|
|
24
|
+
object
|
|
28
25
|
method stype = source#stype
|
|
29
|
-
method private
|
|
26
|
+
method private can_generate_frame = source#is_ready
|
|
30
27
|
method abort_track = source#abort_track
|
|
31
28
|
method remaining = source#remaining
|
|
32
29
|
method seek_source = source#seek_source
|
|
33
30
|
method self_sync = source#self_sync
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
(* The tmp_frame is intended to be filled by the underlying source. Content
|
|
37
|
-
untouched by the converter are replaced by by content from the calling
|
|
38
|
-
frame. Touched content get their own layer. *)
|
|
39
|
-
method private tmp_frame =
|
|
40
|
-
match tmp_frame with
|
|
41
|
-
| Some tmp_frame -> tmp_frame
|
|
42
|
-
| None ->
|
|
43
|
-
(* We need to delay the creation of the frame in order not to evaluate
|
|
44
|
-
the kind too early (the user has to have a chance of setting the
|
|
45
|
-
default number of channels). *)
|
|
46
|
-
let frame = Frame.create source#content_type in
|
|
47
|
-
tmp_frame <- Some frame;
|
|
48
|
-
frame
|
|
49
|
-
|
|
50
|
-
method private copy_frame src dst =
|
|
51
|
-
Frame.set_breaks dst (Frame.breaks src);
|
|
52
|
-
Frame.set_all_metadata dst (Frame.get_all_metadata src);
|
|
53
|
-
if not audio then (
|
|
54
|
-
try Frame.set_audio dst (Frame.audio src) with Not_found -> ());
|
|
55
|
-
if not video then (
|
|
56
|
-
try Frame.set_video dst (Frame.video src) with Not_found -> ());
|
|
57
|
-
if not midi then (
|
|
58
|
-
try Frame.set_video dst (Frame.midi src) with Not_found -> ())
|
|
59
|
-
|
|
60
|
-
method private get_frame frame =
|
|
61
|
-
let tmp_frame = self#tmp_frame in
|
|
62
|
-
self#copy_frame frame tmp_frame;
|
|
63
|
-
source#get tmp_frame;
|
|
64
|
-
converter ~frame tmp_frame;
|
|
65
|
-
self#copy_frame tmp_frame frame
|
|
31
|
+
method private generate_frame = converter source#get_frame
|
|
66
32
|
end
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
*****************************************************************************)
|
|
22
22
|
|
|
23
23
|
open Source
|
|
24
|
+
open Mm
|
|
24
25
|
|
|
25
26
|
class mean ~field ~normalize source =
|
|
26
27
|
object
|
|
@@ -28,24 +29,21 @@ class mean ~field ~normalize source =
|
|
|
28
29
|
|
|
29
30
|
inherit
|
|
30
31
|
Conversion.base
|
|
31
|
-
~
|
|
32
|
-
~converter:(fun ~frame tmp_frame ->
|
|
32
|
+
~converter:(fun frame ->
|
|
33
33
|
(* Compute the mean of audio channels *)
|
|
34
|
-
let
|
|
35
|
-
let
|
|
36
|
-
let
|
|
37
|
-
let
|
|
38
|
-
Content.Audio.get_data (Frame.get tmp_frame field)
|
|
39
|
-
in
|
|
34
|
+
let len = Frame.position frame in
|
|
35
|
+
let alen = Frame.audio_of_main len in
|
|
36
|
+
let src_content = Content.Audio.get_data (Frame.get frame field) in
|
|
37
|
+
let dst_content = Audio.Mono.create alen in
|
|
40
38
|
let amp =
|
|
41
|
-
if normalize then 1. /. float (Array.length
|
|
39
|
+
if normalize then 1. /. float (Array.length src_content) else 1.
|
|
42
40
|
in
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Array.fold_left (fun m b -> m +. b.(i)) 0. tmp_content *. amp
|
|
41
|
+
for i = 0 to alen - 1 do
|
|
42
|
+
dst_content.(i) <-
|
|
43
|
+
Array.fold_left (fun m b -> m +. b.(i)) 0. src_content *. amp
|
|
47
44
|
done;
|
|
48
|
-
Frame.
|
|
45
|
+
Frame.set_data frame field Content.Audio.lift_data [| dst_content |])
|
|
46
|
+
source
|
|
49
47
|
end
|
|
50
48
|
|
|
51
49
|
let _ =
|