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

Allow applications to add a custom/fallback title #500

Closed
d-k-bo opened this issue Oct 23, 2024 · 2 comments
Closed

Allow applications to add a custom/fallback title #500

d-k-bo opened this issue Oct 23, 2024 · 2 comments

Comments

@d-k-bo
Copy link

d-k-bo commented Oct 23, 2024

I'm currently working on adding an integrated video player to Televido using libclapper(-gtk). First of all, thank your for your great work making this possible!

Unfortunately, most of the media that is available via Televido doesn't provide a title tag. This means that ClapperGtk.Titlelabel can't be used to show a reasonable title and MPRIS just displays “Unknown Title”.

As the video title is known from external data, it would be nice if Clapper.MediaItem:title was writable or if there was a different property to provide a fallback title if the media doesn't contain a title tag.

@Rafostar
Copy link
Owner

I'm currently working on adding an integrated video player to d-k-bo/televido#20 using libclapper(-gtk).

Hi, thanks for checking out the Clapper project! 😄

As the video title is known from external data

Applications that "know" the title should use taginject element. Just create it from GStreamer element factory, fill its tags property, then set it as Clapper player video-filter before playing.

This way both ClapperGtk.TitleLabel and MPRIS should display the title you want. You have to set scope to be "global" as this is media title and not stream/track title, so this will require GStreamer 1.24 from you.

provide a fallback title if the media doesn't contain a title tag

In future (taginject) will also handle situations where video has the same tag as the one you injected by setting merge-mode property (from next GStreamer version), so you control which title should be preferred when both are available.

A quick code snippet (python3) for reference:

taginject = Gst.ElementFactory.make('taginject', None)
taginject.props.tags = "title=(string)\"Big Buck Bunny\""
taginject.props.scope = Gst.TagScope.GLOBAL

video.props.player.props.video_filter = taginject

This functionality description is something probably worth adding to the Clapper API documentation 😅

@d-k-bo
Copy link
Author

d-k-bo commented Oct 23, 2024

Wow, thank you, that works flawlessly! I'm impressed that this can be solves in 4 lines of code (well, it translates to 13 lines in my case, but most of it is boilerplate).

I wasn't aware that you could inject GStreamer elements using Clapper.Player:video-filter, especially since forgot that this is considered a “filter” in the GStreamer terminology.

@d-k-bo d-k-bo closed this as completed Oct 23, 2024
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