Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on_end event for video.add_text method #2621

Closed
kessenza opened this issue Sep 15, 2022 · 1 comment
Closed

on_end event for video.add_text method #2621

kessenza opened this issue Sep 15, 2022 · 1 comment
Assignees

Comments

@kessenza
Copy link

kessenza commented Sep 15, 2022

It would be very useful to have an on_end event handler on video.add_text to intercept when text goes out of the screen (with speed >0).
This is useful in particular when cycle=false so we can programmatically change text when one line of text ends.
Note that we can't achieve the same result with very long text and cycle=true because liquidsoap throws exception when it has to deal with text bigger than 1k chars (more or less).
The exception thrown is the following:

22/09/14 20:37:13 [clock.main:4] Source output.url failed while streaming: Failure("FT_Load_Char")!
2022/09/14 20:37:13 [clock.main:4] Raised by primitive operation at Ftlow.render_char in file "freetype/ftlow.ml", line 144, characters 2-60
2022/09/14 20:37:13 [clock.main:4] Called from Freetype.render_char in file "freetype/freetype.ml", line 108, characters 4-56
2022/09/14 20:37:13 [clock.main:4] Called from OFreetype.draw_gen in file "freetype/oFreetype.ml", line 71, characters 21-59
2022/09/14 20:37:13 [clock.main:4] Called from Video_text_camlimages.render_text in file "decoder/text/video_text_camlimages.ml", line 49, characters 4-215
2022/09/14 20:37:13 [clock.main:4] Called from Video_text.text#render_text in file "sources/video_text.ml", line 36, characters 33-74
2022/09/14 20:37:13 [clock.main:4] Called from Video_text.text#synthesize in file "sources/video_text.ml", line 61, characters 8-33
2022/09/14 20:37:13 [clock.main:4] Called from Synthesized.source#get_frame in file "sources/synthesized.ml", line 59, characters 8-37
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#instrumented_get_frame in file "source.ml", line 589, characters 6-24
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#get in file "source.ml", line 660, characters 10-41
2022/09/14 20:37:13 [clock.main:4] Called from VFrame.get_content in file "stream/vFrame.ml", line 45, characters 4-20
2022/09/14 20:37:13 [clock.main:4] Called from Video_effects.base#get_frame in file "operators/video_effects.ml", line 37, characters 12-41
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#instrumented_get_frame in file "source.ml", line 589, characters 6-24
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#get in file "source.ml", line 660, characters 10-41
2022/09/14 20:37:13 [clock.main:4] Called from Available.available#get_frame in file "operators/available.ml", line 40, characters 6-20
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#instrumented_get_frame in file "source.ml", line 589, characters 6-24
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#get in file "source.ml", line 660, characters 10-41
2022/09/14 20:37:13 [clock.main:4] Called from Add.add#get_frame.(fun) in file "operators/add.ml", line 119, characters 12-24
2022/09/14 20:37:13 [clock.main:4] Called from Stdlib__List.fold_left in file "list.ml", line 121, characters 24-34
2022/09/14 20:37:13 [clock.main:4] Called from Add.add#get_frame in file "operators/add.ml", line 108, characters 8-1023
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#instrumented_get_frame in file "source.ml", line 589, characters 6-24
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#get in file "source.ml", line 660, characters 10-41
2022/09/14 20:37:13 [clock.main:4] Called from Add.add#get_frame.(fun) in file "operators/add.ml", line 119, characters 12-24
2022/09/14 20:37:13 [clock.main:4] Called from Stdlib__List.fold_left in file "list.ml", line 121, characters 24-34
2022/09/14 20:37:13 [clock.main:4] Called from Add.add#get_frame in file "operators/add.ml", line 108, characters 8-1023
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#instrumented_get_frame in file "source.ml", line 589, characters 6-24
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#get in file "source.ml", line 660, characters 10-41
2022/09/14 20:37:13 [clock.main:4] Called from Add.add#get_frame.(fun) in file "operators/add.ml", line 119, characters 12-24
2022/09/14 20:37:13 [clock.main:4] Called from Stdlib__List.fold_left in file "list.ml", line 121, characters 24-34
2022/09/14 20:37:13 [clock.main:4] Called from Add.add#get_frame in file "operators/add.ml", line 108, characters 8-1023
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#instrumented_get_frame in file "source.ml", line 589, characters 6-24
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#get in file "source.ml", line 660, characters 10-41
2022/09/14 20:37:13 [clock.main:4] Called from Switch.switch#get_frame in file "operators/switch.ml", line 254, characters 14-39
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#instrumented_get_frame in file "source.ml", line 589, characters 6-24
2022/09/14 20:37:13 [clock.main:4] Called from Source.operator#get in file "source.ml", line 660, characters 10-41
2022/09/14 20:37:13 [clock.main:4] Called from Output.output#output in file "outputs/output.ml", line 166, characters 10-30

But in my opinion this is correct and this is type of issue shouldn't be solved increase text buffer but using different strategies such as on_end event handler.

Alternatively we could have an on_scroll event (where x is passed) to use to change things when a particular x value is reached.

@smimram smimram self-assigned this Sep 16, 2022
@smimram smimram changed the title on_end event for video.add_text method on_end event for video.add_text method Sep 16, 2022
@smimram
Copy link
Member

smimram commented Sep 16, 2022

I have just added an on_cycle option to register a handler when cycling. However it will only work when cycle=true is activated. When this is not the case, see my answer to #2622.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants