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.
Files changed (418) hide show
  1. package/dist/cli.js +2 -2
  2. package/dist/index.js +2 -2
  3. package/package.json +4 -3
  4. package/src/cli.ts +0 -0
  5. package/src/liquidsoap.grammar +1 -1
  6. package/src/parser.js +1 -1
  7. package/tests/liquidsoap/.github/alpine/APKBUILD-minimal.in +1 -1
  8. package/tests/liquidsoap/.github/alpine/APKBUILD.in +1 -1
  9. package/tests/liquidsoap/.github/alpine/liquidsoap.pre-install +0 -0
  10. package/tests/liquidsoap/.github/debian/rules +1 -1
  11. package/tests/liquidsoap/.github/debian/rules-minimal +1 -1
  12. package/tests/liquidsoap/.github/opam/liquidsoap-core-windows.opam +4 -3
  13. package/tests/liquidsoap/.github/opam/packages/ffmpeg-av-windows/ffmpeg-av-windows.1.2.0/opam +38 -0
  14. package/tests/liquidsoap/.github/opam/packages/ffmpeg-avcodec-windows/ffmpeg-avcodec-windows.1.2.0/opam +37 -0
  15. package/tests/liquidsoap/.github/opam/packages/ffmpeg-avdevice-windows/ffmpeg-avdevice-windows.1.2.0/opam +37 -0
  16. package/tests/liquidsoap/.github/opam/packages/ffmpeg-avfilter-windows/ffmpeg-avfilter-windows.1.2.0/opam +37 -0
  17. package/tests/liquidsoap/.github/opam/packages/ffmpeg-avutil-windows/ffmpeg-avutil-windows.1.2.0/opam +37 -0
  18. package/tests/liquidsoap/.github/opam/packages/ffmpeg-swresample-windows/ffmpeg-swresample-windows.1.2.0/opam +38 -0
  19. package/tests/liquidsoap/.github/opam/packages/ffmpeg-swscale-windows/ffmpeg-swscale-windows.1.2.0/opam +37 -0
  20. package/tests/liquidsoap/.github/opam/packages/ffmpeg-windows/ffmpeg-windows.1.2.0/opam +35 -0
  21. package/tests/liquidsoap/.github/scripts/add-local-opam-packages.sh +0 -0
  22. package/tests/liquidsoap/.github/scripts/build-apk.sh +0 -0
  23. package/tests/liquidsoap/.github/scripts/build-deb.sh +0 -0
  24. package/tests/liquidsoap/.github/scripts/build-details.sh +1 -1
  25. package/tests/liquidsoap/.github/scripts/build-doc.sh +0 -0
  26. package/tests/liquidsoap/.github/scripts/build-docker-alpine.sh +0 -0
  27. package/tests/liquidsoap/.github/scripts/build-docker.sh +0 -0
  28. package/tests/liquidsoap/.github/scripts/build-posix.sh +16 -13
  29. package/tests/liquidsoap/.github/scripts/build-website.sh +0 -0
  30. package/tests/liquidsoap/.github/scripts/build-win32.sh +0 -0
  31. package/tests/liquidsoap/.github/scripts/checkout-deps.sh +0 -0
  32. package/tests/liquidsoap/.github/scripts/export-metrics.sh +0 -0
  33. package/tests/liquidsoap/.github/scripts/push-docker.sh +0 -0
  34. package/tests/liquidsoap/.github/scripts/stats-posix.sh +0 -0
  35. package/tests/liquidsoap/.github/scripts/test-posix.sh +0 -0
  36. package/tests/liquidsoap/.github/workflows/ci.yml +10 -1
  37. package/tests/liquidsoap/.pre-commit-config.yaml +1 -1
  38. package/tests/liquidsoap/CHANGES.md +101 -1
  39. package/tests/liquidsoap/README.md +1 -1
  40. package/tests/liquidsoap/ROADMAP.md +28 -26
  41. package/tests/liquidsoap/doc/content/cookbook.md +46 -3
  42. package/tests/liquidsoap/doc/content/database.md +126 -0
  43. package/tests/liquidsoap/doc/content/documentation.md +1 -0
  44. package/tests/liquidsoap/doc/content/encoding_formats.md +6 -7
  45. package/tests/liquidsoap/doc/content/ffmpeg_encoder.md +20 -0
  46. package/tests/liquidsoap/doc/content/hls_output.md +27 -2
  47. package/tests/liquidsoap/doc/content/index.md +1 -1
  48. package/tests/liquidsoap/doc/content/liq/basic-radio.liq +14 -6
  49. package/tests/liquidsoap/doc/content/liq/check +0 -0
  50. package/tests/liquidsoap/doc/content/liq/liquidsoap +0 -0
  51. package/tests/liquidsoap/doc/content/liq/medialib.sqlite.liq +4 -0
  52. package/tests/liquidsoap/doc/content/liq/on2-if2.liq +5 -2
  53. package/tests/liquidsoap/doc/content/liq/on2-initial.liq +10 -5
  54. package/tests/liquidsoap/doc/content/liq/on2-replaygain.liq +13 -4
  55. package/tests/liquidsoap/doc/content/liq/on2-volume.liq +4 -2
  56. package/tests/liquidsoap/doc/content/liq/playlists.liq +2 -1
  57. package/tests/liquidsoap/doc/content/liq/radiopi.liq +2 -6
  58. package/tests/liquidsoap/doc/content/liq/source-cue.liq +26 -0
  59. package/tests/liquidsoap/doc/content/liq/space_overhead.liq +0 -0
  60. package/tests/liquidsoap/doc/content/liq/split-cue.liq +7 -8
  61. package/tests/liquidsoap/doc/content/liq/sqlite.liq +120 -0
  62. package/tests/liquidsoap/doc/content/liq/video-in-video.liq +2 -0
  63. package/tests/liquidsoap/doc/content/migrating.md +12 -0
  64. package/tests/liquidsoap/doc/content/on2_part2.md +1 -1
  65. package/tests/liquidsoap/doc/content/playlist_parsers.md +2 -10
  66. package/tests/liquidsoap/doc/content/seek.md +1 -20
  67. package/tests/liquidsoap/doc/dune.inc +655 -0
  68. package/tests/liquidsoap/dune-project +8 -5
  69. package/tests/liquidsoap/liquidsoap +0 -0
  70. package/tests/liquidsoap/liquidsoap-core.opam +6 -4
  71. package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_bitstream_filters.ml +100 -128
  72. package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_decoder.ml +10 -11
  73. package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_encoder.ml +14 -15
  74. package/tests/liquidsoap/src/core/builtins/builtins_ffmpeg_filters.ml +33 -3
  75. package/tests/liquidsoap/src/core/builtins/builtins_files.ml +64 -12
  76. package/tests/liquidsoap/src/core/builtins/builtins_optionals.ml +0 -1
  77. package/tests/liquidsoap/src/core/builtins/builtins_prometheus.ml +4 -4
  78. package/tests/liquidsoap/src/core/builtins/builtins_request.ml +16 -1
  79. package/tests/liquidsoap/src/core/builtins/builtins_resolvers.ml +1 -1
  80. package/tests/liquidsoap/src/core/builtins/builtins_settings.ml +12 -2
  81. package/tests/liquidsoap/src/core/builtins/builtins_socket.ml +17 -4
  82. package/tests/liquidsoap/src/core/builtins/builtins_source.ml +17 -7
  83. package/tests/liquidsoap/src/core/builtins/builtins_sqlite.ml +362 -0
  84. package/tests/liquidsoap/src/core/builtins/builtins_ssl.ml +18 -9
  85. package/tests/liquidsoap/src/core/builtins/builtins_tls.ml +38 -27
  86. package/tests/liquidsoap/src/core/clock.ml +1 -1
  87. package/tests/liquidsoap/src/core/clock.mli +1 -1
  88. package/tests/liquidsoap/src/core/conversions/conversion.ml +4 -38
  89. package/tests/liquidsoap/src/core/conversions/mean.ml +12 -14
  90. package/tests/liquidsoap/src/core/conversions/stereo.ml +4 -4
  91. package/tests/liquidsoap/src/core/conversions/swap.ml +8 -23
  92. package/tests/liquidsoap/src/core/decoder/aac_decoder.ml +3 -3
  93. package/tests/liquidsoap/src/core/decoder/decoder.ml +134 -129
  94. package/tests/liquidsoap/src/core/decoder/decoder.mli +11 -4
  95. package/tests/liquidsoap/src/core/decoder/decoder_utils.ml +8 -9
  96. package/tests/liquidsoap/src/core/decoder/decoder_utils.mli +2 -2
  97. package/tests/liquidsoap/src/core/decoder/external_decoder.ml +7 -5
  98. package/tests/liquidsoap/src/core/decoder/ffmpeg_copy_decoder.ml +1 -1
  99. package/tests/liquidsoap/src/core/decoder/ffmpeg_decoder.ml +138 -60
  100. package/tests/liquidsoap/src/core/decoder/ffmpeg_decoder_common.ml +10 -0
  101. package/tests/liquidsoap/src/core/decoder/ffmpeg_internal_decoder.ml +1 -2
  102. package/tests/liquidsoap/src/core/decoder/ffmpeg_raw_decoder.ml +1 -1
  103. package/tests/liquidsoap/src/core/decoder/flac_metadata_plug.ml +3 -3
  104. package/tests/liquidsoap/src/core/decoder/gstreamer_decoder.ml +1 -2
  105. package/tests/liquidsoap/src/core/decoder/id3_plug.ml +3 -3
  106. package/tests/liquidsoap/src/core/decoder/image/sdlimage_decoder.ml +3 -3
  107. package/tests/liquidsoap/src/core/decoder/image_decoder.ml +25 -23
  108. package/tests/liquidsoap/src/core/decoder/image_plug.ml +3 -3
  109. package/tests/liquidsoap/src/core/decoder/liq_flac_decoder.ml +10 -11
  110. package/tests/liquidsoap/src/core/decoder/liq_ogg_decoder.ml +5 -5
  111. package/tests/liquidsoap/src/core/decoder/mad_decoder.ml +6 -7
  112. package/tests/liquidsoap/src/core/decoder/midi_decoder.ml +10 -10
  113. package/tests/liquidsoap/src/core/decoder/ogg_metadata_plug.ml +3 -3
  114. package/tests/liquidsoap/src/core/decoder/srt_decoder.ml +23 -15
  115. package/tests/liquidsoap/src/core/decoder/taglib_plug.ml +3 -3
  116. package/tests/liquidsoap/src/core/decoder/text/video_text_sdl.ml +12 -7
  117. package/tests/liquidsoap/src/core/decoder/video_plug.ml +3 -3
  118. package/tests/liquidsoap/src/core/dune +19 -22
  119. package/tests/liquidsoap/src/core/encoder/encoder.ml +1 -1
  120. package/tests/liquidsoap/src/core/encoder/encoder.mli +1 -1
  121. package/tests/liquidsoap/src/core/encoder/encoder_formats.ml +6 -0
  122. package/tests/liquidsoap/src/core/encoder/encoder_utils.ml +66 -0
  123. package/tests/liquidsoap/src/core/encoder/encoders/avi_encoder.ml +38 -39
  124. package/tests/liquidsoap/src/core/encoder/encoders/fdkaac_encoder.ml +1 -1
  125. package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_copy_encoder.ml +26 -24
  126. package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_encoder.ml +24 -6
  127. package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_encoder_common.ml +52 -45
  128. package/tests/liquidsoap/src/core/encoder/encoders/ffmpeg_internal_encoder.ml +55 -34
  129. package/tests/liquidsoap/src/core/encoder/encoders/gstreamer_encoder.ml +27 -22
  130. package/tests/liquidsoap/src/core/encoder/encoders/lame_encoder.ml +5 -4
  131. package/tests/liquidsoap/src/core/encoder/encoders/ogg_encoder.ml +14 -7
  132. package/tests/liquidsoap/src/core/encoder/encoders/shine_encoder.ml +4 -5
  133. package/tests/liquidsoap/src/core/encoder/formats/ffmpeg_format.ml +9 -0
  134. package/tests/liquidsoap/src/core/encoder/lang/lang_ffmpeg.ml +13 -10
  135. package/tests/liquidsoap/src/core/encoder/lang_encoder.ml +1 -1
  136. package/tests/liquidsoap/src/core/harbor/harbor.ml +7 -2
  137. package/tests/liquidsoap/src/core/harbor/harbor_base.ml +7 -3
  138. package/tests/liquidsoap/src/core/io/alsa_io.ml +8 -5
  139. package/tests/liquidsoap/src/core/io/ffmpeg_filter_io.ml +9 -14
  140. package/tests/liquidsoap/src/core/io/ffmpeg_io.ml +23 -24
  141. package/tests/liquidsoap/src/core/io/gstreamer_io.ml +24 -20
  142. package/tests/liquidsoap/src/core/io/oss_io.ml +7 -5
  143. package/tests/liquidsoap/src/core/io/portaudio_io.ml +7 -5
  144. package/tests/liquidsoap/src/core/io/pulseaudio_io.ml +8 -7
  145. package/tests/liquidsoap/src/core/io/srt_io.ml +115 -114
  146. package/tests/liquidsoap/src/core/io/udp_io.ml +6 -3
  147. package/tests/liquidsoap/src/core/lang.mli +3 -0
  148. package/tests/liquidsoap/src/core/lang_source.ml +23 -9
  149. package/tests/liquidsoap/src/core/ogg_formats/opus_encoder.ml +1 -1
  150. package/tests/liquidsoap/src/core/operators/accelerate.ml +10 -23
  151. package/tests/liquidsoap/src/core/operators/add.ml +131 -122
  152. package/tests/liquidsoap/src/core/operators/amplify.ml +36 -27
  153. package/tests/liquidsoap/src/core/operators/available.ml +20 -8
  154. package/tests/liquidsoap/src/core/operators/biquad_filter.ml +8 -8
  155. package/tests/liquidsoap/src/core/operators/chord.ml +7 -9
  156. package/tests/liquidsoap/src/core/operators/clip.ml +7 -7
  157. package/tests/liquidsoap/src/core/operators/comb.ml +7 -8
  158. package/tests/liquidsoap/src/core/operators/compand.ml +9 -9
  159. package/tests/liquidsoap/src/core/operators/compress.ml +15 -10
  160. package/tests/liquidsoap/src/core/operators/compress_exp.ml +8 -9
  161. package/tests/liquidsoap/src/core/operators/cross.ml +180 -247
  162. package/tests/liquidsoap/src/core/operators/defer.ml +8 -18
  163. package/tests/liquidsoap/src/core/operators/delay.ml +10 -18
  164. package/tests/liquidsoap/src/core/operators/delay_line.ml +9 -8
  165. package/tests/liquidsoap/src/core/operators/dtmf.ml +18 -16
  166. package/tests/liquidsoap/src/core/operators/dyn_op.ml +66 -63
  167. package/tests/liquidsoap/src/core/operators/echo.ml +8 -7
  168. package/tests/liquidsoap/src/core/operators/filter.ml +8 -8
  169. package/tests/liquidsoap/src/core/operators/filter_rc.ml +11 -10
  170. package/tests/liquidsoap/src/core/operators/fir_filter.ml +8 -7
  171. package/tests/liquidsoap/src/core/operators/flanger.ml +9 -8
  172. package/tests/liquidsoap/src/core/operators/frei0r_op.ml +113 -91
  173. package/tests/liquidsoap/src/core/operators/gate.ml +9 -8
  174. package/tests/liquidsoap/src/core/operators/iir_filter.ml +7 -7
  175. package/tests/liquidsoap/src/core/operators/insert_metadata.ml +29 -54
  176. package/tests/liquidsoap/src/core/operators/ladspa_op.ml +38 -36
  177. package/tests/liquidsoap/src/core/operators/lilv_op.ml +44 -44
  178. package/tests/liquidsoap/src/core/operators/lufs.ml +8 -8
  179. package/tests/liquidsoap/src/core/operators/map_metadata.ml +23 -20
  180. package/tests/liquidsoap/src/core/operators/map_op.ml +6 -7
  181. package/tests/liquidsoap/src/core/operators/max_duration.ml +21 -20
  182. package/tests/liquidsoap/src/core/operators/midi_routing.ml +13 -9
  183. package/tests/liquidsoap/src/core/operators/ms_stereo.ml +13 -15
  184. package/tests/liquidsoap/src/core/operators/muxer.ml +30 -101
  185. package/tests/liquidsoap/src/core/operators/noblank.ml +26 -48
  186. package/tests/liquidsoap/src/core/operators/normalize.ml +13 -9
  187. package/tests/liquidsoap/src/core/operators/on_end.ml +25 -12
  188. package/tests/liquidsoap/src/core/operators/on_frame.ml +9 -9
  189. package/tests/liquidsoap/src/core/operators/on_metadata.ml +9 -10
  190. package/tests/liquidsoap/src/core/operators/on_offset.ml +20 -13
  191. package/tests/liquidsoap/src/core/operators/on_track.ml +7 -10
  192. package/tests/liquidsoap/src/core/operators/pan.ml +7 -8
  193. package/tests/liquidsoap/src/core/operators/pipe.ml +14 -17
  194. package/tests/liquidsoap/src/core/operators/pitch.ml +7 -5
  195. package/tests/liquidsoap/src/core/operators/replaygain_op.ml +6 -6
  196. package/tests/liquidsoap/src/core/operators/resample.ml +7 -6
  197. package/tests/liquidsoap/src/core/operators/rms_smooth.ml +8 -8
  198. package/tests/liquidsoap/src/core/operators/sequence.ml +48 -58
  199. package/tests/liquidsoap/src/core/operators/soundtouch_op.ml +12 -12
  200. package/tests/liquidsoap/src/core/operators/st_bpm.ml +8 -7
  201. package/tests/liquidsoap/src/core/operators/stereotool_op.ml +5 -7
  202. package/tests/liquidsoap/src/core/operators/still_frame.ml +13 -10
  203. package/tests/liquidsoap/src/core/operators/switch.ml +128 -168
  204. package/tests/liquidsoap/src/core/operators/time_warp.ml +44 -103
  205. package/tests/liquidsoap/src/core/operators/track/merge_metadata.ml +31 -48
  206. package/tests/liquidsoap/src/core/operators/track_map.ml +6 -32
  207. package/tests/liquidsoap/src/core/operators/video_effects.ml +48 -13
  208. package/tests/liquidsoap/src/core/operators/video_fade.ml +69 -57
  209. package/tests/liquidsoap/src/core/operators/window_op.ml +8 -8
  210. package/tests/liquidsoap/src/core/outputs/graphics_out.ml +11 -8
  211. package/tests/liquidsoap/src/core/outputs/harbor_output.ml +3 -3
  212. package/tests/liquidsoap/src/core/outputs/hls_output.ml +203 -116
  213. package/tests/liquidsoap/src/core/outputs/icecast2.ml +31 -5
  214. package/tests/liquidsoap/src/core/outputs/output.ml +27 -31
  215. package/tests/liquidsoap/src/core/outputs/output.mli +4 -5
  216. package/tests/liquidsoap/src/core/outputs/pipe_output.ml +19 -8
  217. package/tests/liquidsoap/src/core/outputs/sdl_out.ml +12 -9
  218. package/tests/liquidsoap/src/core/playlist_parser.ml +2 -6
  219. package/tests/liquidsoap/src/core/request.ml +84 -36
  220. package/tests/liquidsoap/src/core/request.mli +11 -8
  221. package/tests/liquidsoap/src/core/source.ml +343 -181
  222. package/tests/liquidsoap/src/core/source.mli +147 -33
  223. package/tests/liquidsoap/src/core/sources/alsa_in.ml +4 -6
  224. package/tests/liquidsoap/src/core/sources/audio_gen.ml +23 -22
  225. package/tests/liquidsoap/src/core/sources/bjack_in.ml +7 -5
  226. package/tests/liquidsoap/src/core/sources/blank.ml +55 -36
  227. package/tests/liquidsoap/src/core/sources/debug_sources.ml +2 -2
  228. package/tests/liquidsoap/src/core/sources/external_input_video.ml +2 -3
  229. package/tests/liquidsoap/src/core/sources/generated.ml +25 -47
  230. package/tests/liquidsoap/src/core/sources/harbor_input.ml +7 -9
  231. package/tests/liquidsoap/src/core/sources/latest_metadata.ml +1 -2
  232. package/tests/liquidsoap/src/core/sources/noise.ml +38 -27
  233. package/tests/liquidsoap/src/core/sources/request_dynamic.ml +181 -198
  234. package/tests/liquidsoap/src/core/sources/synthesized.ml +36 -23
  235. package/tests/liquidsoap/src/core/sources/video_board.ml +8 -10
  236. package/tests/liquidsoap/src/core/sources/video_testsrc.ml +9 -11
  237. package/tests/liquidsoap/src/core/sources/video_text.ml +8 -11
  238. package/tests/liquidsoap/src/core/stream/aFrame.ml +0 -32
  239. package/tests/liquidsoap/src/core/stream/aFrame.mli +2 -46
  240. package/tests/liquidsoap/src/core/stream/content.ml +96 -11
  241. package/tests/liquidsoap/src/core/stream/content.mli +32 -22
  242. package/tests/liquidsoap/src/core/stream/content_audio.ml +8 -4
  243. package/tests/liquidsoap/src/core/stream/content_base.ml +24 -35
  244. package/tests/liquidsoap/src/core/stream/content_midi.ml +0 -1
  245. package/tests/liquidsoap/src/core/stream/content_pcm_base.ml +0 -1
  246. package/tests/liquidsoap/src/core/stream/content_timed.ml +15 -1
  247. package/tests/liquidsoap/src/core/stream/content_video.ml +91 -30
  248. package/tests/liquidsoap/src/core/stream/ffmpeg_content_base.ml +0 -49
  249. package/tests/liquidsoap/src/core/stream/ffmpeg_copy_content.ml +2 -1
  250. package/tests/liquidsoap/src/core/stream/ffmpeg_raw_content.ml +2 -1
  251. package/tests/liquidsoap/src/core/stream/frame.ml +67 -118
  252. package/tests/liquidsoap/src/core/stream/frame.mli +49 -43
  253. package/tests/liquidsoap/src/core/stream/frame_base.ml +20 -32
  254. package/tests/liquidsoap/src/core/stream/frame_settings.ml +13 -36
  255. package/tests/liquidsoap/src/core/stream/generator.ml +47 -140
  256. package/tests/liquidsoap/src/core/stream/generator.mli +6 -13
  257. package/tests/liquidsoap/src/core/stream/mFrame.ml +0 -12
  258. package/tests/liquidsoap/src/core/stream/mFrame.mli +0 -19
  259. package/tests/liquidsoap/src/core/stream/metadata_base.ml +75 -0
  260. package/tests/liquidsoap/src/core/stream/vFrame.ml +0 -16
  261. package/tests/liquidsoap/src/core/stream/vFrame.mli +1 -35
  262. package/tests/liquidsoap/src/core/synth/dssi_op.ml +19 -20
  263. package/tests/liquidsoap/src/core/synth/keyboard.ml +6 -10
  264. package/tests/liquidsoap/src/core/synth/keyboard_sdl.ml +5 -11
  265. package/tests/liquidsoap/src/core/synth/synth_op.ml +11 -10
  266. package/tests/liquidsoap/src/core/tools/http.ml +40 -6
  267. package/tests/liquidsoap/src/core/tools/http.mli +21 -3
  268. package/tests/liquidsoap/src/core/tools/liq_posix_time.ml +3 -1
  269. package/tests/liquidsoap/src/core/tools/producer_consumer.ml +7 -18
  270. package/tests/liquidsoap/src/core/tools/server.ml +1 -1
  271. package/tests/liquidsoap/src/core/tools/server_builtins.ml +1 -1
  272. package/tests/liquidsoap/src/core/tools/start_stop.ml +2 -6
  273. package/tests/liquidsoap/src/core/tools/tutils.ml +1 -1
  274. package/tests/liquidsoap/src/core/track.ml +1 -2
  275. package/tests/liquidsoap/src/core/visualization/midimeter.ml +7 -5
  276. package/tests/liquidsoap/src/core/visualization/video_volume.ml +55 -68
  277. package/tests/liquidsoap/src/core/visualization/vis_volume.ml +1 -1
  278. package/tests/liquidsoap/src/js/index.html +4 -4
  279. package/tests/liquidsoap/src/{core/builtins/builtins_magic.ml → lang/active_value.ml} +16 -12
  280. package/tests/liquidsoap/src/lang/active_value.mli +33 -0
  281. package/tests/liquidsoap/src/lang/builtins_math.ml +7 -6
  282. package/tests/liquidsoap/src/lang/dune +1 -0
  283. package/tests/liquidsoap/src/lang/environment.ml +3 -1
  284. package/tests/liquidsoap/src/lang/evaluation.ml +13 -2
  285. package/tests/liquidsoap/src/lang/lang.mli +3 -0
  286. package/tests/liquidsoap/src/lang/lang_core.ml +13 -6
  287. package/tests/liquidsoap/src/lang/lexer.ml +2 -0
  288. package/tests/liquidsoap/src/lang/methods.ml +1 -0
  289. package/tests/liquidsoap/src/lang/methods.mli +1 -0
  290. package/tests/liquidsoap/src/lang/modules.ml +1 -0
  291. package/tests/liquidsoap/src/lang/parser_helper.ml +10 -1
  292. package/tests/liquidsoap/src/lang/parser_helper.mli +8 -1
  293. package/tests/liquidsoap/src/lang/term/parsed_term.ml +2 -0
  294. package/tests/liquidsoap/src/lang/term/runtime_term.ml +6 -1
  295. package/tests/liquidsoap/src/lang/term/term_base.ml +128 -74
  296. package/tests/liquidsoap/src/lang/term/term_reducer.ml +69 -3
  297. package/tests/liquidsoap/src/lang/term.ml +0 -47
  298. package/tests/liquidsoap/src/lang/type.ml +17 -1
  299. package/tests/liquidsoap/src/lang/type.mli +1 -0
  300. package/tests/liquidsoap/src/lang/types/type_base.ml +1 -1
  301. package/tests/liquidsoap/src/lang/utils.ml +1 -0
  302. package/tests/liquidsoap/src/lang/value.ml +16 -2
  303. package/tests/liquidsoap/src/libs/error.liq +16 -0
  304. package/tests/liquidsoap/src/libs/extra/deprecations.liq +18 -0
  305. package/tests/liquidsoap/src/libs/extra/metadata.liq +101 -0
  306. package/tests/liquidsoap/src/libs/extra/openai.liq +152 -0
  307. package/tests/liquidsoap/src/libs/extra/server.liq +39 -25
  308. package/tests/liquidsoap/src/libs/extra/source.liq +188 -0
  309. package/tests/liquidsoap/src/libs/fades.liq +92 -46
  310. package/tests/liquidsoap/src/libs/file.liq +71 -5
  311. package/tests/liquidsoap/src/libs/medialib.liq +384 -2
  312. package/tests/liquidsoap/src/libs/metadata.liq +1 -9
  313. package/tests/liquidsoap/src/libs/playlist.liq +224 -141
  314. package/tests/liquidsoap/src/libs/request.liq +112 -84
  315. package/tests/liquidsoap/src/libs/server.liq +12 -0
  316. package/tests/liquidsoap/src/libs/source.liq +24 -3
  317. package/tests/liquidsoap/src/libs/sqlite.liq +164 -0
  318. package/tests/liquidsoap/src/libs/stdlib.liq +4 -0
  319. package/tests/liquidsoap/src/libs/string.liq +35 -1
  320. package/tests/liquidsoap/src/libs/utils.liq +8 -0
  321. package/tests/liquidsoap/src/libs/video.liq +2 -1
  322. package/tests/liquidsoap/src/runtime/build_config.ml +1 -1
  323. package/tests/liquidsoap/src/runtime/main.ml +1 -1
  324. package/tests/liquidsoap/src/tooling/parsed_json.ml +4 -0
  325. package/tests/liquidsoap/tests/core/content_test.ml +32 -20
  326. package/tests/liquidsoap/tests/core/decoder_test.ml +4 -4
  327. package/tests/liquidsoap/tests/core/ffmpeg_quality.ml +2 -0
  328. package/tests/liquidsoap/tests/core/frame_test.ml +0 -35
  329. package/tests/liquidsoap/tests/core/generator_test.ml +4 -4
  330. package/tests/liquidsoap/tests/core/more_types.ml +2 -0
  331. package/tests/liquidsoap/tests/core/output_encoded_test.ml +7 -5
  332. package/tests/liquidsoap/tests/core/output_test.ml +6 -11
  333. package/tests/liquidsoap/tests/core/stream_decoder_test.ml +3 -4
  334. package/tests/liquidsoap/tests/failures/ctype.liq +0 -0
  335. package/tests/liquidsoap/tests/failures/error.liq +0 -0
  336. package/tests/liquidsoap/tests/failures/record-invalid-member1.liq +0 -0
  337. package/tests/liquidsoap/tests/failures/record-invalid-member2.liq +0 -0
  338. package/tests/liquidsoap/tests/failures/ref.liq +0 -0
  339. package/tests/liquidsoap/tests/fixme/GH1170.liq +0 -0
  340. package/tests/liquidsoap/tests/fixme/cross2.liq +0 -0
  341. package/tests/liquidsoap/tests/fixme/cross3.liq +0 -0
  342. package/tests/liquidsoap/tests/fixme/sequence-1.liq +0 -0
  343. package/tests/liquidsoap/tests/language/bool.liq +1 -12
  344. package/tests/liquidsoap/tests/language/dune.inc +12 -0
  345. package/tests/liquidsoap/tests/language/file.liq +7 -2
  346. package/tests/liquidsoap/tests/language/functions.liq +2 -13
  347. package/tests/liquidsoap/tests/language/interactive.liq +5 -16
  348. package/tests/liquidsoap/tests/language/list.liq +73 -78
  349. package/tests/liquidsoap/tests/language/loop.liq +6 -18
  350. package/tests/liquidsoap/tests/language/mem_usage.liq +0 -1
  351. package/tests/liquidsoap/tests/language/metadata.liq +9 -13
  352. package/tests/liquidsoap/tests/language/null.liq +8 -12
  353. package/tests/liquidsoap/tests/language/number.liq +10 -0
  354. package/tests/liquidsoap/tests/language/pp.liq +8 -20
  355. package/tests/liquidsoap/tests/language/predicate.liq +6 -18
  356. package/tests/liquidsoap/tests/language/ref.liq +3 -15
  357. package/tests/liquidsoap/tests/language/regexp.liq +14 -25
  358. package/tests/liquidsoap/tests/language/sqlite.liq +96 -0
  359. package/tests/liquidsoap/tests/language/stdlib.liq +7 -20
  360. package/tests/liquidsoap/tests/language/string.liq +7 -0
  361. package/tests/liquidsoap/tests/media/dune.inc +39 -0
  362. package/tests/liquidsoap/tests/media/encoder_audio_only.liq.in +1 -1
  363. package/tests/liquidsoap/tests/media/encoder_audio_video.liq.in +1 -1
  364. package/tests/liquidsoap/tests/media/encoder_multitrack.liq.in +1 -1
  365. package/tests/liquidsoap/tests/media/encoder_video_only.liq.in +1 -1
  366. package/tests/liquidsoap/tests/media/ffmpeg_bitstream_filter.liq +94 -0
  367. package/tests/liquidsoap/tests/media/ffmpeg_complex_filter.liq +1 -1
  368. package/tests/liquidsoap/tests/media/ffmpeg_filter.liq +3 -9
  369. package/tests/liquidsoap/tests/media/ffmpeg_raw_hls.liq +15 -12
  370. package/tests/liquidsoap/tests/media/ffmpeg_transparency_filter.liq +3 -9
  371. package/tests/liquidsoap/tests/media/gen_dune.ml +1 -0
  372. package/tests/liquidsoap/tests/media/mk_encoder_test.sh +0 -0
  373. package/tests/liquidsoap/tests/media/mk_stream_test.sh +0 -0
  374. package/tests/liquidsoap/tests/media/multitrack.liq +21 -1
  375. package/tests/liquidsoap/tests/media/stream_audio.liq.in +0 -0
  376. package/tests/liquidsoap/tests/media/stream_video.liq.in +0 -0
  377. package/tests/liquidsoap/tests/performance/erathostenes.liq +0 -0
  378. package/tests/liquidsoap/tests/performance/memory.liq +0 -0
  379. package/tests/liquidsoap/tests/performance/small-record.liq +0 -0
  380. package/tests/liquidsoap/tests/regression/GH1327.liq +8 -0
  381. package/tests/liquidsoap/tests/regression/GH3316.liq +2 -0
  382. package/tests/liquidsoap/tests/regression/GH3645.liq +16 -0
  383. package/tests/liquidsoap/tests/regression/GH3675.liq +37 -0
  384. package/tests/liquidsoap/tests/regression/LS354-2.liq +11 -3
  385. package/tests/liquidsoap/tests/regression/dune.inc +45 -14
  386. package/tests/liquidsoap/tests/regression/track_sensitive.liq +17 -0
  387. package/tests/liquidsoap/tests/regression/unified-pcm-types.aac +0 -0
  388. package/tests/liquidsoap/tests/regression/unified-pcm-types.liq +3 -0
  389. package/tests/liquidsoap/tests/run_test.ml +7 -3
  390. package/tests/liquidsoap/tests/streams/195.liq +4 -1
  391. package/tests/liquidsoap/tests/streams/cross-override.liq +12 -4
  392. package/tests/liquidsoap/tests/streams/cross-persist-override.liq +12 -4
  393. package/tests/liquidsoap/tests/streams/cross.liq +1 -1
  394. package/tests/liquidsoap/tests/streams/crossfade.liq +11 -24
  395. package/tests/liquidsoap/tests/streams/cue-cut.liq +16 -0
  396. package/tests/liquidsoap/tests/streams/dtmf.liq +3 -0
  397. package/tests/liquidsoap/tests/streams/dtmf_pcm_s16.liq +4 -0
  398. package/tests/liquidsoap/tests/streams/dune.inc +145 -0
  399. package/tests/liquidsoap/tests/streams/fades-persistent-override.liq +7 -2
  400. package/tests/liquidsoap/tests/streams/hls_discontinuity.liq +68 -0
  401. package/tests/liquidsoap/tests/streams/hls_id3v2.liq +76 -4
  402. package/tests/liquidsoap/tests/streams/hls_large_frame.liq +31 -0
  403. package/tests/liquidsoap/tests/streams/merge_metadata.liq +2 -4
  404. package/tests/liquidsoap/tests/streams/no-cue-cut.liq +22 -0
  405. package/tests/liquidsoap/tests/streams/random.liq +4 -4
  406. package/tests/liquidsoap/tests/streams/rotate.liq +44 -21
  407. package/tests/liquidsoap/tests/streams/sharing.liq +5 -0
  408. package/tests/liquidsoap/tests/streams/source-cue.liq +134 -0
  409. package/tests/liquidsoap/tests/streams/srt_raw_pcm.liq +5 -0
  410. package/tests/liquidsoap/tests/test.liq +1 -2
  411. package/tests/run.sh +0 -0
  412. package/tests/liquidsoap/.github/opam/packages/duppy/duppy.0.9.3/opam +0 -37
  413. package/tests/liquidsoap/.github/opam/packages/ssl/ssl.0.7.0/opam +0 -40
  414. package/tests/liquidsoap/src/core/liqmagic.disabled.ml +0 -2
  415. package/tests/liquidsoap/src/core/liqmagic.enabled.ml +0 -3
  416. package/tests/liquidsoap/src/core/liqmagic.mli +0 -4
  417. package/tests/liquidsoap/src/core/operators/cuepoint.ml +0 -216
  418. package/tests/liquidsoap/tests/regression/GH3121.liq +0 -16
@@ -23,6 +23,7 @@
23
23
  open Mm
24
24
  open Source
25
25
  open Extralib
26
+ module Pcre = Re.Pcre
26
27
 
27
28
  let video_frei0r = Lang.add_module ~base:Modules.video "frei0r"
28
29
 
@@ -39,48 +40,53 @@ let frei0r_enable =
39
40
  let plugin_dirs =
40
41
  try
41
42
  let path = Unix.getenv "LIQ_FREI0R_PATH" in
42
- Pcre.split ~pat:":" path
43
+ Pcre.split ~rex:(Pcre.regexp ":") path
43
44
  with Not_found -> Frei0r.default_paths
44
45
 
45
46
  class frei0r_filter ~name bgra instance params (source : source) =
46
47
  let fps = Lazy.force Frame.video_rate in
47
48
  let dt = 1. /. float fps in
48
- object
49
+ object (self)
49
50
  inherit operator ~name:("frei0r." ^ name) [source]
50
51
  method stype = source#stype
51
52
  method remaining = source#remaining
52
53
  method seek_source = source#seek_source
53
- method private _is_ready = source#is_ready
54
+ method private can_generate_frame = source#is_ready
54
55
  method self_sync = source#self_sync
55
56
  method abort_track = source#abort_track
56
57
  val mutable t = 0.
