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

Support libpeas based plugin system #501

Merged
merged 4 commits into from
Nov 11, 2024
Merged

Support libpeas based plugin system #501

merged 4 commits into from
Nov 11, 2024

Conversation

Rafostar
Copy link
Owner

@Rafostar Rafostar commented Oct 30, 2024

Add a libpeas based plugin system. In order to not be confused with GStreamer plugins, I will be using term enhancers as these are meant to be callable from already present functionalities in Clapper library, enhancing them (possibly using other non-C libraries). These are meant mostly for either not actual playback and/or out of GStreamer scope functionalities.

Currently implemented is CLAPPER_EXTRACTABLE, an interface for creating enhancers that extract data from different sources before letting it be played via GStreamer. Note that absolutely no actual extraction code is shipped as part of the app. For this reason loadable enhancers system was invented.

For now, this is meant to replace gtuber with something (hopefully) easier to maintain by using extractors from different libraries (that others will maintain instead of myself 😆).


Issues:
Needs CLAPPER_USE_PLAYBIN3=1 to play smoothly in HQ - not fixable here, we should change to playbin3 by default for next Clapper release anyway while other apps can already enforce it with env, so not a problem.

Testing:
Both local build and Flatpak package from this PR CI (checks tab) work fine. Windows is currently untested.

@Rafostar
Copy link
Owner Author

Currently, applications can quickly check an enhancer availability with:

gboolean
clapper_enhancer_check (
  GType iface_type,
  const gchar* scheme,
  const gchar* host,
  const gchar** name
)

AND check whether Clapper was even compiled with ability to load enhancers (requires libpeas) by using CLAPPER_WITH_ENHANCERS_LOADER or alternatively get this from pkgconfig.

Example:

gboolean supported = clapper_enhancer_check (CLAPPER_TYPE_EXTRACTABLE, "https", "example.com", NULL);

As requested in: GeopJr/Tuba#1171

ping @GeopJr

@GeopJr
Copy link

GeopJr commented Oct 31, 2024

Sounds good to me, thanks! And I'm interested in maintaining a few extractors probably :)

@Rafostar
Copy link
Owner Author

Rafostar commented Oct 31, 2024

Created a separate repo for enhancer type of plugins here. Also added there an yt-dlp enhancer implementing ClapperExtractable interface from this PR.

I will later update this PR to fix CI with missing dependencies and replace gtuber with this new stuff, so it will be easier to test.

@Rafostar Rafostar force-pushed the libpeas branch 3 times, most recently from 5c36892 to d4c47f9 Compare November 1, 2024 17:08
@Rafostar
Copy link
Owner Author

Rafostar commented Nov 1, 2024

Sounds good to me, thanks! And I'm interested in maintaining a few extractors probably :)

Thanks. Hopefully now most of the hard stuff will be handled by Clapper Enhancer yt-dlp and yt-dlp guys will maintain actual web extraction for us 😄.

Nonetheless, you are (and everyone else) always welcome to contribute (maybe even with new extractors). Now they can be written in C, Vala, Python, GJS and maybe even Rust. I will be moving the ones that are preferred to be custom written over yt-dlp from gtuber repo.

@Rafostar
Copy link
Owner Author

Rafostar commented Nov 1, 2024

The CI now passed, Flatpak was built and... it works! 🎉
I will be updating this PR first comment description with any issues/concerns/todo's I find while testing.

@Rafostar Rafostar force-pushed the libpeas branch 9 times, most recently from 647c991 to cfc80eb Compare November 10, 2024 16:01
@Rafostar
Copy link
Owner Author

Rafostar commented Nov 10, 2024

OK. So what was tested overall now:

  • loading/writing python plugins
  • loading/writing C (compiled) plugins
  • registering internal GStreamer static elements
  • custom URI schemes
  • passing tags, TOC and headers
  • DASH streaming
  • HLS streaming
  • direct video URI playback

In overall, everything "here" seems to work fine. What remains is to add/restore more extractors, but these can be even gradually added later (even after next Clapper version), since its another repo and gtuber can still work as a fallback when installed for the not yet ported things.

@Rafostar Rafostar changed the title WIP: Support libpeas based plugin system Support libpeas based plugin system Nov 10, 2024
@Rafostar Rafostar marked this pull request as ready for review November 10, 2024 17:04
Allow loading external plugins called "Enhancers" that as the name suggests,
enhance Clapper library capabilities.

Currently implemented is a "ClapperExtractable" interface meant to extract
an actual media that GStreamer can later play from an initial input URI.
Additionally, an internal GStreamer elements that work with it are ported/moved
here from "gtuber" library that this functionality replaces.
Also add all required dependencies
Not needed to build the docs, so disable it
Required for enhancers loader
@Rafostar Rafostar merged commit 0a15e70 into master Nov 11, 2024
5 checks passed
@Rafostar Rafostar deleted the libpeas branch November 16, 2024 21:33
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

Successfully merging this pull request may close these issues.

2 participants