diff --git a/buildsystem/get-vlc.sh b/buildsystem/get-vlc.sh index 4d91af92aefe1b186cc432ef090b298828e8c0a6..b6472e378795d6603021de1481e3fc56ca77aad2 100755 --- a/buildsystem/get-vlc.sh +++ b/buildsystem/get-vlc.sh @@ -67,7 +67,7 @@ done # Fetch VLC source # #################### -VLC_TESTED_HASH=488ee616e5c94e516563095c6b3ac3a85cf72871 +VLC_TESTED_HASH=6752d97062d38f79967411d74e194d7dceefdb7f VLC_REPOSITORY=https://code.videolan.org/videolan/vlc.git VLC_BRANCH=master if [ ! -d "vlc" ]; then diff --git a/libvlc/jni/libvlcjni-mediaplayer.c b/libvlc/jni/libvlcjni-mediaplayer.c index 9e91f2b73feb5555646195968d838548badcd42a..9b0ec7a15686d0e2dfb656755cfdb814aa4a6cf0 100644 --- a/libvlc/jni/libvlcjni-mediaplayer.c +++ b/libvlc/jni/libvlcjni-mediaplayer.c @@ -51,9 +51,7 @@ static const libvlc_event_type_t mp_events[] = { libvlc_MediaPlayerSeekableChanged, libvlc_MediaPlayerPausableChanged, libvlc_MediaPlayerLengthChanged, -#ifdef LIBVLC_MEDIA_PLAYER_HAS_RECORDING libvlc_MediaPlayerRecordChanged, -#endif -1, }; @@ -133,12 +131,10 @@ MediaPlayer_event_cb(vlcjni_object *p_obj, const libvlc_event_t *p_ev, case libvlc_MediaPlayerLengthChanged: p_java_event->arg1 = p_ev->u.media_player_length_changed.new_length; break; -#ifdef LIBVLC_MEDIA_PLAYER_HAS_RECORDING case libvlc_MediaPlayerRecordChanged: p_java_event->arg1 = p_ev->u.media_player_record_changed.recording; - p_java_event->argc1 = p_ev->u.media_player_record_changed.file_path; + p_java_event->argc1 = p_ev->u.media_player_record_changed.recorded_file_path; break; -#endif } p_java_event->type = p_ev->type; return true; diff --git a/libvlc/patches/0001-compat-Workaround-sendmsg-bug-on-android.patch b/libvlc/patches/0001-compat-Workaround-sendmsg-bug-on-android.patch index ac859bcd845af0c920dd8c564afd04b0580bfbde..80a831238c3b73b875815032b2559d722f1982f5 100644 --- a/libvlc/patches/0001-compat-Workaround-sendmsg-bug-on-android.patch +++ b/libvlc/patches/0001-compat-Workaround-sendmsg-bug-on-android.patch @@ -1,8 +1,8 @@ -From 74d4a8bf145b38305729f6ab4286a82704732af9 Mon Sep 17 00:00:00 2001 -Message-Id: <74d4a8bf145b38305729f6ab4286a82704732af9.1659517329.git.thomas@gllm.fr> +From 6a9eb21838d7525666a9a306c005307aaef6afb8 Mon Sep 17 00:00:00 2001 +Message-Id: <6a9eb21838d7525666a9a306c005307aaef6afb8.1666876576.git.thomas@gllm.fr> From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr> Date: Thu, 28 Mar 2019 15:23:48 +0100 -Subject: [PATCH 1/7] compat: Workaround sendmsg bug on android +Subject: [PATCH 1/6] compat: Workaround sendmsg bug on android This only happens on 64bits builds, see compat/sendmsg.c comments --- @@ -10,10 +10,10 @@ This only happens on 64bits builds, see compat/sendmsg.c comments 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/posix/filesystem.c b/src/posix/filesystem.c -index 18105a643c..fb4b25672f 100644 +index 2fdebda80de..7985609ee40 100644 --- a/src/posix/filesystem.c +++ b/src/posix/filesystem.c -@@ -350,7 +350,21 @@ ssize_t vlc_sendto(int fd, const void *buf, size_t len, int flags, +@@ -360,7 +360,21 @@ ssize_t vlc_sendto(int fd, const void *buf, size_t len, int flags, .msg_iovlen = 1, }; diff --git a/libvlc/patches/0002-network-tls-Handle-errors-from-older-kernels.patch b/libvlc/patches/0002-network-tls-Handle-errors-from-older-kernels.patch index 60bf744321e42796295ea1471c28ba08fb0acaac..266aa40e3c7d07bbf6ec5c2de53fb4fa01561a80 100644 --- a/libvlc/patches/0002-network-tls-Handle-errors-from-older-kernels.patch +++ b/libvlc/patches/0002-network-tls-Handle-errors-from-older-kernels.patch @@ -1,10 +1,10 @@ -From 15246d91bd07f46642e50d0eb5ef6777670c2e5d Mon Sep 17 00:00:00 2001 -Message-Id: <15246d91bd07f46642e50d0eb5ef6777670c2e5d.1659517329.git.thomas@gllm.fr> -In-Reply-To: <74d4a8bf145b38305729f6ab4286a82704732af9.1659517329.git.thomas@gllm.fr> -References: <74d4a8bf145b38305729f6ab4286a82704732af9.1659517329.git.thomas@gllm.fr> +From 59586d4e6b640a9e43907f06b9c407408d633ff5 Mon Sep 17 00:00:00 2001 +Message-Id: <59586d4e6b640a9e43907f06b9c407408d633ff5.1666876576.git.thomas@gllm.fr> +In-Reply-To: <6a9eb21838d7525666a9a306c005307aaef6afb8.1666876576.git.thomas@gllm.fr> +References: <6a9eb21838d7525666a9a306c005307aaef6afb8.1666876576.git.thomas@gllm.fr> From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr> Date: Fri, 29 Mar 2019 10:56:26 +0100 -Subject: [PATCH 2/7] network: tls: Handle errors from older kernels +Subject: [PATCH 2/6] 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 @@ -21,7 +21,7 @@ expected. 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/stream.c b/src/network/stream.c -index 0990c6190f..cdb6c5f0ef 100644 +index 0990c6190ff..cdb6c5f0ef7 100644 --- a/src/network/stream.c +++ b/src/network/stream.c @@ -385,8 +385,11 @@ static ssize_t vlc_tls_ConnectWrite(vlc_tls_t *tls, diff --git a/libvlc/patches/0003-access_output-file-Add-error-dialog-for-write-open.patch b/libvlc/patches/0003-access_output-file-Add-error-dialog-for-write-open.patch index c656ec5cfbd13ccc9def32126f4e9256a64fe578..171e2e37433b63f6c8cd325821d0dfeab6513ba0 100644 --- a/libvlc/patches/0003-access_output-file-Add-error-dialog-for-write-open.patch +++ b/libvlc/patches/0003-access_output-file-Add-error-dialog-for-write-open.patch @@ -1,17 +1,17 @@ -From 585fe2aa2c1ab8ad994e77c4ab114ddada57c707 Mon Sep 17 00:00:00 2001 -Message-Id: <585fe2aa2c1ab8ad994e77c4ab114ddada57c707.1659517329.git.thomas@gllm.fr> -In-Reply-To: <74d4a8bf145b38305729f6ab4286a82704732af9.1659517329.git.thomas@gllm.fr> -References: <74d4a8bf145b38305729f6ab4286a82704732af9.1659517329.git.thomas@gllm.fr> +From ab586865eef91d953b600c47cb4521fa039ee007 Mon Sep 17 00:00:00 2001 +Message-Id: <ab586865eef91d953b600c47cb4521fa039ee007.1666876576.git.thomas@gllm.fr> +In-Reply-To: <6a9eb21838d7525666a9a306c005307aaef6afb8.1666876576.git.thomas@gllm.fr> +References: <6a9eb21838d7525666a9a306c005307aaef6afb8.1666876576.git.thomas@gllm.fr> From: Soomin Lee <bubu@mikan.io> Date: Mon, 1 Oct 2018 15:37:57 +0200 -Subject: [PATCH 3/7] access_output: file: Add error dialog for write/open +Subject: [PATCH 3/6] access_output: file: Add error dialog for write/open --- modules/access_output/file.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/access_output/file.c b/modules/access_output/file.c -index d4ec686e55..1e86e20f8b 100644 +index d4ec686e559..1e86e20f8be 100644 --- a/modules/access_output/file.c +++ b/modules/access_output/file.c @@ -86,6 +86,9 @@ static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer ) diff --git a/libvlc/patches/0005-input-es_out-set-video-exclusive.patch b/libvlc/patches/0004-input-es_out-set-video-exclusive.patch similarity index 69% rename from libvlc/patches/0005-input-es_out-set-video-exclusive.patch rename to libvlc/patches/0004-input-es_out-set-video-exclusive.patch index e463429a8e53376e9f14ac25612069946978a1fe..7f35e460acc599b07f031e7956bdb84949c5c5c3 100644 --- a/libvlc/patches/0005-input-es_out-set-video-exclusive.patch +++ b/libvlc/patches/0004-input-es_out-set-video-exclusive.patch @@ -1,10 +1,10 @@ -From 2354021f0135e9b84a459dbb0e5af72de4486fa0 Mon Sep 17 00:00:00 2001 -Message-Id: <2354021f0135e9b84a459dbb0e5af72de4486fa0.1659517329.git.thomas@gllm.fr> -In-Reply-To: <74d4a8bf145b38305729f6ab4286a82704732af9.1659517329.git.thomas@gllm.fr> -References: <74d4a8bf145b38305729f6ab4286a82704732af9.1659517329.git.thomas@gllm.fr> +From 2d15baf86fe0cea8255e534ff975ff6aebc128eb Mon Sep 17 00:00:00 2001 +Message-Id: <2d15baf86fe0cea8255e534ff975ff6aebc128eb.1666876576.git.thomas@gllm.fr> +In-Reply-To: <6a9eb21838d7525666a9a306c005307aaef6afb8.1666876576.git.thomas@gllm.fr> +References: <6a9eb21838d7525666a9a306c005307aaef6afb8.1666876576.git.thomas@gllm.fr> From: Thomas Guillem <thomas@gllm.fr> Date: Thu, 2 Jul 2020 15:05:01 +0200 -Subject: [PATCH 5/7] input: es_out: set video exclusive +Subject: [PATCH 4/6] input: es_out: set video exclusive Since there can be only one video at a time for now (only one Surface is supported). @@ -13,7 +13,7 @@ supported). 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/input/es_out.c b/src/input/es_out.c -index 1d9fb33ecd..2280936179 100644 +index cf10e4a409b..4967cae4ceb 100644 --- a/src/input/es_out.c +++ b/src/input/es_out.c @@ -556,7 +556,7 @@ es_out_t *input_EsOutNew( input_thread_t *p_input, input_source_t *main_source, diff --git a/libvlc/patches/0004-libvlc-media_player-Add-record-method.patch b/libvlc/patches/0004-libvlc-media_player-Add-record-method.patch deleted file mode 100644 index 419fd9d666ffd80b8ebeef76c5c5b758e0477df5..0000000000000000000000000000000000000000 --- a/libvlc/patches/0004-libvlc-media_player-Add-record-method.patch +++ /dev/null @@ -1,148 +0,0 @@ -From 7c27188974301bc271dc75718f844749be8b6990 Mon Sep 17 00:00:00 2001 -Message-Id: <7c27188974301bc271dc75718f844749be8b6990.1659517329.git.thomas@gllm.fr> -In-Reply-To: <74d4a8bf145b38305729f6ab4286a82704732af9.1659517329.git.thomas@gllm.fr> -References: <74d4a8bf145b38305729f6ab4286a82704732af9.1659517329.git.thomas@gllm.fr> -From: Thomas Guillem <thomas@gllm.fr> -Date: Wed, 20 Jul 2022 16:44:03 +0200 -Subject: [PATCH 4/7] libvlc: media_player: Add record method - ---- - include/vlc/libvlc_events.h | 9 ++++++++ - include/vlc/libvlc_media_player.h | 14 ++++++++++++ - lib/media_player.c | 36 +++++++++++++++++++++++++++++++ - 3 files changed, 59 insertions(+) - -diff --git a/include/vlc/libvlc_events.h b/include/vlc/libvlc_events.h -index cd5869abb8..924e9016cb 100644 ---- a/include/vlc/libvlc_events.h -+++ b/include/vlc/libvlc_events.h -@@ -31,6 +31,8 @@ - - # ifdef __cplusplus - extern "C" { -+# else -+# include <stdbool.h> - # endif - - typedef struct libvlc_renderer_item_t libvlc_renderer_item_t; -@@ -147,6 +149,7 @@ enum libvlc_event_e { - */ - libvlc_MediaPlayerTitleSelectionChanged, - libvlc_MediaPlayerChapterChanged, -+ libvlc_MediaPlayerRecordChanged, - - /** - * A \link #libvlc_media_t media item\endlink was added to a -@@ -400,6 +403,12 @@ typedef struct libvlc_event_t - const char *device; - } media_player_audio_device; - -+ struct -+ { -+ const char *file_path; -+ bool recording; -+ } media_player_record_changed; -+ - struct - { - libvlc_renderer_item_t *item; -diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h -index 51beb770e3..aea4e23ed4 100644 ---- a/include/vlc/libvlc_media_player.h -+++ b/include/vlc/libvlc_media_player.h -@@ -25,6 +25,8 @@ - #ifndef VLC_LIBVLC_MEDIA_PLAYER_H - #define VLC_LIBVLC_MEDIA_PLAYER_H 1 - -+#define LIBVLC_MEDIA_PLAYER_HAS_RECORDING -+ - # ifdef __cplusplus - extern "C" { - # else -@@ -2652,6 +2654,18 @@ LIBVLC_API int libvlc_media_player_set_role(libvlc_media_player_t *p_mi, - - /** @} audio */ - -+/** -+ * Start/stop recording -+ * -+ * \version LibVLC 4.0.0 and later. -+ * -+ * \param p_mi media player -+ * \param directory path of the recording directory or NULL to stop recording -+ * \return 0 on success, -1 on error -+ */ -+LIBVLC_API int libvlc_media_player_record(libvlc_media_player_t *p_mi, -+ const char *directory); -+ - /** @} media_player */ - - # ifdef __cplusplus -diff --git a/lib/media_player.c b/lib/media_player.c -index 043568e25d..4e2acd5d28 100644 ---- a/lib/media_player.c -+++ b/lib/media_player.c -@@ -386,6 +386,23 @@ on_chapter_selection_changed(vlc_player_t *player, - libvlc_event_send(&mp->event_manager, &event); - } - -+static void *on_recording_changed(vlc_player_t *player, -+ bool recording, void *data) -+{ -+ libvlc_media_player_t *mp = data; -+ char *file_path = recording ? NULL : -+ var_GetString(mp->p_libvlc_instance->p_libvlc_int, -+ "record-file"); -+ -+ libvlc_event_t event; -+ event.type = libvlc_MediaPlayerRecordChanged; -+ event.u.media_player_record_changed.file_path = file_path; -+ event.u.media_player_record_changed.recording = recording; -+ -+ libvlc_event_send(&mp->event_manager, &event); -+ free(file_path); -+} -+ - static void - on_media_subitems_changed(vlc_player_t *player, input_item_t *media, - input_item_node_t *new_subitems, void *data) -@@ -501,6 +518,7 @@ static const struct vlc_player_cbs vlc_player_cbs = { - .on_titles_changed = on_titles_changed, - .on_title_selection_changed = on_title_selection_changed, - .on_chapter_selection_changed = on_chapter_selection_changed, -+ .on_recording_changed = on_recording_changed, - .on_media_subitems_changed = on_media_subitems_changed, - .on_cork_changed = on_cork_changed, - .on_vout_changed = on_vout_changed, -@@ -593,6 +611,7 @@ libvlc_media_player_new( libvlc_instance_t *instance ) - var_Create (mp, "rate", VLC_VAR_FLOAT|VLC_VAR_DOINHERIT); - var_Create (mp, "sout", VLC_VAR_STRING); - var_Create (mp, "demux-filter", VLC_VAR_STRING); -+ var_Create (mp, "input-record-path", VLC_VAR_STRING); - - /* Video */ - var_Create (mp, "vout", VLC_VAR_STRING|VLC_VAR_DOINHERIT); -@@ -2239,3 +2258,20 @@ static_assert(libvlc_video_primaries_BT601_525 == (cast_)COLOR_PRIMARIES_BT601_5 - libvlc_video_primaries_BT470_M == (cast_)COLOR_PRIMARIES_BT470_M - , "libvlc video color primaries mismatch"); - #undef cast_ -+ -+int libvlc_media_player_record(libvlc_media_player_t *p_mi, -+ const char *directory) -+{ -+ vlc_player_t *player = p_mi->player; -+ -+ const bool enable = directory != NULL; -+ -+ if (enable) -+ var_SetString(p_mi, "input-record-path", directory); -+ -+ vlc_player_Lock(player); -+ vlc_player_SetRecordingEnabled(player, enable); -+ vlc_player_Unlock(player); -+ -+ return VLC_SUCCESS; -+} --- -2.35.1 - diff --git a/libvlc/patches/0006-stream_ReadLine-increase-line-length-limit.patch b/libvlc/patches/0005-stream_ReadLine-increase-line-length-limit.patch similarity index 72% rename from libvlc/patches/0006-stream_ReadLine-increase-line-length-limit.patch rename to libvlc/patches/0005-stream_ReadLine-increase-line-length-limit.patch index ae9aa8a0b8dd9323e870e84888fcb0b9f93dcddd..3a49106ce593178b74ac985b073edc89f3012f37 100644 --- a/libvlc/patches/0006-stream_ReadLine-increase-line-length-limit.patch +++ b/libvlc/patches/0005-stream_ReadLine-increase-line-length-limit.patch @@ -1,10 +1,10 @@ -From 49df65886cf8d4a7bddc64d557a9c9d13f42d50c Mon Sep 17 00:00:00 2001 -Message-Id: <49df65886cf8d4a7bddc64d557a9c9d13f42d50c.1659517329.git.thomas@gllm.fr> -In-Reply-To: <74d4a8bf145b38305729f6ab4286a82704732af9.1659517329.git.thomas@gllm.fr> -References: <74d4a8bf145b38305729f6ab4286a82704732af9.1659517329.git.thomas@gllm.fr> +From 4446fecbfd61cc02347b76883603879326657d94 Mon Sep 17 00:00:00 2001 +Message-Id: <4446fecbfd61cc02347b76883603879326657d94.1666876576.git.thomas@gllm.fr> +In-Reply-To: <6a9eb21838d7525666a9a306c005307aaef6afb8.1666876576.git.thomas@gllm.fr> +References: <6a9eb21838d7525666a9a306c005307aaef6afb8.1666876576.git.thomas@gllm.fr> From: Pierre Ynard <linkfanel@yahoo.fr> Date: Mon, 20 Jul 2020 13:11:34 +0200 -Subject: [PATCH 6/7] stream_ReadLine: increase line length limit +Subject: [PATCH 5/6] 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 @@ -17,7 +17,7 @@ Fixes #24957 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/input/stream.c b/src/input/stream.c -index e44f8dd2b2..5fadd22b82 100644 +index e44f8dd2b25..5fadd22b829 100644 --- a/src/input/stream.c +++ b/src/input/stream.c @@ -191,7 +191,7 @@ stream_t *(vlc_stream_NewMRL)(vlc_object_t* parent, const char* mrl ) diff --git a/libvlc/patches/0007-input-display-discoverer-preparsers-logs.patch b/libvlc/patches/0006-input-display-discoverer-preparsers-logs.patch similarity index 59% rename from libvlc/patches/0007-input-display-discoverer-preparsers-logs.patch rename to libvlc/patches/0006-input-display-discoverer-preparsers-logs.patch index e068b2773399145d6150a028ac72129cad4fc710..5855f6ae0f8b10e67e3e13987b4d0d86adc5e7b4 100644 --- a/libvlc/patches/0007-input-display-discoverer-preparsers-logs.patch +++ b/libvlc/patches/0006-input-display-discoverer-preparsers-logs.patch @@ -1,17 +1,17 @@ -From 464dcd6dd872d50106ffc9dae68a90f0846642eb Mon Sep 17 00:00:00 2001 -Message-Id: <464dcd6dd872d50106ffc9dae68a90f0846642eb.1659517329.git.thomas@gllm.fr> -In-Reply-To: <74d4a8bf145b38305729f6ab4286a82704732af9.1659517329.git.thomas@gllm.fr> -References: <74d4a8bf145b38305729f6ab4286a82704732af9.1659517329.git.thomas@gllm.fr> +From 33b4a6d265f8dbac46d99040a891e0fd96860c07 Mon Sep 17 00:00:00 2001 +Message-Id: <33b4a6d265f8dbac46d99040a891e0fd96860c07.1666876576.git.thomas@gllm.fr> +In-Reply-To: <6a9eb21838d7525666a9a306c005307aaef6afb8.1666876576.git.thomas@gllm.fr> +References: <6a9eb21838d7525666a9a306c005307aaef6afb8.1666876576.git.thomas@gllm.fr> From: Thomas Guillem <thomas@gllm.fr> Date: Thu, 3 Dec 2020 09:56:05 +0100 -Subject: [PATCH 7/7] input: display discoverer/preparsers logs +Subject: [PATCH 6/6] input: display discoverer/preparsers logs --- src/input/input.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/input/input.c b/src/input/input.c -index bead2daaa5..eb8eeb3977 100644 +index 21e019a6e72..d12de7bf367 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -297,7 +297,6 @@ input_thread_t *input_Create( vlc_object_t *p_parent, diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java index 53e0145740629f98688627b839db076ca75e3fda..7cfc010c961aa5c4999a42a91096c25aff472e84 100644 --- a/libvlc/src/org/videolan/libvlc/LibVLC.java +++ b/libvlc/src/org/videolan/libvlc/LibVLC.java @@ -53,34 +53,8 @@ public class LibVLC extends VLCObject<ILibVLC.Event> implements ILibVLC { mAppContext = context.getApplicationContext(); loadLibraries(); - if (options == null) - options = new ArrayList<>(); - boolean setAout = true, setChroma = true; - // check if aout/vout options are already set - for (String option : options) { - if (option.startsWith("--aout=")) - setAout = false; - if (option.startsWith("--android-display-chroma")) - setChroma = false; - if (!setAout && !setChroma) - break; - } - - // set aout/vout options if they are not set - if (setAout || setChroma) { - if (setAout) { - final HWDecoderUtil.AudioOutput hwAout = HWDecoderUtil.getAudioOutputFromDevice(); - if (hwAout == HWDecoderUtil.AudioOutput.OPENSLES) - options.add("--aout=opensles"); - else - options.add("--aout=android_audiotrack"); - } - if (setChroma) { - options.add("--android-display-chroma"); - options.add("RV16"); - } - } - nativeNew(options.toArray(new String[options.size()]), context.getDir("vlc", Context.MODE_PRIVATE).getAbsolutePath()); + nativeNew(options != null ? options.toArray(new String[options.size()]) : null, + context.getDir("vlc", Context.MODE_PRIVATE).getAbsolutePath()); } /** diff --git a/libvlc/src/org/videolan/libvlc/MediaPlayer.java b/libvlc/src/org/videolan/libvlc/MediaPlayer.java index 3c1c634abf3e1c91a1efd2af6446310ccf8600fb..a7b41456cfbf375721618d48c0abd9b01a07d1cd 100644 --- a/libvlc/src/org/videolan/libvlc/MediaPlayer.java +++ b/libvlc/src/org/videolan/libvlc/MediaPlayer.java @@ -420,8 +420,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> { private boolean mPlayRequested = false; private boolean mListenAudioPlug = true; private int mVoutCount = 0; - private boolean mAudioReset = false; - private String mAudioOutput = "android_audiotrack"; + private String mAudioOutput = null; private String mAudioOutputDevice = null; private boolean mAudioPlugRegistered = false; @@ -739,14 +738,6 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> { public void play() { synchronized (this) { if (!mPlaying) { - /* HACK: stop() reset the audio output, so set it again before first play. */ - if (mAudioReset) { - if (mAudioOutput != null) - nativeSetAudioOutput(mAudioOutput); - if (mAudioOutputDevice != null) - nativeSetAudioOutputDevice(mAudioOutputDevice); - mAudioReset = false; - } if (mListenAudioPlug) registerAudioPlug(true); mPlayRequested = true; @@ -814,7 +805,6 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> { synchronized (this) { mPlayRequested = false; mPlaying = false; - mAudioReset = true; } nativeStop(); if (mAfd != null) try { @@ -873,8 +863,8 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> { nativeSetAspectRatio(aspect); } - private boolean isAudioTrack() { - return mAudioOutput != null && mAudioOutput.equals("android_audiotrack"); + private boolean isAudioDigitalOutputCapable() { + return mAudioOutput == null || mAudioOutput.contains("audiotrack"); } /** @@ -908,7 +898,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> { mAudioOutput = aout; /* If The user forced an output different than AudioTrack, don't listen to audio * plug events and let the user decide */ - mListenAudioPlug = isAudioTrack(); + mListenAudioPlug = isAudioDigitalOutputCapable(); if (!mListenAudioPlug) registerAudioPlug(false); @@ -937,7 +927,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> { public synchronized boolean setAudioDigitalOutputEnabled(boolean enabled) { if (enabled == mAudioDigitalOutputEnabled) return true; - if (!mListenAudioPlug || !isAudioTrack()) + if (!mListenAudioPlug || !isAudioDigitalOutputCapable()) return false; registerAudioPlug(false); @@ -953,7 +943,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> { * @return true on success */ public synchronized boolean forceAudioDigitalEncodings(int []encodings) { - if (!isAudioTrack()) + if (!isAudioDigitalOutputCapable()) return false; if (encodings.length == 0) @@ -972,7 +962,7 @@ public class MediaPlayer extends VLCObject<MediaPlayer.Event> { mAudioOutputDevice = id; if (fromUser) { /* The user forced a device, don't listen to audio plug events and let the user decide */ - mListenAudioPlug = mAudioOutputDevice == null && isAudioTrack(); + mListenAudioPlug = mAudioOutputDevice == null && isAudioDigitalOutputCapable(); if (!mListenAudioPlug) registerAudioPlug(false); } diff --git a/libvlc/src/org/videolan/libvlc/util/HWDecoderUtil.java b/libvlc/src/org/videolan/libvlc/util/HWDecoderUtil.java index 120b10069f5586ceb62eda8138804c20df54cbc4..630a2257d2c381a5bfe52c38391bb64abc69084d 100644 --- a/libvlc/src/org/videolan/libvlc/util/HWDecoderUtil.java +++ b/libvlc/src/org/videolan/libvlc/util/HWDecoderUtil.java @@ -33,7 +33,7 @@ public class HWDecoderUtil { } public enum AudioOutput { - OPENSLES, AUDIOTRACK, ALL + OPENSLES, ALL } private static class DecoderBySOC {