[totem/wip/hadess/track-lists: 6/7] backend: Add bacon_video_toggle_subtitles()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/track-lists: 6/7] backend: Add bacon_video_toggle_subtitles()
- Date: Fri, 11 Feb 2022 17:33:13 +0000 (UTC)
commit 35baa6f759c18815a565e7f0509e756c472fd2f2
Author: Bastien Nocera <hadess hadess net>
Date: Fri Feb 11 18:23:07 2022 +0100
backend: Add bacon_video_toggle_subtitles()
src/backend/bacon-video-widget.c | 23 +++++++++++++++++++++++
src/backend/bacon-video-widget.h | 1 +
2 files changed, 24 insertions(+)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index 4fc4d41f0..3d9e6ad29 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -2671,6 +2671,29 @@ bacon_video_widget_set_subtitle (BaconVideoWidget * bvw, int subtitle)
}
}
+/**
+ * bacon_video_toggle_subtitles:
+ * @bvw: a #BaconVideoWidget
+ *
+ * Toggles the visibility of subtitles.
+ **/
+void
+bacon_video_toggle_subtitles (BaconVideoWidget *bvw)
+{
+ guint flags;
+
+ g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
+ g_return_if_fail (bvw->play != NULL);
+
+ g_object_get (bvw->play, "flags", &flags, NULL);
+ if (flags & GST_PLAY_FLAG_TEXT)
+ flags &= ~GST_PLAY_FLAG_TEXT;
+ else
+ flags |= GST_PLAY_FLAG_TEXT;
+ g_object_set (bvw->play, "flags", flags, NULL);
+ g_signal_emit (bvw, bvw_signals[SIGNAL_SUBTITLES_CHANGED], 0);
+}
+
static BvwLangInfo *
find_next_info_for_id (GList *list,
int current)
diff --git a/src/backend/bacon-video-widget.h b/src/backend/bacon-video-widget.h
index 0e6c77b22..3964c6118 100644
--- a/src/backend/bacon-video-widget.h
+++ b/src/backend/bacon-video-widget.h
@@ -385,6 +385,7 @@ int bacon_video_widget_get_subtitle (BaconVideoWidget *bvw);
void bacon_video_widget_set_subtitle (BaconVideoWidget *bvw,
int subtitle);
void bacon_video_widget_set_next_subtitle (BaconVideoWidget *bvw);
+void bacon_video_toggle_subtitles (BaconVideoWidget *bvw);
gboolean bacon_video_widget_has_next_track (BaconVideoWidget *bvw);
gboolean bacon_video_widget_has_previous_track (BaconVideoWidget *bvw);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]