diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2023-01-11 15:22:01 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2023-01-11 22:31:31 -0800 |
commit | b08baac7e388bf32fefd4f1ab129b28d5fc57aa9 (patch) | |
tree | 51e7b414c88ef5637b038f6747be15898d54618d /src/modules/montage | |
parent | 470305ae1c7b038fa0ad58223a2d48f60158a7bf (diff) |
* turn til_fb_fragment_t.stream into a discrete parameter
This was mostly done out of convenience at the expense of turning
the fragment struct into more of a junk drawer.
But properly cleaning up owned stream pipes on context destroy
makes the inappropriateness of being part of til_fb_fragment_t
glaringly apparent.
Now the stream is just a separate thing passed to context create,
with a reference kept in the context for use throughout. Cleanup
of the owned pipes on the stream supplied to context create is
automagic when the context gets destroyed.
Note that despite there being a stream in the module context, the
stream to use is still supplied to all the rendering family
functions (prepare/render/finish) and it's the passed-in stream
which should be used by these functions. This is done to support
the possibility of switching out the stream frame-to-frame, which
may be interesting. Imagine doing things like a latent stream
and a future stream and switching between them on the fly for
instance. If there's a sequencing composite module, it could
flip between multiple sets of tracks or jump around multiple
streams with the visuals immediately flipping accordingly.
This should fix the --print-pipes crashing issues caused by lack
of cleanup when contexts were removed (like rtv does so often).
Diffstat (limited to 'src/modules/montage')
-rw-r--r-- | src/modules/montage/montage.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/modules/montage/montage.c b/src/modules/montage/montage.c index 6697bc5..3ab944f 100644 --- a/src/modules/montage/montage.c +++ b/src/modules/montage/montage.c @@ -16,10 +16,10 @@ typedef struct montage_context_t { size_t n_modules; } montage_context_t; -static til_module_context_t * montage_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, char *path, til_setup_t *setup); +static til_module_context_t * montage_create_context(til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, char *path, til_setup_t *setup); static void montage_destroy_context(til_module_context_t *context); -static void montage_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan); -static void montage_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr); +static void montage_prepare_frame(til_module_context_t *context, til_stream_t *stream, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan); +static void montage_render_fragment(til_module_context_t *context, til_stream_t *stream, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr); til_module_t montage_module = { @@ -32,13 +32,13 @@ til_module_t montage_module = { }; -static til_module_context_t * montage_create_context(unsigned seed, unsigned ticks, unsigned n_cpus, char *path, til_setup_t *setup) +static til_module_context_t * montage_create_context(til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, char *path, til_setup_t *setup) { const til_module_t **modules, *rtv_module, *compose_module; size_t n_modules; montage_context_t *ctxt; - ctxt = til_module_context_new(sizeof(montage_context_t), seed, ticks, n_cpus, path); + ctxt = til_module_context_new(stream, sizeof(montage_context_t), seed, ticks, n_cpus, path); if (!ctxt) return NULL; @@ -92,7 +92,7 @@ static til_module_context_t * montage_create_context(unsigned seed, unsigned tic (void) til_module_randomize_setup(module, rand_r(&seed), &setup, NULL); /* FIXME errors */ - (void) til_module_create_context(module, rand_r(&seed), ticks, 1, path, setup, &ctxt->contexts[i]); + (void) til_module_create_context(module, stream, rand_r(&seed), ticks, 1, path, setup, &ctxt->contexts[i]); til_setup_free(setup); } @@ -210,13 +210,13 @@ static int montage_fragmenter(til_module_context_t *context, const til_fb_fragme } -static void montage_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan) +static void montage_prepare_frame(til_module_context_t *context, til_stream_t *stream, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan) { *res_frame_plan = (til_frame_plan_t){ .fragmenter = montage_fragmenter }; } -static void montage_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr) +static void montage_render_fragment(til_module_context_t *context, til_stream_t *stream, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr) { montage_context_t *ctxt = (montage_context_t *)context; til_fb_fragment_t *fragment = *fragment_ptr; @@ -227,5 +227,5 @@ static void montage_render_fragment(til_module_context_t *context, unsigned tick return; } - til_module_render(ctxt->contexts[fragment->number], ticks, fragment_ptr); + til_module_render(ctxt->contexts[fragment->number], stream, ticks, fragment_ptr); } |