57
58
 
58
- method private get_frame buf =
59
- match VFrame.get_content buf source with
60
- | None -> ()
61
- | Some (rgb, offset, length) ->
62
- params ();
63
- let rgb = Content.Video.get_data rgb in
64
- for i = offset to offset + length - 1 do
65
- (* TODO: we could try to be more efficient than converting to/from RGBA32 and swap colors... *)
66
- let img = Video.Canvas.render rgb i in
67
- let img = Image.YUV420.to_RGBA32 img in
68
- if bgra then Image.RGBA32.swap_rb img;
69
- let src = Image.RGBA32.data (Image.RGBA32.copy img) in
70
- let dst = Image.RGBA32.data img in
71
- Frei0r.update1 instance t src dst;
72
- if bgra then Image.RGBA32.swap_rb img;
73
- let img = Image.YUV420.of_RGBA32 img in
74
- Video.Canvas.put rgb i img;
75
- t <- t +. dt
76
- done
59
+ method private render img =
60
+ let img = Video.Canvas.Image.render img in
61
+ let img = Image.YUV420.to_RGBA32 img in
62
+ if bgra then Image.RGBA32.swap_rb img;
63
+ let src = Image.RGBA32.data (Image.RGBA32.copy img) in
64
+ let dst = Image.RGBA32.data img in
65
+ Frei0r.update1 instance t src dst;
66
+ if bgra then Image.RGBA32.swap_rb img;
67
+ t <- t +. dt;
68
+ Video.Canvas.Image.make (Image.YUV420.of_RGBA32 img)
69
+
70
+ method private generate_frame =
71
+ let buf =
72
+ Content.Video.get_data (source#get_mutable_content Frame.Fields.video)
73
+ in
74
+ params ();
75
+ source#set_frame_data Frame.Fields.video Content.Video.lift_data
76
+ {
77
+ buf with
78
+ Content.Video.data =
79
+ List.map
80
+ (fun (pos, img) -> (pos, self#render img))
81
+ buf.Content.Video.data;
82
+ }
77
83
  end
78
84
 
79
85
  class frei0r_mixer ~name bgra instance params (source : source) source2 =
80
86
  let fps = Lazy.force Frame.video_rate in
81
87
  let dt = 1. /. float fps in
82
88
  object (self)
83
- inherit operator ~name:("frei0r." ^ name) [source; source2] as super
89
+ inherit operator ~name:("frei0r." ^ name) [source; source2]
84
90
  method seek_source = (self :> Source.source)
85
91
 
86
92
  method stype =
@@ -93,8 +99,7 @@ class frei0r_mixer ~name bgra instance params (source : source) source2 =
93
99
  | -1, x | x, -1 -> x
94
100
  | x, y -> min x y
95
101
 
96
- method private _is_ready ?frame () =
97
- source#is_ready ?frame () && source2#is_ready ?frame ()
102
+ method private can_generate_frame = source#is_ready && source2#is_ready
98
103
 
99
104
  method self_sync =
100
105
  match (source#self_sync, source2#self_sync) with
@@ -106,53 +111,64 @@ class frei0r_mixer ~name bgra instance params (source : source) source2 =
106
111
  source2#abort_track
107
112
 
108
113
  val mutable t = 0.
109
- val mutable tmp = Frame.dummy ()
110
-
111
- method! private wake_up a =
112
- super#wake_up a;
113
- tmp <- Frame.create self#content_type
114
-
115
- method private get_frame buf =
116
- (* Prepare buffer for the second source
117
- * at the same position as final buffer. *)
118
- Frame.clear tmp;
119
- Frame.set_breaks tmp [Frame.position buf];
120
-
121
- (* Get content in respective buffers *)
122
- let c = VFrame.get_content buf source in
123
- let c2 = VFrame.get_content tmp source2 in
124
- match (c, c2) with
125
- | Some (rgb, offset, length), Some (rgb', offset', length') ->
126
- params ();
127
-
128
- (* Mix content where the two streams are available.
129
- * We could cut one stream when the other is too short,
130
- * and/or attempt to get some more data in the buffers...
131
- * each solution has its downsides and it'll rarely matter
132
- * because there's usually only one image per video frame. *)
133
- assert (offset = offset');
134
- let length = min length length' in
135
- let rgb = Content.Video.get_data rgb in
136
- let rgb' = Content.Video.get_data rgb' in
137
- for i = offset to offset + length - 1 do
138
- (* TODO: we could try to be more efficient than converting to/from RGBA32 and swap colors... *)
139
- let img = Video.Canvas.render rgb i in
140
- let img = Image.YUV420.to_RGBA32 img in
141
- let img' = Video.Canvas.get rgb' i in
142
- let img' = Video.Canvas.Image.render img' in
143
- let img' = Image.YUV420.to_RGBA32 img' in
144
- if bgra then Image.RGBA32.swap_rb img;
145
- if bgra then Image.RGBA32.swap_rb img';
146
- let src = Image.RGBA32.data (Image.RGBA32.copy img) in
147
- let src' = Image.RGBA32.data img' in
148
- let dst = Image.RGBA32.data img in
149
- Frei0r.update2 instance t src src' dst;
150
- if bgra then Image.RGBA32.swap_rb img;
151
- let img = Image.YUV420.of_RGBA32 img in
152
- Video.Canvas.put rgb i img;
153
- t <- t +. dt
154
- done
155
- | _ -> ()
114
+
115
+ method private generate_frame =
116
+ let length = min source#frame_position source2#frame_position in
117
+ let c =
118
+ Frame.get
119
+ (source#get_partial_frame (fun f -> Frame.slice f length))
120
+ Frame.Fields.video
121
+ in
122
+ let c' =
123
+ Frame.get
124
+ (source2#get_partial_frame (fun f -> Frame.slice f length))
125
+ Frame.Fields.video
126
+ in
127
+
128
+ let rgb = Content.Video.get_data c in
129
+ let rgb =
130
+ self#generate_video ~field:Frame.Fields.video
131
+ ~create:(fun ~pos ~width:_ ~height:_ () ->
132
+ self#nearest_image ~pos
133
+ ~last_image:(source#last_image Frame.Fields.video)
134
+ rgb)
135
+ length
136
+ in
137
+ let rgb' = Content.Video.get_data c' in
138
+
139
+ params ();
140
+
141
+ (* Mix content where the two streams are available.
142
+ * We could cut one stream when the other is too short,
143
+ * and/or attempt to get some more data in the buffers...
144
+ * each solution has its downsides and it'll rarely matter
145
+ * because there's usually only one image per video frame. *)
146
+ let data =
147
+ List.map
148
+ (fun (pos, img) ->
149
+ let img = Video.Canvas.Image.render img in
150
+ let img = Image.YUV420.to_RGBA32 img in
151
+ let img' =
152
+ self#nearest_image ~pos
153
+ ~last_image:(source2#last_image Frame.Fields.video)
154
+ rgb'
155
+ in
156
+ let img' = Video.Canvas.Image.render img' in
157
+ let img' = Image.YUV420.to_RGBA32 img' in
158
+ if bgra then Image.RGBA32.swap_rb img;
159
+ if bgra then Image.RGBA32.swap_rb img';
160
+ let src = Image.RGBA32.data (Image.RGBA32.copy img) in
161
+ let src' = Image.RGBA32.data img' in
162
+ let dst = Image.RGBA32.data img in
163
+ Frei0r.update2 instance t src src' dst;
164
+ if bgra then Image.RGBA32.swap_rb img;
165
+ let img = Image.YUV420.of_RGBA32 img in
166
+ t <- t +. dt;
167
+ (pos, Video.Canvas.Image.make img))
168
+ rgb.Content.Video.data
169
+ in
170
+ source#set_frame_data Frame.Fields.video Content.Video.lift_data
171
+ { rgb with Content.Video.data }
156
172
  end
157
173
 
158
174
  class frei0r_source ~name bgra instance params =
@@ -162,33 +178,39 @@ class frei0r_source ~name bgra instance params =
162
178
  inherit source ~name:("frei0r." ^ name) ()
163
179
  method seek_source = (self :> Source.source)
164
180
  method stype = `Infallible
165
- method private _is_ready ?frame:_ _ = true
181
+ method private can_generate_frame = true
166
182
  method self_sync = (`Static, false)
167
183
  val mutable must_fail = false
168
184
  method abort_track = must_fail <- true
169
185
  method remaining = if must_fail then 0 else -1
170
186
  val mutable t = 0.
171
187
 
172
- method private get_frame frame =
188
+ method private render_image img =
189
+ let img = Video.Canvas.Image.render img in
190
+ let img = Image.YUV420.to_RGBA32 img in
191
+ let dst = Image.RGBA32.data img in
192
+ Frei0r.update0 instance t dst;
193
+ if bgra then Image.RGBA32.swap_rb img;
194
+ let img = Image.YUV420.of_RGBA32 img in
195
+ t <- t +. dt;
196
+ Video.Canvas.Image.make img
197
+
198
+ method private generate_frame =
173
199
  if must_fail then (
174
200
  must_fail <- false;
175
- VFrame.add_break frame (VFrame.position frame))
201
+ self#end_of_track)
176
202
  else (
177
203
  params ();
178
- let start = VFrame.position frame in
179
- let stop = VFrame.size () in
180
- let rgb = VFrame.data frame in
181
- for i = start to stop - 1 do
182
- let img = Video.Canvas.render rgb i in
183
- let img = Image.YUV420.to_RGBA32 img in
184
- let dst = Image.RGBA32.data img in
185
- Frei0r.update0 instance t dst;
186
- if bgra then Image.RGBA32.swap_rb img;
187
- let img = Image.YUV420.of_RGBA32 img in
188
- Video.Canvas.put rgb i img;
189
- t <- t +. dt
190
- done;
191
- VFrame.add_break frame stop)
204
+ let length = Lazy.force Frame.size in
205
+ let buf = Frame.create ~length self#content_type in
206
+ let rgb = self#generate_video ~field:Frame.Fields.video length in
207
+ let data =
208
+ List.map
209
+ (fun (pos, img) -> (pos, self#render_image img))
210
+ rgb.Content.Video.data
211
+ in
212
+ Frame.set_data buf Frame.Fields.video Content.Video.lift_data
213
+ { rgb with Content.Video.data })
192
214
  end
193
215
 
194
216
  (** Make a list of parameters. *)
@@ -303,7 +325,7 @@ let register_plugin fname =
303
325
  let explanation =
304
326
  let e = info.Frei0r.explanation in
305
327
  let e = String.capitalize_ascii e in
306
- let e = Pcre.substitute ~pat:"@" ~subst:(fun _ -> "(at)") e in
328
+ let e = Pcre.substitute ~rex:(Pcre.regexp "@") ~subst:(fun _ -> "(at)") e in
307
329
  if e = "" then e
308
330
  else if e.[String.length e - 1] = '.' then
309
331
  String.sub e 0 (String.length e - 1)
@@ -311,7 +333,7 @@ let register_plugin fname =
311
333
  in
312
334
  let author =
313
335
  let a = info.Frei0r.author in
314
- let a = Pcre.substitute ~pat:"@" ~subst:(fun _ -> "(at)") a in
336
+ let a = Pcre.substitute ~rex:(Pcre.regexp "@") ~subst:(fun _ -> "(at)") a in
315
337
  a
316
338
  in
317
339
  let descr = Printf.sprintf "%s (by %s)." explanation author in
@@ -29,7 +29,7 @@ class gate ~threshold ~attack ~release ~hold ~range ~window (source : source) =
29
29
  method stype = source#stype
30
30
  method remaining = source#remaining
31
31
  method seek_source = source#seek_source
32
- method private _is_ready = source#is_ready
32
+ method private can_generate_frame = source#is_ready
33
33
  method abort_track = source#abort_track
34
34
  method self_sync = source#self_sync
35
35
 
@@ -47,11 +47,11 @@ class gate ~threshold ~attack ~release ~hold ~range ~window (source : source) =
47
47
  val mutable hold_delay =
48
48
  int_of_float (hold () *. float (Lazy.force Frame.audio_rate))
49
49
 
50
- method private get_frame buf =
51
- let offset = AFrame.position buf in
52
- source#get buf;
53
- let position = AFrame.position buf in
54
- let buf = AFrame.pcm buf in
50
+ method private generate_frame =
51
+ let buf =
52
+ Content.Audio.get_data (source#get_mutable_content Frame.Fields.audio)
53
+ in
54
+ let position = self#frame_audio_position in
55
55
  let chans = self#audio_channels in
56
56
  let samplerate = float (Lazy.force Frame.audio_rate) in
57
57
  let attack = attack () in
@@ -63,7 +63,7 @@ class gate ~threshold ~attack ~release ~hold ~range ~window (source : source) =
63
63
  let window_coef = 1. -. exp (-1. /. (window () *. samplerate)) in
64
64
  let range = range () in
65
65
  let hold = int_of_float (hold () *. samplerate) in
66
- for i = offset to position - 1 do
66
+ for i = 0 to position - 1 do
67
67
  let x =
68
68
  let x = ref 0. in
69
69
  for c = 0 to chans - 1 do
@@ -95,7 +95,8 @@ class gate ~threshold ~attack ~release ~hold ~range ~window (source : source) =
95
95
  for c = 0 to chans - 1 do
96
96
  buf.(c).(i) <- buf.(c).(i) *. gain
97
97
  done
98
- done
98
+ done;
99
+ source#set_frame_data Frame.Fields.audio Content.Audio.lift_data buf
99
100
  end
100
101
 
101
102
  let _ =
@@ -415,14 +415,13 @@ class iir (source : source) filter_family filter_type order freq1 freq2 qfactor
415
415
  method remaining = source#remaining
416
416
  method seek_source = source#seek_source
417
417
  method self_sync = source#self_sync
418
- method private _is_ready = source#is_ready
418
+ method private can_generate_frame = source#is_ready
419
419
  method abort_track = source#abort_track
420
420
  val mutable v_offs = 0
421
421
 
422
- method private get_frame buf =
423
- let offset = AFrame.position buf in
424
- source#get buf;
425
- let b = AFrame.pcm buf in
422
+ method private generate_frame =
423
+ let c = source#get_mutable_content Frame.Fields.audio in
424
+ let b = Content.Audio.get_data c in
426
425
  let v_len = Array.length xv.(0) in
427
426
  let coeffs_len = Array.length xcoeffs in
428
427
  let fold_left2 init v coeffs l =
@@ -437,7 +436,7 @@ class iir (source : source) filter_family filter_type order freq1 freq2 qfactor
437
436
  let xvc = xv.(c) in
438
437
  let yvc = yv.(c) in
439
438
  let bc = b.(c) in
440
- for i = offset to AFrame.position buf - 1 do
439
+ for i = 0 to source#frame_audio_position - 1 do
441
440
  v_offs <- (v_offs + 1) mod v_len;
442
441
  xvc.((coeffs_len - 1 + v_offs) mod v_len) <- bc.(i) /. gain;
443
442
  let insert =
@@ -447,7 +446,8 @@ class iir (source : source) filter_family filter_type order freq1 freq2 qfactor
447
446
  yvc.((coeffs_len - 1 + v_offs) mod v_len) <- insert;
448
447
  bc.(i) <- insert
449
448
  done
450
- done
449
+ done;
450
+ source#set_frame_data Frame.Fields.audio Content.Audio.lift_data b
451
451
  end
452
452
 
453
453
  let filter_iir = Lang.add_module ~base:Filter.filter "iir"
@@ -26,53 +26,33 @@ exception Error
26
26
 
27
27
  (* This is an internal operator. *)
28
28
  class insert_metadata source =
29
- object (self)
29
+ object
30
30
  inherit operator ~name:"insert_metadata" [source]
31
31
  method stype = source#stype
32
- method private _is_ready = source#is_ready
32
+ method private can_generate_frame = source#is_ready
33
33
  method remaining = source#remaining
34
34
  method seek_source = source#seek_source
35
35
  method abort_track = source#abort_track
36
36
  method self_sync = source#self_sync
37
- val mutable metadata = None
38
- val mutable new_track = false
39
- val lock_m = Mutex.create ()
40
- val mutable ns = []
41
-
42
- method insert_metadata nt m : unit =
43
- Mutex.lock lock_m;
44
- metadata <- Some m;
45
- new_track <- nt;
46
- Mutex.unlock lock_m
47
-
48
- method private add_metadata frame pos =
49
- Tutils.mutexify lock_m
50
- (fun () ->
51
- (match (metadata, Frame.get_metadata frame pos) with
52
- | Some m, None ->
53
- metadata <- None;
54
- Frame.set_metadata frame pos m
55
- | _ -> ());
56
- metadata <- None)
57
- ()
58
-
59
- method private insert_track =
60
- Tutils.mutexify lock_m
61
- (fun () ->
62
- let ret = new_track in
63
- new_track <- false;
64
- ret)
65
- ()
66
-
67
- method private get_frame buf =
68
- let p = Frame.position buf in
69
- if self#insert_track then Frame.add_break buf p
70
- else (
71
- (* Insert new metadata _after_ the call to #get
72
- otherwise, it will be visible to sources under
73
- this one! See: #1115 *)
74
- source#get buf;
75
- self#add_metadata buf p)
37
+ val metadata = Atomic.make None
38
+
39
+ method insert_metadata ~new_track m =
40
+ Atomic.set metadata (Some (new_track, m))
41
+
42
+ method private generate_frame =
43
+ let buf = source#get_frame in
44
+ match Atomic.exchange metadata None with
45
+ | Some (new_track, m) ->
46
+ let m =
47
+ Frame.Metadata.append
48
+ (Option.value ~default:Frame.Metadata.empty
49
+ (Frame.get_metadata buf 0))
50
+ m
51
+ in
52
+ let buf = Frame.add_metadata buf 0 m in
53
+ if new_track then Frame.(add_track_mark (drop_track_marks buf)) 0
54
+ else buf
55
+ | None -> buf
76
56
  end
77
57
 
78
58
  let _ =
@@ -98,7 +78,7 @@ let _ =
98
78
  (fun p ->
99
79
  let m = Lang.to_metadata (List.assoc "" p) in
100
80
  let new_track = Lang.to_bool (List.assoc "new_track" p) in
101
- s#insert_metadata new_track m;
81
+ s#insert_metadata ~new_track m;
102
82
  Lang.unit) );
103
83
  ]
104
84
  ~return_t
@@ -121,22 +101,17 @@ class replay meta src =
121
101
  inherit operator ~name:"replay_metadata" [src]
122
102
  val mutable first = true
123
103
  method stype = src#stype
124
- method private _is_ready = src#is_ready
104
+ method private can_generate_frame = src#is_ready
125
105
  method abort_track = src#abort_track
126
106
  method remaining = src#remaining
127
107
  method self_sync = src#self_sync
128
108
  method seek_source = src#seek_source
129
109
 
130
- method private get_frame ab =
131
- let start = Frame.position ab in
132
- src#get ab;
133
- let stop = Frame.position ab in
110
+ method private generate_frame =
111
+ let buf = src#get_frame in
134
112
  if first then (
135
- if
136
- List.filter
137
- (fun (pos, _) -> start <= pos && pos <= stop)
138
- (Frame.get_all_metadata ab)
139
- = []
140
- then Frame.set_metadata ab start meta;
141
- first <- false)
113
+ first <- false;
114
+ if Frame.get_all_metadata buf = [] then Frame.add_metadata buf 0 meta
115
+ else buf)
116
+ else buf
142
117
  end
@@ -23,6 +23,7 @@
23
23
  open Mm
24
24
  open Source
25
25
  open Ladspa
26
+ module Pcre = Re.Pcre
26
27
 
27
28
  module String = struct
28
29
  include String
@@ -63,7 +64,7 @@ class virtual base source =
63
64
  method stype = source#stype
64
65
  method remaining = source#remaining
65
66
  method seek_source = source#seek_source
66
- method private _is_ready = source#is_ready
67
+ method private can_generate_frame = source#is_ready
67
68
  method self_sync = source#self_sync
68
69
  method abort_track = source#abort_track
69
70
  end
@@ -73,7 +74,7 @@ class virtual base_nosource =
73
74
  inherit source ~name:"ladspa" ()
74
75
  method seek_source = (self :> Source.source)
75
76
  method stype = `Infallible
76
- method private _is_ready ?frame:_ _ = true
77
+ method private can_generate_frame = true
77
78
  method self_sync = (`Static, false)
78
79
  val mutable must_fail = false
79
80
  method abort_track = must_fail <- true
@@ -111,23 +112,23 @@ class ladspa_mono (source : source) plugin descr input output params =
111
112
  Array.iter Descriptor.activate i;
112
113
  inst <- Some i
113
114
 
114
- method private get_frame buf =
115
- let offset = AFrame.position buf in
116
- source#get buf;
117
- let b = AFrame.pcm buf in
118
- let position = AFrame.position buf in
119
- let len = position - offset in
115
+ method private generate_frame =
116
+ let b =
117
+ Content.Audio.get_data (source#get_mutable_content Frame.Fields.audio)
118
+ in
119
+ let len = source#frame_audio_position in
120
120
  let inst = Option.get inst in
121
121
  for c = 0 to Array.length b - 1 do
122
- let buf = Audio.Mono.to_ba b.(c) offset len in
122
+ let buf = Audio.Mono.to_ba b.(c) 0 len in
123
123
  Descriptor.connect_port inst.(c) input buf;
124
124
  Descriptor.connect_port inst.(c) output buf;
125
125
  List.iter
126
126
  (fun (p, v) -> Descriptor.set_control_port inst.(c) p (v ()))
127
127
  params;
128
128
  Descriptor.run inst.(c) len;
129
- Audio.Mono.copy_from_ba buf b.(c) offset len
130
- done
129
+ Audio.Mono.copy_from_ba buf b.(c) 0 len
130
+ done;
131
+ source#set_frame_data Frame.Fields.audio Content.Audio.lift_data b
131
132
  end
132
133
 
133
134
  class ladspa (source : source) plugin descr inputs outputs params =
@@ -141,13 +142,12 @@ class ladspa (source : source) plugin descr inputs outputs params =
141
142
 
142
143
  initializer Descriptor.activate inst
143
144
 
144
- method private get_frame buf =
145
- let offset = AFrame.position buf in
146
- source#get buf;
147
- let b = AFrame.pcm buf in
148
- let position = AFrame.position buf in
149
- let len = position - offset in
150
- let ba = Audio.to_ba b offset len in
145
+ method private generate_frame =
146
+ let b =
147
+ Content.Audio.get_data (source#get_mutable_content Frame.Fields.audio)
148
+ in
149
+ let len = source#frame_audio_position in
150
+ let ba = Audio.to_ba b 0 len in
151
151
  List.iter (fun (p, v) -> Descriptor.set_control_port inst p (v ())) params;
152
152
  if Array.length inputs = Array.length outputs then (
153
153
  (* The simple case: number of channels does not get changed. *)
@@ -156,23 +156,23 @@ class ladspa (source : source) plugin descr inputs outputs params =
156
156
  Descriptor.connect_port inst outputs.(c) ba.(c)
157
157
  done;
158
158
  Descriptor.run inst len;
159
- Audio.copy_from_ba ba b offset len)
159
+ Audio.copy_from_ba ba b 0 len)
160
160
  else (
161
161
  (* We have to change channels. *)
162
162
  for c = 0 to Array.length b - 1 do
163
163
  Descriptor.connect_port inst inputs.(c) ba.(c)
164
164
  done;
165
- let d = AFrame.pcm buf in
166
- let dba = Audio.to_ba d offset len in
167
- for c = 0 to Array.length d - 1 do
165
+ let dba = Audio.to_ba b 0 len in
166
+ for c = 0 to Array.length b - 1 do
168
167
  Descriptor.connect_port inst outputs.(c) dba.(c)
169
168
  done;
170
169
  Descriptor.run inst len;
171
- Audio.copy_from_ba dba d offset len)
170
+ Audio.copy_from_ba dba b 0 len);
171
+ source#set_frame_data Frame.Fields.audio Content.Audio.lift_data b
172
172
  end
173
173
 
174
174
  class ladspa_nosource plugin descr outputs params =
175
- object
175
+ object (self)
176
176
  inherit base_nosource
177
177
 
178
178
  val inst =
@@ -182,25 +182,25 @@ class ladspa_nosource plugin descr outputs params =
182
182
 
183
183
  initializer Descriptor.activate inst
184
184
 
185
- method private get_frame buf =
185
+ method private generate_frame =
186
186
  if must_fail then (
187
- AFrame.add_break buf (AFrame.position buf);
188
- must_fail <- false)
187
+ must_fail <- false;
188
+ self#end_of_track)
189
189
  else (
190
- let offset = AFrame.position buf in
191
- let b = AFrame.pcm buf in
192
- let position = AFrame.size () in
193
- let len = position - offset in
190
+ let length = Lazy.force Frame.size in
191
+ let buf = Frame.create ~length self#content_type in
192
+ let b = Content.Audio.get_data (Frame.get buf Frame.Fields.audio) in
194
193
  List.iter
195
194
  (fun (p, v) -> Descriptor.set_control_port inst p (v ()))
196
195
  params;
197
- let ba = Audio.to_ba b offset len in
196
+ let alen = Frame.audio_of_main length in
197
+ let ba = Audio.to_ba b 0 alen in
198
198
  for c = 0 to Array.length b - 1 do
199
199
  Descriptor.connect_port inst outputs.(c) ba.(c)
200
200
  done;
201
- Descriptor.run inst len;
202
- Audio.copy_from_ba ba b offset len;
203
- AFrame.add_break buf position)
201
+ Descriptor.run inst alen;
202
+ Audio.copy_from_ba ba b 0 alen;
203
+ Frame.set_data buf Frame.Fields.audio Content.Audio.lift_data b)
204
204
  end
205
205
 
206
206
  (* List the indexes of control ports. *)
@@ -321,7 +321,9 @@ let register_descr plugin_name descr_n d inputs outputs =
321
321
  @ if ni = 0 then [] else [("", Lang.source_t input_t, None, None)]
322
322
  in
323
323
  let maker = Descriptor.maker d in
324
- let maker = Pcre.substitute ~pat:"@" ~subst:(fun _ -> "(at)") maker in
324
+ let maker =
325
+ Pcre.substitute ~rex:(Pcre.regexp "@") ~subst:(fun _ -> "(at)") maker
326
+ in
325
327
  let descr = Printf.sprintf "%s by %s." (Descriptor.name d) maker in
326
328
  let return_t =
327
329
  if mono then input_t