Skip to content

Commit

Permalink
Set video title using taginject element
Browse files Browse the repository at this point in the history
  • Loading branch information
d-k-bo committed Oct 23, 2024
1 parent 31f8130 commit 9aca4b2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ eyre = "0.6.12"
futures-util = "0.3.31"
gettext-rs = { version = "0.7", features = ["gettext-system"] }
gsettings-macro = "0.2.1"
gst = { version = "0.23.2", package = "gstreamer", features = ["v1_24"] }
gtk = { version = "0.9.2", package = "gtk4", features = ["gnome_46", "blueprint"] }
gvdb-macros = "0.1.13"
html2pango = "0.6.0"
Expand Down
15 changes: 15 additions & 0 deletions src/player.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ mod imp {
));

let slf = self.obj();

let taginject = gst::ElementFactory::make("taginject")
.property("scope", gst::TagScope::Global)
.build()
.expect("failed to create `taginject` element");
self.video
.player()
.expect("should not be nullable")
.set_video_filter(Some(&taginject));
slf.connect_title_notify(glib::clone!(
#[weak]
taginject,
move |slf| taginject.set_property("tags", format!("title={}", slf.title()))
));

self.video.connect_toggle_fullscreen(glib::clone!(
#[weak]
slf,
Expand Down

0 comments on commit 9aca4b2

Please sign in to comment.