[vlc-devel] [PATCH 2/2] dvdread: Implement analog access check as in dvdnav
david.fuhrmann at gmail.com
david.fuhrmann at gmail.com
Mon May 4 20:09:14 CEST 2020
From: David Fuhrmann <dfuhrmann at videolan.org>
---
modules/access/Makefile.am | 2 +-
modules/access/dvdread.c | 21 ++++++++++++++-------
2 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/modules/access/Makefile.am b/modules/access/Makefile.am
index 265683c3f8..9996d376d0 100644
--- a/modules/access/Makefile.am
+++ b/modules/access/Makefile.am
@@ -252,7 +252,7 @@ endif
access_LTLIBRARIES += $(LTLIBdvdnav)
EXTRA_LTLIBRARIES += libdvdnav_plugin.la
-libdvdread_plugin_la_SOURCES = access/dvdread.c demux/mpeg/ps.h demux/mpeg/pes.h \
+libdvdread_plugin_la_SOURCES = access/dvd_helper.h access/dvdread.c demux/mpeg/ps.h demux/mpeg/pes.h \
demux/moving_avg.h demux/timestamps_filter.h
libdvdread_plugin_la_CFLAGS = $(AM_CFLAGS) $(DVDREAD_CFLAGS)
libdvdread_plugin_la_LIBADD = $(DVDREAD_LIBS)
diff --git a/modules/access/dvdread.c b/modules/access/dvdread.c
index 657cdcacb2..318e829e57 100644
--- a/modules/access/dvdread.c
+++ b/modules/access/dvdread.c
@@ -62,6 +62,8 @@
#include <assert.h>
#include <limits.h>
+#include "dvd_helper.h"
+
/*****************************************************************************
* Module descriptor
*****************************************************************************/
@@ -194,6 +196,18 @@ static int Open( vlc_object_t *p_this )
if( unlikely(psz_file == NULL) )
return VLC_EGENERIC;
+ if( DVDProbeMacOSPermission( psz_file ) != VLC_SUCCESS )
+ {
+ msg_Err( p_demux, "Path %s cannot be opened due to unsufficient permissions", psz_file );
+ vlc_dialog_display_error( p_demux, _("Problem accessing a system resource"),
+ _("Potentially, macOS blocks access to your disc. "
+ "Please open \"System Preferences\" -> \"Security & Privacy\" "
+ "and allow VLC to access your external media in \"Files and Folders\" section."));
+
+ free( psz_file );
+ return VLC_EGENERIC;
+ }
+
/* Open dvdread */
const char *psz_path = ToLocale( psz_file );
#if DVDREAD_VERSION >= DVDREAD_VERSION_CODE(6, 1, 0)
@@ -207,15 +221,8 @@ static int Open( vlc_object_t *p_this )
if( p_dvdread == NULL )
{
msg_Err( p_demux, "DVDRead cannot open source: %s", psz_file );
-#ifdef __APPLE__
- vlc_dialog_display_error( p_demux, _("Problem accessing a system resource"),
- _("Potentially, macOS blocks access to your disc. "
- "Please open \"System Preferences\" -> \"Security & Privacy\" "
- "and allow VLC to access your external media in \"Files and Folders\" section."));
-#else
vlc_dialog_display_error( p_demux, _("Playback failure"),
_("DVDRead could not open the disc \"%s\"."), psz_file );
-#endif
free( psz_file );
return VLC_EGENERIC;
--
2.21.1 (Apple Git-122.3)
More information about the vlc-devel
mailing list