Skip to content

Commit

Permalink
Fix metadata in cue cut. (#3615)
Browse files Browse the repository at this point in the history
  • Loading branch information
toots authored Jan 6, 2024
1 parent b7658d7 commit c31df34
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/operators/cuepoint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ class cue_cut ~m_cue_in ~m_cue_out ~on_cue_in ~on_cue_out source_val =
in

let buf = Frame.add_track_mark buf 0 in
let buf =
match (Frame.get_all_metadata buf, source#last_metadata) with
| [], Some m -> Frame.add_metadata buf 0 m
| _ -> buf
in

match out_pos with
| None ->
Expand Down
16 changes: 16 additions & 0 deletions tests/streams/cue-cut-meta.liq
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
def check() =
s = playlist(prefix="annotate:liq_cue_in=0.1,foo=bla:", "playlist")

s = cue_cut(s)

s =
source.on_metadata(
s, fun (m) -> if m["foo"] == "bla" then test.pass() else test.fail() end
)

output.dummy(fallible=true, s)

thread.run(delay=3., test.fail)
end

test.check(check)
29 changes: 29 additions & 0 deletions tests/streams/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,35 @@
(:run_test ../run_test.exe))
(action (run %{run_test} ctype2.liq liquidsoap %{test_liq} ctype2.liq)))

(rule
(alias citest)
(package liquidsoap)
(deps
cue-cut-meta.liq
./file1.mp3
./file2.mp3
./file3.mp3
./jingle1.mp3
./jingle2.mp3
./jingle3.mp3
./file1.png
./file2.png
./jingles
./playlist
./huge_playlist
./replaygain_track_gain.mp3
./r128_track_gain.mp3
./replaygain_r128_track_gain.mp3
./replaygain_track_gain.opus
./r128_track_gain.opus
./replaygain_r128_track_gain.opus
./without_replaygain_track_gain.mp3
../../src/bin/liquidsoap.exe
(package liquidsoap)
(:test_liq ../test.liq)
(:run_test ../run_test.exe))
(action (run %{run_test} cue-cut-meta.liq liquidsoap %{test_liq} cue-cut-meta.liq)))

(rule
(alias citest)
(package liquidsoap)
Expand Down

0 comments on commit c31df34

Please sign in to comment.