[totem/wip/hadess/simplify-text-sub: 9/10] backend: Restore audio track when adding a text subtitle
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem/wip/hadess/simplify-text-sub: 9/10] backend: Restore audio track when adding a text subtitle
- Date: Sun, 13 Feb 2022 12:08:38 +0000 (UTC)
commit 9fba65fe42e4ff3d1b42e3f71aae0e2cb8c96775
Author: Bastien Nocera <hadess hadess net>
Date: Fri Feb 11 19:03:43 2022 +0100
backend: Restore audio track when adding a text subtitle
Closes: #226
src/backend/bacon-video-widget.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index 9814d1e7f..554a74c78 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -3940,6 +3940,7 @@ bacon_video_widget_set_text_subtitle (BaconVideoWidget * bvw,
const gchar * subtitle_uri)
{
GstState cur_state;
+ int lang;
g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
g_return_if_fail (GST_IS_ELEMENT (bvw->play));
@@ -3951,6 +3952,9 @@ bacon_video_widget_set_text_subtitle (BaconVideoWidget * bvw,
bvw->subtitle_uri == NULL)
return;
+ /* Save current audio track */
+ lang = bacon_video_widget_get_language (bvw);
+
/* Wait for the previous state change to finish */
gst_element_get_state (bvw->play, NULL, NULL, GST_CLOCK_TIME_NONE);
@@ -3973,9 +3977,11 @@ bacon_video_widget_set_text_subtitle (BaconVideoWidget * bvw,
gst_element_get_state (bvw->play, NULL, NULL, GST_CLOCK_TIME_NONE);
}
- if (bvw->current_time > 0)
+ if (bvw->current_time > 0) {
bacon_video_widget_seek_time_no_lock (bvw, bvw->current_time,
GST_SEEK_FLAG_ACCURATE, NULL);
+ bacon_video_widget_set_language (bvw, lang);
+ }
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]