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
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
|
|
21
21
|
*****************************************************************************)
|
|
22
22
|
|
|
23
|
+
open Mm
|
|
24
|
+
|
|
23
25
|
type clock_variable
|
|
24
26
|
|
|
25
27
|
(** In [`CPU] mode, synchronization is governed by the CPU clock.
|
|
@@ -45,6 +47,11 @@ type self_sync = [ `Static | `Dynamic ] * bool
|
|
|
45
47
|
* A `Infallible source never fails; it is always ready. *)
|
|
46
48
|
type source_t = [ `Fallible | `Infallible ]
|
|
47
49
|
|
|
50
|
+
exception Unavailable
|
|
51
|
+
|
|
52
|
+
type streaming_state =
|
|
53
|
+
[ `Unavailable | `Ready of unit -> unit | `Done of Frame.t ]
|
|
54
|
+
|
|
48
55
|
(** Instrumentation. *)
|
|
49
56
|
|
|
50
57
|
type metadata = (int * Frame.metadata) list
|
|
@@ -60,12 +67,11 @@ type watcher = {
|
|
|
60
67
|
clock_sync_mode:clock_sync_mode ->
|
|
61
68
|
unit;
|
|
62
69
|
sleep : unit -> unit;
|
|
63
|
-
|
|
70
|
+
generate_frame :
|
|
64
71
|
start_time:float ->
|
|
65
72
|
end_time:float ->
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
is_partial:bool ->
|
|
73
|
+
length:int ->
|
|
74
|
+
has_track_mark:bool ->
|
|
69
75
|
metadata:metadata ->
|
|
70
76
|
unit;
|
|
71
77
|
before_output : unit -> unit;
|
|
@@ -166,21 +172,42 @@ class virtual source :
|
|
|
166
172
|
|
|
167
173
|
method private video_dimensions : int * int
|
|
168
174
|
|
|
169
|
-
(** Retrieve the frame currently being filled. *)
|
|
170
|
-
method memo : Frame.t
|
|
171
|
-
|
|
172
175
|
(** A buffer that can be used by the source. *)
|
|
173
176
|
method buffer : Generator.t
|
|
174
177
|
|
|
175
|
-
|
|
178
|
+
method private generate_video :
|
|
179
|
+
?create:
|
|
180
|
+
(pos:int -> width:int -> height:int -> unit -> Video.Canvas.image) ->
|
|
181
|
+
field:Frame.Fields.field ->
|
|
182
|
+
int ->
|
|
183
|
+
Content.Video.data
|
|
184
|
+
|
|
185
|
+
method last_image : Frame.Fields.field -> Video.Canvas.image
|
|
186
|
+
|
|
187
|
+
method private nearest_image :
|
|
188
|
+
pos:int ->
|
|
189
|
+
last_image:Video.Canvas.image ->
|
|
190
|
+
Content.Video.data ->
|
|
191
|
+
Video.Canvas.image
|
|
192
|
+
|
|
193
|
+
(** An empty frame that can be used by the source. *)
|
|
194
|
+
method empty_frame : Frame.t
|
|
195
|
+
|
|
196
|
+
(** An empty frame with a track mark. *)
|
|
197
|
+
method end_of_track : Frame.t
|
|
198
|
+
|
|
199
|
+
(** Number of main ticks left in the current track. Defaults to -1=unknown. *)
|
|
176
200
|
method virtual remaining : int
|
|
177
201
|
|
|
202
|
+
(* Elapsed time since the last track mark. *)
|
|
178
203
|
method elapsed : int
|
|
204
|
+
|
|
205
|
+
(* Estimated total duration of the current track. -1=unknown. *)
|
|
179
206
|
method duration : int
|
|
180
207
|
|
|
181
|
-
(** Return the source effectively used to seek
|
|
208
|
+
(** Return the source effectively used to seek. Used
|
|
182
209
|
by the muxer to determine if there is a unique seeking
|
|
183
|
-
source. Should return [self] if there isn't a unique
|
|
210
|
+
source. Should return [self] if there isn't such a unique
|
|
184
211
|
source. *)
|
|
185
212
|
method virtual seek_source : source
|
|
186
213
|
|
|
@@ -188,39 +215,95 @@ class virtual source :
|
|
|
188
215
|
returns the number of ticks actually skipped.
|
|
189
216
|
By default it always returns 0, refusing to seek at all.
|
|
190
217
|
That method may be called from any thread, concurrently
|
|
191
|
-
with [#
|
|
218
|
+
with [#get_frame], so they should not interfere. *)
|
|
192
219
|
method seek : int -> int
|
|
193
220
|
|
|
194
|
-
(** [is_ready] tells you if [get] can be called.
|
|
195
|
-
Frame argument is optional. With no frame, the
|
|
196
|
-
function tells you if the source can produce
|
|
197
|
-
fresh data. With a frame, it tells you if the
|
|
198
|
-
source can fill the frame from its current position,
|
|
199
|
-
potentially using cached data when the source is
|
|
200
|
-
caching. *)
|
|
201
|
-
method is_ready : ?frame:Frame.t -> unit -> bool
|
|
202
|
-
|
|
203
|
-
(* Internal implementation of [is_ready]. *)
|
|
204
|
-
method virtual private _is_ready : ?frame:Frame.t -> unit -> bool
|
|
205
|
-
|
|
206
|
-
(** [get buf] asks the source to fill the buffer [buf] if possible.
|
|
207
|
-
The [get] call is partial when the buffer is not completely filled.
|
|
208
|
-
[get] should never be called with a full buffer,
|
|
209
|
-
and without checking that the source is ready. *)
|
|
210
|
-
method get : Frame.t -> unit
|
|
211
|
-
|
|
212
221
|
(** The source's last metadata. *)
|
|
213
222
|
method last_metadata : Frame.metadata option
|
|
214
223
|
|
|
215
224
|
(** Register a callback to be called on new metadata *)
|
|
216
225
|
method on_metadata : (Frame.metadata -> unit) -> unit
|
|
217
226
|
|
|
218
|
-
(** Register a callback to be called on new track
|
|
227
|
+
(** Register a callback to be called on new track. Callback
|
|
228
|
+
is called with the most recent metadata before a given
|
|
229
|
+
track mark. *)
|
|
219
230
|
method on_track : (Frame.metadata -> unit) -> unit
|
|
220
231
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
232
|
+
(** These two are used by [generate_from_multiple_sources] and should not
|
|
233
|
+
be used otherwise. *)
|
|
234
|
+
method private execute_on_track : Frame.t -> unit
|
|
235
|
+
|
|
236
|
+
method private set_last_metadata : Frame.t -> unit
|
|
237
|
+
|
|
238
|
+
(** Sources must implement this method. It should return [true] when
|
|
239
|
+
the source can produce data during the current streaming cycle. *)
|
|
240
|
+
method virtual private can_generate_frame : bool
|
|
241
|
+
|
|
242
|
+
(** Sources must implement this method. It should return the data
|
|
243
|
+
produced during the current streaming cycle. Sources are responsible
|
|
244
|
+
for producing as much data as possible, up-to the frame size setting. *)
|
|
245
|
+
method virtual private generate_frame : Frame.t
|
|
246
|
+
|
|
247
|
+
(** This method is based on [can_generate_frame] and has the same value through
|
|
248
|
+
the whole streaming cycle. *)
|
|
249
|
+
method is_ready : bool
|
|
250
|
+
|
|
251
|
+
(** If the source is ready, this method computes the frame generated by the
|
|
252
|
+
source during the current streaming cycle. Returned value is cached and should
|
|
253
|
+
be the same throughout the whole streaming cycle. *)
|
|
254
|
+
method get_frame : Frame.t
|
|
255
|
+
|
|
256
|
+
(** This method passes the frame returned by [#get_frame] to the given callback.
|
|
257
|
+
The callback should return the portion of the frame (of the form: [start, end))
|
|
258
|
+
that was effectively used. This method is used when a consumer of the source's data
|
|
259
|
+
only uses an initial chunk of the frame. In this case, the remaining data is cached
|
|
260
|
+
whenever possible and returned during the next streaming cycle. Final returned value
|
|
261
|
+
is the same as the partial chunk returned for the callback for easy method call chaining. *)
|
|
262
|
+
method get_partial_frame : (Frame.t -> Frame.t) -> Frame.t
|
|
263
|
+
|
|
264
|
+
(** Check a frame without consuming any of its data. *)
|
|
265
|
+
method peek_frame : Frame.t
|
|
266
|
+
|
|
267
|
+
(** This method requests a specific field of the frame that can be mutated. It is used
|
|
268
|
+
by a consumer of the source that will modify the source's data (e.g. [amplify]). The
|
|
269
|
+
source will do its best to minimize data copy according to the streaming context. Typically,
|
|
270
|
+
if there is only one consumer of the source's data, it should be safe to pass its
|
|
271
|
+
data without copying it. *)
|
|
272
|
+
method get_mutable_content : Frame.field -> Content.data
|
|
273
|
+
|
|
274
|
+
(** This method is the same as [#get_mutable_content] but returns a full frame with the requested
|
|
275
|
+
mutable field included. *)
|
|
276
|
+
method get_mutable_frame : Frame.field -> Frame.t
|
|
277
|
+
|
|
278
|
+
(** By convention, frames produced during the streaming cycle can only have at most one
|
|
279
|
+
track mark. In case of multiple track marks (which most likely indicate a programming
|
|
280
|
+
problem), all subsequent track marks past the first one are dropped.
|
|
281
|
+
|
|
282
|
+
This function returns a pair: [(initial_frame, new_track option)] of an initial frame
|
|
283
|
+
and, if a track mark is present in the frame, the optional portion of the frame contained
|
|
284
|
+
after this track mark.
|
|
285
|
+
|
|
286
|
+
This method can be used to implement operations that should be aware of new tracks. *)
|
|
287
|
+
method private split_frame : Frame.t -> Frame.t * Frame.t option
|
|
288
|
+
|
|
289
|
+
(** This method is a convenience function to set some data. It returns the frame produced by the
|
|
290
|
+
source during the current streaming cycle with the given field data replaced by the data
|
|
291
|
+
passed to the function with length set as the frame's length. *)
|
|
292
|
+
method set_frame_data :
|
|
293
|
+
Frame.field ->
|
|
294
|
+
(?offset:int -> ?length:int -> 'a -> Content.data) ->
|
|
295
|
+
'a ->
|
|
296
|
+
Frame.t
|
|
297
|
+
|
|
298
|
+
(** Various information related to the current frame. *)
|
|
299
|
+
|
|
300
|
+
method frame_position : int
|
|
301
|
+
method frame_audio_position : int
|
|
302
|
+
method frame_has_track_mark : bool
|
|
303
|
+
method frame_track_mark : int option
|
|
304
|
+
method frame_metadata : (int * Frame.Metadata.t) list
|
|
305
|
+
|
|
306
|
+
(** Tells the source to end its current track. *)
|
|
224
307
|
method virtual abort_track : unit
|
|
225
308
|
|
|
226
309
|
method is_active : bool
|
|
@@ -275,6 +358,37 @@ class virtual active_operator :
|
|
|
275
358
|
inherit active_source
|
|
276
359
|
end
|
|
277
360
|
|
|
361
|
+
(** Type governing whether or not the same source should be re-selected.
|
|
362
|
+
- [`Force] means that the operator should at least try to see if a new
|
|
363
|
+
source should be selected.
|
|
364
|
+
- [`Ok] means that the operator should re-select the current source
|
|
365
|
+
whenever possible.
|
|
366
|
+
- [`After_position p] means that the operator should re-select the
|
|
367
|
+
current source only if it can produce data past the given position
|
|
368
|
+
The [generate_from_multiple_sources] implements a [can_reselect] that
|
|
369
|
+
can be called with the currently selected source to validate this logic. *)
|
|
370
|
+
type reselect = [ `Ok | `Force | `After_position of int ]
|
|
371
|
+
|
|
372
|
+
(* Helper to generate data from a sequence of source.
|
|
373
|
+
Data generation calls [get_source] on track marks.
|
|
374
|
+
When frame is partial, a track mark is added unless [merge] is
|
|
375
|
+
set to [true]. *)
|
|
376
|
+
class virtual generate_from_multiple_sources :
|
|
377
|
+
merge:(unit -> bool)
|
|
378
|
+
-> track_sensitive:(unit -> bool)
|
|
379
|
+
-> unit
|
|
380
|
+
-> object
|
|
381
|
+
method virtual get_source : reselect:reselect -> unit -> source option
|
|
382
|
+
method virtual split_frame : Frame.t -> Frame.t * Frame.t option
|
|
383
|
+
method virtual empty_frame : Frame.t
|
|
384
|
+
method virtual private execute_on_track : Frame.t -> unit
|
|
385
|
+
method virtual private set_last_metadata : Frame.t -> unit
|
|
386
|
+
method virtual log : Log.t
|
|
387
|
+
method private can_reselect : reselect:reselect -> source -> bool
|
|
388
|
+
method private can_generate_frame : bool
|
|
389
|
+
method private generate_frame : Frame.t
|
|
390
|
+
end
|
|
391
|
+
|
|
278
392
|
val has_outputs : unit -> bool
|
|
279
393
|
val iterate_new_outputs : (active_source -> unit) -> unit
|
|
280
394
|
|
|
@@ -44,6 +44,7 @@ class mic ~clock_safe ~fallible ~on_start ~on_stop ~start device =
|
|
|
44
44
|
val mutable initialized = false
|
|
45
45
|
method self_sync = (`Static, true)
|
|
46
46
|
method seek_source = (self :> Source.source)
|
|
47
|
+
method private can_generate_frame = active_source#started
|
|
47
48
|
|
|
48
49
|
method! private wake_up l =
|
|
49
50
|
active_source#wake_up l;
|
|
@@ -134,12 +135,9 @@ class mic ~clock_safe ~fallible ~on_start ~on_stop ~start device =
|
|
|
134
135
|
Pcm.recover dev e)
|
|
135
136
|
else raise e
|
|
136
137
|
|
|
137
|
-
method
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
let fbuf = AFrame.pcm buf in
|
|
141
|
-
Audio.blit buffer 0 fbuf 0 buffer_length;
|
|
142
|
-
AFrame.add_break buf buffer_length
|
|
138
|
+
method generate_frame =
|
|
139
|
+
Frame.set_data self#empty_frame Frame.Fields.audio Content.Audio.lift_data
|
|
140
|
+
ioring#get_block
|
|
143
141
|
|
|
144
142
|
method! reset = ()
|
|
145
143
|
end
|
|
@@ -26,36 +26,37 @@ open Mm
|
|
|
26
26
|
|
|
27
27
|
open Source
|
|
28
28
|
|
|
29
|
-
let
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
29
|
+
let get_params = function
|
|
30
|
+
| format when Content.Audio.is_format format -> format
|
|
31
|
+
| format when Content_pcm_s16.is_format format ->
|
|
32
|
+
Content.Audio.lift_params (Content_pcm_s16.get_params format)
|
|
33
|
+
| format when Content_pcm_f32.is_format format ->
|
|
34
|
+
Content.Audio.lift_params (Content_pcm_f32.get_params format)
|
|
33
35
|
| _ -> raise Content.Invalid
|
|
34
36
|
|
|
37
|
+
let to_content ~format c =
|
|
38
|
+
match format with
|
|
39
|
+
| _ when Content.Audio.is_format format -> Content.Audio.lift_data c
|
|
40
|
+
| _ when Content_pcm_s16.is_format format ->
|
|
41
|
+
Content_pcm_s16.(lift_data (from_audio c))
|
|
42
|
+
| _ when Content_pcm_f32.is_format format ->
|
|
43
|
+
Content_pcm_f32.(lift_data (from_audio c))
|
|
44
|
+
| _ -> raise Content.Invalid
|
|
45
|
+
|
|
35
46
|
class gen ~seek name g freq duration ampl =
|
|
36
47
|
let g = g (freq ()) in
|
|
37
|
-
object
|
|
48
|
+
object (self)
|
|
38
49
|
inherit Synthesized.source ~seek ~name duration
|
|
39
50
|
|
|
40
|
-
method private synthesize
|
|
41
|
-
let
|
|
42
|
-
let
|
|
43
|
-
let content =
|
|
44
|
-
let buf =
|
|
51
|
+
method private synthesize length =
|
|
52
|
+
let frame = Frame.create ~length Frame.Fields.empty in
|
|
53
|
+
let format = Frame.Fields.find Frame.Fields.audio self#content_type in
|
|
54
|
+
let content = Content.make ~length (get_params format) in
|
|
55
|
+
let buf = Content.Audio.get_data content in
|
|
45
56
|
g#set_frequency (freq ());
|
|
46
57
|
g#set_volume (ampl ());
|
|
47
|
-
g#fill buf
|
|
48
|
-
|
|
49
|
-
| _ when Content.Audio.is_data content -> ()
|
|
50
|
-
| _ when Content_pcm_s16.is_data content ->
|
|
51
|
-
let pcm = Content_pcm_s16.get_data content in
|
|
52
|
-
Content_pcm_s16.blit_audio buf off pcm off len;
|
|
53
|
-
Frame.set_audio frame (Content_pcm_s16.lift_data pcm)
|
|
54
|
-
| _ when Content_pcm_f32.is_data content ->
|
|
55
|
-
let pcm = Content_pcm_f32.get_data content in
|
|
56
|
-
Content_pcm_f32.blit_audio buf off pcm off len;
|
|
57
|
-
Frame.set_audio frame (Content_pcm_f32.lift_data pcm)
|
|
58
|
-
| _ -> raise Content.Invalid
|
|
58
|
+
g#fill buf 0 (Frame.audio_of_main length);
|
|
59
|
+
Frame.Fields.add Frame.Fields.audio (to_content ~format buf) frame
|
|
59
60
|
end
|
|
60
61
|
|
|
61
62
|
let add name g =
|
|
@@ -40,6 +40,7 @@ class jack_in ~clock_safe ~on_start ~on_stop ~fallible ~autostart ~nb_blocks
|
|
|
40
40
|
|
|
41
41
|
inherit! [Bytes.t] IoRing.input ~nb_blocks as ioring
|
|
42
42
|
method seek_source = (self :> Source.source)
|
|
43
|
+
method private can_generate_frame = active_source#started
|
|
43
44
|
|
|
44
45
|
method! private wake_up l =
|
|
45
46
|
active_source#wake_up l;
|
|
@@ -102,14 +103,15 @@ class jack_in ~clock_safe ~on_start ~on_stop ~fallible ~autostart ~nb_blocks
|
|
|
102
103
|
done;
|
|
103
104
|
String.blit !ans 0 block 0 length
|
|
104
105
|
|
|
105
|
-
method private
|
|
106
|
-
|
|
106
|
+
method private generate_frame =
|
|
107
|
+
let length = Lazy.force Frame.size in
|
|
108
|
+
let frame = Frame.create ~length self#content_type in
|
|
109
|
+
let buf = Content.Audio.get_data (Frame.get frame Frame.Fields.audio) in
|
|
107
110
|
let buffer = ioring#get_block in
|
|
108
|
-
let fbuf = AFrame.pcm buf in
|
|
109
111
|
Audio.S16LE.to_audio
|
|
110
112
|
(Bytes.unsafe_to_string buffer)
|
|
111
|
-
0
|
|
112
|
-
|
|
113
|
+
0 buf 0 samples_per_frame;
|
|
114
|
+
Frame.set_data frame Frame.Fields.audio Content.Audio.lift_data buf
|
|
113
115
|
|
|
114
116
|
method! reset = ()
|
|
115
117
|
end
|
|
@@ -33,48 +33,67 @@ class blank duration =
|
|
|
33
33
|
|
|
34
34
|
method remaining = remaining
|
|
35
35
|
method stype = `Infallible
|
|
36
|
-
method private
|
|
36
|
+
method private can_generate_frame = true
|
|
37
37
|
method self_sync = (`Static, false)
|
|
38
38
|
method! seek x = x
|
|
39
39
|
method seek_source = (self :> Source.source)
|
|
40
40
|
method abort_track = remaining <- 0
|
|
41
|
+
val mutable is_first = true
|
|
41
42
|
|
|
42
|
-
method
|
|
43
|
-
let
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
else min remaining (Lazy.force Frame.size - position)
|
|
47
|
-
in
|
|
48
|
-
let audio_pos = Frame.audio_of_main position in
|
|
43
|
+
method generate_frame =
|
|
44
|
+
let was_first = is_first in
|
|
45
|
+
is_first <- false;
|
|
46
|
+
let length = Lazy.force Frame.size in
|
|
49
47
|
let audio_len = Frame.audio_of_main length in
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
48
|
+
let frame =
|
|
49
|
+
Frame.Fields.fold
|
|
50
|
+
(fun field format frame ->
|
|
51
|
+
match format with
|
|
52
|
+
| _ when Content.Audio.is_format format ->
|
|
53
|
+
let data =
|
|
54
|
+
Content.Audio.get_data (Content.make ~length format)
|
|
55
|
+
in
|
|
56
|
+
Audio.clear data 0 audio_len;
|
|
57
|
+
Frame.set_data frame field Content.Audio.lift_data data
|
|
58
|
+
| _ when Content_pcm_s16.is_format format ->
|
|
59
|
+
let data =
|
|
60
|
+
Content_pcm_s16.get_data (Content.make ~length format)
|
|
61
|
+
in
|
|
62
|
+
Content_pcm_s16.clear data 0 audio_len;
|
|
63
|
+
Frame.set_data frame field Content_pcm_s16.lift_data data
|
|
64
|
+
| _ when Content_pcm_f32.is_format format ->
|
|
65
|
+
let data =
|
|
66
|
+
Content_pcm_f32.get_data (Content.make ~length format)
|
|
67
|
+
in
|
|
68
|
+
Content_pcm_f32.clear data 0 audio_len;
|
|
69
|
+
Frame.set_data frame field Content_pcm_f32.lift_data data
|
|
70
|
+
| _ when Content.Video.is_format format ->
|
|
71
|
+
let data =
|
|
72
|
+
self#generate_video ~field
|
|
73
|
+
~create:(fun ~pos:_ ~width ~height () ->
|
|
74
|
+
let img = Video.Canvas.Image.create width height in
|
|
75
|
+
Video.Canvas.Image.iter Video.Image.blank img)
|
|
76
|
+
length
|
|
77
|
+
in
|
|
78
|
+
Frame.set_data frame field Content.Video.lift_data data
|
|
79
|
+
| _
|
|
80
|
+
when Content.Metadata.is_format format
|
|
81
|
+
|| Content.Track_marks.is_format format ->
|
|
82
|
+
frame
|
|
83
|
+
| _ -> failwith "Invalid content type!")
|
|
84
|
+
self#content_type
|
|
85
|
+
(Frame.create ~length Frame.Fields.empty)
|
|
86
|
+
in
|
|
87
|
+
match (was_first, remaining) with
|
|
88
|
+
| true, _ -> Frame.add_track_mark frame 0
|
|
89
|
+
| _, -1 -> frame
|
|
90
|
+
| _, r ->
|
|
91
|
+
if r < length then (
|
|
92
|
+
remaining <- ticks - r;
|
|
93
|
+
Frame.add_track_mark frame r)
|
|
94
|
+
else (
|
|
95
|
+
remaining <- r - length;
|
|
96
|
+
frame)
|
|
78
97
|
end
|
|
79
98
|
|
|
80
99
|
let blank =
|
|
@@ -25,11 +25,11 @@ class fail name =
|
|
|
25
25
|
inherit Source.source ~name ()
|
|
26
26
|
method seek_source = (self :> Source.source)
|
|
27
27
|
method stype = `Fallible
|
|
28
|
-
method private
|
|
28
|
+
method private can_generate_frame = false
|
|
29
29
|
method self_sync = (`Static, false)
|
|
30
30
|
method remaining = 0
|
|
31
31
|
method abort_track = ()
|
|
32
|
-
method
|
|
32
|
+
method generate_frame = assert false
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
let fail () = (new fail "fail" :> Source.source)
|
|
@@ -169,7 +169,7 @@ let _ =
|
|
|
169
169
|
(width * height * 3));
|
|
170
170
|
let data = (Option.get !video_converter) data in
|
|
171
171
|
Generator.put buffer Frame.Fields.video
|
|
172
|
-
(Content.Video.
|
|
172
|
+
(Content.Video.lift_image data)
|
|
173
173
|
| `Frame (`Audio, _, data) ->
|
|
174
174
|
let converter = Option.get !audio_converter in
|
|
175
175
|
let data, ofs, len =
|
|
@@ -234,8 +234,7 @@ let _ =
|
|
|
234
234
|
(* Img.swap_rb data; *)
|
|
235
235
|
(* Img.Effect.flip data; *)
|
|
236
236
|
Generator.put buffer Frame.Fields.video
|
|
237
|
-
(Content.Video.
|
|
238
|
-
(Video.Canvas.single (Video.Canvas.Image.make data)))
|
|
237
|
+
(Content.Video.lift_image (Video.Canvas.Image.make data))
|
|
239
238
|
in
|
|
240
239
|
let bufferize = Lang.to_float (List.assoc "buffer" p) in
|
|
241
240
|
let restart = Lang.to_bool (List.assoc "restart" p) in
|
|
@@ -28,8 +28,8 @@ class virtual source ?(seek = false) ?(replay_meta = false) ~bufferize
|
|
|
28
28
|
let bufferize = Frame.main_of_seconds bufferize in
|
|
29
29
|
object (self : < Source.source ; .. > as 'a)
|
|
30
30
|
val mutable buffering = true
|
|
31
|
-
val mutable
|
|
32
|
-
val mutable cur_meta :
|
|
31
|
+
val mutable add_track_mark = false
|
|
32
|
+
val mutable cur_meta : Frame.metadata option = None
|
|
33
33
|
method virtual private log : Log.t
|
|
34
34
|
method virtual private mutexify : 'a 'b. ('a -> 'b) -> 'a -> 'b
|
|
35
35
|
method virtual buffer : Generator.t
|
|
@@ -46,11 +46,11 @@ class virtual source ?(seek = false) ?(replay_meta = false) ~bufferize
|
|
|
46
46
|
()
|
|
47
47
|
|
|
48
48
|
method seek_source = (self :> Source.source)
|
|
49
|
-
method abort_track =
|
|
49
|
+
method abort_track = add_track_mark <- true
|
|
50
50
|
method private length = Generator.length self#buffer
|
|
51
51
|
val mutable last_buffering_warning = -1
|
|
52
52
|
|
|
53
|
-
method private
|
|
53
|
+
method private can_generate_frame =
|
|
54
54
|
let r = self#length in
|
|
55
55
|
if buffering then (
|
|
56
56
|
(* We have some data, but not enough for safely starting to play it. *)
|
|
@@ -58,16 +58,10 @@ class virtual source ?(seek = false) ?(replay_meta = false) ~bufferize
|
|
|
58
58
|
last_buffering_warning <- r;
|
|
59
59
|
self#log#debug "Not ready: need more buffering (%i/%i)." r bufferize);
|
|
60
60
|
r > bufferize)
|
|
61
|
-
else
|
|
62
|
-
(* This only happens if the end of track has not been played yet,
|
|
63
|
-
* after which the buffering phase will start again. Does not mean
|
|
64
|
-
* that we're not accumulating data, but it means that we don't know
|
|
65
|
-
* yet that we'll stop playing it until the buffer is full enough. *)
|
|
66
|
-
if r = 0 then self#log#info "Not ready for a new track: empty buffer.";
|
|
67
|
-
r > 0)
|
|
61
|
+
else r > 0
|
|
68
62
|
|
|
69
63
|
method remaining =
|
|
70
|
-
if
|
|
64
|
+
if add_track_mark then 0
|
|
71
65
|
else if buffering && self#length <= bufferize then 0
|
|
72
66
|
else Generator.remaining self#buffer
|
|
73
67
|
|
|
@@ -92,46 +86,30 @@ class virtual source ?(seek = false) ?(replay_meta = false) ~bufferize
|
|
|
92
86
|
cur_meta <- new_meta;
|
|
93
87
|
false)
|
|
94
88
|
|
|
95
|
-
method private replay_metadata
|
|
89
|
+
method private replay_metadata frame =
|
|
96
90
|
match cur_meta with
|
|
97
|
-
| None ->
|
|
98
|
-
| Some m -> Frame.
|
|
91
|
+
| None -> frame
|
|
92
|
+
| Some m -> Frame.add_metadata frame 0 m
|
|
99
93
|
|
|
100
|
-
method private
|
|
94
|
+
method private generate_frame =
|
|
101
95
|
self#mutexify
|
|
102
96
|
(fun () ->
|
|
103
97
|
let was_buffering = buffering in
|
|
104
|
-
let pos = Frame.position ab in
|
|
105
98
|
buffering <- false;
|
|
106
|
-
if
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
if
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if Frame.is_partial ab then self#log#info "End of track.";
|
|
122
|
-
if Generator.length self#buffer = 0 then (
|
|
123
|
-
self#log#info "Buffer emptied, buffering needed.";
|
|
124
|
-
buffering <- true);
|
|
125
|
-
if self#save_metadata ab && was_buffering && replay_meta then
|
|
126
|
-
self#replay_metadata pos ab))
|
|
99
|
+
if add_track_mark && empty_on_abort then Generator.clear self#buffer;
|
|
100
|
+
let buf = Generator.slice self#buffer (Lazy.force Frame.size) in
|
|
101
|
+
let buf =
|
|
102
|
+
if was_buffering || add_track_mark then (
|
|
103
|
+
self#log#info "Adding track mark.";
|
|
104
|
+
add_track_mark <- false;
|
|
105
|
+
Frame.add_track_mark buf 0)
|
|
106
|
+
else buf
|
|
107
|
+
in
|
|
108
|
+
if Generator.length self#buffer = 0 then (
|
|
109
|
+
self#log#info "Buffer emptied, buffering needed.";
|
|
110
|
+
buffering <- true);
|
|
111
|
+
if self#save_metadata buf && was_buffering && replay_meta then
|
|
112
|
+
self#replay_metadata buf
|
|
113
|
+
else buf)
|
|
127
114
|
()
|
|
128
115
|
end
|
|
129
|
-
|
|
130
|
-
(* Reads data from a fixed buffer generator. The generator shouldn't be fed anymore. *)
|
|
131
|
-
class consumer buffer =
|
|
132
|
-
object
|
|
133
|
-
inherit Source.source ~name:"buffer" ()
|
|
134
|
-
inherit! source ~bufferize:0. ~empty_on_abort:true ()
|
|
135
|
-
method stype = `Fallible
|
|
136
|
-
method! buffer = buffer
|
|
137
|
-
end
|
|
@@ -27,6 +27,12 @@ let address_resolver s =
|
|
|
27
27
|
Utils.name_of_sockaddr ~rev_dns:Harbor_base.conf_revdns#get
|
|
28
28
|
(Unix.getpeername s)
|
|
29
29
|
|
|
30
|
+
let should_shutdown = Atomic.make false
|
|
31
|
+
|
|
32
|
+
let () =
|
|
33
|
+
Lifecycle.before_core_shutdown ~name:"input.harbor shutdown" (fun () ->
|
|
34
|
+
Atomic.set should_shutdown true)
|
|
35
|
+
|
|
30
36
|
class http_input_server ~pos ~transport ~dumpfile ~logfile ~bufferize ~max ~icy
|
|
31
37
|
~port ~meta_charset ~icy_charset ~replay_meta ~mountpoint ~on_connect
|
|
32
38
|
~on_disconnect ~login ~debug ~timeout () =
|
|
@@ -34,13 +40,6 @@ class http_input_server ~pos ~transport ~dumpfile ~logfile ~bufferize ~max ~icy
|
|
|
34
40
|
object (self)
|
|
35
41
|
inherit Source.active_source ~name:"input.harbor" () as super
|
|
36
42
|
inherit! Generated.source ~empty_on_abort:false ~replay_meta ~bufferize ()
|
|
37
|
-
val should_shutdown = Atomic.make false
|
|
38
|
-
|
|
39
|
-
initializer
|
|
40
|
-
Lifecycle.before_core_shutdown
|
|
41
|
-
~name:(Printf.sprintf "%s shutdown" self#id) (fun () ->
|
|
42
|
-
Atomic.set should_shutdown true)
|
|
43
|
-
|
|
44
43
|
val mutable relay_socket = None
|
|
45
44
|
|
|
46
45
|
(** Function to read on socket. *)
|
|
@@ -65,8 +64,7 @@ class http_input_server ~pos ~transport ~dumpfile ~logfile ~bufferize ~max ~icy
|
|
|
65
64
|
|
|
66
65
|
method private output =
|
|
67
66
|
self#has_ticked;
|
|
68
|
-
if self#is_ready
|
|
69
|
-
self#get self#memo
|
|
67
|
+
if self#is_ready then ignore self#get_frame
|
|
70
68
|
|
|
71
69
|
method reset = self#disconnect ~lock:true
|
|
72
70
|
method buffer_length_cmd = Frame.seconds_of_audio self#length
|
|
@@ -27,8 +27,7 @@ class virtual source =
|
|
|
27
27
|
method virtual private on_new_metadata : unit
|
|
28
28
|
|
|
29
29
|
method private save_latest_metadata frame =
|
|
30
|
-
let
|
|
31
|
-
let l = List.sort compare (Frame.get_all_metadata frame) in
|
|
30
|
+
let l = List.rev (Frame.get_all_metadata frame) in
|
|
32
31
|
if List.length l > 0 then (
|
|
33
32
|
latest_metadata <- snd (List.hd l);
|
|
34
33
|
self#on_new_metadata)
|