diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1b9d3a6..cc39368 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,3 +18,4 @@ repos: args: ["--", "-Dwarnings"] - id: cargo-test - id: cargo-fmt + exclude: video_player_mpv/ diff --git a/delfin/src/video_player/backends/mod.rs b/delfin/src/video_player/backends/mod.rs index 58ee094..581ba88 100644 --- a/delfin/src/video_player/backends/mod.rs +++ b/delfin/src/video_player/backends/mod.rs @@ -95,6 +95,9 @@ pub trait VideoPlayerBackend: fmt::Debug { /// Set the current audio track. fn set_audio_track(&self, audio_track_id: Option); + /// Set Subtitle scale. + fn set_subtitle_scale(&self, subtitle_scale: f64); + /// Get notified when video player reaches the end of the current video. fn connect_end_of_stream(&mut self, callback: Box); diff --git a/delfin/src/video_player/backends/mpv.rs b/delfin/src/video_player/backends/mpv.rs index d19fdd8..e203ba0 100644 --- a/delfin/src/video_player/backends/mpv.rs +++ b/delfin/src/video_player/backends/mpv.rs @@ -208,6 +208,10 @@ impl VideoPlayerBackend for VideoPlayerBackendMpv { .set_audio_track(audio_track_id.map(|id| id as u32).unwrap_or(0)); } + fn set_subtitle_scale(&self, subtitle_scale: f64) { + self.widget.set_subtitle_scale(subtitle_scale); + } + fn disconnect_signal_handler(&mut self, id: &Uuid) { match self.signal_handler_ids.remove(id) { Some(signal_handler_id) => { diff --git a/video_player_mpv/src/auto/versions.txt b/video_player_mpv/src/auto/versions.txt index 3fcc0d0..44a9254 100644 --- a/video_player_mpv/src/auto/versions.txt +++ b/video_player_mpv/src/auto/versions.txt @@ -1,3 +1,3 @@ Generated by gir (https://github.com/gtk-rs/gir @ 428c880ecf0b) -from sys/build (@ 6aaf92b050cd) +from sys/build (@ c9cffe18b7d6) from sys/gir-files (@ 20031a537e40) diff --git a/video_player_mpv/src/auto/video_player_mpv.rs b/video_player_mpv/src/auto/video_player_mpv.rs index 251548a..7c0839b 100644 --- a/video_player_mpv/src/auto/video_player_mpv.rs +++ b/video_player_mpv/src/auto/video_player_mpv.rs @@ -111,6 +111,13 @@ impl VideoPlayerMpv { } } + #[doc(alias = "vpm_video_player_mpv_set_subtitle_scale")] + pub fn set_subtitle_scale(&self, subtitle_scale: f64) { + unsafe { + ffi::vpm_video_player_mpv_set_subtitle_scale(self.to_glib_none().0, subtitle_scale); + } + } + #[doc(alias = "vpm_video_player_mpv_set_subtitle_track")] pub fn set_subtitle_track(&self, subtitle_track_id: u32) { unsafe { diff --git a/video_player_mpv/sys/build/Vpm-0.0.gir b/video_player_mpv/sys/build/Vpm-0.0.gir index ac0f848..2ff0bb5 100644 --- a/video_player_mpv/sys/build/Vpm-0.0.gir +++ b/video_player_mpv/sys/build/Vpm-0.0.gir @@ -378,6 +378,22 @@ and/or use gtk-doc annotations. --> + + + + + + + + + + + + + + mpv_ctx->handle, "sid", MPV_FORMAT_INT64, &id); } + +void vpm_video_player_mpv_set_subtitle_scale(VpmVideoPlayerMpv *self, + double subtitle_scale) { + mpv_set_option(self->mpv_ctx->handle, "sub-scale", MPV_FORMAT_DOUBLE, + &subtitle_scale); +} diff --git a/video_player_mpv/sys/video-player-mpv/video-player-mpv.h b/video_player_mpv/sys/video-player-mpv/video-player-mpv.h index 222c38d..f67233e 100644 --- a/video_player_mpv/sys/video-player-mpv/video-player-mpv.h +++ b/video_player_mpv/sys/video-player-mpv/video-player-mpv.h @@ -36,4 +36,7 @@ int vpm_video_player_mpv_current_subtitle_track(VpmVideoPlayerMpv *self); void vpm_video_player_mpv_set_subtitle_track(VpmVideoPlayerMpv *self, uint subtitle_track_id); +void vpm_video_player_mpv_set_subtitle_scale(VpmVideoPlayerMpv *self, + double subtitle_scale); + G_END_DECLS