-
-
Notifications
You must be signed in to change notification settings - Fork 73
feat(clapper): prepare for 0.10 #1435
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| #if CLAPPER_0_10 | ||
| private bool enhancer_check (string scheme, string? t_host = null) { | ||
| if (!Clapper.WITH_ENHANCERS_LOADER) return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for information, this is fine cause it might save you from calling .substring (4) below in a (I guess rare) situation where Clapper is compiled without this option, so you can leave it as-is. But other than that (including compiled with but none installed) it is perfectly safe for applications to call Clapper.get_global_enhancer_proxies() - in this case returned GListModel will simply have zero elements and for loop would not execute.
Ohhh, I didn't read the description, I just assumed it would only check the whole value and not treat them as a list, so I dismissed it instantly 😔... Much better than splitting and all! It doesn't look like it matters and it's too early to do optimizations since the API is not done, but I do wonder if it's worth keeping some sort of 'cache'. E.g. "https", "youtube.com": passed Keep that in memory and next time those combinations of scheme and host are checked, instantly return whether it's supported from memory instead of checking all plugins again |
I thought about this too, but unsure how much of a boost you would get here to be worth it. These strings are read during init, then stored in enhancer proxy object, so there is no string dup/free going on. Just saving the amount of time it takes to iterate (currently) up to 3 elements array. |
Co-authored-by: Rafał Dzięgiel <rafostar.github@gmail.com>
Co-authored-by: Rafał Dzięgiel <rafostar.github@gmail.com>
|
In regards of MPRIS moving to enhancers, is there anything I should do here? |
Built-in |
|
Currently something like this: #if CLAPPER_HAVE_MPRIS
ClapperFeature *feature = CLAPPER_FEATURE (clapper_mpris_new (
mpris_name, APP_NAME, APP_ID));
clapper_mpris_set_queue_controllable (CLAPPER_MPRIS (feature), TRUE);
clapper_player_add_feature (player, feature);
gst_object_unref (feature);
#endifBecomes this: ClapperEnhancerProxyList *proxies = clapper_player_get_enhancer_proxies (player);
ClapperEnhancerProxy *proxy;
/* Check if MPRIS enhancer is available */
if ((proxy = clapper_enhancer_proxy_list_get_proxy_by_module (proxies, "clapper-mpris"))) {
/* Allow instances of this proxy target to be created as needed (enable this enhancer) */
clapper_enhancer_proxy_set_target_creation_allowed (proxy, TRUE);
/* Configure application scope properties */
clapper_enhancer_proxy_set_locally (proxy,
"own-name", mpris_name,
"identity", APP_NAME,
"desktop-entry", APP_ID,
"queue-controllable", TRUE, NULL);
gst_object_unref (proxy);
}Optionally, an I also imagine that once this goes live, you might want to build clapper without mpris meson option in your Flathub manifest, since you are gonna get mpris from enhancers extension. I have yet to test whether bindings (including VALA) for that work correctly. |
|
Sounds good to me and it makes sense to move it to enhancers! I'll add this to this PR eventually, after all this is a draft for 0.10 / I expect API changes :) |
Just dropping here links to migration guide(s) in case you ever decide to continue with this PR. No rush. Even with latest Clapper version, Tuba still compiles cleanly (only deprecations warnings). Cheers. |
fix: #1431