From f3b085ba9ab868b5182b4404b99bc279de00dbf9 Mon Sep 17 00:00:00 2001 From: Thomas Guillem Date: Wed, 4 Aug 2021 13:40:30 +0200 Subject: [PATCH] MediaPlayer: backport 4.0 fast seek argument in setTime/setPosition WARNING: this patch make the "input-fast-seek" option useless. --- buildsystem/compile-medialibrary.sh | 3 + ...ys-use-set_time-set_position-fast-ar.patch | 47 ++++++ libvlc/jni/libvlcjni-mediaplayer.c | 20 +-- ...at-Workaround-sendmsg-bug-on-android.patch | 8 +- ...bvlc-events-Add-callbacks-for-record.patch | 12 +- ...tls-Handle-errors-from-older-kernels.patch | 12 +- ...file-Add-error-dialog-for-write-open.patch | 12 +- ...ibvlc-media_player-Add-record-method.patch | 12 +- ...006-input-es_out-set-video-exclusive.patch | 12 +- ..._ReadLine-increase-line-length-limit.patch | 12 +- ...ract-attachment-also-when-preparsing.patch | 12 +- ...t-display-discoverer-preparsers-logs.patch | 12 +- ...4.0-patches-to-allow-preparsing-of-n.patch | 12 +- ...ibass-add-support-for-sub-text-scale.patch | 12 +- ...a_player-backport-fast-seek-argument.patch | 135 ++++++++++++++++++ .../src/org/videolan/libvlc/MediaPlayer.java | 19 ++- 16 files changed, 272 insertions(+), 80 deletions(-) create mode 100644 buildsystem/patches/libvlcpp/0001-MediaPlayer-always-use-set_time-set_position-fast-ar.patch create mode 100644 libvlc/patches/vlc3/0012-media_player-backport-fast-seek-argument.patch diff --git a/buildsystem/compile-medialibrary.sh b/buildsystem/compile-medialibrary.sh index d6026a8d2..7409713e0 100755 --- a/buildsystem/compile-medialibrary.sh +++ b/buildsystem/compile-medialibrary.sh @@ -100,6 +100,9 @@ if [ ! -d "${MEDIALIBRARY_MODULE_DIR}/medialibrary" ]; then # git checkout 0.5.x git reset --hard ${MEDIALIBRARY_HASH} git submodule update --init libvlcpp + # TODO: remove when switching to VLC 4.0 + cd libvlcpp + git am ${SRC_DIR}/buildsystem/patches/libvlcpp/* else cd ${MEDIALIBRARY_MODULE_DIR}/medialibrary if ! git cat-file -e ${MEDIALIBRARY_HASH}; then diff --git a/buildsystem/patches/libvlcpp/0001-MediaPlayer-always-use-set_time-set_position-fast-ar.patch b/buildsystem/patches/libvlcpp/0001-MediaPlayer-always-use-set_time-set_position-fast-ar.patch new file mode 100644 index 000000000..ab5ab0ced --- /dev/null +++ b/buildsystem/patches/libvlcpp/0001-MediaPlayer-always-use-set_time-set_position-fast-ar.patch @@ -0,0 +1,47 @@ +From 3e02d1956f4859ed915e6b25be70227bbd6f3492 Mon Sep 17 00:00:00 2001 +From: Thomas Guillem +Date: Mon, 9 Aug 2021 13:29:56 +0200 +Subject: [PATCH] MediaPlayer: always use set_time/set_position fast argument + +--- + vlcpp/MediaPlayer.hpp | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/vlcpp/MediaPlayer.hpp b/vlcpp/MediaPlayer.hpp +index 24aeb24..9d8eecd 100644 +--- a/vlcpp/MediaPlayer.hpp ++++ b/vlcpp/MediaPlayer.hpp +@@ -31,6 +31,8 @@ + + #include "common.hpp" + ++#define FORCE_FASTSEEK_API ++ + namespace VLC + { + +@@ -339,8 +341,8 @@ public: + * \version{4.x} + * \param b_fast prefer fast seeking or precise seeking + */ +-#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0) +- void setTime(libvlc_time_t i_time, bool b_fast) ++#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0) || defined(FORCE_FASTSEEK_API) ++ void setTime(libvlc_time_t i_time, bool b_fast = false) + { + libvlc_media_player_set_time(*this, i_time, b_fast); + } +@@ -372,8 +374,8 @@ public: + * \version{4.x} + * \param b_fast prefer fast seeking or precise seeking + */ +-#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0) +- void setPosition(float f_pos, bool b_fast) ++#if LIBVLC_VERSION_INT >= LIBVLC_VERSION(4, 0, 0, 0) || defined(FORCE_FASTSEEK_API) ++ void setPosition(float f_pos, bool b_fast = false) + { + libvlc_media_player_set_position(*this, f_pos, b_fast); + } +-- +2.30.2 + diff --git a/libvlc/jni/libvlcjni-mediaplayer.c b/libvlc/jni/libvlcjni-mediaplayer.c index c82580fae..9c678024a 100644 --- a/libvlc/jni/libvlcjni-mediaplayer.c +++ b/libvlc/jni/libvlcjni-mediaplayer.c @@ -432,19 +432,15 @@ Java_org_videolan_libvlc_MediaPlayer_getTime(JNIEnv *env, jobject thiz) } void -Java_org_videolan_libvlc_MediaPlayer_setTime(JNIEnv *env, jobject thiz, - jlong time) +Java_org_videolan_libvlc_MediaPlayer_nativeSetTime(JNIEnv *env, jobject thiz, + jlong time, jboolean fast) { vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz); if (!p_obj) return; -#if defined(LIBVLC_VERSION_MAJOR) && LIBVLC_VERSION_MAJOR < 4 - libvlc_media_player_set_time(p_obj->u.p_mp, time); -#else - libvlc_media_player_set_time(p_obj->u.p_mp, time, false); -#endif + libvlc_media_player_set_time(p_obj->u.p_mp, time, fast); } jfloat @@ -459,19 +455,15 @@ Java_org_videolan_libvlc_MediaPlayer_getPosition(JNIEnv *env, jobject thiz) } void -Java_org_videolan_libvlc_MediaPlayer_setPosition(JNIEnv *env, jobject thiz, - jfloat pos) +Java_org_videolan_libvlc_MediaPlayer_nativeSetPosition(JNIEnv *env, jobject thiz, + jfloat pos, jboolean fast) { vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz); if (!p_obj) return; -#if defined(LIBVLC_VERSION_MAJOR) && LIBVLC_VERSION_MAJOR < 4 - libvlc_media_player_set_position(p_obj->u.p_mp, pos); -#else - libvlc_media_player_set_position(p_obj->u.p_mp, pos, false); -#endif + libvlc_media_player_set_position(p_obj->u.p_mp, pos, fast); } diff --git a/libvlc/patches/vlc3/0001-compat-Workaround-sendmsg-bug-on-android.patch b/libvlc/patches/vlc3/0001-compat-Workaround-sendmsg-bug-on-android.patch index ab3e6056b..e6ca0f665 100644 --- a/libvlc/patches/vlc3/0001-compat-Workaround-sendmsg-bug-on-android.patch +++ b/libvlc/patches/vlc3/0001-compat-Workaround-sendmsg-bug-on-android.patch @@ -1,8 +1,8 @@ -From e089efabc5661354409dcad56f1817c2b1867d9d Mon Sep 17 00:00:00 2001 -Message-Id: +From 725e37106e83190ea20042aa9dc01c1c7646b37d Mon Sep 17 00:00:00 2001 +Message-Id: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Thu, 28 Mar 2019 15:23:48 +0100 -Subject: [PATCH 01/11] compat: Workaround sendmsg bug on android +Subject: [PATCH 01/13] compat: Workaround sendmsg bug on android This only happens on 64bits builds, see compat/sendmsg.c comments Message-Id: @@ -85,5 +85,5 @@ index 010454a01c..1b36e3d574 100644 } # endif -- -2.25.1 +2.30.2 diff --git a/libvlc/patches/vlc3/0002-libvlc-events-Add-callbacks-for-record.patch b/libvlc/patches/vlc3/0002-libvlc-events-Add-callbacks-for-record.patch index 0ab3c3dd7..379dc9785 100644 --- a/libvlc/patches/vlc3/0002-libvlc-events-Add-callbacks-for-record.patch +++ b/libvlc/patches/vlc3/0002-libvlc-events-Add-callbacks-for-record.patch @@ -1,10 +1,10 @@ -From e43b5791caa7ac99f096a1253978fa8a7d9d34ee Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: -References: +From 4ae0d163c5954a4e07bd0e6ad984b17c4eecb288 Mon Sep 17 00:00:00 2001 +Message-Id: <4ae0d163c5954a4e07bd0e6ad984b17c4eecb288.1628587500.git.thomas@gllm.fr> +In-Reply-To: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> +References: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> From: Soomin Lee Date: Thu, 27 Sep 2018 18:40:39 +0200 -Subject: [PATCH 02/11] libvlc: events: Add callbacks for record +Subject: [PATCH 02/13] libvlc: events: Add callbacks for record Message-Id: <5b9396f1f52bbbde75adaf92922b9e45a1fb1e78.1593695247.git.thomas@gllm.fr> Message-Id: <68a0f5e3a48eb05cc647084ec4886986132f83ce.1599040437.git.nicolas@videolabs.io> @@ -80,5 +80,5 @@ index fda1091cc8..ab8be9e05c 100644 return VLC_SUCCESS; } -- -2.25.1 +2.30.2 diff --git a/libvlc/patches/vlc3/0003-network-tls-Handle-errors-from-older-kernels.patch b/libvlc/patches/vlc3/0003-network-tls-Handle-errors-from-older-kernels.patch index 358d8e40d..6ebe8865f 100644 --- a/libvlc/patches/vlc3/0003-network-tls-Handle-errors-from-older-kernels.patch +++ b/libvlc/patches/vlc3/0003-network-tls-Handle-errors-from-older-kernels.patch @@ -1,10 +1,10 @@ -From 94471e415681595e3870833f9cc5c219b1bd5506 Mon Sep 17 00:00:00 2001 -Message-Id: <94471e415681595e3870833f9cc5c219b1bd5506.1627899467.git.nicolas@videolabs.io> -In-Reply-To: -References: +From 139768f14b8a509b1c949974590e3c6b1f54ce5c Mon Sep 17 00:00:00 2001 +Message-Id: <139768f14b8a509b1c949974590e3c6b1f54ce5c.1628587500.git.thomas@gllm.fr> +In-Reply-To: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> +References: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Fri, 29 Mar 2019 10:56:26 +0100 -Subject: [PATCH 03/11] network: tls: Handle errors from older kernels +Subject: [PATCH 03/13] network: tls: Handle errors from older kernels If MSG_FASTOPEN is defined, but turns out to be unimplemented by the underlying kernel (as is the case on android where the NDK claims to @@ -45,5 +45,5 @@ index e054f3f59f..1d8e375245 100644 #else tls->writev = vlc_tls_SocketWrite; -- -2.25.1 +2.30.2 diff --git a/libvlc/patches/vlc3/0004-access_output-file-Add-error-dialog-for-write-open.patch b/libvlc/patches/vlc3/0004-access_output-file-Add-error-dialog-for-write-open.patch index 35030bca4..3278ecab5 100644 --- a/libvlc/patches/vlc3/0004-access_output-file-Add-error-dialog-for-write-open.patch +++ b/libvlc/patches/vlc3/0004-access_output-file-Add-error-dialog-for-write-open.patch @@ -1,10 +1,10 @@ -From b2a2a2e57dda5775d5de64290eaec8cbde7fbdef Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: -References: +From e7cc17f80b5cb0b1c4ef2303a4659053431b2788 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> +References: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> From: Soomin Lee Date: Mon, 1 Oct 2018 15:37:57 +0200 -Subject: [PATCH 04/11] access_output: file: Add error dialog for write/open +Subject: [PATCH 04/13] access_output: file: Add error dialog for write/open Message-Id: Message-Id: @@ -46,5 +46,5 @@ index ef4f2d18d1..55e4822b90 100644 break; flags &= ~O_EXCL; -- -2.25.1 +2.30.2 diff --git a/libvlc/patches/vlc3/0005-libvlc-media_player-Add-record-method.patch b/libvlc/patches/vlc3/0005-libvlc-media_player-Add-record-method.patch index fa981dfce..dec9574ee 100644 --- a/libvlc/patches/vlc3/0005-libvlc-media_player-Add-record-method.patch +++ b/libvlc/patches/vlc3/0005-libvlc-media_player-Add-record-method.patch @@ -1,10 +1,10 @@ -From 86d05a99255a4669f7d23702236da8621f09b728 Mon Sep 17 00:00:00 2001 -Message-Id: <86d05a99255a4669f7d23702236da8621f09b728.1627899467.git.nicolas@videolabs.io> -In-Reply-To: -References: +From 3cf63adb805bd113b180c41df8494c7a359e741c Mon Sep 17 00:00:00 2001 +Message-Id: <3cf63adb805bd113b180c41df8494c7a359e741c.1628587500.git.thomas@gllm.fr> +In-Reply-To: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> +References: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> From: Soomin Lee Date: Wed, 31 Oct 2018 10:08:55 +0100 -Subject: [PATCH 05/11] libvlc: media_player: Add record method +Subject: [PATCH 05/13] libvlc: media_player: Add record method Message-Id: <4c22fcedd313e51abfc506a8670cd06e3cf6d0e7.1593695247.git.thomas@gllm.fr> Message-Id: <369e9c1443a233fb747af79758de0acde8d6ae53.1599040437.git.nicolas@videolabs.io> @@ -84,5 +84,5 @@ index ab8be9e05c..059e7ed993 100644 + return VLC_SUCCESS; +} -- -2.25.1 +2.30.2 diff --git a/libvlc/patches/vlc3/0006-input-es_out-set-video-exclusive.patch b/libvlc/patches/vlc3/0006-input-es_out-set-video-exclusive.patch index 15e9a07ad..e48867ee8 100644 --- a/libvlc/patches/vlc3/0006-input-es_out-set-video-exclusive.patch +++ b/libvlc/patches/vlc3/0006-input-es_out-set-video-exclusive.patch @@ -1,10 +1,10 @@ -From a3d0ca1d0fee32adb87d72f300b0f2e715fe0a43 Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: -References: +From 160914569d8a4b3ae27b931a2028ec58a37b4be0 Mon Sep 17 00:00:00 2001 +Message-Id: <160914569d8a4b3ae27b931a2028ec58a37b4be0.1628587500.git.thomas@gllm.fr> +In-Reply-To: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> +References: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> From: Thomas Guillem Date: Thu, 2 Jul 2020 15:05:01 +0200 -Subject: [PATCH 06/11] input: es_out: set video exclusive +Subject: [PATCH 06/13] input: es_out: set video exclusive Since there can be only one video at a time for now (only one Surface is supported). @@ -33,5 +33,5 @@ index 5a2b194688..c700f31db5 100644 EsOutPropsInit( &p_sys->audio, true, p_input, ES_OUT_ES_POLICY_EXCLUSIVE, "audio-track-id", "audio-track", "audio-language", "audio" ); -- -2.25.1 +2.30.2 diff --git a/libvlc/patches/vlc3/0007-stream_ReadLine-increase-line-length-limit.patch b/libvlc/patches/vlc3/0007-stream_ReadLine-increase-line-length-limit.patch index 571f5c16a..ba95d8a6c 100644 --- a/libvlc/patches/vlc3/0007-stream_ReadLine-increase-line-length-limit.patch +++ b/libvlc/patches/vlc3/0007-stream_ReadLine-increase-line-length-limit.patch @@ -1,10 +1,10 @@ -From 4c5d2134f93a240bd2fdcecead002e514e86646f Mon Sep 17 00:00:00 2001 -Message-Id: <4c5d2134f93a240bd2fdcecead002e514e86646f.1627899467.git.nicolas@videolabs.io> -In-Reply-To: -References: +From ab4ee97a6102316e29de2932653f17a72477bd4c Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> +References: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> From: Pierre Ynard Date: Mon, 20 Jul 2020 13:11:34 +0200 -Subject: [PATCH 07/11] stream_ReadLine: increase line length limit +Subject: [PATCH 07/13] stream_ReadLine: increase line length limit Very long lines are occasionally encountered in text web resources such as HTML, JSON or other API data. This bumps the hardcoded limit from @@ -38,5 +38,5 @@ index b94279b431..6be87f8551 100644 { stream_priv_t *priv = (stream_priv_t *)s; -- -2.25.1 +2.30.2 diff --git a/libvlc/patches/vlc3/0008-input-Extract-attachment-also-when-preparsing.patch b/libvlc/patches/vlc3/0008-input-Extract-attachment-also-when-preparsing.patch index 7668af810..1d13f7536 100644 --- a/libvlc/patches/vlc3/0008-input-Extract-attachment-also-when-preparsing.patch +++ b/libvlc/patches/vlc3/0008-input-Extract-attachment-also-when-preparsing.patch @@ -1,10 +1,10 @@ -From 3babd8e0a7b22578509f18e15eb52b261fa7ba63 Mon Sep 17 00:00:00 2001 -Message-Id: <3babd8e0a7b22578509f18e15eb52b261fa7ba63.1627899467.git.nicolas@videolabs.io> -In-Reply-To: -References: +From dc967e7c2290936691d530a6e64033fadb81b881 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> +References: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Fri, 29 Nov 2019 15:41:08 +0100 -Subject: [PATCH 08/11] input: Extract attachment also when preparsing +Subject: [PATCH 08/13] input: Extract attachment also when preparsing Message-Id: <90f80f4face6fe96f631651d8c212541a6539a34.1606132271.git.hugo@beauzee.fr> Message-Id: <4e829aba815aa6faf4a8d4ee8076abb8e20c7059.1607001652.git.nicolas@videolabs.io> @@ -1840,5 +1840,5 @@ index a15ba0d923..8ce2287e45 100644 +vlc_input_attachment_Hold +vlc_input_attachment_Release -- -2.25.1 +2.30.2 diff --git a/libvlc/patches/vlc3/0009-input-display-discoverer-preparsers-logs.patch b/libvlc/patches/vlc3/0009-input-display-discoverer-preparsers-logs.patch index 64e3acd84..258e17843 100644 --- a/libvlc/patches/vlc3/0009-input-display-discoverer-preparsers-logs.patch +++ b/libvlc/patches/vlc3/0009-input-display-discoverer-preparsers-logs.patch @@ -1,10 +1,10 @@ -From e4644ba2a7a4a9c3f2f9a11b204d1a25526578b6 Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: -References: +From 81f873502fa31e9e5517496425a23a0697a0e1c6 Mon Sep 17 00:00:00 2001 +Message-Id: <81f873502fa31e9e5517496425a23a0697a0e1c6.1628587500.git.thomas@gllm.fr> +In-Reply-To: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> +References: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> From: Thomas Guillem Date: Thu, 3 Dec 2020 09:56:05 +0100 -Subject: [PATCH 09/11] input: display discoverer/preparsers logs +Subject: [PATCH 09/13] input: display discoverer/preparsers logs Message-Id: <6b6571e1c1999271bf484459195446ec756f1028.1607001652.git.nicolas@videolabs.io> --- @@ -25,5 +25,5 @@ index 51cb215387..fb4020594e 100644 /* Make sure the interaction option is honored */ if( !var_InheritBool( p_input, "interact" ) ) -- -2.25.1 +2.30.2 diff --git a/libvlc/patches/vlc3/0010-taglib-Backport-4.0-patches-to-allow-preparsing-of-n.patch b/libvlc/patches/vlc3/0010-taglib-Backport-4.0-patches-to-allow-preparsing-of-n.patch index 8a85fbec9..b6f9ab977 100644 --- a/libvlc/patches/vlc3/0010-taglib-Backport-4.0-patches-to-allow-preparsing-of-n.patch +++ b/libvlc/patches/vlc3/0010-taglib-Backport-4.0-patches-to-allow-preparsing-of-n.patch @@ -1,10 +1,10 @@ -From e984a0fcad6caa74b31fe0bd6dfaf06cad3e2a18 Mon Sep 17 00:00:00 2001 -Message-Id: -In-Reply-To: -References: +From 143e87709c8889f7e8e40e9a0123e48f06114017 Mon Sep 17 00:00:00 2001 +Message-Id: <143e87709c8889f7e8e40e9a0123e48f06114017.1628587500.git.thomas@gllm.fr> +In-Reply-To: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> +References: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Fri, 12 Mar 2021 11:34:02 +0100 -Subject: [PATCH 10/11] taglib: Backport 4.0 patches to allow preparsing of +Subject: [PATCH 10/13] taglib: Backport 4.0 patches to allow preparsing of network files Cherry-picked from: @@ -763,5 +763,5 @@ index 123d09c94f..04a44c30e8 100644 if( f.isNull() ) return VLC_EGENERIC; -- -2.25.1 +2.30.2 diff --git a/libvlc/patches/vlc3/0011-Revert-codec-libass-add-support-for-sub-text-scale.patch b/libvlc/patches/vlc3/0011-Revert-codec-libass-add-support-for-sub-text-scale.patch index 49c3a08e9..5b1b85e5f 100644 --- a/libvlc/patches/vlc3/0011-Revert-codec-libass-add-support-for-sub-text-scale.patch +++ b/libvlc/patches/vlc3/0011-Revert-codec-libass-add-support-for-sub-text-scale.patch @@ -1,10 +1,10 @@ -From 5ca3cf90e729033fdfa1134e4f040d8d5af53a62 Mon Sep 17 00:00:00 2001 -Message-Id: <5ca3cf90e729033fdfa1134e4f040d8d5af53a62.1627899467.git.nicolas@videolabs.io> -In-Reply-To: -References: +From c99c1440760b4da7fc0bb038d1d77ade3175e83b Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> +References: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> From: Francois Cartegnie Date: Tue, 20 Jul 2021 21:23:13 +0200 -Subject: [PATCH 11/11] Revert "codec: libass: add support for sub-text-scale" +Subject: [PATCH 11/13] Revert "codec: libass: add support for sub-text-scale" This reverts commit 72fd3b20f855198959e0dfb6b331acc5cb4502c6. @@ -101,5 +101,5 @@ index 79cd0615c0..b60f6946e4 100644 const mtime_t i_stream_date = p_subpic->updater.p_sys->i_pts + (i_ts - p_subpic->i_start); int i_changed; -- -2.25.1 +2.30.2 diff --git a/libvlc/patches/vlc3/0012-media_player-backport-fast-seek-argument.patch b/libvlc/patches/vlc3/0012-media_player-backport-fast-seek-argument.patch new file mode 100644 index 000000000..3e7a74f44 --- /dev/null +++ b/libvlc/patches/vlc3/0012-media_player-backport-fast-seek-argument.patch @@ -0,0 +1,135 @@ +From be372d1971f389a25b75995b631d61b82f5d7b4d Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> +References: <725e37106e83190ea20042aa9dc01c1c7646b37d.1628587500.git.thomas@gllm.fr> +From: Thomas Guillem +Date: Wed, 4 Aug 2021 13:33:50 +0200 +Subject: [PATCH 12/13] media_player: backport fast seek argument + +The fast-seek option is not global anymore but related to each seek +requests. +--- + include/vlc/libvlc_media_player.h | 8 ++++++-- + lib/media_player.c | 6 ++++-- + src/input/input.c | 7 +++---- + src/input/input_internal.h | 1 - + 4 files changed, 13 insertions(+), 9 deletions(-) + +diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h +index bc0d1f774c..007a5eb419 100644 +--- a/include/vlc/libvlc_media_player.h ++++ b/include/vlc/libvlc_media_player.h +@@ -801,8 +801,10 @@ LIBVLC_API libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_ + * + * \param p_mi the Media Player + * \param i_time the movie time (in ms). ++ * \param b_fast prefer fast seeking or precise seeking + */ +-LIBVLC_API void libvlc_media_player_set_time( libvlc_media_player_t *p_mi, libvlc_time_t i_time ); ++LIBVLC_API void libvlc_media_player_set_time( libvlc_media_player_t *p_mi, ++ libvlc_time_t i_time, bool b_fast ); + + /** + * Get movie position as percentage between 0.0 and 1.0. +@@ -819,8 +821,10 @@ LIBVLC_API float libvlc_media_player_get_position( libvlc_media_player_t *p_mi ) + * + * \param p_mi the Media Player + * \param f_pos the position ++ * \param b_fast prefer fast seeking or precise seeking + */ +-LIBVLC_API void libvlc_media_player_set_position( libvlc_media_player_t *p_mi, float f_pos ); ++LIBVLC_API void libvlc_media_player_set_position( libvlc_media_player_t *p_mi, ++ float f_pos, bool b_fast ); + + /** + * Set movie chapter (if applicable). +diff --git a/lib/media_player.c b/lib/media_player.c +index 15686ba864..0fd04c5c24 100644 +--- a/lib/media_player.c ++++ b/lib/media_player.c +@@ -1383,7 +1383,7 @@ libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi ) + } + + void libvlc_media_player_set_time( libvlc_media_player_t *p_mi, +- libvlc_time_t i_time ) ++ libvlc_time_t i_time, bool b_fast ) + { + input_thread_t *p_input_thread; + +@@ -1391,12 +1391,13 @@ void libvlc_media_player_set_time( libvlc_media_player_t *p_mi, + if( !p_input_thread ) + return; + ++ var_SetBool( p_input_thread, "input-fast-seek", b_fast ); + var_SetInteger( p_input_thread, "time", to_mtime(i_time) ); + vlc_object_release( p_input_thread ); + } + + void libvlc_media_player_set_position( libvlc_media_player_t *p_mi, +- float position ) ++ float position, bool b_fast ) + { + input_thread_t *p_input_thread; + +@@ -1404,6 +1405,7 @@ void libvlc_media_player_set_position( libvlc_media_player_t *p_mi, + if( !p_input_thread ) + return; + ++ var_SetBool( p_input_thread, "input-fast-seek", b_fast ); + var_SetFloat( p_input_thread, "position", position ); + vlc_object_release( p_input_thread ); + } +diff --git a/src/input/input.c b/src/input/input.c +index fb4020594e..0497f06673 100644 +--- a/src/input/input.c ++++ b/src/input/input.c +@@ -969,7 +969,6 @@ static void StartTitle( input_thread_t * p_input ) + msg_Warn( p_input, "invalid stop-time ignored" ); + priv->i_stop = 0; + } +- priv->b_fast_seek = var_GetBool( p_input, "input-fast-seek" ); + } + + static int SlaveCompare(const void *a, const void *b) +@@ -2010,7 +2009,7 @@ static bool Control( input_thread_t *p_input, + /* Reset the decoders states and clock sync (before calling the demuxer */ + es_out_SetTime( input_priv(p_input)->p_es_out, -1 ); + if( demux_Control( input_priv(p_input)->master->p_demux, DEMUX_SET_POSITION, +- (double) f_pos, !input_priv(p_input)->b_fast_seek ) ) ++ (double) f_pos, !var_GetBool( p_input, "input-fast-seek" ) ) ) + { + msg_Err( p_input, "INPUT_CONTROL_SET_POSITION " + "%2.1f%% failed", (double)(f_pos * 100.f) ); +@@ -2046,7 +2045,7 @@ static bool Control( input_thread_t *p_input, + + i_ret = demux_Control( input_priv(p_input)->master->p_demux, + DEMUX_SET_TIME, i_time, +- !input_priv(p_input)->b_fast_seek ); ++ !var_GetBool( p_input, "input-fast-seek" ) ); + if( i_ret ) + { + int64_t i_length; +@@ -2059,7 +2058,7 @@ static bool Control( input_thread_t *p_input, + f_pos = VLC_CLIP(f_pos, 0.0, 1.0); + i_ret = demux_Control( input_priv(p_input)->master->p_demux, + DEMUX_SET_POSITION, f_pos, +- !input_priv(p_input)->b_fast_seek ); ++ !var_GetBool( p_input, "input-fast-seek" ) ); + } + } + if( i_ret ) +diff --git a/src/input/input_internal.h b/src/input/input_internal.h +index b79df99cac..a43864ef36 100644 +--- a/src/input/input_internal.h ++++ b/src/input/input_internal.h +@@ -103,7 +103,6 @@ typedef struct input_thread_private_t + int64_t i_start; /* :start-time,0 by default */ + int64_t i_stop; /* :stop-time, 0 if none */ + int64_t i_time; /* Current time */ +- bool b_fast_seek;/* :input-fast-seek */ + + /* Output */ + bool b_out_pace_control; /* XXX Move it ot es_sout ? */ +-- +2.30.2 + diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java index 9fb476979..fada058c0 100644 --- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java +++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java @@ -1302,9 +1302,16 @@ public class MediaPlayer extends VLCObject { /** * Sets the movie time (in ms), if any media is being played. * @param time: Time in ms. + * @param fast: Prefer fast seeking or precise seeking * @return the movie time (in ms), or -1 if there is no media. */ - public native long setTime(long time); + public long setTime(long time, boolean fast) { + return nativeSetTime(time, fast); + } + + public long setTime(long time) { + return nativeSetTime(time, false); + } /** * Gets the movie position. @@ -1315,8 +1322,14 @@ public class MediaPlayer extends VLCObject { /** * Sets the movie position. * @param pos: movie position. + * @param fast: Prefer fast seeking or precise seeking */ - public native void setPosition(float pos); + public void setPosition(float pos, boolean fast) { + nativeSetPosition(pos, fast); + } + public void setPosition(float pos) { + nativeSetPosition(pos, false); + } /** * Gets current movie's length in ms. @@ -1404,6 +1417,8 @@ public class MediaPlayer extends VLCObject { } /* JNI */ + public native long nativeSetTime(long time, boolean fast); + public native void nativeSetPosition(float pos, boolean fast); private native void nativeNewFromLibVlc(ILibVLC ILibVLC, AWindow window); private native void nativeNewFromMedia(IMedia media, AWindow window); private native void nativeRelease();