Skip to content

Commit

Permalink
perf: skip plugin scan on VLC init if cache exists
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhd1701 committed Jun 15, 2022
1 parent a6aef80 commit 8311e7c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions gridplayer/vlc_player/instance.py
Expand Up @@ -13,7 +13,7 @@
from gridplayer.vlc_player.libvlc import vlc

# Prepare `vsnprintf` function
if platform.system() == "Windows":
if env.IS_WINDOWS:
# Note: must use same version of libc as libvlc
vsnprintf = ctypes.cdll.msvcrt.vsnprintf
else:
Expand Down Expand Up @@ -105,18 +105,23 @@ def init_instance(self):
"--no-disable-screensaver",
"--no-sub-autodetect-file",
"--no-lua",
"--no-plugins-scan",
"--no-osd",
"--no-snapshot-preview",
"--no-spu",
"--no-interact",
"--no-stats",
"--no-keyboard-events",
"--no-mouse-events",
# "--http-reconnect",
*self.vlc_options,
]

if _is_plugin_cache_exists():
self._logger.debug("Using plugin cache")
options.append("--no-plugins-scan")

# https://forum.videolan.org/viewtopic.php?t=147229
if platform.system() == "Windows":
if env.IS_WINDOWS:
options.append("--aout=directsound")

# Root CAs are outdated on Windows 7
Expand Down Expand Up @@ -207,3 +212,9 @@ def create_instance(self):
instance.setup_log_queue(self._log_queue, log_level)

return instance


def _is_plugin_cache_exists():
plugin_cache_path = Path(vlc.plugin_path) / "plugins.dat"

return plugin_cache_path.is_file()

0 comments on commit 8311e7c

Please sign in to comment.