Support multiple media per layer
Opened this issue · 5 comments
It would be good to have some kind of "playlist" for media. This could be easily(?) implemented by using an array of objects for each layer.
When the first object of the array finishes playback, the next object is started automatically.
You can of course have multiple "layers", each of which is active for the appropriate window of time. (Inactive layers shouldn't actually take any display planes or anything.) Of course you need to know the media length to do that.
In design, I'd been resisting adding "convenience" features to the script format in the service of simplicity, but I've heard other people wanting "once this video is done, do that other thing" (where "do that other thing" is often playing a different video). Of course you can query the info on the video length and set that all up in code... but that's work.
So maybe giving in a little bit and allowing the media to be a list (internally expanding to the separate layers with time windows, probably) would be a worthwhile concession. That does mean querying the media at script load time, but that does get cached, and script re-submission should be quick.
Are these layer hardware planes in terms of KMS? In this case, using multiple layers could be problematic as the number of planes is limited.
Alternatively a bi-directional interface for external programs might be another way to do this, e.g. informing the external process that a video is about to finish.
A DRM/KMS plane will only get used when any given layer is active (they're dynamically assigned as each frame is "built") so the various extra layers are no problem as long as only one is active at a time. (Or two at a time, if you want to overlap them a bit to create crossfade effects or something...)
Understood. Does this also mean if 2 videos don't overlap, they might be rendered on the same DRM/KMS plane? That's would be pretty cool.
Correct. Every frame, pivid assigns DRM/KMS planes from the start for whatever layers are active that frame, in layer order. (Skipping planes that are in use by some other display, if multiple displays are active, since multiple displays flip at different times.)
So even if two videos briefly overlap, once they're done, it will go back to using only the first plane... there's no sticky association of video to plane, it's all assigned frame by frame.